john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Report StorageGateway

//2012-05-14 johnpfeiffer  datamodel merge of storagegatewaymanager.PstCloudGateway and storagemanager.PstGateway;
import java.sql.Timestamp;
import java.util.Comparator;

public class StorageGateway
{
    private String oid;
    private String hash;
    private String address;
    private short connected;
    private Timestamp lastModified;
    private short deleted;

    private String deviceType;
    private String deviceSerialNumber;
    private String networkUserOid;
    private String networkAccountOid;
    private int storageSizeInMB = -1;
    private short privateGateway = -1;
    private short defaultGatewayForNewCloudUser = -1;       //unused
    private Timestamp creationDate;

    StorageGateway( String oid , String hash , String address , short connected , Timestamp lastModified , short deleted , String deviceSerialNumber )
    {
        if( oid != null && hash != null && address != null && lastModified != null && deviceSerialNumber != null )
        {
            this.oid = oid;
            this.hash = hash;
            this.address = address;
            this.connected = connected;
            this.lastModified = lastModified;
            this.deleted = deleted;
            this.deviceSerialNumber = deviceSerialNumber;
        }else
        {       throw new IllegalArgumentException( "Error: oid, hash , address, timestamp , or deviceSerialNumber is null" );
        }
    }

    StorageGateway( String oid , String hash , String deviceType , String networkAccountOid , int storageSizeInMB ,  short privateGateway , Timestamp creationDate , short deleted , String deviceSerialNumber )
    {
        if( oid != null && hash != null && deviceType != null && networkAccountOid != null && storageSizeInMB > 0 && creationDate != null && deviceSerialNumber != null )
        {
            this.oid = oid;
            this.hash = hash;
            this.deviceType = deviceType;
            this.networkAccountOid = networkAccountOid;
            this.privateGateway = privateGateway;
            this.storageSizeInMB = storageSizeInMB;
            this.creationDate = creationDate;
            this.deleted = deleted;
            this.deviceSerialNumber = deviceSerialNumber;
        }else
        {       throw new IllegalArgumentException( "Error: oid, hash , address, connected, timestamp, deviceType, networkAccountOid, creationDate , or deviceSerialNumber is null" );
        }
    }

    StorageGateway( String oid , String hash , String address , short connected , Timestamp lastModified , String deviceType ,  String networkAccountOid , int storageSizeInMB , short privateGateway , Timestamp creationDate , short deleted , String deviceSerialNumber )
    {
        if( oid != null && hash != null && address != null && lastModified != null && deviceType != null && networkAccountOid != null && creationDate != null && deviceSerialNumber != null )
        {
            this.oid = oid;
            this.hash = hash;
            this.address = address;
            this.connected = connected;
            this.lastModified = lastModified;
            this.deleted = deleted;
            this.deviceSerialNumber = deviceSerialNumber;
            this.deviceType = deviceType;
            this.networkAccountOid = networkAccountOid;
            this.storageSizeInMB = storageSizeInMB;
            this.privateGateway = privateGateway;
            this.creationDate = creationDate;
        }else
        {       throw new IllegalArgumentException( "Error: oid, hash , address, connected, timestamp, deviceType, networkAccountOid, creationDate, or deviceSerialNumber is null" );
        }
    }

    StorageGateway( String oid , String hash , String address , short connected , Timestamp lastModified , String deviceType , String networkUserOid , String networkAccountOid ,
            int storageSizeInMB , short privateGateway , short defaultGatewayForNewCloudUser , Timestamp creationDate , short deleted , String deviceSerialNumber  )
    {
        if( oid != null && hash != null && address != null && lastModified != null && deviceType != null && networkAccountOid != null && creationDate != null && deviceSerialNumber != null )
        {
            this.oid = oid;
            this.hash = hash;
            this.address = address;
            this.connected = connected;
            this.lastModified = lastModified;
            this.deleted = deleted;
            this.deviceSerialNumber = deviceSerialNumber;
            this.deviceType = deviceType;
            this.networkUserOid = networkUserOid;
            this.networkAccountOid = networkAccountOid;
            this.storageSizeInMB = storageSizeInMB;
            this.privateGateway = privateGateway;
            this.defaultGatewayForNewCloudUser = defaultGatewayForNewCloudUser;
            this.creationDate = creationDate;
        }else
        {       throw new IllegalArgumentException( "Error: oid, hash , address, connected, timestamp, deviceType, networkAccountOid, creationDate, or deviceSerialNumber is null" );
        }
    }


    protected String getOid()
    {       return oid;
    }
    protected String getHash()
    {       return hash;
    }
    protected String getAddress()
    {       return address;
    }
    protected short getConnected()
    {       return connected;
    }
    protected boolean isConnected()
    {       boolean result = false;
            if( connected == 1 )
            {       result = true;
            }
            return result;
    }
    protected Timestamp getLastModified()
    {       return lastModified;
    }
    protected short getDeleted()
    {       return deleted;
    }
    protected boolean isDeleted()
    {       boolean result = false;
        if( deleted == 1 )
        {       result = true;
        }
        return result;
    }
    protected String getDeviceSerialNumber()
    {       return deviceSerialNumber;
    }
    protected String getDeviceType()
    {       return deviceType;
    }
    protected String getNetworkAccountOid()
    {       return networkAccountOid;
    }
    protected int getStorageSizeInMB()
    {       return storageSizeInMB;
    }
    protected short getPrivateGateway()
    {       return privateGateway;
    }
    protected boolean isPrivateGateway()
    {       boolean result = false;
            if( privateGateway == 1 )
            {       result = true;
            }
            return result;
    }
    protected Timestamp getCreationDate()
    {       return creationDate;
    }

    //not currently important or retrieved
    protected String getNetworkUserOid()
    {       return networkUserOid;
    }
    protected boolean isDefaultGatewayForNewCloudUser()
    {       boolean result = false;
            if( defaultGatewayForNewCloudUser == 1 )
            {       result = true;
            }
            return result;
    }



    // inner class?
  protected static Comparator<StorageGateway> COMPARE_BY_ADDRESS = new Comparator<StorageGateway>()
  {
    public int compare( StorageGateway first , StorageGateway other )
    {       return first.address.compareTo( other.address );
    }
  };
  protected static Comparator<StorageGateway> COMPARE_BY_LASTMODIFIED = new Comparator<StorageGateway>()
  {
    public int compare( StorageGateway first , StorageGateway other )
    {       return first.lastModified.compareTo( other.lastModified );
    }
  };
  protected static Comparator<StorageGateway> COMPARE_BY_CREATIONDATE = new Comparator<StorageGateway>()
  {
    public int compare( StorageGateway first , StorageGateway other )
    {       return first.creationDate.compareTo( other.creationDate );
    }
  };
  // further consideration Collections.sort(list, String.CASE_INSENSITIVE_ORDER); , Collections.sort(list, Collections.reverseOrder());

  // convenience classes
    protected String getStorageGatewayCSV()
    {
        return( deviceSerialNumber + " , " + hash + " , " +  address + " , " +  connected + " , " +  lastModified + " , " + deviceType + " , " + networkAccountOid + " , " + storageSizeInMB + " , " + creationDate );
    }


} //end class

  • « file ReadMore
  • Report StorageGatewayDAO »

Published

May 14, 2012

Category

java-servlet

~553 words

Tags

  • java-servlet 61
  • report 14
  • storagegateway 2