com.projectdarkstar.tools.dtc.data
Class AbstractDTO

java.lang.Object
  extended by com.projectdarkstar.tools.dtc.data.AbstractDTO
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ClientAppConfigDTO, ClientAppDTO, HardwareResourceDTO, HardwareResourceFamilyDTO, LogFileDTO, PkgLibraryDTO, PkgLibraryTagDTO, PropertyDTO, ServerAppConfigDTO, ServerAppDTO, SystemProbeDTO, SystemProbeTagDTO, TestExecutionDTO, TestExecutionResultClientDataDTO, TestExecutionResultClientDataTupleDTO, TestExecutionResultClientLogDTO, TestExecutionResultDTO, TestExecutionResultProbeDataDTO, TestExecutionResultProbeLogDTO, TestExecutionResultServerLogDTO, TestExecutionTagDTO, TestQueueDTO, TestSpecDTO, TestSuiteDTO

public abstract class AbstractDTO
extends Object
implements Serializable

Provides basic functionality for a Data Transfer Object in the Darkstar Test Cluster.

See Also:
Serialized Form

Constructor Summary
AbstractDTO()
           
 
Method Summary
protected  void checkBlank(String key)
          Checks if the given attribute is blank or null.
protected  void checkNull(String key)
          Checks if the given attribute is null.
 Boolean getFullyPopulated()
           
abstract  Long getId()
           
 Map<String,Object> getUpdatedAttributes()
           
protected  void updateAttribute(String attribute, Object value)
          Schedules update of the attribute with the name attribute by loading the given value into the updatedAttributes map.
abstract  void validate()
          Validates that each attribute and pending updated attribute (from the updatedAttributes Map) has a valid value in the context of the particular object.
protected  Object valueToValidate(String key)
          Returns the value to validate for a particular attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDTO

public AbstractDTO()
Method Detail

getFullyPopulated

public Boolean getFullyPopulated()

getUpdatedAttributes

public Map<String,Object> getUpdatedAttributes()

updateAttribute

protected void updateAttribute(String attribute,
                               Object value)
                        throws DTCInvalidDataException
Schedules update of the attribute with the name attribute by loading the given value into the updatedAttributes map. The value is only loaded into the map if the object's current value of the attribute is different than the given value.

Parameters:
attribute - the name of the attribute to update
value - the value to set the attribute to
Throws:
com.projectdarkstar.tools.dtc.service.DTCInvalidDataException - if there is a problem retrieving the current value of the attribute
DTCInvalidDataException

valueToValidate

protected Object valueToValidate(String key)
                          throws DTCInvalidDataException
Returns the value to validate for a particular attribute. If the attribute has a pending update via a call to updateAttribute(String,Object) then that value is returned. Otherwise the current value of the attribute is returned

Parameters:
key - the attribute name to get the value for
Returns:
the value to validate
Throws:
DTCInvalidDataException - if the attribute with the specified key cannot be retrieved

checkBlank

protected void checkBlank(String key)
                   throws DTCInvalidDataException
Checks if the given attribute is blank or null.

Parameters:
key - the attribute name to check
Throws:
DTCInvalidDataException - if the attribute with the given name is a blank string

checkNull

protected void checkNull(String key)
                  throws DTCInvalidDataException
Checks if the given attribute is null.

Parameters:
key - the attribute name to check
Throws:
DTCInvalidDataException - if the attribute with the given name is a null

validate

public abstract void validate()
                       throws DTCInvalidDataException
Validates that each attribute and pending updated attribute (from the updatedAttributes Map) has a valid value in the context of the particular object.

Throws:
com.projectdarkstar.tools.dtc.service.DTCInvalidDataException - if validation fails
DTCInvalidDataException

getId

public abstract Long getId()


Copyright © 2013. All Rights Reserved.