com.arsdigita.workflow.simple
Class UserTask

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.UserTask
All Implemented Interfaces:
Assignable, Audited, Cloneable

public class UserTask
extends Task
implements Assignable

Aser task that is associated with an interface for performing some manual operation.

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

Field Summary
static String BASE_DATA_OBJECT_TYPE
           
static int DEFAULT_DURATION
           
static String DISABLE_OP
           
static String ENABLE_OP
           
static String FINISH_OP
           
static String ROLLBACK_OP
           
static String versionId
           
 
Fields inherited from class com.arsdigita.workflow.simple.Task
DELETED, DISABLED, ENABLED, FINISHED, INACTIVE
 
Fields inherited from class com.arsdigita.kernel.ACSObject
CONTAINER, DEFAULT_DOMAIN_CLASS, DISPLAY_NAME, ID, OBJECT_TYPE
 
Constructor Summary
  UserTask()
          Creates a new task definition and sets the properties label and description to null.
  UserTask(BigDecimal id)
          Restores a task definition from an OID as BigDecimal.
  UserTask(DataObject userTaskObject)
          Constructor for restoring a user task from a data object.
protected UserTask(ObjectType type)
          Constructor for a user task that is used for setting the object type.
  UserTask(OID oid)
          Restores a user task definition from an OID.
protected UserTask(String typeName)
          Constructor for user task that is used for setting the object type by name.
  UserTask(String label, String description)
          Constructor for a user task without runtime information.
  UserTask(String label, String description, boolean is_active, int duration_minutes)
          Constructor for a user task with usage information.
 
Method Summary
 void assignGroup(Group group)
          Assigns a group of users to this task.
 void assignUser(User user)
          Assigns a user to this task.
 Object clone()
          Clones a user task.
protected  void copyAttributes(UserTask task)
          Exports the attributes of this domain object.
 void delete()
          Deletes this user task.
protected  void disableEvt()
          Sends email that this task has been disabled.
 void enable()
          Set the startDate to the current date, carrying the duration over from the current value.
 void enableEvt()
          Enables an event action.
 void finish(User user)
          Marks the task as finished.
 void finish(User user, String comment)
          Marks the task as finished with an additional comment.
protected  void finishEvt()
          Sends email to assignees with information about who completed the task and when.
protected  Message generateMessage(String operation, Party sender)
          Generate the message to send if for the specified event
static Party getAlertsSender()
           
protected  DataAssociation getAssignedGroupAssociation()
          Retrieve the assigned group data collection.
 GroupCollection getAssignedGroupCollection()
           
 int getAssignedGroupCount()
          Gets number of assigned groups.
 Iterator getAssignedGroups()
          Returns the assigned groups.
protected  DataAssociation getAssignedUserAssociation()
          Retrieve the assigned users datacollection.
 UserCollection getAssignedUserCollection()
           
 int getAssignedUserCount()
          Gets the number of assigned users.
 Iterator getAssignedUsers()
          Returns all assigned users.
 Date getDueDate()
          Retrieves the due date of this user task.
 Duration getDuration()
          Returns the duration attribute for this user task.
 User getLockedUser()
          Retrieves the user who locked the process.
 Party getNotificationSender()
          Returns the notification sender.
 Date getStartDate()
          Retrieves the start date of this user task.
 OID getUserTaskOID()
          Returns the OID of this user task.
 boolean isAssigned()
          Tests whether any user or group is assigned to this task.
 boolean isAssigned(Group group)
          Tests whether a specific group is assigned to this task.
 boolean isAssigned(User user)
          Tests whether a specificv user is assigned to this task.
 boolean isLocked()
          Checks whether the task is locked by a user.
 boolean isOverdue()
          Tests whether the task is overdue.
 void lock(User user)
          Locks the task for finishing by a specified user.
 void removeAllGroupAssignees()
          Removes all groups assigned to this task.
 void removeGroup(Group group)
          Removes a group from assignment list.
 void removeUser(User user)
          Removes a user from the assignment list.
protected  void rollbackEvt()
          Sends email to subscribed events that this task was rolled back.
protected  boolean sendAlerts(String operation)
          Whether or not to send alerts.
protected  void sendMessageToAssignees(Message msg)
          Internal sends a message to all assignees of this task.
 void setDueDate(Date dueDate)
          Sets the due date of the user task.
 void setDuration(Duration duration)
          Sets the duration for this user task.
 Party setNotificationSender(Party party)
          Specifies who is sending out the notification.
 void setStartDate(Date startDate)
          Sets the start date for a user task.
 void unlock(User user)
          Releases the lock on the task if it is currently locked.
 
Methods inherited from class com.arsdigita.workflow.simple.Task
addComment, addComment, addComment, addDependency, addFinishedListener, copyAttributes, disable, equals, finish, getBaseDataObjectType, getComments, getCommentsSize, getDependencies, getDependencyCount, getDescription, getDisplayName, getFinishedListeners, getFinishedListenersCount, getFinishedListenersInternal, getLabel, getLastComment, getLastCommentInWorkflow, getParentID, getRequiredTasks, getState, getStateMapping, getStateString, getStateString, getWorkflow, initAttributes, initialize, isActive, isDependency, isEnabled, isFinished, notifyFinished, removeAllDependencies, removeAllFinishedListeners, removeComment, removeDependency, removeFinishedListener, 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

DEFAULT_DURATION

public static final int DEFAULT_DURATION
See Also:
Constant Field Values

ENABLE_OP

public static final String ENABLE_OP
See Also:
Constant Field Values

DISABLE_OP

public static final String DISABLE_OP
See Also:
Constant Field Values

ROLLBACK_OP

public static final String ROLLBACK_OP
See Also:
Constant Field Values

FINISH_OP

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

UserTask

public UserTask(String label,
                String description,
                boolean is_active,
                int duration_minutes)
Constructor for a user task with usage information.

Parameters:
label - the task label
description - the task description
is_active - whether the task is in use
duration_minutes - the projected duration of the task in minutes

UserTask

public UserTask(String label,
                String description)
Constructor for a user task without runtime information.

Parameters:
label - the task definition label
description - the description

UserTask

public UserTask()
Creates a new task definition and sets the properties label and description to null. The 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.


UserTask

protected UserTask(ObjectType type)
Constructor for a user task that is used for setting the object type.

Parameters:
type - the object type

UserTask

protected UserTask(String typeName)
Constructor for user task that is used for setting the object type by name.

Parameters:
typeName - the type name

UserTask

public UserTask(DataObject userTaskObject)
Constructor for restoring a user task from a data object.

Parameters:
userTaskObject - the data object

UserTask

public UserTask(OID oid)
         throws DataObjectNotFoundException
Restores a user task definition from an OID.

Parameters:
oid - the user task OID

UserTask

public UserTask(BigDecimal id)
         throws DataObjectNotFoundException
Restores a task definition from an OID as BigDecimal.

Parameters:
id - the user task ID as BigDecimal
Method Detail

getUserTaskOID

public OID getUserTaskOID()
Returns the OID of this user task.

Returns:
user task OID.
See Also:
OID

getStartDate

public Date getStartDate()
Retrieves the start date of this user task.

Returns:
the start date of this user task.

getDueDate

public Date getDueDate()
Retrieves the due date of this user task.

Returns:
the due date of this user task.

setStartDate

public void setStartDate(Date startDate)
Sets the start date for a user task.

Parameters:
startDate - the date the task is supposed to start

setDuration

public void setDuration(Duration duration)
Sets the duration for this user task. Updates the start date and due date accordingly.

Parameters:
duration - the duration for this task

getDuration

public Duration getDuration()
Returns the duration attribute for this user task.

Returns:
the duration for this user task.

setDueDate

public void setDueDate(Date dueDate)
Sets the due date of the user task.

Parameters:
dueDate - the imposed due date of the user task

finish

public void finish(User user)
            throws TaskException
Marks the task as finished. (persistent operation)

This operation is only valid if the task is enabled. Only the user who previously locked the task can call this method.

Parameters:
user - the user who checks off the task
Throws:
TaskException

enable

public void enable()
Set the startDate to the current date, carrying the duration over from the current value.

Overrides:
enable in class Task

enableEvt

public void enableEvt()
Enables an event action. Sends out notification to assigned users.

Overrides:
enableEvt in class Task

finishEvt

protected void finishEvt()
Sends email to assignees with information about who completed the task and when.

Overrides:
finishEvt in class Task

rollbackEvt

protected void rollbackEvt()
Sends email to subscribed events that this task was rolled back.

Overrides:
rollbackEvt in class Task

disableEvt

protected void disableEvt()
Sends email that this task has been disabled.

Overrides:
disableEvt in class Task

generateMessage

protected Message generateMessage(String operation,
                                  Party sender)
Generate the message to send if for the specified event


sendMessageToAssignees

protected void sendMessageToAssignees(Message msg)
Internal sends a message to all assignees of this task.

Parameters:
msg - the message
See Also:
Message

finish

public void finish(User user,
                   String comment)
            throws TaskException
Marks the task as finished with an additional comment. (persistent operation)

Parameters:
user - the user checking off the task as finished
comment - a comment
Throws:
TaskException

lock

public void lock(User user)
Locks the task for finishing by a specified user. (persistent operation)

Parameters:
user - the user who is locking the task

unlock

public void unlock(User user)
Releases the lock on the task if it is currently locked. (persistent operation)

Parameters:
user - the user who is unlocking the task

isLocked

public boolean isLocked()
Checks whether the task is locked by a user.

Returns:
true if the task is locked by a user; false otherwise.

getLockedUser

public User getLockedUser()
Retrieves the user who locked the process.

Returns:
the user who locked the process.

assignUser

public void assignUser(User user)
Assigns a user to this task. You must use the save method to make it persistant.

Specified by:
assignUser in interface Assignable
Parameters:
user - an active user of the system

assignGroup

public void assignGroup(Group group)
Assigns a group of users to this task. Use the save method to make it persistent.

Specified by:
assignGroup in interface Assignable
Parameters:
group - the group to assign

removeUser

public void removeUser(User user)
Removes a user from the assignment list.

Specified by:
removeUser in interface Assignable
Parameters:
user - the user to be removed

removeGroup

public void removeGroup(Group group)
Removes a group from assignment list.

Specified by:
removeGroup in interface Assignable
Parameters:
group - the group to be removed

removeAllGroupAssignees

public void removeAllGroupAssignees()
Removes all groups assigned to this task.


isAssigned

public boolean isAssigned()
Tests whether any user or group is assigned to this task.

Specified by:
isAssigned in interface Assignable
Returns:
true if a user or a group is assigned; false otherwise.

isAssigned

public boolean isAssigned(User user)
Tests whether a specificv user is assigned to this task.

Specified by:
isAssigned in interface Assignable
Parameters:
user - a system user
Returns:
true if the user is assigned to this task; false otherwise.

isAssigned

public boolean isAssigned(Group group)
Tests whether a specific group is assigned to this task.

Specified by:
isAssigned in interface Assignable
Parameters:
group - a system group
Returns:
true if the group is actually assigned to this task; false otherwise.

getAssignedUserCount

public int getAssignedUserCount()
Gets the number of assigned users.

Returns:
the number of assigned users.

getAssignedGroupCount

public int getAssignedGroupCount()
Gets number of assigned groups.

Returns:
the number of assigned groups.

getAssignedUsers

public Iterator getAssignedUsers()
Returns all assigned users.

Specified by:
getAssignedUsers in interface Assignable
Returns:
an iterator over all assigned users.

getAssignedGroups

public Iterator getAssignedGroups()
Returns the assigned groups.

Specified by:
getAssignedGroups in interface Assignable
Returns:
an iterator over all assigned groups.

getAssignedUserAssociation

protected DataAssociation getAssignedUserAssociation()
Retrieve the assigned users datacollection.

Returns:
the assigned user data collection

getAssignedUserCollection

public final UserCollection getAssignedUserCollection()

getAssignedGroupAssociation

protected DataAssociation getAssignedGroupAssociation()
Retrieve the assigned group data collection.

Returns:
the assigned group data collection.

getAssignedGroupCollection

public final GroupCollection getAssignedGroupCollection()

delete

public void delete()
Deletes this user task. (persistent operation).

Overrides:
delete in class Task

isOverdue

public boolean isOverdue()
Tests whether the task is overdue.

Returns:
true if the task is overdue; false otherwise.

setNotificationSender

public Party setNotificationSender(Party party)
Specifies who is sending out the notification.

Parameters:
party - the sender in email messages
Returns:
the previous sender if one exists otherwise null

getNotificationSender

public Party getNotificationSender()
Returns the notification sender.

Returns:
the notification sender.

clone

public Object clone()
Clones a user task. Deep cloning (except the primary key). Clones class and db-row The cloned copy is saved to persistent storage before returning.

Overrides:
clone in class Task
Returns:
a clone of the user task definition.

copyAttributes

protected void copyAttributes(UserTask task)
Exports the attributes of this domain object.

Parameters:
task - the domain object to which this method copies the attributes of this object

getAlertsSender

public static Party getAlertsSender()

sendAlerts

protected boolean sendAlerts(String operation)
Whether or not to send alerts. Subclasses can override this to send alerts based on different criteria, but they should always check super.sendAlerts() as well.



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