public class WorkflowServiceImpl extends Object implements WorkflowService
Constructor and Description |
---|
WorkflowServiceImpl() |
Modifier and Type | Method and Description |
---|---|
WorkflowInstance |
cancelWorkflow(String workflowId)
Cancel an "in-flight" Workflow instance
|
List<WorkflowInstance> |
cancelWorkflows(List<String> workflowIds)
Cancel a batch of "in-flight" Workflow instances
|
long |
countTasks(WorkflowTaskQuery workflowTaskQuery)
Get the number of tasks matching the given query
|
long |
countWorkflows(WorkflowInstanceQuery workflowInstanceQuery)
Get count of workflow instances
|
org.alfresco.service.cmr.repository.NodeRef |
createPackage(org.alfresco.service.cmr.repository.NodeRef container)
Create a Workflow Package (a container of content to route through the Workflow).
|
WorkflowInstance |
deleteWorkflow(String workflowId)
Delete a Workflow instance.
|
WorkflowDeployment |
deployDefinition(org.alfresco.service.cmr.repository.NodeRef definitionContent)
Deploy a Workflow Definition to the Alfresco Repository
Note: The specified content object must be of type bpm:workflowdefinition.
|
WorkflowDeployment |
deployDefinition(String engineId,
InputStream workflowDefinition,
String mimetype)
Deploy a Workflow Definition to the Alfresco Repository
|
WorkflowDeployment |
deployDefinition(String engineId,
InputStream workflowDefinition,
String mimetype,
String name)
Deploy a Workflow Definition to the Alfresco Repository
|
WorkflowTask |
endTask(String taskId,
String transition)
End the Task (i.e.
|
WorkflowPath |
fireEvent(String pathId,
String event)
Fire custom event against specified path
|
List<WorkflowInstance> |
getActiveWorkflows()
Gets all active workflow instances.
|
List<WorkflowInstance> |
getActiveWorkflows(String workflowDefinitionId)
Gets all active workflow instances of the specified Workflow Definition
|
List<WorkflowDefinition> |
getAllDefinitions()
Gets all deployed Workflow Definitions (with all previous versions)
|
List<WorkflowDefinition> |
getAllDefinitionsByName(String workflowName)
Gets all (including previous) Workflow Definitions for the given unique name
|
List<WorkflowTask> |
getAssignedTasks(String authority,
WorkflowTaskState state)
Gets all tasks assigned to the specified authority
|
List<WorkflowTask> |
getAssignedTasks(String authority,
WorkflowTaskState state,
boolean lazyInitialization)
Gets all tasks assigned to the specified authority
|
List<WorkflowInstance> |
getCompletedWorkflows()
Gets all completed workflow instances.
|
List<WorkflowInstance> |
getCompletedWorkflows(String workflowDefinitionId)
Gets all completed workflow instances of the specified Workflow Definition
|
WorkflowDefinition |
getDefinitionById(String workflowDefinitionId)
Gets a Workflow Definition by unique Id
|
WorkflowDefinition |
getDefinitionByName(String workflowName)
Gets the latest Workflow Definition by unique name
|
byte[] |
getDefinitionImage(String workflowDefinitionId)
Gets a graphical view of the Workflow Definition
|
List<WorkflowDefinition> |
getDefinitions()
Gets latest deployed Workflow Definitions
|
List<org.alfresco.service.cmr.repository.NodeRef> |
getPackageContents(org.alfresco.service.cmr.repository.NodeRef packageRef)
Get a list of node refs to all the package contents.
|
List<org.alfresco.service.cmr.repository.NodeRef> |
getPackageContents(String taskId)
Get a list of node refs to all the package contents for the given task id.
|
Map<org.alfresco.service.namespace.QName,Serializable> |
getPathProperties(String pathId)
Gets the properties associated with the specified path (and parent paths)
|
List<WorkflowTask> |
getPooledTasks(String authority)
Gets the pooled tasks available to the specified authority
|
List<WorkflowTask> |
getPooledTasks(String authority,
boolean lazyinitialization)
Gets the pooled tasks available to the specified authority
|
WorkflowTask |
getStartTask(String workflowInstanceId)
Gets the start task instance for the given workflow instance.
|
List<WorkflowTask> |
getStartTasks(List<String> workflowInstanceIds,
boolean sameSession)
Gets the start task instances for the given workflow instances.
|
WorkflowTask |
getTaskById(String taskId)
Gets a Task by unique Id
|
List<WorkflowTaskDefinition> |
getTaskDefinitions(String workflowDefinitionId)
Gets the Task Definitions for the given Workflow Definition
|
List<WorkflowTask> |
getTasksForWorkflowPath(String pathId)
Gets all Tasks associated with the specified path
|
List<WorkflowTimer> |
getTimers(String workflowId)
Gets all active timers for the specified workflow
|
WorkflowInstance |
getWorkflowById(String workflowId)
Gets a specific workflow instances
|
InputStream |
getWorkflowImage(String workflowInstanceId)
Gets a graphical view of the workflow instance
|
List<WorkflowPath> |
getWorkflowPaths(String workflowId)
Gets all Paths for the specified Workflow instance.
|
List<WorkflowInstance> |
getWorkflows()
Gets all workflow instances (both active and completed).
|
List<WorkflowInstance> |
getWorkflows(String workflowDefinitionId)
Gets all workflow instances (both active and completed) of the specified Workflow Definition
|
List<WorkflowInstance> |
getWorkflows(WorkflowInstanceQuery workflowInstanceQuery)
Gets all "in-flight" workflow instances according to the specified workflowInstanceQuery parameter
|
List<WorkflowInstance> |
getWorkflows(WorkflowInstanceQuery workflowInstanceQuery,
int maxItems,
int skipCount)
Gets maxItems "in-flight" workflow instances according to the specified workflowInstanceQuery parameter
Get maxItems and skipCount parameters form request
|
List<WorkflowInstance> |
getWorkflowsForContent(org.alfresco.service.cmr.repository.NodeRef packageItem,
boolean active)
Gets the Workflows that act upon the specified Repository content.
|
boolean |
hasWorkflowImage(String workflowInstanceId)
Determines if a graphical view of the workflow instance exists
|
boolean |
isDefinitionDeployed(org.alfresco.service.cmr.repository.NodeRef workflowDefinition)
Is the specified Workflow Definition already deployed?
Note: the notion of "already deployed" may differ between bpm engines.
|
boolean |
isDefinitionDeployed(String engineId,
InputStream workflowDefinition,
String mimetype)
Is the specified Workflow Definition already deployed?
Note: the notion of "already deployed" may differ between bpm engines.
|
boolean |
isMultiTenantWorkflowDeploymentEnabled() |
boolean |
isTaskClaimable(WorkflowTask task,
String username)
Determines if the given user can claim the given task
|
boolean |
isTaskClaimable(WorkflowTask task,
String username,
boolean refreshTask)
Determines if the given user can claim the given task
|
boolean |
isTaskEditable(WorkflowTask task,
String username)
Determines if the given user can edit the given task
|
boolean |
isTaskEditable(WorkflowTask task,
String username,
boolean refreshTask)
Determines if the given user can edit the given task
|
boolean |
isTaskReassignable(WorkflowTask task,
String username)
Determines if the given user can reassign the given task
|
boolean |
isTaskReassignable(WorkflowTask task,
String username,
boolean refreshTask)
Determines if the given user can reassign the given task
|
boolean |
isTaskReleasable(WorkflowTask task,
String username)
Determines if the given user can release the given task
|
boolean |
isTaskReleasable(WorkflowTask task,
String username,
boolean refreshTask)
Determines if the given user can release the given task
|
List<WorkflowTask> |
queryTasks(WorkflowTaskQuery query) |
List<WorkflowTask> |
queryTasks(WorkflowTaskQuery query,
boolean sameSession)
Query for tasks
|
void |
setAuthorityService(AuthorityService authorityService)
Sets the Authority Service
|
void |
setBPMEngineRegistry(BPMEngineRegistry registry)
Sets the BPM Engine Registry
|
void |
setContentService(ContentService contentService)
Sets the Content Service
|
void |
setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
Set the dictionary service
|
void |
setMaxAuthoritiesForPooledTasks(int maxAuthoritiesForPooledTasks)
Sets the maximum number of groups to check for pooled tasks.
|
void |
setMaxPooledTasks(int maxPooledTasks)
Sets the maximum number of pooled tasks to return in a query.
|
void |
setMultiTenantWorkflowDeploymentEnabled(boolean deployWorkflowsInTenant) |
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
Sets the Node Service
|
void |
setProtectedNodeService(org.alfresco.service.cmr.repository.NodeService protectedNodeService)
Set the node service which applies permissions
|
void |
setTransactionService(TransactionService transactionService) |
void |
setWorkflowAdminService(WorkflowAdminService workflowAdminService) |
void |
setWorkflowNotification(WorkflowNotificationUtils service)
Set the workflow notification utils
|
void |
setWorkflowPackageComponent(WorkflowPackageComponent workflowPackageComponent)
Sets the Workflow Package Component
|
WorkflowPath |
signal(String pathId,
String transition)
Signal the transition from one Workflow Node to another
|
WorkflowPath |
startWorkflow(String workflowDefinitionId,
Map<org.alfresco.service.namespace.QName,Serializable> parameters)
Start a Workflow Instance
|
WorkflowPath |
startWorkflowFromTemplate(org.alfresco.service.cmr.repository.NodeRef templateDefinition)
Start a Workflow Instance from an existing "Start Task" template node held in the
Repository.
|
void |
undeployDefinition(String workflowDefinitionId)
Undeploy an exisiting Workflow Definition
TODO: Determine behaviour when "in-flight" workflow instances exist
|
WorkflowTask |
updateTask(String taskId,
Map<org.alfresco.service.namespace.QName,Serializable> properties,
Map<org.alfresco.service.namespace.QName,List<org.alfresco.service.cmr.repository.NodeRef>> add,
Map<org.alfresco.service.namespace.QName,List<org.alfresco.service.cmr.repository.NodeRef>> remove)
Update the Properties and Associations of a Task
|
public void setTransactionService(TransactionService transactionService)
transactionService
- service that tells if the server is read-only or notpublic void setAuthorityService(AuthorityService authorityService)
authorityService
- AuthorityServicepublic void setBPMEngineRegistry(BPMEngineRegistry registry)
registry
- bpm engine registrypublic void setWorkflowAdminService(WorkflowAdminService workflowAdminService)
workflowAdminService
- the workflowAdminService to setpublic void setWorkflowPackageComponent(WorkflowPackageComponent workflowPackageComponent)
workflowPackageComponent
- workflow package componentpublic void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
nodeService
- NodeServicepublic void setContentService(ContentService contentService)
contentService
- ContentServicepublic void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
dictionaryService
- DictionaryServicepublic void setProtectedNodeService(org.alfresco.service.cmr.repository.NodeService protectedNodeService)
protectedNodeService
- NodeServicepublic void setWorkflowNotification(WorkflowNotificationUtils service)
service
- workflow notification utilspublic void setMaxAuthoritiesForPooledTasks(int maxAuthoritiesForPooledTasks)
maxAuthoritiesForPooledTasks
- the limit to set. If this is less than or equal to zero then there is no limit.public void setMaxPooledTasks(int maxPooledTasks)
maxPooledTasks
- the limit to set. If this is less than or equal to zero then there is no limit.public WorkflowDeployment deployDefinition(String engineId, InputStream workflowDefinition, String mimetype)
WorkflowService
deployDefinition
in interface WorkflowService
engineId
- the bpm engine idworkflowDefinition
- the workflow definitionmimetype
- the mimetype of the workflow definitionpublic WorkflowDeployment deployDefinition(String engineId, InputStream workflowDefinition, String mimetype, String name)
WorkflowService
deployDefinition
in interface WorkflowService
engineId
- the bpm engine idworkflowDefinition
- the workflow definitionmimetype
- the mimetype of the workflow definitionname
- a name representing the deploymentpublic boolean isDefinitionDeployed(org.alfresco.service.cmr.repository.NodeRef workflowDefinition)
WorkflowService
isDefinitionDeployed
in interface WorkflowService
workflowDefinition
- the content object containing the definitionpublic boolean isDefinitionDeployed(String engineId, InputStream workflowDefinition, String mimetype)
WorkflowService
isDefinitionDeployed
in interface WorkflowService
engineId
- the bpm engine idworkflowDefinition
- the definition to checkmimetype
- the mimetype of the definitionpublic WorkflowDeployment deployDefinition(org.alfresco.service.cmr.repository.NodeRef definitionContent)
WorkflowService
deployDefinition
in interface WorkflowService
definitionContent
- the content object containing the definitionpublic void undeployDefinition(String workflowDefinitionId)
WorkflowService
undeployDefinition
in interface WorkflowService
workflowDefinitionId
- the id of the definition to undeploypublic List<WorkflowDefinition> getDefinitions()
WorkflowService
getDefinitions
in interface WorkflowService
public List<WorkflowDefinition> getAllDefinitions()
WorkflowService
getAllDefinitions
in interface WorkflowService
public WorkflowDefinition getDefinitionById(String workflowDefinitionId)
WorkflowService
getDefinitionById
in interface WorkflowService
workflowDefinitionId
- the workflow definition idpublic WorkflowDefinition getDefinitionByName(String workflowName)
WorkflowService
getDefinitionByName
in interface WorkflowService
workflowName
- workflow name e.g. activiti$activitiReviewpublic List<WorkflowDefinition> getAllDefinitionsByName(String workflowName)
WorkflowService
getAllDefinitionsByName
in interface WorkflowService
workflowName
- workflow name e.g. activiti$activitiReviewpublic byte[] getDefinitionImage(String workflowDefinitionId)
WorkflowService
getDefinitionImage
in interface WorkflowService
workflowDefinitionId
- the workflow definition idpublic List<WorkflowTaskDefinition> getTaskDefinitions(String workflowDefinitionId)
WorkflowService
getTaskDefinitions
in interface WorkflowService
workflowDefinitionId
- the workflow definition idpublic WorkflowPath startWorkflow(String workflowDefinitionId, Map<org.alfresco.service.namespace.QName,Serializable> parameters)
WorkflowService
startWorkflow
in interface WorkflowService
workflowDefinitionId
- the workflow definition idparameters
- the initial set of parameters used to populate the "Start Task" propertiespublic WorkflowPath startWorkflowFromTemplate(org.alfresco.service.cmr.repository.NodeRef templateDefinition)
WorkflowService
startWorkflowFromTemplate
in interface WorkflowService
templateDefinition
- the node representing the Start Task propertiespublic List<WorkflowInstance> getActiveWorkflows(String workflowDefinitionId)
getActiveWorkflows
in interface WorkflowService
workflowDefinitionId
- the workflow definition idpublic List<WorkflowInstance> getCompletedWorkflows(String workflowDefinitionId)
getCompletedWorkflows
in interface WorkflowService
workflowDefinitionId
- the workflow definition idpublic List<WorkflowInstance> getWorkflows(String workflowDefinitionId)
getWorkflows
in interface WorkflowService
workflowDefinitionId
- the workflow definition idpublic List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery)
WorkflowService
getWorkflows
in interface WorkflowService
workflowInstanceQuery
- WorkflowInstanceQuerypublic List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery, int maxItems, int skipCount)
WorkflowService
getWorkflows
in interface WorkflowService
workflowInstanceQuery
- WorkflowInstanceQuerymaxItems
- intskipCount
- intpublic long countWorkflows(WorkflowInstanceQuery workflowInstanceQuery)
WorkflowService
countWorkflows
in interface WorkflowService
workflowInstanceQuery
- WorkflowInstanceQuerypublic long countTasks(WorkflowTaskQuery workflowTaskQuery)
WorkflowService
countTasks
in interface WorkflowService
workflowTaskQuery
- the filter by which tasks are queriedpublic List<WorkflowInstance> getActiveWorkflows()
getActiveWorkflows
in interface WorkflowService
public List<WorkflowInstance> getCompletedWorkflows()
getCompletedWorkflows
in interface WorkflowService
public List<WorkflowInstance> getWorkflows()
getWorkflows
in interface WorkflowService
public WorkflowInstance getWorkflowById(String workflowId)
getWorkflowById
in interface WorkflowService
workflowId
- the id of the workflow to retrievepublic List<WorkflowPath> getWorkflowPaths(String workflowId)
WorkflowService
getWorkflowPaths
in interface WorkflowService
workflowId
- workflow instance idpublic Map<org.alfresco.service.namespace.QName,Serializable> getPathProperties(String pathId)
WorkflowService
getPathProperties
in interface WorkflowService
pathId
- workflow path idpublic WorkflowInstance cancelWorkflow(String workflowId)
WorkflowService
cancelWorkflow
in interface WorkflowService
workflowId
- the workflow instance to cancelpublic List<WorkflowInstance> cancelWorkflows(List<String> workflowIds)
WorkflowService
cancelWorkflows
in interface WorkflowService
workflowIds
- List of the workflow instances to cancelpublic void setMultiTenantWorkflowDeploymentEnabled(boolean deployWorkflowsInTenant)
public boolean isMultiTenantWorkflowDeploymentEnabled()
isMultiTenantWorkflowDeploymentEnabled
in interface WorkflowService
public WorkflowInstance deleteWorkflow(String workflowId)
WorkflowService
deleteWorkflow
in interface WorkflowService
workflowId
- the workflow instance to cancelpublic WorkflowPath signal(String pathId, String transition)
WorkflowService
signal
in interface WorkflowService
pathId
- the workflow path to signal ontransition
- the transition id to follow (or null, for the default transition)public WorkflowPath fireEvent(String pathId, String event)
WorkflowService
fireEvent
in interface WorkflowService
pathId
- the workflow path to fire event onevent
- name of eventpublic List<WorkflowTimer> getTimers(String workflowId)
WorkflowService
getTimers
in interface WorkflowService
public List<WorkflowTask> getTasksForWorkflowPath(String pathId)
WorkflowService
getTasksForWorkflowPath
in interface WorkflowService
pathId
- the path idpublic WorkflowTask getStartTask(String workflowInstanceId)
getStartTask
in interface WorkflowService
workflowInstanceId
- Stringpublic List<WorkflowTask> getStartTasks(List<String> workflowInstanceIds, boolean sameSession)
WorkflowService
getStartTasks
in interface WorkflowService
sameSession
- indicates that the returned WorkflowTask
elements will be used in
the same session. If true
, the returned List will be a lazy loaded list
providing greater performance.public boolean hasWorkflowImage(String workflowInstanceId)
WorkflowService
hasWorkflowImage
in interface WorkflowService
workflowInstanceId
- the workflow instance idpublic InputStream getWorkflowImage(String workflowInstanceId)
WorkflowService
getWorkflowImage
in interface WorkflowService
workflowInstanceId
- the workflow instance idpublic List<WorkflowTask> getAssignedTasks(String authority, WorkflowTaskState state)
WorkflowService
getAssignedTasks
in interface WorkflowService
authority
- the authoritystate
- filter by specified workflow task statepublic List<WorkflowTask> getAssignedTasks(String authority, WorkflowTaskState state, boolean lazyInitialization)
WorkflowService
getAssignedTasks
in interface WorkflowService
authority
- the authoritystate
- filter by specified workflow task statelazyInitialization
- hint to the underlying workflow-engine to allow returning WorkflowTask
s which
aren't fully initialized but will be when the required values are required. If true
, the
returned enities should be used inside of the transaction-boundaries of this service-call.
If false
, fully initialized entities are returned, just as with WorkflowService.getAssignedTasks(String, WorkflowTaskState)
.
public List<WorkflowTask> getPooledTasks(String authority)
WorkflowService
getPooledTasks
in interface WorkflowService
authority
- the authoritypublic List<WorkflowTask> getPooledTasks(String authority, boolean lazyinitialization)
WorkflowService
getPooledTasks
in interface WorkflowService
authority
- the authoritylazyinitialization
- hint to the underlying workflow-engine to allow returning WorkflowTask
s which
aren't fully initialized but will be when the required values are required. If true
, the
returned enities should be used inside of the transaction-boundaries of this service-call.
If false
, fully initialized entities are returned, just as with WorkflowService.getPooledTasks(String)
.
public List<WorkflowTask> queryTasks(WorkflowTaskQuery query)
queryTasks
in interface WorkflowService
public List<WorkflowTask> queryTasks(WorkflowTaskQuery query, boolean sameSession)
WorkflowService
queryTasks
in interface WorkflowService
query
- the filter by which tasks are queriedsameSession
- indicates that the returned WorkflowTask
elements will be used in
the same session. If true
, the returned List will be a lazy loaded list
providing greater performance.public WorkflowTask updateTask(String taskId, Map<org.alfresco.service.namespace.QName,Serializable> properties, Map<org.alfresco.service.namespace.QName,List<org.alfresco.service.cmr.repository.NodeRef>> add, Map<org.alfresco.service.namespace.QName,List<org.alfresco.service.cmr.repository.NodeRef>> remove)
WorkflowService
updateTask
in interface WorkflowService
taskId
- the task id to updateproperties
- the map of properties to set on the task (or null, if none to set)add
- the map of items to associate with the task (or null, if none to add)remove
- the map of items to dis-associate with the task (or null, if none to remove)public WorkflowTask endTask(String taskId, String transition)
WorkflowService
endTask
in interface WorkflowService
taskId
- the task id to endtransition
- the task transition id to take on completion (or null, for the default transition)public boolean isTaskEditable(WorkflowTask task, String username)
WorkflowService
isTaskEditable
in interface WorkflowService
task
- The task to checkusername
- The user to checkpublic boolean isTaskEditable(WorkflowTask task, String username, boolean refreshTask)
WorkflowService
isTaskEditable
in interface WorkflowService
task
- The task to checkusername
- The user to checkrefreshTask
- Whether or not to refresh the WorkflowTask
before check is perfromedpublic boolean isTaskReassignable(WorkflowTask task, String username)
WorkflowService
isTaskReassignable
in interface WorkflowService
task
- The task to checkusername
- The user to checkpublic boolean isTaskReassignable(WorkflowTask task, String username, boolean refreshTask)
WorkflowService
isTaskReassignable
in interface WorkflowService
task
- The task to checkusername
- The user to checkrefreshTask
- Whether or not to refresh the WorkflowTask
before check is perfromedpublic boolean isTaskClaimable(WorkflowTask task, String username)
WorkflowService
isTaskClaimable
in interface WorkflowService
task
- The task to checkusername
- The user to checkpublic boolean isTaskClaimable(WorkflowTask task, String username, boolean refreshTask)
WorkflowService
isTaskClaimable
in interface WorkflowService
task
- The task to checkusername
- The user to checkrefreshTask
- Whether or not to refresh the WorkflowTask
before check is perfromedpublic boolean isTaskReleasable(WorkflowTask task, String username)
WorkflowService
isTaskReleasable
in interface WorkflowService
task
- The task to checkusername
- The user to checkpublic boolean isTaskReleasable(WorkflowTask task, String username, boolean refreshTask)
WorkflowService
isTaskReleasable
in interface WorkflowService
task
- The task to checkusername
- The user to checkrefreshTask
- Whether or not to refresh the WorkflowTask
before check is perfromedpublic WorkflowTask getTaskById(String taskId)
WorkflowService
getTaskById
in interface WorkflowService
taskId
- the task idpublic org.alfresco.service.cmr.repository.NodeRef createPackage(org.alfresco.service.cmr.repository.NodeRef container)
WorkflowService
createPackage
in interface WorkflowService
container
- (optional) a pre-created container (e.g. folder, versioned folder or layered folder)public List<WorkflowInstance> getWorkflowsForContent(org.alfresco.service.cmr.repository.NodeRef packageItem, boolean active)
WorkflowService
getWorkflowsForContent
in interface WorkflowService
packageItem
- the repository content item to get workflows foractive
- true => active workflows only, false => completed workflows onlypublic List<org.alfresco.service.cmr.repository.NodeRef> getPackageContents(String taskId)
WorkflowService
getPackageContents
in interface WorkflowService
taskId
- - the task idpublic List<org.alfresco.service.cmr.repository.NodeRef> getPackageContents(org.alfresco.service.cmr.repository.NodeRef packageRef)
WorkflowService
getPackageContents
in interface WorkflowService
packageRef
- the nodeRef to the packageCopyright © 2005–2017 Alfresco Software. All rights reserved.