com.arsdigita.cms.lifecycle
Class Lifecycle

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

public class Lifecycle
extends com.arsdigita.kernel.ACSObject

This class represents a Publication Lifecycle for a Content Item. Associated with each Lifecycle is a set of phases. A phase can only be associated with one Lifecycle.

Version:
$Revision: #16 $ $DateTime: 2004/04/07 16:07:11 $
Author:
Jack Chung, Michael Pih

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 Lifecycle()
          If this constructor is used, the lifecycle definition needs to be set with the setLifecycleDefinition method.
  Lifecycle(BigDecimal id)
          Constructor.
  Lifecycle(com.arsdigita.persistence.DataObject obj)
           
  Lifecycle(com.arsdigita.persistence.OID oid)
          Constructor.
protected Lifecycle(String type)
           
 
Method Summary
 Phase addCustomPhase(String label, Date startDate, Date endDate)
          Adds a custom phase which is not part of the lifecycle definition.
 Phase addCustomPhase(String label, Long start, Long end)
          Adds a custom phase which is not part of the lifecycle definition.
 Phase addPhase(PhaseDefinition pd)
          Adds a phase which uses the default delay and duration from the phase definition.
 Phase addPhase(PhaseDefinition pd, Date startDate)
          Adds a phase which uses the supplied start date and calculate the end date using the phase definition default duration.
 Phase addPhase(PhaseDefinition pd, Date startDate, Date endDate)
          Adds a phase which uses the supplied start date and end date.
 PhaseCollection getActivePhases()
          Fetches the phases in this lifecycle that should be currently active.
 PhaseCollection getActivePhases(Date date)
          Fetches the phases in this lifecycle that should be active at the specified time.
 String getBaseDataObjectType()
           
 Date getEndDate()
          Get the end date
 String getLabel()
          Fetches the label of the lifecycle, which is the same as the label of the associated lifecycle definition.
 LifecycleDefinition getLifecycleDefinition()
          Fetches the definition of publication lifecycle.
 LifecycleListener getListener()
          Get the lifecycle listener associated with this phase.
 String getListenerClassName()
          Fetches the class name of the listener associated with this lifecycle.
 PhaseCollection getPhases()
          Fetches all phases within this lifecycle.
 Date getStartDate()
          Get the start date.
 boolean hasBegun()
           
 boolean hasEnded()
           
protected  void initialize()
          A new Lifecycle has neither begun nor ended.
 void setEndDate(Date date)
          Set the end date
protected  void setHasBegun(boolean hasBegun)
           
protected  void setLifecycleDefinition(LifecycleDefinition definition)
          Update the associated definition of publication lifecycle.
 void setListenerClassName(String listener)
          Associate a listener with this lifecycle.
 void setStartDate(Date date)
          Set the start date
 void start()
          Starts this lifecycle 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 lifecycle.
 
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, afterSave, beforeDelete, clear, delete, 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

Lifecycle

protected Lifecycle()
If this constructor is used, the lifecycle definition needs to be set with the setLifecycleDefinition method.


Lifecycle

public Lifecycle(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.

Lifecycle

public Lifecycle(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 Lifecycle.BASE_DATA_OBJECT_TYPE.

Parameters:
id - The id for the retrieved DataObject.

Lifecycle

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

Lifecycle

protected Lifecycle(String type)
Method Detail

initialize

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


getBaseDataObjectType

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

getLabel

public String getLabel()
Fetches the label of the lifecycle, which is the same as the label of the associated lifecycle definition.

Returns:
The label of this lifecycle

getStartDate

public Date getStartDate()
Get the start date.

Returns:
The start date

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

setEndDate

public void setEndDate(Date date)
Set the end date

Parameters:
date - The end date

getListenerClassName

public String getListenerClassName()
Fetches the class name of the listener associated with this lifecycle.

Returns:
The class name of the 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 with this lifecycle.

Parameters:
listener - The class name of the lifecycle listener

hasBegun

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

setHasBegun

protected void setHasBegun(boolean hasBegun)

hasEnded

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

getLifecycleDefinition

public LifecycleDefinition getLifecycleDefinition()
Fetches the definition of publication lifecycle.

Returns:
The lifecycle definition

setLifecycleDefinition

protected void setLifecycleDefinition(LifecycleDefinition definition)
Update the associated definition of publication lifecycle.

Parameters:
definition - The lifecycle definition

getPhases

public PhaseCollection getPhases()
Fetches all phases within this lifecycle. To remove the phase from this cycle, you need to explicitly call the delete() method on that particular phase.

Returns:
A collection of phases

getActivePhases

public PhaseCollection getActivePhases()
Fetches the phases in this lifecycle that should be currently active.

Returns:
A collection of active phases

getActivePhases

public PhaseCollection getActivePhases(Date date)
Fetches the phases in this lifecycle that should be active at the specified time.

Parameters:
date - The specified time.
Returns:
A collection of active phases

addPhase

public Phase addPhase(PhaseDefinition pd)
Adds a phase which uses the default delay and duration from the phase definition.

Parameters:
pd - The phase definition
Returns:
The phase

addPhase

public Phase addPhase(PhaseDefinition pd,
                      Date startDate)
Adds a phase which uses the supplied start date and calculate the end date using the phase definition default duration.

Parameters:
pd - The phase definition
startDate - Date at which the phase becomes active
Returns:
The phase

addPhase

public Phase addPhase(PhaseDefinition pd,
                      Date startDate,
                      Date endDate)
Adds a phase which uses the supplied start date and end date. If end date is null, then this phase will never end.

Parameters:
pd - The phase definition
startDate - Date at which the phase becomes active
endDate - Date at which the phase is no longer active
Returns:
The phase

addCustomPhase

public Phase addCustomPhase(String label,
                            Date startDate,
                            Date endDate)
Adds a custom phase which is not part of the lifecycle definition.

Parameters:
label - the name of this phase.
startDate - start time of this phase
endDate - end time of this phase If end date is null, then this phase will never end.

addCustomPhase

public Phase addCustomPhase(String label,
                            Long start,
                            Long end)
Adds a custom phase which is not part of the lifecycle definition.

Parameters:
label - the name of this phase.
start - start time of this phase
end - end time of this phase If end date is null, then this phase will never end.

start

public void start()
Starts this lifecycle 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 lifecycle's definition, as well as the listener associated with any phases that begin immediately.


stop

protected void stop()
Stop the lifecycle.



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