Class ProcessTask
- java.lang.Object
-
- com.aquima.interactions.process.impl.ProcessTask
-
- All Implemented Interfaces:
IProcessTask
public class ProcessTask extends Object implements IProcessTask
Class exposing process engine functionality for a task.- Since:
- 7.1
- Author:
- Jon van Leuven
-
-
Field Summary
Fields Modifier and Type Field Description protected ProcessEngine
processEngine
protected ITaskModel
task
-
Constructor Summary
Constructors Modifier Constructor Description protected
ProcessTask(ProcessEngine processEngine, long caseId, ITaskModel taskModel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort(IUserData userData, IProcessCaseUpdates updates)
This method may be invoked to indicate the process step has been aborted.void
assign(IUserData userData, IAssigneeInfo assigneeInfo, boolean isUserSet)
This method may be used to assign the task.void
cancel(IUserData userData)
This method may be used to explicitly cancel the task.protected void
cancelTask(IUserData userData)
void
complete(IUserData userData, IProcessCaseUpdates updates, String taskExit)
This method may be invoked to indicate the process step has been successfully completed.protected void
completeTask(IUserData userData)
void
evaluateAfterComplete(IUserData userData, String taskExit, ProcessCase processCase)
Evaluates the case after a task has been completedIRole[]
evaluateRequiredRoles()
This method returns the required roles to start this task.IAssigneeInfo
getAssigneeInfo()
This method returns the AssigneeInfo of whom the task is assigned to.long
getCaseId()
This method returns the ID of the case the task is defined for.String
getCustomFieldValue(String name)
This method returns the value of a custom fieldString
getDescription()
This method returns an optional description of the task.IMultilingualText
getDisplayName()
Returns theIMultilingualText
display name for the task.protected Map<String,String>
getDisplayNameValues(ITaskModel task, IProcessCase processCase)
DateTimeValue
getDueDate()
this method returns the date at which the task should be completed.String
getExecutedBy()
Gets the name of the user that executed this task.long
getId()
This method returns the unique ID of this task.String
getName()
This method returns the name of the task as present in the task definition.GUID
getNodeId()
This method returns the optional node ID this task belongs to.Integer
getPriority()
This method returns the priority of a task.DateTimeValue
getStartDate()
This method returns the date at which the task may start.TaskStatusType
getStatus()
This method returns the current status of the task.ITaskModel
getTask()
DateTimeValue
getTimeoutDate()
this method returns the date at which the task will expireprotected boolean
hasPermissionsToExecute(IUserData userData)
boolean
isUserSet()
void
setStartDate(DateTimeValue startDate)
This method may be used to change the start date of the task.void
setTimeoutDate(IUserData userData, DateTimeValue timeoutDate)
This method may be used to change the timeout date of the task.void
start(IUserData userData)
This method will attempt to mark the process step as started for the current user.String
toString()
void
traceTaskOffline(IUserData userData)
void
unassign()
This method may be used to clear the assignment information of the task.protected void
unscheduleJob(IUserData userData)
protected void
unscheduleJobWithAdvancedScheduler(IUserData userData)
protected void
unscheduleJobWithCaseEngine(IUserData userData)
protected void
updateInternalTaskModel()
-
-
-
Field Detail
-
processEngine
protected final ProcessEngine processEngine
-
task
protected ITaskModel task
-
-
Constructor Detail
-
ProcessTask
protected ProcessTask(ProcessEngine processEngine, long caseId, ITaskModel taskModel)
-
-
Method Detail
-
abort
public void abort(IUserData userData, IProcessCaseUpdates updates) throws AppException
Description copied from interface:IProcessTask
This method may be invoked to indicate the process step has been aborted. The abort method may be manually invoked, but can also be invoked by a session that has been closed. This method is also known as "cancel task" in the documentation.- Specified by:
abort
in interfaceIProcessTask
- Parameters:
userData
- User that aborts the execution of the task.updates
- Object containing updates that should be applied to the case data.- Throws:
AppException
- This exception is thrown when the task could not be aborted.
-
cancel
public void cancel(IUserData userData)
Description copied from interface:IProcessTask
This method may be used to explicitly cancel the task. Canceling a task may only be done for tasks that are not part of a process definition. Canceling the task will remove the task, and should not be confused with the abort task method.- Specified by:
cancel
in interfaceIProcessTask
- Parameters:
userData
- User that aborts the execution of the task.
-
complete
public void complete(IUserData userData, IProcessCaseUpdates updates, String taskExit) throws AppException
Description copied from interface:IProcessTask
This method may be invoked to indicate the process step has been successfully completed. The complete operation will unlock the case again, and merge the updates from the process step with the case data. This method is also known as "close task" in the documentation.- Specified by:
complete
in interfaceIProcessTask
- Parameters:
userData
- User that marks the task as completed.updates
- Object containing updates that should be applied to the case data.taskExit
- The exit state of the completed task, may be null.- Throws:
AppException
- This exception is thrown when the current task could not be marked as completed.
-
evaluateAfterComplete
public void evaluateAfterComplete(IUserData userData, String taskExit, ProcessCase processCase)
Description copied from interface:IProcessTask
Evaluates the case after a task has been completed- Specified by:
evaluateAfterComplete
in interfaceIProcessTask
- Parameters:
userData
- user that marks the task as completedtaskExit
- the exit state of the completed taskprocessCase
- the case which is evaluated
-
start
public void start(IUserData userData) throws ProcessException
Description copied from interface:IProcessTask
This method will attempt to mark the process step as started for the current user. The start operation may fail if another process has updated the case, or started another task, in the time between acquiring the task and starting it. When the start method has completed without an exception, the case will be locked by the current user, and the either the complete or abort method should be invoked to release it.- Specified by:
start
in interfaceIProcessTask
- Parameters:
userData
- User that will start the task.- Throws:
ProcessException
-
traceTaskOffline
public void traceTaskOffline(IUserData userData)
-
hasPermissionsToExecute
protected boolean hasPermissionsToExecute(IUserData userData)
-
getAssigneeInfo
public IAssigneeInfo getAssigneeInfo()
Description copied from interface:IProcessTask
This method returns the AssigneeInfo of whom the task is assigned to.- Specified by:
getAssigneeInfo
in interfaceIProcessTask
- Returns:
- the AssigneeInfo of whom the task is assigned to.
-
getPriority
public Integer getPriority()
Description copied from interface:IProcessTask
This method returns the priority of a task.- Specified by:
getPriority
in interfaceIProcessTask
- Returns:
- The priority
-
getExecutedBy
public String getExecutedBy()
Description copied from interface:IProcessTask
Gets the name of the user that executed this task.- Specified by:
getExecutedBy
in interfaceIProcessTask
- Returns:
- Username
-
getCaseId
public long getCaseId()
Description copied from interface:IProcessTask
This method returns the ID of the case the task is defined for.- Specified by:
getCaseId
in interfaceIProcessTask
- Returns:
- The ID of the case the task is defined for.
-
getTimeoutDate
public DateTimeValue getTimeoutDate()
Description copied from interface:IProcessTask
this method returns the date at which the task will expire- Specified by:
getTimeoutDate
in interfaceIProcessTask
- Returns:
- The date at which the task will expire
-
getId
public long getId()
Description copied from interface:IProcessTask
This method returns the unique ID of this task.- Specified by:
getId
in interfaceIProcessTask
- Returns:
- the unique ID of this process step.
-
getNodeId
public GUID getNodeId()
Description copied from interface:IProcessTask
This method returns the optional node ID this task belongs to.- Specified by:
getNodeId
in interfaceIProcessTask
- Returns:
- the node ID of this task.
-
getName
public String getName()
Description copied from interface:IProcessTask
This method returns the name of the task as present in the task definition.- Specified by:
getName
in interfaceIProcessTask
- Returns:
- The name of the task.
-
getDescription
public String getDescription()
Description copied from interface:IProcessTask
This method returns an optional description of the task.- Specified by:
getDescription
in interfaceIProcessTask
- Returns:
- Description of the task
-
getStartDate
public DateTimeValue getStartDate()
Description copied from interface:IProcessTask
This method returns the date at which the task may start.- Specified by:
getStartDate
in interfaceIProcessTask
- Returns:
- The date at which the task may start.
-
setStartDate
public void setStartDate(DateTimeValue startDate) throws ProcessDataAccessException
Description copied from interface:IProcessTask
This method may be used to change the start date of the task.- Specified by:
setStartDate
in interfaceIProcessTask
- Parameters:
startDate
- The new timeout date for the task.- Throws:
ProcessDataAccessException
-
getStatus
public TaskStatusType getStatus()
Description copied from interface:IProcessTask
This method returns the current status of the task.- Specified by:
getStatus
in interfaceIProcessTask
- Returns:
- the current status of the task.
-
assign
public void assign(IUserData userData, IAssigneeInfo assigneeInfo, boolean isUserSet) throws ProcessDataAccessException
Description copied from interface:IProcessTask
This method may be used to assign the task.- Specified by:
assign
in interfaceIProcessTask
- Parameters:
userData
- Object containing information about the current user.assigneeInfo
- The AssigneeInfo of who the task should be assigned to.- Throws:
ProcessDataAccessException
-
setTimeoutDate
public void setTimeoutDate(IUserData userData, DateTimeValue timeoutDate) throws ProcessDataAccessException
Description copied from interface:IProcessTask
This method may be used to change the timeout date of the task. Adjusting the timeout date of the task may cause the task to be aborted.- Specified by:
setTimeoutDate
in interfaceIProcessTask
- Parameters:
userData
- Object containing information about the current user.timeoutDate
- The new timeout date for the task.- Throws:
ProcessDataAccessException
-
getDueDate
public DateTimeValue getDueDate()
Description copied from interface:IProcessTask
this method returns the date at which the task should be completed.- Specified by:
getDueDate
in interfaceIProcessTask
- Returns:
- The date at which the task should be completed.
-
unassign
public void unassign() throws ProcessDataAccessException
Description copied from interface:IProcessTask
This method may be used to clear the assignment information of the task.- Specified by:
unassign
in interfaceIProcessTask
- Throws:
ProcessDataAccessException
-
completeTask
protected void completeTask(IUserData userData)
-
cancelTask
protected void cancelTask(IUserData userData)
-
unscheduleJob
protected void unscheduleJob(IUserData userData)
-
unscheduleJobWithAdvancedScheduler
protected void unscheduleJobWithAdvancedScheduler(IUserData userData)
-
unscheduleJobWithCaseEngine
protected void unscheduleJobWithCaseEngine(IUserData userData)
-
updateInternalTaskModel
protected void updateInternalTaskModel()
-
evaluateRequiredRoles
public IRole[] evaluateRequiredRoles() throws ProcessException
Description copied from interface:IProcessTask
This method returns the required roles to start this task.- Specified by:
evaluateRequiredRoles
in interfaceIProcessTask
- Returns:
- The required roles.
- Throws:
ProcessException
-
getCustomFieldValue
public String getCustomFieldValue(String name)
Description copied from interface:IProcessTask
This method returns the value of a custom field- Specified by:
getCustomFieldValue
in interfaceIProcessTask
- Parameters:
name
- the custom field name- Returns:
- null if the field does not exist or has no value for this task
-
getTask
public ITaskModel getTask()
-
getDisplayNameValues
protected Map<String,String> getDisplayNameValues(ITaskModel task, IProcessCase processCase)
-
isUserSet
public boolean isUserSet()
- Specified by:
isUserSet
in interfaceIProcessTask
- Returns:
- whether the assignee of the task is set manually by an user or by routing algorithm
-
getDisplayName
public IMultilingualText getDisplayName()
Description copied from interface:IProcessTask
Returns theIMultilingualText
display name for the task.- Specified by:
getDisplayName
in interfaceIProcessTask
- Returns:
- display name for the task
-
-