public class TaskServiceImpl extends DefaultComponent implements TaskService
Modifier and Type | Class and Description |
---|---|
class |
TaskServiceImpl.GetTaskRootParentPathUnrestricted |
TaskService.VariableName
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_TASK_PROVIDER |
static ComponentName |
NAME |
lastModified
TASK_INSTANCE_EVENT_PROPERTIES_KEY
Constructor and Description |
---|
TaskServiceImpl() |
Modifier and Type | Method and Description |
---|---|
String |
acceptTask(CoreSession coreSession,
NuxeoPrincipal principal,
Task task,
String comment)
Ends the task using event name
TaskEventNames.WORKFLOW_TASK_COMPLETED and marking the task as validated. |
void |
activate(ComponentContext context)
Activates the component.
|
boolean |
canEndTask(NuxeoPrincipal principal,
Task task)
Returns true if user is an administrator, the initiator of the task, or an actor of the task.
|
List<Task> |
createTask(CoreSession coreSession,
NuxeoPrincipal principal,
DocumentModel document,
String taskName,
List<String> actorIds,
boolean createOneTaskPerActor,
String directive,
String comment,
Date dueDate,
Map<String,String> taskVariables,
String parentPath)
Creates a task and starts it.
|
List<Task> |
createTask(CoreSession coreSession,
NuxeoPrincipal principal,
DocumentModel document,
String taskName,
String taskType,
String processId,
List<String> prefixedActorIds,
boolean createOneTaskPerActor,
String directive,
String comment,
Date dueDate,
Map<String,String> taskVariables,
String parentPath)
Creates a task and starts it.
|
List<Task> |
createTask(CoreSession coreSession,
NuxeoPrincipal principal,
DocumentModel document,
String taskDocumentType,
String taskName,
String taskType,
String processId,
List<String> actorIds,
boolean createOneTaskPerActor,
String directive,
String comment,
Date dueDate,
Map<String,String> taskVariables,
String parentPath,
Map<String,Serializable> eventInfo)
Creates a task of the given document type and starts it.
|
List<Task> |
createTask(CoreSession coreSession,
NuxeoPrincipal principal,
List<DocumentModel> documents,
String taskDocumentType,
String taskName,
String taskType,
String processId,
List<String> actorIds,
boolean createOneTaskPerActor,
String directive,
String comment,
Date dueDate,
Map<String,String> taskVariables,
String parentPath,
Map<String,Serializable> eventInfo)
Deprecated.
since 7.4 use
createTaskWithProcessName instead |
List<Task> |
createTaskForProcess(CoreSession coreSession,
NuxeoPrincipal principal,
List<DocumentModel> documents,
String taskDocumentType,
String taskName,
String taskType,
String processId,
String processName,
List<String> actorIds,
boolean createOneTaskPerActor,
String directive,
String comment,
Date dueDate,
Map<String,String> taskVariables,
String parentPath,
Map<String,Serializable> eventInfo)
Creates a task of the given documents type and starts it.
|
void |
deactivate(ComponentContext context)
Deactivates the component.
|
void |
delegateTask(CoreSession session,
String taskId,
List<String> delegatedActors,
String comment)
Delegates the given task to the list of actors.
|
void |
deleteTask(CoreSession coreSession,
String taskId)
Remove the documentTask identified by the given taskId if coreSession's principal has the Remove permission.
|
String |
endTask(CoreSession coreSession,
NuxeoPrincipal principal,
Task task,
String comment,
String eventName,
boolean isValidated)
Use the task provider held by the
Task.TASK_PROVIDER_KEY task variable to end the task . |
List<Task> |
getAllCurrentTaskInstances(CoreSession coreSession,
List<SortInfo> sortInfos)
Returns the list of task instances associated assigned to the current user.
|
List<Task> |
getAllTaskInstances(String processId,
CoreSession session)
Returns all the tasks instances for the given
processId . |
List<Task> |
getAllTaskInstances(String processId,
List<String> actors,
CoreSession session)
Returns all the tasks instances for the given
processId which assigned to one of the actor in the list or
its pool. |
List<Task> |
getAllTaskInstances(String processId,
NuxeoPrincipal user,
CoreSession session)
Returns all the tasks instances for the given
processId and where the user is the actor or belongs to the
pooled actor list. |
List<Task> |
getAllTaskInstances(String processId,
String nodeId,
CoreSession session)
Returns all the tasks instances for the given
processId originating from the given nodeId . |
List<Task> |
getCurrentTaskInstances(CoreSession coreSession) |
List<Task> |
getCurrentTaskInstances(CoreSession coreSession,
List<SortInfo> sortInfos)
Provide @param sortInfo to handle sort page-provider contributions (see
getCurrentTaskInstances(org.nuxeo.ecm.core.api.CoreSession) ) |
List<Task> |
getCurrentTaskInstances(List<String> actors,
CoreSession coreSession)
Returns a list of task instances assigned to one of the actors in the list or to its pool.
|
List<Task> |
getCurrentTaskInstances(List<String> actors,
CoreSession coreSession,
List<SortInfo> sortInfos)
Provide @param sortInfo to handle sort page-provider contributions (see
getCurrentTaskInstances(org.nuxeo.ecm.core.api.CoreSession) ) |
DocumentModel |
getTargetDocumentModel(Task task,
CoreSession coreSession) |
Task |
getTask(CoreSession coreSession,
String taskId) |
List<Task> |
getTaskInstances(DocumentModel dm,
List<String> actors,
boolean includeDelegatedTasks,
CoreSession session)
Returns the list of task instances associated with this document assigned to one of the actor in the list or its
pool.
|
List<Task> |
getTaskInstances(DocumentModel dm,
List<String> actors,
CoreSession coreSession)
Returns the list of task instances associated with this document assigned to one of the actor in the list or its
pool.
|
List<Task> |
getTaskInstances(DocumentModel dm,
NuxeoPrincipal user,
CoreSession coreSession)
Returns the list of task instances associated with this document for which the user is the actor or belongs to
the pooled actor list.
|
String |
getTaskRootParentPath(CoreSession coreSession)
Default value is /task-root
|
protected boolean |
isTaskAssignedToUser(Task task,
NuxeoPrincipal user,
boolean checkDelegatedActors) |
protected void |
notifyEvent(CoreSession session,
Task task,
List<DocumentModel> docs,
String event,
Map<String,Serializable> eventInfo,
String comment,
NuxeoPrincipal principal,
List<String> actorIds) |
void |
reassignTask(CoreSession session,
String taskId,
List<String> newActors,
String comment)
Reassign the given task to the list of actors.
|
void |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
String |
rejectTask(CoreSession coreSession,
NuxeoPrincipal principal,
Task task,
String comment)
Ends the task using event name
TaskEventNames.WORKFLOW_TASK_REJECTED and marking the task as not
validated. |
void |
unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
protected List<Task> |
wrapDocModelInTask(DocumentModelList taskDocuments)
Deprecated.
since 5.6
|
applicationStarted, getAdapter, getApplicationStartedOrder, getLastModified, registerExtension, setLastModified, setModifiedNow, unregisterExtension
public static final ComponentName NAME
public static final String DEFAULT_TASK_PROVIDER
public TaskServiceImpl()
public void activate(ComponentContext context)
Component
This method is called by the runtime when a component is activated.
activate
in interface Component
activate
in class DefaultComponent
context
- the runtime contextpublic void deactivate(ComponentContext context)
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution
in class DefaultComponent
public List<Task> createTask(CoreSession coreSession, NuxeoPrincipal principal, DocumentModel document, String taskName, List<String> actorIds, boolean createOneTaskPerActor, String directive, String comment, Date dueDate, Map<String,String> taskVariables, String parentPath)
TaskService
TaskEventNames.WORKFLOW_TASK_ASSIGNED
and
TaskEventNames.WORKFLOW_TASK_ASSIGNED
, passing the task in the event properties using key
TaskService.TASK_INSTANCE_EVENT_PROPERTIES_KEY
createTask
in interface TaskService
coreSession
- the session to use when notifyingprincipal
- the principal marked as initiator of the task and used when notifying.document
- the document to attach to the task.taskName
- the task name.actorIds
- the list of actor ids, prefixed with 'user:' or 'group:'.createOneTaskPerActor
- if true, one task will be created per actor, else a single task will be assigned to
all actors.directive
- the directive, put in the task variables.comment
- string added to the task comments and used as a notification commentdueDate
- the due date, set on the task instancetaskVariables
- additional task variablesparentPath
- /task-root if nullpublic List<Task> createTask(CoreSession coreSession, NuxeoPrincipal principal, DocumentModel document, String taskDocumentType, String taskName, String taskType, String processId, List<String> actorIds, boolean createOneTaskPerActor, String directive, String comment, Date dueDate, Map<String,String> taskVariables, String parentPath, Map<String,Serializable> eventInfo)
TaskService
TaskEventNames.WORKFLOW_TASK_ASSIGNED
and TaskEventNames.WORKFLOW_TASK_ASSIGNED
, passing the task
in the event properties using key TaskService.TASK_INSTANCE_EVENT_PROPERTIES_KEY
Also the map eventInfo is passed in
the event propertiescreateTask
in interface TaskService
coreSession
- the session to use when notifyingprincipal
- the principal marked as initiator of the task and used when notifying.document
- the document to attach to the task.taskName
- the task name.taskType
- the task type.processId
- the process ID linked to this task if any.actorIds
- the list of actor ids, prefixed with 'user:' or 'group:'.createOneTaskPerActor
- if true, one task will be created per actor, else a single task will be assigned to
all actors.directive
- the directive, put in the task variables.comment
- string added to the task comments and used as a notification commentdueDate
- the due date, set on the task instancetaskVariables
- additional task variablesparentPath
- /task-root if nullpublic List<Task> createTask(CoreSession coreSession, NuxeoPrincipal principal, DocumentModel document, String taskName, String taskType, String processId, List<String> prefixedActorIds, boolean createOneTaskPerActor, String directive, String comment, Date dueDate, Map<String,String> taskVariables, String parentPath)
TaskService
TaskEventNames.WORKFLOW_TASK_ASSIGNED
and
TaskEventNames.WORKFLOW_TASK_ASSIGNED
, passing the task in the event properties using key
TaskService.TASK_INSTANCE_EVENT_PROPERTIES_KEY
createTask
in interface TaskService
coreSession
- the session to use when notifyingprincipal
- the principal marked as initiator of the task and used when notifying.document
- the document to attach to the task.taskName
- the task name.taskType
- the task type.processId
- the process ID linked to this task if any.prefixedActorIds
- the list of actor ids, prefixed with 'user:' or 'group:'.createOneTaskPerActor
- if true, one task will be created per actor, else a single task will be assigned to
all actors.directive
- the directive, put in the task variables.comment
- string added to the task comments and used as a notification commentdueDate
- the due date, set on the task instancetaskVariables
- additional task variablesparentPath
- /task-root if nullpublic String acceptTask(CoreSession coreSession, NuxeoPrincipal principal, Task task, String comment)
TaskService
TaskEventNames.WORKFLOW_TASK_COMPLETED
and marking the task as validated.acceptTask
in interface TaskService
TaskService.endTask(CoreSession, NuxeoPrincipal, Task, String, String, boolean)
public String rejectTask(CoreSession coreSession, NuxeoPrincipal principal, Task task, String comment)
TaskService
TaskEventNames.WORKFLOW_TASK_REJECTED
and marking the task as not
validated.rejectTask
in interface TaskService
TaskService.endTask(CoreSession, NuxeoPrincipal, Task, String, String, boolean)
public String endTask(CoreSession coreSession, NuxeoPrincipal principal, Task task, String comment, String eventName, boolean isValidated)
Task.TASK_PROVIDER_KEY
task variable to end the task
. If null
use the DEFAULT_TASK_PROVIDER
.endTask
in interface TaskProvider
endTask
in interface TaskService
coreSession
- the session to use when notifying and resolving of referenced document for notification.principal
- principal used when notifyingtask
- the instance to endcomment
- string added to the task comments and used as a notification commenteventName
- the core event name to use when notifyingisValidated
- boolean marker to state if the task was validated or rejectedpublic boolean canEndTask(NuxeoPrincipal principal, Task task)
TaskService
canEndTask
in interface TaskService
protected boolean isTaskAssignedToUser(Task task, NuxeoPrincipal user, boolean checkDelegatedActors)
public Task getTask(CoreSession coreSession, String taskId)
getTask
in interface TaskService
public void deleteTask(CoreSession coreSession, String taskId)
TaskService
deleteTask
in interface TaskService
public DocumentModel getTargetDocumentModel(Task task, CoreSession coreSession)
getTargetDocumentModel
in interface TaskService
task
- the task.public List<Task> getCurrentTaskInstances(CoreSession coreSession)
getCurrentTaskInstances
in interface TaskProvider
public List<Task> getCurrentTaskInstances(CoreSession coreSession, List<SortInfo> sortInfos)
getCurrentTaskInstances(org.nuxeo.ecm.core.api.CoreSession)
)getCurrentTaskInstances
in interface TaskProvider
public List<Task> getAllCurrentTaskInstances(CoreSession coreSession, List<SortInfo> sortInfos)
TaskProvider
getAllCurrentTaskInstances
in interface TaskProvider
public List<Task> getCurrentTaskInstances(List<String> actors, CoreSession coreSession)
getCurrentTaskInstances
in interface TaskProvider
actors
- a list used as actorId to retrieve the tasks.public List<Task> getCurrentTaskInstances(List<String> actors, CoreSession coreSession, List<SortInfo> sortInfos)
getCurrentTaskInstances(org.nuxeo.ecm.core.api.CoreSession)
)getCurrentTaskInstances
in interface TaskProvider
public List<Task> getTaskInstances(DocumentModel dm, NuxeoPrincipal user, CoreSession coreSession)
TaskProvider
If the user is null, then it returns all task instances for the document. The query is done in unrestricted mode and so the documents linked to the tasks are detached.
getTaskInstances
in interface TaskProvider
dm
- the document.public List<Task> getTaskInstances(DocumentModel dm, List<String> actors, CoreSession coreSession)
TaskProvider
getTaskInstances
in interface TaskProvider
public List<Task> getAllTaskInstances(String processId, CoreSession session)
TaskProvider
processId
.
The query is done in unrestricted mode and so the documents linked to the tasks are detached.
getAllTaskInstances
in interface TaskProvider
public List<Task> getAllTaskInstances(String processId, NuxeoPrincipal user, CoreSession session)
TaskProvider
processId
and where the user is the actor or belongs to the
pooled actor list. Doesn't take into account tasks that were delegated to this user.
The query is done in unrestricted mode and so the documents linked to the tasks are detached.
getAllTaskInstances
in interface TaskProvider
public List<Task> getAllTaskInstances(String processId, List<String> actors, CoreSession session)
TaskProvider
processId
which assigned to one of the actor in the list or
its pool. Doesn't take into account tasks that were delegated to these users.
The query is done in unrestricted mode and so the documents linked to the tasks are detached.
getAllTaskInstances
in interface TaskProvider
@Deprecated protected List<Task> wrapDocModelInTask(DocumentModelList taskDocuments)
public String getTaskRootParentPath(CoreSession coreSession)
TaskService
getTaskRootParentPath
in interface TaskService
public List<Task> getAllTaskInstances(String processId, String nodeId, CoreSession session)
TaskProvider
processId
originating from the given nodeId
.
The query is done in unrestricted mode and so the documents linked to the tasks are detached.
getAllTaskInstances
in interface TaskProvider
public void reassignTask(CoreSession session, String taskId, List<String> newActors, String comment)
TaskService
reassignTask
in interface TaskService
public void delegateTask(CoreSession session, String taskId, List<String> delegatedActors, String comment)
TaskService
delegateTask
in interface TaskService
protected void notifyEvent(CoreSession session, Task task, List<DocumentModel> docs, String event, Map<String,Serializable> eventInfo, String comment, NuxeoPrincipal principal, List<String> actorIds)
public List<Task> getTaskInstances(DocumentModel dm, List<String> actors, boolean includeDelegatedTasks, CoreSession session)
TaskProvider
includeDelegatedTasks
is true, takes into account tasks that were delegated to
these users. The query is done in unrestricted mode and so the documents linked to the tasks are detached.getTaskInstances
in interface TaskProvider
@Deprecated public List<Task> createTask(CoreSession coreSession, NuxeoPrincipal principal, List<DocumentModel> documents, String taskDocumentType, String taskName, String taskType, String processId, List<String> actorIds, boolean createOneTaskPerActor, String directive, String comment, Date dueDate, Map<String,String> taskVariables, String parentPath, Map<String,Serializable> eventInfo)
createTaskWithProcessName
insteadTaskService
TaskEventNames.WORKFLOW_TASK_ASSIGNED
and TaskEventNames.WORKFLOW_TASK_ASSIGNED
, passing the task
in the event properties using key TaskService.TASK_INSTANCE_EVENT_PROPERTIES_KEY
Also the map eventInfo is passed in
the event propertiescreateTask
in interface TaskService
coreSession
- the session to use when notifyingprincipal
- the principal marked as initiator of the task and used when notifying.documents
- the documents to attach to the task.taskName
- the task name.taskType
- the task type.processId
- the process ID linked to this task if any.actorIds
- the list of actor ids, prefixed with 'user:' or 'group:'.createOneTaskPerActor
- if true, one task will be created per actor, else a single task will be assigned to
all actors.directive
- the directive, put in the task variables.comment
- string added to the task comments and used as a notification commentdueDate
- the due date, set on the task instancetaskVariables
- additional task variablesparentPath
- /task-root if nullpublic List<Task> createTaskForProcess(CoreSession coreSession, NuxeoPrincipal principal, List<DocumentModel> documents, String taskDocumentType, String taskName, String taskType, String processId, String processName, List<String> actorIds, boolean createOneTaskPerActor, String directive, String comment, Date dueDate, Map<String,String> taskVariables, String parentPath, Map<String,Serializable> eventInfo)
TaskService
TaskEventNames.WORKFLOW_TASK_ASSIGNED
and TaskEventNames.WORKFLOW_TASK_ASSIGNED
, passing the task
in the event properties using key TaskService.TASK_INSTANCE_EVENT_PROPERTIES_KEY
Also the map eventInfo is passed in
the event properties. The process name can also be specified if any.createTaskForProcess
in interface TaskService
coreSession
- the session to use when notifyingprincipal
- the principal marked as initiator of the task and used when notifying.documents
- the documents to attach to the task.taskName
- the task name.taskType
- the task type.processId
- the process ID linked to this task if any.processName
- the process Name linked to this task if any.createOneTaskPerActor
- if true, one task will be created per actor, else a single task will be assigned to
all actors.directive
- the directive, put in the task variables.comment
- string added to the task comments and used as a notification commentdueDate
- the due date, set on the task instancetaskVariables
- additional task variablesparentPath
- /task-root if nullCopyright © 2015 Nuxeo SA. All rights reserved.