com.arsdigita.cms.lifecycle
Class Phase

java.lang.Object
  extended bycom.arsdigita.domain.DomainObject
      extended bycom.arsdigita.domain.ObservableDomainObject
          extended bycom.arsdigita.kernel.ACSObject
              extended bycom.arsdigita.cms.lifecycle.Phase

public class Phase
extends com.arsdigita.kernel.ACSObject

This class represents a phase in Publication Lifecycle for a Content Item. A phase can only be associated with one lifecycle.

Version:
$Revision: #13 $ $DateTime: 2004/04/07 16:07:11 $
Author:
Jack Chung (flattop@arsdigita.com), Michael Pih (pihman@arsdigita.com)

Field Summary
static String BASE_DATA_OBJECT_TYPE
           
static String versionId
           
 
Fields inherited from class com.arsdigita.kernel.ACSObject
CONTAINER, DEFAULT_DOMAIN_CLASS, DISPLAY_NAME, ID
 
Constructor Summary
protected Phase()
          If this constructor is used, the phase definition needs to be set with the setPhaseDefinition method.
  Phase(BigDecimal id)
          Constructor.
  Phase(com.arsdigita.persistence.DataObject obj)
           
  Phase(com.arsdigita.persistence.OID oid)
          Constructor.
protected Phase(String type)
           
 
Method Summary
protected  void afterSave()
           
 void delete()
          Delete this phase, updating the start and end times of the associated lifecycle.
 String getBaseDataObjectType()
           
 Date getEndDate()
          Get the end date
 String getLabel()
          Fetches the label of the phase, which is the same as the PhaseDefinition label
 Lifecycle getLifecycle()
          Fetches the lifecycle to which this phase belongs.
 LifecycleListener getListener()
          Get the lifecycle listener associated with this phase.
 String getListenerClassName()
          Get the lifecycle listener associated with this phase.
 PhaseDefinition getPhaseDefinition()
          Fetches the definition of this phase.
 Date getStartDate()
          Get the start date.
 boolean hasBegun()
           
 boolean hasEnded()
           
protected  void initialize()
          A new Phase has neither begun nor ended.
 void setEndDate(Date date)
          Set the end date
 void setEndTime(Long time)
          Deprecated. use setEndDate(new Date(time))
protected  void setHasBegun(boolean hasBegun)
           
protected  void setLifecycle(Lifecycle lifecycle)
          Update the associated Lifecycle.
 void setListenerClassName(String listener)
          Associate a listener to be run when this phase becomes active.
protected  void setPhaseDefinition(PhaseDefinition definition)
          Update the definition of this phase Every Phase needs to be associated with a definition.
 void setStartDate(Date date)
          Set the start date
 void setStartTime(Long time)
          Deprecated. use setStartDate(new Date(time))
 void start()
          Starts this phase if the start date is past the current time or is undefined (in which case it is set to the current time).
protected  void stop()
          Stop the phase.
 
Methods inherited from class com.arsdigita.kernel.ACSObject
assertPrivilege, beforeSave, checkPrivilege, doCreateCheck, doWriteCheck, getContainer, getDefaultDomainClass, getDisplayName, getID, getSpecificObjectType, getSpecificOID, gimmeContainer, isContainerModified, setID, setID
 
Methods inherited from class com.arsdigita.domain.ObservableDomainObject
addObserver, getObservers
 
Methods inherited from class com.arsdigita.domain.DomainObject
add, add, addToAssociation, afterDelete, beforeDelete, clear, disconnect, equals, get, getObjectType, getOID, getSession, hashCode, isDeleted, isDisconnected, isModified, isNew, isPropertyModified, isValid, remove, remove, remove, removeFromAssociation, save, set, setAssociation, setAssociation, specializeDataObject, specializeDataObject, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values

BASE_DATA_OBJECT_TYPE

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

Phase

protected Phase()
If this constructor is used, the phase definition needs to be set with the setPhaseDefinition method.


Phase

public Phase(com.arsdigita.persistence.OID oid)
      throws com.arsdigita.domain.DataObjectNotFoundException
Constructor. The contained DataObject is retrieved from the persistent storage mechanism with an OID specified by oid.

Parameters:
oid - The OID for the retrieved DataObject.

Phase

public Phase(BigDecimal id)
      throws com.arsdigita.domain.DataObjectNotFoundException
Constructor. The contained DataObject is retrieved from the persistent storage mechanism with an OID specified by id and Phase.BASE_DATA_OBJECT_TYPE.

Parameters:
id - The id for the retrieved DataObject.

Phase

public Phase(com.arsdigita.persistence.DataObject obj)

Phase

protected Phase(String type)
Method Detail

initialize

protected void initialize()
A new Phase has neither begun nor ended.


getBaseDataObjectType

public String getBaseDataObjectType()
Returns:
the base PDL object type for this phase. Child classes should override this method to return the correct value

getLabel

public String getLabel()
Fetches the label of the phase, which is the same as the PhaseDefinition label

Returns:
The label of this phase

getStartDate

public Date getStartDate()
Get the start date.

Returns:
The start date

setStartTime

public void setStartTime(Long time)
Deprecated. use setStartDate(new Date(time))

Set the time when the phase should become active.

Parameters:
time - The start time (milliseconds since Jan 1, 1970)

setStartDate

public void setStartDate(Date date)
Set the start date

Parameters:
date - The start date

getEndDate

public Date getEndDate()
Get the end date

Returns:
The end date. If this is null then the lifecycle has no end

setEndTime

public void setEndTime(Long time)
Deprecated. use setEndDate(new Date(time))

Set the time when the phase should end.

Parameters:
time - The end time (milliseconds since Jan 1, 1970), null if this phase never ends.

setEndDate

public void setEndDate(Date date)
Set the end date

Parameters:
date - The end date

getListenerClassName

public String getListenerClassName()
Get the lifecycle listener associated with this phase.

Returns:
The class name of the lifecycle listener

getListener

public LifecycleListener getListener()
Get the lifecycle listener associated with this phase.

Returns:
The lifecycle listener

setListenerClassName

public void setListenerClassName(String listener)
Associate a listener to be run when this phase becomes active.

Parameters:
listener - The class name of the lifecycle listener

hasBegun

public boolean hasBegun()
Returns:
true if the phase has begun. False otherwise.

setHasBegun

protected void setHasBegun(boolean hasBegun)

hasEnded

public boolean hasEnded()
Returns:
true if the phase has ended. False otherwise.

getLifecycle

public Lifecycle getLifecycle()
Fetches the lifecycle to which this phase belongs.

Returns:
The associated lifecycle

setLifecycle

protected void setLifecycle(Lifecycle lifecycle)
Update the associated Lifecycle. Every Phase needs to be associated with a Lifecycle. If this phase does not belong to any lifecycle, then this phase should be removed by calling the delete() method.

Parameters:
lifecycle - The associated lifecycle

getPhaseDefinition

public PhaseDefinition getPhaseDefinition()
Fetches the definition of this phase.

Returns:
The phase definition

setPhaseDefinition

protected void setPhaseDefinition(PhaseDefinition definition)
Update the definition of this phase Every Phase needs to be associated with a definition. If this phase is not assocaited to any definition, then this phase should be removed by calling the delete() method.

Parameters:
definition - The phase definition

delete

public void delete()
Delete this phase, updating the start and end times of the associated lifecycle.


afterSave

protected void afterSave()

start

public void start()
Starts this phase if the start date is past the current time or is undefined (in which case it is set to the current time). Fires the listener associated with this phase's definition.


stop

protected void stop()
Stop the phase.



Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 19 2004:2352 UTC