org.rhq.core.domain.resource
Class CreateResourceHistory

java.lang.Object
  extended by org.rhq.core.domain.resource.CreateResourceHistory
All Implemented Interfaces:
Serializable

public class CreateResourceHistory
extends Object
implements Serializable

Describes one request to create a new resource.

See Also:
Serialized Form

Field Summary
static String QUERY_DELETE_BY_RESOURCES
           
static String QUERY_FIND_BY_ID
           
static String QUERY_FIND_BY_PARENT_RESOURCE_ID
           
static String QUERY_FIND_WITH_STATUS
           
 
Constructor Summary
CreateResourceHistory()
          Creates an empty instance.
CreateResourceHistory(Resource parentResource, ResourceType resourceType, String subjectName, Configuration resourceConfiguration)
          Helper constructor when creating a request for a configuration-backed resource.
CreateResourceHistory(Resource parentResource, ResourceType resourceType, String subjectName, InstalledPackage installedPackage)
          Helper constructor when creating a request for a content-backed resource.
 
Method Summary
 boolean equals(Object obj)
           
 Configuration getConfiguration()
           
 Date getCreatedDate()
           
 String getCreatedResourceName()
           
 long getCreatedTime()
           
 long getDuration()
          The duration of the configuration update request which simply is the difference between the getCreatedTime() and the getLastModifiedTime().
 String getErrorMessage()
           
 int getId()
           
 InstalledPackage getInstalledPackage()
           
 Date getLastModifiedDate()
           
 long getLastModifiedTime()
           
 String getNewResourceKey()
           
 Resource getParentResource()
           
 ResourceType getResourceType()
           
 CreateResourceStatus getStatus()
           
 String getSubjectName()
           
 int hashCode()
           
 void setConfiguration(Configuration configuration)
           
 void setCreatedResourceName(String createdResourceName)
           
 void setErrorMessage(String errorMessage)
          Calling this method with a non-null error message implies that the request's status is CreateResourceStatus.FAILURE.
 void setErrorMessageFromThrowable(Throwable t)
          Convienence method that sets the error message to the given throwable's stack trace dump.
 void setId(int id)
           
 void setInstalledPackage(InstalledPackage installedPackage)
           
 void setNewResourceKey(String newResourceKey)
           
 void setParentResource(Resource parentResource)
           
 void setResourceType(ResourceType resourceType)
           
 void setStatus(CreateResourceStatus status)
           
 void setSubjectName(String subjectName)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUERY_FIND_WITH_STATUS

public static final String QUERY_FIND_WITH_STATUS
See Also:
Constant Field Values

QUERY_FIND_BY_PARENT_RESOURCE_ID

public static final String QUERY_FIND_BY_PARENT_RESOURCE_ID
See Also:
Constant Field Values

QUERY_FIND_BY_ID

public static final String QUERY_FIND_BY_ID
See Also:
Constant Field Values

QUERY_DELETE_BY_RESOURCES

public static final String QUERY_DELETE_BY_RESOURCES
See Also:
Constant Field Values
Constructor Detail

CreateResourceHistory

public CreateResourceHistory()
Creates an empty instance.


CreateResourceHistory

public CreateResourceHistory(Resource parentResource,
                             ResourceType resourceType,
                             String subjectName,
                             Configuration resourceConfiguration)
Helper constructor when creating a request for a configuration-backed resource.

Parameters:
parentResource - resource under which the new resource is created
resourceType - type of resource being created
subjectName - user creating the resource
resourceConfiguration - the intial configuration for the resource being created

CreateResourceHistory

public CreateResourceHistory(Resource parentResource,
                             ResourceType resourceType,
                             String subjectName,
                             InstalledPackage installedPackage)
Helper constructor when creating a request for a content-backed resource.

Parameters:
parentResource - resource under which the new resource is created
resourceType - type of resource being created
subjectName - user creating the resource
installedPackage - the package being created
Method Detail

getId

public int getId()

setId

public void setId(int id)

getParentResource

public Resource getParentResource()

setParentResource

public void setParentResource(Resource parentResource)

getCreatedResourceName

public String getCreatedResourceName()

setCreatedResourceName

public void setCreatedResourceName(String createdResourceName)

getNewResourceKey

public String getNewResourceKey()

setNewResourceKey

public void setNewResourceKey(String newResourceKey)

getStatus

public CreateResourceStatus getStatus()

setStatus

public void setStatus(CreateResourceStatus status)

getErrorMessage

public String getErrorMessage()

setErrorMessage

public void setErrorMessage(String errorMessage)
Calling this method with a non-null error message implies that the request's status is CreateResourceStatus.FAILURE. The inverse is not true - that is, if you set the error message to null, the status is left as-is; it will not assume that a null error message means the status is successful.

Parameters:
errorMessage - description of the error

setErrorMessageFromThrowable

public void setErrorMessageFromThrowable(Throwable t)
Convienence method that sets the error message to the given throwable's stack trace dump. If the given throwable is null, the error message will be set to null as if passing null to setErrorMessage(String).

Parameters:
t - throwable whose message and stack trace will make up the error message (may be null)

getSubjectName

public String getSubjectName()

setSubjectName

public void setSubjectName(String subjectName)

getCreatedTime

public long getCreatedTime()

getCreatedDate

public Date getCreatedDate()

getLastModifiedTime

public long getLastModifiedTime()

getLastModifiedDate

public Date getLastModifiedDate()

getResourceType

public ResourceType getResourceType()

setResourceType

public void setResourceType(ResourceType resourceType)

getConfiguration

public Configuration getConfiguration()

setConfiguration

public void setConfiguration(Configuration configuration)

getInstalledPackage

public InstalledPackage getInstalledPackage()

setInstalledPackage

public void setInstalledPackage(InstalledPackage installedPackage)

getDuration

public long getDuration()
The duration of the configuration update request which simply is the difference between the getCreatedTime() and the getLastModifiedTime(). If the request hasn't completed yet, this will be the difference between the current time and the created time.

Returns:
the duration of time that the request took or is taking to complete

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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


Copyright © 2008-2009 RHQ Project Advisory Board (Red Hat, Inc.). All Rights Reserved.