com.buildforge.services.common.dbo
Class CollectorDBO

java.lang.Object
  extended by com.buildforge.services.common.dbo.DBObject
      extended by com.buildforge.services.common.dbo.CollectorDBO

public class CollectorDBO
extends DBObject

Database information representing a collector.


Field Summary
static java.lang.Class<CollectorDBO> CLASS
           
static java.lang.String TYPE_KEY
           
 
Constructor Summary
CollectorDBO()
           
 
Method Summary
 void addCollectorProperty(CollectorPropertyDBO prop)
          Adds the supplied CollectorProperty to the end of the property list
 CollectorPropertyDBO addCollectorProperty(CollectorPropertyDBO prop, int index)
          Adds the supplied collector property DBO at the specified index, shifting the property at the index (and all subsequent properties) by one position to make room for it.
 CollectorDBO clone()
           
 CollectorPropertyDBO copyCollectorProperty(int index)
          Returns a copy of the specified collector property DBO.
 CollectorPropertyDBO copyCollectorProperty(int fromIndex, int toIndex, boolean live)
          Copies the specified property into a new position in the property list.
 CollectorDBO fromArray(java.lang.Object[] data)
          Deserialize the database object's settings from a request array.
 java.lang.String getCollectorId()
           
 java.util.List<CollectorPropertyDBO> getCollectorProperties()
           
 CollectorPropertyDBO getCollectorProperty(int index)
           
 CollectorPropertyDBO getCollectorProperty(java.lang.String propertyName)
          Retrieves the first collector property DBO with the specified name that is currently in the property list.
 java.lang.String getLiveCollectorId()
           
 int getSize()
           
 java.lang.String getTypeKey()
          Retrieve the key that should be used to look up the display name for a data type.
 boolean isLive()
          Checks whether or not the object is live.
 void moveCollectorProperty(int fromIndex, int toIndex)
          Moves a property from one index to another.
 CollectorPropertyDBO removeCollectorProperty(int index)
          Removes a collector property DBO by index.
 void setCollectorId(java.lang.String collectorId)
           
 void setLiveCollectorId(java.lang.String newLiveCollectorId)
          Sets this live ID for this collector DBO, updating its own state and those of its properties accordingly.
 void setProperties(java.util.List<CollectorPropertyDBO> newProperties)
           
 java.lang.Object[] toArray()
          Serializes this database object as an array of objects.
 java.lang.String toString()
           
 
Methods inherited from class com.buildforge.services.common.dbo.DBObject
badId, badName, checkDead, checkLive, collision, collision
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_KEY

public static final java.lang.String TYPE_KEY
See Also:
Constant Field Values

CLASS

public static final java.lang.Class<CollectorDBO> CLASS
Constructor Detail

CollectorDBO

public CollectorDBO()
Method Detail

getTypeKey

public java.lang.String getTypeKey()
Description copied from class: DBObject
Retrieve the key that should be used to look up the display name for a data type.

Specified by:
getTypeKey in class DBObject
Returns:
the type key for this object's class

isLive

public boolean isLive()
Description copied from class: DBObject
Checks whether or not the object is live. Note that this is not valid for object types that do not have a unique identifier. Those for which no reasonable implementation exists should always return false.

Specified by:
isLive in class DBObject
Returns:
true iff liveness is a valid concept for this object, and the object is live; otherwise, false is returned.

getCollectorId

public java.lang.String getCollectorId()

getLiveCollectorId

public java.lang.String getLiveCollectorId()

getCollectorProperties

public java.util.List<CollectorPropertyDBO> getCollectorProperties()

getSize

public int getSize()

getCollectorProperty

public CollectorPropertyDBO getCollectorProperty(int index)

setLiveCollectorId

public void setLiveCollectorId(java.lang.String newLiveCollectorId)
Sets this live ID for this collector DBO, updating its own state and those of its properties accordingly.

Parameters:
newLiveCollectorId - the ID to set as live

setCollectorId

public void setCollectorId(java.lang.String collectorId)

setProperties

public void setProperties(java.util.List<CollectorPropertyDBO> newProperties)

addCollectorProperty

public void addCollectorProperty(CollectorPropertyDBO prop)
Adds the supplied CollectorProperty to the end of the property list

Parameters:
prop -

addCollectorProperty

public CollectorPropertyDBO addCollectorProperty(CollectorPropertyDBO prop,
                                                 int index)
                                          throws APIException
Adds the supplied collector property DBO at the specified index, shifting the property at the index (and all subsequent properties) by one position to make room for it.

Parameters:
prop - the collector property DBO to insert
index - the 0-based index at which to insert the new property. If this value would place the new property beyond the end of the list, then it is placed at the end.
Returns:
the collector property DBO, for convenience
Throws:
APIException

getCollectorProperty

public CollectorPropertyDBO getCollectorProperty(java.lang.String propertyName)
Retrieves the first collector property DBO with the specified name that is currently in the property list.

Parameters:
propertyName - the property name to find
Returns:
the collector property DBO, or null if no such property can be found.

removeCollectorProperty

public CollectorPropertyDBO removeCollectorProperty(int index)
                                             throws APIException
Removes a collector property DBO by index.

Parameters:
index - the 0-basex index of the collector property DBO to remove from the list
Returns:
the collector property DBO that was removed
Throws:
APIException

moveCollectorProperty

public void moveCollectorProperty(int fromIndex,
                                  int toIndex)
                           throws APIException
Moves a property from one index to another.

Parameters:
fromIndex - the 0-based original index of the property
toIndex - the 0-based index of the property after it has been moved. If the value would move the property past the end of the property list, then it is moved to the end.
Throws:
APIException

copyCollectorProperty

public CollectorPropertyDBO copyCollectorProperty(int index)
                                           throws APIException
Returns a copy of the specified collector property DBO. This copy is in no way connected to the original, and will be suitable for addition to another, entirely different collector.

Parameters:
index - the 0-based index to specify the property to copy
Returns:
the copied collector property DBO
Throws:
APIException

copyCollectorProperty

public CollectorPropertyDBO copyCollectorProperty(int fromIndex,
                                                  int toIndex,
                                                  boolean live)
                                           throws APIException
Copies the specified property into a new position in the property list.

Parameters:
fromIndex - the 0-based index of the property that from which the values for the new property will be copied
toIndex - the 0-based index at which to insert the new property. If this value is larger than the current size of the list, then the new property is placed at the end of the list.
Returns:
the copied collector property DBO
Throws:
APIException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clone

public CollectorDBO clone()
Overrides:
clone in class java.lang.Object

fromArray

public CollectorDBO fromArray(java.lang.Object[] data)
                       throws APIException
Description copied from class: DBObject
Deserialize the database object's settings from a request array. This method is used to reconstruct a database object from the array that was created by DBObject.toArray().

Specified by:
fromArray in class DBObject
Parameters:
data - the object list that renders this object
Returns:
this object, for convenience
Throws:
APIException - if there is something wrong with the serialized data that interferes with the reconstruction of the object. The most obvious reason for this would be if the serialized array contains the wrong number of fields or otherwise does not match the serialized form for this type of database object.

toArray

public java.lang.Object[] toArray()
Description copied from class: DBObject
Serializes this database object as an array of objects. As specified in the description for Protocol, all supported protocols transfer database objects in this form.

Specified by:
toArray in class DBObject