Class WorkflowTaskFinder
Assigned tasks are asked of Activiti workflow by workflow: WorkflowTaskQuery accepts
both processId and actorId, so the returned tasks belong to the right workflow by
construction and nothing has to be filtered in memory. Scanning every task of the account and
reading task.getPath().getInstance().getId() on each would lazily load the path and the
workflow instance once per task, for a cost driven by the size of the user's task list rather
than by the one or two workflows actually asked about.
Pooled tasks cannot be expressed that way — WorkflowTaskQuery has no setting for
candidate groups — so they are scanned, but only as a fallback once the bounded query came back
empty.
- Version:
- $Id: $Id
- Author:
- matthieu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.alfresco.service.cmr.workflow.WorkflowService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanhasPooledTaskOn(String actorId, Collection<String> workflowIds, Predicate<org.alfresco.service.cmr.workflow.WorkflowTask> filter) The fallback: pooled tasks, for want of an API to query them by workflow.booleanhasTaskOn(String actorId, Collection<String> workflowIds, Predicate<org.alfresco.service.cmr.workflow.WorkflowTask> accept) Whether the user holds an in-progress task on one of these workflows.
-
Field Details
-
workflowService
@Autowired @Qualifier("WorkflowService") private org.alfresco.service.cmr.workflow.WorkflowService workflowService
-
-
Constructor Details
-
WorkflowTaskFinder
public WorkflowTaskFinder()
-
-
Method Details
-
hasTaskOn
public boolean hasTaskOn(String actorId, Collection<String> workflowIds, Predicate<org.alfresco.service.cmr.workflow.WorkflowTask> accept) Whether the user holds an in-progress task on one of these workflows.Assigned tasks are queried first; pooled tasks are only scanned when the query found nothing.
- Parameters:
actorId- the user, as Activiti knows itworkflowIds- the workflow instances carried by the contentaccept- an extra filter on the task, ornullto accept them all. It is only evaluated on the tasks already retained, so a costly predicate stays cheap.- Returns:
- true on the first matching task
-
hasPooledTaskOn
private boolean hasPooledTaskOn(String actorId, Collection<String> workflowIds, Predicate<org.alfresco.service.cmr.workflow.WorkflowTask> filter) The fallback: pooled tasks, for want of an API to query them by workflow.Filtering on the instance is still needed here, with its lazy loading, but it is only paid by the accounts holding no assigned task on these workflows.
- Parameters:
actorId- the userworkflowIds- the workflow instances looked forfilter- an extra filter, nevernull- Returns:
- true on the first matching task
-