com.arsdigita.workflow.simple
Class Workflow

java.lang.Object
  extended bycom.arsdigita.domain.DomainObject
      extended bycom.arsdigita.domain.ObservableDomainObject
          extended bycom.arsdigita.kernel.ACSObject
              extended bycom.arsdigita.auditing.AuditedACSObject
                  extended bycom.arsdigita.workflow.simple.Task
                      extended bycom.arsdigita.workflow.simple.Workflow
All Implemented Interfaces:
Audited, Cloneable
Direct Known Subclasses:
WorkflowTemplate

public class Workflow
extends Task

Represents a process instance that is assigned to a particular process that is associated with some object.

Author:
Khy Huang, Stefan Deusch, Uday Mathur, Karl Goldstein

Field Summary
static String BASE_DATA_OBJECT_TYPE
           
static int DELETED
           
static int INIT
           
static int NONE
           
static int STARTED
           
static int STOPPED
           
static String versionId
           
 
Fields inherited from class com.arsdigita.workflow.simple.Task
DISABLED, ENABLED, FINISHED, INACTIVE
 
Fields inherited from class com.arsdigita.kernel.ACSObject
CONTAINER, DEFAULT_DOMAIN_CLASS, DISPLAY_NAME, ID, OBJECT_TYPE
 
Constructor Summary
  Workflow()
          Creates a new workflow process with the properties label and description set to null.
  Workflow(BigDecimal id)
          Restores a workflow process using a BigDecimal ID.
  Workflow(DataObject workflowDataObject)
          Restores a workflow process from a task data object.
protected Workflow(ObjectType type)
          Constructor for setting the object type.
  Workflow(OID oid)
          Restores a workflow process using an OID.
protected Workflow(String typeName)
          Constructor for setting the object type name.
  Workflow(String label, String description)
          Creates a new workflow process.
 
Method Summary
 void addTask(Task task)
          Adds a task to this process.
 Object clone()
          Performs a deep clone of the workflow.
protected  void cloneTasks(Workflow workflowClone)
           
 void disableEvt()
          On a disable event, stops the workflow.
 void enable()
          Overrides the enable method (since the behavior is a little different).
 String getBaseDataObjectType()
          Returns the base data object type.
 Iterator getEnabledTasks()
          Returns an iterator over all enabled tasks in the process.
 Iterator getFinishedTasks()
          Returns an iterator over all finished tasks in the process.
static BigDecimal getItemID(BigDecimal workflowId)
           
static BigDecimal getItemID(Workflow w)
           
 ACSObject getObject()
          Get the ACSObject this Workflow is associated with.
 OID getObjectOID()
          Returns the object associated with the process.
static Workflow getObjectWorkflow(ACSObject o)
           
static Workflow getObjectWorkflow(BigDecimal id)
           
static BigDecimal getObjectWorkflowID(ACSObject o)
           
static BigDecimal getObjectWorkflowID(BigDecimal id)
           
 Iterator getOverdueTasks()
           
 int getProcessState()
          Retrieves the state of the process.
 TaskCollection getTaskCollection()
           
 int getTaskCount()
          Returns the number of task in this process.
 Iterator getTasks()
          Returns an iterator for the tasks in this process.
 WorkflowTemplate getWorkflowTemplate()
          Get the template from which this workflow was instantiated.
protected  void initialize()
          Initializes the internal state depending on whether this is a new or a restored instance.
 void removeAllTasks()
          Removes all tasks from this workflow.
 void removeTask(Task task)
          Deletes a task.
 void removeTask(Task task, Iterator dependentList)
          Removes a task from the underlying workflow process definition.
 void save(User user)
          Saves the current state of the process.
 void setObject(ACSObject o)
          Sets the Object that this workflow is applied to.
 void setObjectID(BigDecimal id)
          Set the object id
 void setWorkflowTemplate(WorkflowTemplate template)
          Set the template from which this Workflow was instantiated.
 void start(User user)
          Starts the process.
protected  void startInternal()
          Gets the process spinning.
 void stop(User user)
          Stops the process.
 
Methods inherited from class com.arsdigita.workflow.simple.Task
addComment, addComment, addComment, addDependency, addFinishedListener, copyAttributes, delete, disable, enableEvt, equals, finish, finishEvt, getComments, getCommentsSize, getDependencies, getDependencyCount, getDescription, getDisplayName, getFinishedListeners, getFinishedListenersCount, getFinishedListenersInternal, getLabel, getLastComment, getLastCommentInWorkflow, getParentID, getRequiredTasks, getState, getStateMapping, getStateString, getStateString, getWorkflow, initAttributes, isActive, isDependency, isEnabled, isFinished, notifyFinished, removeAllDependencies, removeAllFinishedListeners, removeComment, removeDependency, removeFinishedListener, rollbackEvt, setActive, setDescription, setLabel, setState, toString
 
Methods inherited from class com.arsdigita.auditing.AuditedACSObject
getCreationDate, getCreationIP, getCreationUser, getLastModifiedDate, getLastModifiedIP, getLastModifiedUser
 
Methods inherited from class com.arsdigita.kernel.ACSObject
assertPrivilege, beforeSave, checkPrivilege, doCreateCheck, doWriteCheck, getContainer, getDefaultDomainClass, 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, disconnect, get, getObjectType, getOID, getSession, hashCode, isDeleted, isDisconnected, isModified, isNew, isPropertyModified, isValid, remove, remove, remove, removeFromAssociation, save, set, setAssociation, setAssociation, specializeDataObject, specializeDataObject
 
Methods inherited from class java.lang.Object
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

NONE

public static final int NONE
See Also:
Constant Field Values

STARTED

public static final int STARTED
See Also:
Constant Field Values

STOPPED

public static final int STOPPED
See Also:
Constant Field Values

DELETED

public static final int DELETED
See Also:
Constant Field Values

INIT

public static final int INIT
See Also:
Constant Field Values
Constructor Detail

Workflow

public Workflow(String label,
                String description)
Creates a new workflow process. The properties of this object are not made persistent until the save method is called.

Parameters:
label - the label
description - the description

Workflow

public Workflow()
Creates a new workflow process with the properties label and description set to null. Properties of this object are not made persistent until the save method is called. If save() is called without setting these properties, an IllegalArgumentException will be thrown.


Workflow

public Workflow(DataObject workflowDataObject)
Restores a workflow process from a task data object.

Parameters:
workflowDataObject -

Workflow

protected Workflow(ObjectType type)
Constructor for setting the object type.

Parameters:
type - the object type
See Also:
ObjectType

Workflow

protected Workflow(String typeName)
Constructor for setting the object type name.

Parameters:
typeName - the type name

Workflow

public Workflow(OID oid)
         throws DataObjectNotFoundException
Restores a workflow process using an OID.

Parameters:
oid - the OID
See Also:
OID

Workflow

public Workflow(BigDecimal id)
         throws DataObjectNotFoundException
Restores a workflow process using a BigDecimal ID.

Parameters:
id - the BigDecimal ID of this object. An OID will be created implicitly with the BASE_DATA_OBJECT_TYPE constant specified in this file.
Method Detail

initialize

protected void initialize()
Initializes the internal state depending on whether this is a new or a restored instance.

Overrides:
initialize in class Task

getBaseDataObjectType

public String getBaseDataObjectType()
Returns the base data object type.

Overrides:
getBaseDataObjectType in class Task
Returns:
the base data object type.

addTask

public void addTask(Task task)
Adds a task to this process. (persistent operation)

Parameters:
task - the task to add to this process
See Also:
Task

removeTask

public void removeTask(Task task)
Deletes a task. (perisistent operation).

Parameters:
task - to be removed

removeAllTasks

public void removeAllTasks()
Removes all tasks from this workflow. (persistent operation)


getTaskCollection

public final TaskCollection getTaskCollection()

save

public void save(User user)
          throws ProcessException
Saves the current state of the process.

Parameters:
user - the user
Throws:
ProcessException

getTaskCount

public int getTaskCount()
Returns the number of task in this process.

Returns:
the numnber of tasks in the workflow

stop

public void stop(User user)
Stops the process. (persistent operation)

Parameters:
user - the user that stopped the process

start

public void start(User user)
Starts the process. This method marks all the tasks as active when called the first time. (persistent operation)

Parameters:
user - the user that starts the process

startInternal

protected void startInternal()
Gets the process spinning. This method also marks all the tasks as active.


getProcessState

public int getProcessState()
Retrieves the state of the process.

Returns:
The process state

setObject

public void setObject(ACSObject o)
Sets the Object that this workflow is applied to.

Parameters:
o - the object to which to apply this workflow.

setObjectID

public void setObjectID(BigDecimal id)
Set the object id


getTasks

public Iterator getTasks()
Returns an iterator for the tasks in this process.

Returns:
the list of all tasks.

getEnabledTasks

public Iterator getEnabledTasks()
Returns an iterator over all enabled tasks in the process.

Returns:
an interator over enabled tasks.

getFinishedTasks

public Iterator getFinishedTasks()
Returns an iterator over all finished tasks in the process.

Returns:
an iterator over finished tasks.

getOverdueTasks

public Iterator getOverdueTasks()
Returns:
an iterator over all overdue tasks in the process.

getObjectOID

public OID getObjectOID()
Returns the object associated with the process.

Returns:
the ACS object that this process is based on.

getObject

public ACSObject getObject()
Get the ACSObject this Workflow is associated with.


removeTask

public void removeTask(Task task,
                       Iterator dependentList)
Removes a task from the underlying workflow process definition.

Parameters:
task - the task to be removed
dependentList - the task definitions that are dependent on the passed in task definition

clone

public Object clone()
Performs a deep clone of the workflow. All tasks are cloned as well. The cloned copy is saved to persistent storage before returning.

Overrides:
clone in class Task
Returns:
the cloned workflow process.

cloneTasks

protected void cloneTasks(Workflow workflowClone)

enable

public void enable()
Overrides the enable method (since the behavior is a little different).

Overrides:
enable in class Task

disableEvt

public void disableEvt()
On a disable event, stops the workflow.

Overrides:
disableEvt in class Task

setWorkflowTemplate

public void setWorkflowTemplate(WorkflowTemplate template)
Set the template from which this Workflow was instantiated.


getWorkflowTemplate

public WorkflowTemplate getWorkflowTemplate()
Get the template from which this workflow was instantiated.


getItemID

public static BigDecimal getItemID(Workflow w)

getItemID

public static BigDecimal getItemID(BigDecimal workflowId)

getObjectWorkflowID

public static BigDecimal getObjectWorkflowID(BigDecimal id)

getObjectWorkflowID

public static BigDecimal getObjectWorkflowID(ACSObject o)

getObjectWorkflow

public static Workflow getObjectWorkflow(BigDecimal id)

getObjectWorkflow

public static Workflow getObjectWorkflow(ACSObject o)


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