com.projectdarkstar.tools.dtc.data
Class HardwareResourceDTO

java.lang.Object
  extended by com.projectdarkstar.tools.dtc.data.AbstractDTO
      extended by com.projectdarkstar.tools.dtc.data.HardwareResourceDTO
All Implemented Interfaces:
Serializable

public class HardwareResourceDTO
extends AbstractDTO

Represents a physical hardware resource that can be used during a DTC test.

See Also:
Serialized Form

Constructor Summary
HardwareResourceDTO(Long id, Long versionNumber, String hostname, String lockedBy, Date lockedAt, Boolean enabled)
           
 
Method Summary
 boolean equals(Object o)
           
 Boolean getEnabled()
          Returns true if this resource is available for use during tests.
 List<HardwareResourceFamilyDTO> getFamilies()
          Returns a list of HardwareResourceFamilyDTO objects that represents the set of families that this resource is a member of.
 String getHostname()
          Returns the hostname of the resource
 Long getId()
          Returns the id of the entity in persistent storage
 Date getLockedAt()
          Returns a Date object representing the time that this resource was locked.
 String getLockedBy()
          Returns the identifier of the entity which currently has a lock on this resource.
 Long getVersionNumber()
          Returns the version number in the data store that this entity represents.
 int hashCode()
           
protected  void setEnabled(Boolean enabled)
           
protected  void setFamilies(List<HardwareResourceFamilyDTO> families)
           
protected  void setHostname(String hostname)
           
 void setId(Long id)
           
protected  void setLockedAt(Date lockedAt)
           
protected  void setLockedBy(String lockedBy)
           
 void updateEnabled(Boolean enabled)
           
 void updateFamilies(List<HardwareResourceFamilyDTO> families)
           
 void updateHostname(String hostname)
           
 void updateLockedAt(Date lockedAt)
           
 void updateLockedBy(String lockedBy)
           
 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.
 
Methods inherited from class com.projectdarkstar.tools.dtc.data.AbstractDTO
checkBlank, checkNull, getFullyPopulated, getUpdatedAttributes, updateAttribute, valueToValidate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HardwareResourceDTO

public HardwareResourceDTO(Long id,
                           Long versionNumber,
                           String hostname,
                           String lockedBy,
                           Date lockedAt,
                           Boolean enabled)
Method Detail

getId

public Long getId()
Returns the id of the entity in persistent storage

Specified by:
getId in class AbstractDTO
Returns:
id of the entity

setId

public void setId(Long id)

getVersionNumber

public Long getVersionNumber()
Returns the version number in the data store that this entity represents. Whenever an update to an object is pushed to the persistent data store, the version number is incremented.

Returns:
version number of the entity

getHostname

public String getHostname()
Returns the hostname of the resource

Returns:
hostname of the resource

setHostname

protected void setHostname(String hostname)

updateHostname

public void updateHostname(String hostname)
                    throws DTCInvalidDataException
Throws:
DTCInvalidDataException

getLockedBy

public String getLockedBy()
Returns the identifier of the entity which currently has a lock on this resource. If the resource is not locked, returns null.

Returns:
the identifier of the locking entity

setLockedBy

protected void setLockedBy(String lockedBy)

updateLockedBy

public void updateLockedBy(String lockedBy)
                    throws DTCInvalidDataException
Throws:
DTCInvalidDataException

getLockedAt

public Date getLockedAt()
Returns a Date object representing the time that this resource was locked. If the resource is not locked, returns null.

Returns:
the time that this resource was locked

setLockedAt

protected void setLockedAt(Date lockedAt)

updateLockedAt

public void updateLockedAt(Date lockedAt)
                    throws DTCInvalidDataException
Throws:
DTCInvalidDataException

getEnabled

public Boolean getEnabled()
Returns true if this resource is available for use during tests. If it is not enabled, no tests may acquire a lock on it.

Returns:
whether or not this resource is enabled for testing

setEnabled

protected void setEnabled(Boolean enabled)

updateEnabled

public void updateEnabled(Boolean enabled)
                   throws DTCInvalidDataException
Throws:
DTCInvalidDataException

getFamilies

public List<HardwareResourceFamilyDTO> getFamilies()
Returns a list of HardwareResourceFamilyDTO objects that represents the set of families that this resource is a member of.

Returns:
list of families for this resource

setFamilies

protected void setFamilies(List<HardwareResourceFamilyDTO> families)

updateFamilies

public void updateFamilies(List<HardwareResourceFamilyDTO> families)
                    throws DTCInvalidDataException
Throws:
DTCInvalidDataException

validate

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

Specified by:
validate in class AbstractDTO
Throws:
DTCInvalidDataException

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2013. All Rights Reserved.