public interface WorkflowService extends Service
Modifier and Type | Field and Description |
---|---|
static int |
FILTER_ASSIGNEE_ALL
tasks assigned to the current user and unassigned task current user can
claim (member of the group)
|
static int |
FILTER_ASSIGNEE_ME
Only tasks explicitly assign to the current user.
|
static int |
FILTER_ASSIGNEE_UNASSIGNED
Only unassigned tasks current user can claim (member of the group)
|
static int |
FILTER_DUE_7DAYS
Only tasks which are due in the next 7 days.
|
static int |
FILTER_DUE_NODATE
Only tasks with no due date.
|
static int |
FILTER_DUE_OVERDUE
Only tasks which are overdue.
|
static int |
FILTER_DUE_TODAY
Only tasks which are due today.
|
static int |
FILTER_DUE_TOMORROW
Only tasks which are due tomorrow.
|
static int |
FILTER_INITIATOR_ANY
tasks assigned to anybody.
|
static int |
FILTER_INITIATOR_ME
Only tasks explicitly assign to the current user.
|
static String |
FILTER_KEY_ASSIGNEE
Filter based on the assignee of the task.
|
static String |
FILTER_KEY_DUE
Filter based on due date of the task.
|
static String |
FILTER_KEY_INITIATOR |
static String |
FILTER_KEY_PRIORITY
Filter based on priority of the task.
|
static String |
FILTER_KEY_STATUS
Filter based on status of the task.
|
static int |
FILTER_NO_ASSIGNEE
tasks not assigned to the current user
|
static int |
FILTER_PRIORITY_HIGH
Only tasks with a high priority.
|
static int |
FILTER_PRIORITY_LOW
Only tasks with a low priority.
|
static int |
FILTER_PRIORITY_MEDIUM
Only tasks with a medium priority.
|
static int |
FILTER_STATUS_ACTIVE
Only active (not completed) tasks are returned.
|
static int |
FILTER_STATUS_ANY
All tasks are returned.
|
static int |
FILTER_STATUS_COMPLETE
Only completed tasks are returned.
|
Modifier and Type | Method and Description |
---|---|
void |
addDocuments(Task task,
List<Document> items)
Add a list of items to the the specified task.
|
Task |
claimTask(Task task)
Claiming a task is done by one of the candidates of a task, task owner or
process-initiator
|
Task |
completeTask(Task task,
Map<String,Serializable> variables)
Completing a task.
|
void |
deleteProcess(Process process)
Deletes a process.
|
List<Document> |
getDocuments(Process process)
Returns a list items associated to the process.
|
PagingResult<Document> |
getDocuments(Process process,
ListingContext listingContext) |
List<Document> |
getDocuments(Task task)
Returns a list items associated to the the task.
|
PagingResult<Document> |
getDocuments(Task task,
ListingContext listingContext) |
Process |
getProcess(String processId)
Retrieves a single process.
|
ProcessDefinition |
getProcessDefinition(String processDefinitionIdentifier)
Returns a single process definition.
|
ProcessDefinition |
getProcessDefinitionByKey(String processDefinitionKey)
Returns a single process definition that matches the (versionless)
specific key.
|
List<ProcessDefinition> |
getProcessDefinitions() |
PagingResult<ProcessDefinition> |
getProcessDefinitions(ListingContext listingContext) |
ContentStream |
getProcessDiagram(Process process)
This process diagram shows a user the context of the task that is being
performed.
|
ContentStream |
getProcessDiagram(String processId)
This process diagram shows a user the context of the task that is being
performed.
|
List<Process> |
getProcesses()
Returns a list of processes in progress for the current user.
Each process is an execution of a process definition. |
PagingResult<Process> |
getProcesses(ListingContext listingContext)
Returns a list of process.
|
Task |
getTask(String taskIdentifier)
Retrieves a single task by its id.
|
List<Task> |
getTasks()
Returns a list of task in progress for the current user.
|
PagingResult<Task> |
getTasks(ListingContext listingContext)
Returns a list of tasks that the authenticated user is allowed to see.
This method support the use of ListingFilter
inside the ListingContext parameter to get task that meet certain
criteria like FILTER_KEY_ASSIGNEE , FILTER_KEY_STATUS ,
FILTER_KEY_PRIORITY , FILTER_KEY_DUE . |
List<Task> |
getTasks(Process process)
Get all the tasks in progress for the specified process.
|
PagingResult<Task> |
getTasks(Process process,
ListingContext listingContext)
Get the tasks for the specified process.
|
Map<String,Property> |
getVariables(Process process)
Retrieves the variables for a given process.
|
Map<String,Property> |
getVariables(Task task)
Retrieves the variables for a given task.
|
Task |
reassignTask(Task task,
Person assignee)
Reassign the task from the owner to an assignee
|
Process |
refresh(Process process)
Returns the latest (and complete) variables for the provided process.
|
Task |
refresh(Task task)
Returns the latest (and complete) variables for the provided task.
|
void |
removeDocuments(Task task,
List<Document> items)
Delete a list of items to the the task.
|
Process |
startProcess(ProcessDefinition processDefinition,
List<Person> assignees,
Map<String,Serializable> variables,
List<Document> items)
Start a new process based on the specified process definition with an
optional set of variables and document attachments(items).
Variables keys must respect the same format as defined by the workflowModel inside the repository. |
Task |
unclaimTask(Task task)
This removes the assignee of the task i.e the current user.
|
Process |
updateVariables(Process process,
Map<String,Serializable> variables)
Update the variables for a given process.
|
Task |
updateVariables(Task task,
Map<String,Serializable> variables)
Update the variables for a given process.
|
static final String FILTER_KEY_STATUS
FILTER_STATUS_ANY
, FILTER_STATUS_ACTIVE
,
FILTER_STATUS_COMPLETE
#getTasks(ListingContext)}
,
Constant Field Valuesstatic final int FILTER_STATUS_ANY
static final int FILTER_STATUS_ACTIVE
static final int FILTER_STATUS_COMPLETE
static final String FILTER_KEY_DUE
FILTER_DUE_TODAY
, FILTER_DUE_TOMORROW
,
FILTER_DUE_7DAYS
, FILTER_DUE_OVERDUE
,
FILTER_DUE_NODATE
#getTasks(ListingContext)}
,
Constant Field Valuesstatic final int FILTER_DUE_TODAY
static final int FILTER_DUE_TOMORROW
static final int FILTER_DUE_7DAYS
static final int FILTER_DUE_OVERDUE
static final int FILTER_DUE_NODATE
static final String FILTER_KEY_PRIORITY
FILTER_PRIORITY_HIGH
,
FILTER_PRIORITY_MEDIUM
, FILTER_PRIORITY_LOW
#getTasks(ListingContext)}
,
Constant Field Valuesstatic final int FILTER_PRIORITY_LOW
static final int FILTER_PRIORITY_MEDIUM
static final int FILTER_PRIORITY_HIGH
static final String FILTER_KEY_ASSIGNEE
FILTER_ASSIGNEE_ME
,
FILTER_ASSIGNEE_UNASSIGNED
or the string value representing the
unique identifier of a person.#getTasks(ListingContext)}
,
Constant Field Valuesstatic final int FILTER_ASSIGNEE_ME
static final int FILTER_ASSIGNEE_UNASSIGNED
static final int FILTER_ASSIGNEE_ALL
static final int FILTER_NO_ASSIGNEE
static final String FILTER_KEY_INITIATOR
static final int FILTER_INITIATOR_ME
static final int FILTER_INITIATOR_ANY
List<ProcessDefinition> getProcessDefinitions()
PagingResult<ProcessDefinition> getProcessDefinitions(ListingContext listingContext)
listingContext
- : Listing context that define the behavior of
paging results
ListingContext
ProcessDefinition getProcessDefinition(String processDefinitionIdentifier)
processDefinitionIdentifier
- : unique identifierProcessDefinition getProcessDefinitionByKey(String processDefinitionKey)
processDefinitionKey
- : unique keyList<Process> getProcesses()
PagingResult<Process> getProcesses(ListingContext listingContext)
listingContext
- : Listing context that define the behavior of
paging results
ListingContext
Process startProcess(ProcessDefinition processDefinition, List<Person> assignees, Map<String,Serializable> variables, List<Document> items)
A collection of default Alfresco variables are available inside the
WorkflowModel
Starting an Adhoc Process
// Process Definition Listing
List<ProcessDefinition> definitions = workflowService.getProcessDefinitions();
// Retrieve adhoc processDefinition
ProcessDefinition def = null;
for (ProcessDefinition processDefinition : definitions)
{
if (WorkflowModel.KEY_ADHOC_ACTIVITI.equals(processDefinition.getKey()))
{
def = processDefinition;
break;
}
}
// Start Process : Prepare Variables
Map<String, Serializable> variables = new HashMap<String, Serializable>();
// ASSIGNEE
Person user = alfsession.getServiceRegistry().getPersonService().getPerson(alfsession.getPersonIdentifier());
List<Person> users = new ArrayList<Person>();
users.add(user);
// DUE DATE
GregorianCalendar calendar = new GregorianCalendar();
calendar.set(Calendar.YEAR, 2000);
variables.put(WorkflowModel.PROP_WORKFLOW_DUE_DATE, DateUtils.format(calendar));
// PRIORITY
variables.put(WorkflowModel.PROP_WORKFLOW_PRIORITY, priority);
// DESCRIPTION
variables.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, description);
// START THE PROCESS
return workflowService.startProcess(def, users, variables, null);
processDefinition
- (mandatory) : Represents the process definition
to execute.assignees
- (optional) : List of person to assign. In case of
"group based process", leave this parameter as null and add
inside the variables map the correct key/value like
bpm__groupAssignee. Warning : Majority of default alfresco
workflow/process require an assignee.variables
- (optional) : Map of process variables to add at the
start.items
- (optional) : List of document object.void deleteProcess(Process process)
process
- : process object to deleteProcess getProcess(String processId)
processId
- : unique identifier of the processAlfrescoServiceException
- : if network or internal problems occur
during the process.List<Task> getTasks(Process process)
process
- AlfrescoServiceException
- : if network or internal problems occur
during the process.PagingResult<Task> getTasks(Process process, ListingContext listingContext)
ListingFilter
inside the ListingContext parameter to get task that meet certain
criteria like FILTER_KEY_STATUS
.process
- : process specifiedlistingContext
- : defines the behavior of paging results
ListingContext
AlfrescoServiceException
- : if network or internal problems occur
during the process.Process refresh(Process process)
process
- : process to refreshAlfrescoServiceException
- : if network or internal problems occur
during the process.Map<String,Property> getVariables(Process process)
process
- List<Document> getDocuments(Process process)
process
- AlfrescoServiceException
- : if network or internal problems occur
during the process.PagingResult<Document> getDocuments(Process process, ListingContext listingContext)
process
- listingContext
- : defines the behavior of paging results
ListingContext
AlfrescoServiceException
- : if network or internal problems occur
during the process.List<Document> getDocuments(Task task)
task
- AlfrescoServiceException
- : if network or internal problems occur
during the process.PagingResult<Document> getDocuments(Task task, ListingContext listingContext)
task
- listingContext
- : defines the behavior of paging results
ListingContext
AlfrescoServiceException
- : if network or internal problems occur
during the process.void addDocuments(Task task, List<Document> items)
process
- items
- AlfrescoServiceException
- : if network or internal problems occur
during the process.void removeDocuments(Task task, List<Document> items)
process
- items
- AlfrescoServiceException
- : if network or internal problems occur
during the process.List<Task> getTasks()
AlfrescoServiceException
- : if network or internal problems occur
during the process.PagingResult<Task> getTasks(ListingContext listingContext)
ListingFilter
inside the ListingContext parameter to get task that meet certain
criteria like FILTER_KEY_ASSIGNEE
, FILTER_KEY_STATUS
,
FILTER_KEY_PRIORITY
, FILTER_KEY_DUE
. It's possible to
add more than one filter. In this case filters value are joined with an
AND operator.
// We wants tasks which are unassigned AND active
ListingFilter lf = new ListingFilter();
lf.addFilter(WorkflowService.FILTER_STATUS, WorkflowService.FILTER_STATUS_ACTIVE);
lf.addFilter(WorkflowService.FILTER_ASSIGNEE, WorkflowService.FILTER_ASSIGNEE_UNASSIGNED);
ListingContext lc = new ListingContext();
lc.setFilter(lf);
PagingResult<Task> pagingTasks = workflowService.getTasks(lc);
listingContext
- : defines the behavior of paging results
ListingContext
AlfrescoServiceException
- : if network or internal problems occur
during the process.Task getTask(String taskIdentifier)
taskIdentifier
- : unique identifier of the taskAlfrescoServiceException
- : if network or internal problems occur
during the process.Task claimTask(Task task)
task
- : Task object to claimAlfrescoServiceException
- : if network or internal problems occur
during the process.Task unclaimTask(Task task)
task
- : Task object to unclaimAlfrescoServiceException
- : if network or internal problems occur
during the process.Task completeTask(Task task, Map<String,Serializable> variables)
task
- : Task object to completeAlfrescoServiceException
- : if network or internal problems occur
during the process.Task reassignTask(Task task, Person assignee)
task
- : Task object to reassignassignee
- : New assignee username/identifier of the taskAlfrescoServiceException
- : if network or internal problems occur
during the process.Task updateVariables(Task task, Map<String,Serializable> variables)
task
- : tak to updatevariables
- : map of variables to updateAlfrescoServiceException
- : if network or internal problems occur
during the process.Process updateVariables(Process process, Map<String,Serializable> variables)
process
- : process to updatevariables
- : map of variables to updateAlfrescoServiceException
- : if network or internal problems occur
during the process.Task refresh(Task task)
task
- : task to refreshAlfrescoServiceException
- : if network or internal problems occur
during the process.Map<String,Property> getVariables(Task task)
task
- : task to refreshContentStream getProcessDiagram(Process process)
process
- : process objectAlfrescoServiceException
- : if network or internal problems occur
during the process.UnsupportedOperationException
- : if the workflow engine is jBPMContentStream getProcessDiagram(String processId)
processId
- : process unique identifierUnsupportedOperationException
- : if the workflow engine is jBPMCopyright © 2012-2018 Alfresco Software. All Rights Reserved.