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 |
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)
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> |
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
|
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) |
applicationStarted, getAdapter, getApplicationStartedOrder, getLastModified, registerExtension, setLastModified, unregisterExtension
public static final ComponentName NAME
public static final String DEFAULT_TASK_PROVIDER
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) throws ClientException
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 nullClientException
public 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) throws ClientException
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 nullClientException
public 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) throws ClientException
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 nullClientException
public String acceptTask(CoreSession coreSession, NuxeoPrincipal principal, Task task, String comment) throws ClientException
TaskService
TaskEventNames.WORKFLOW_TASK_COMPLETED
and marking the task as validated.acceptTask
in interface TaskService
ClientException
TaskService.endTask(CoreSession, NuxeoPrincipal, Task, String, String, boolean)
public String rejectTask(CoreSession coreSession, NuxeoPrincipal principal, Task task, String comment) throws ClientException
TaskService
TaskEventNames.WORKFLOW_TASK_REJECTED
and marking the task as not
validated.rejectTask
in interface TaskService
ClientException
TaskService.endTask(CoreSession, NuxeoPrincipal, Task, String, String, boolean)
public String endTask(CoreSession coreSession, NuxeoPrincipal principal, Task task, String comment, String eventName, boolean isValidated) throws ClientException
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 rejectedClientException
- when trying to end a task without being granted the right to do so (see
TaskService.canEndTask(NuxeoPrincipal, Task)
), or when any other error occurspublic boolean canEndTask(NuxeoPrincipal principal, Task task) throws ClientException
TaskService
canEndTask
in interface TaskService
ClientException
public Task getTask(CoreSession coreSession, String taskId) throws ClientException
getTask
in interface TaskService
ClientException
public void deleteTask(CoreSession coreSession, String taskId) throws ClientException
TaskService
deleteTask
in interface TaskService
ClientException
public DocumentModel getTargetDocumentModel(Task task, CoreSession coreSession) throws ClientException
getTargetDocumentModel
in interface TaskService
task
- the task.ClientException
public List<Task> getCurrentTaskInstances(CoreSession coreSession) throws ClientException
getCurrentTaskInstances
in interface TaskProvider
ClientException
public List<Task> getCurrentTaskInstances(CoreSession coreSession, List<SortInfo> sortInfos) throws ClientException
getCurrentTaskInstances(org.nuxeo.ecm.core.api.CoreSession)
)getCurrentTaskInstances
in interface TaskProvider
ClientException
public List<Task> getCurrentTaskInstances(List<String> actors, CoreSession coreSession) throws ClientException
getCurrentTaskInstances
in interface TaskProvider
actors
- a list used as actorId to retrieve the tasks.ClientException
public List<Task> getCurrentTaskInstances(List<String> actors, CoreSession coreSession, List<SortInfo> sortInfos) throws ClientException
getCurrentTaskInstances(org.nuxeo.ecm.core.api.CoreSession)
)getCurrentTaskInstances
in interface TaskProvider
ClientException
public List<Task> getTaskInstances(DocumentModel dm, NuxeoPrincipal user, CoreSession coreSession) throws ClientException
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.ClientException
public List<Task> getTaskInstances(DocumentModel dm, List<String> actors, CoreSession coreSession) throws ClientException
TaskProvider
getTaskInstances
in interface TaskProvider
ClientException
public List<Task> getAllTaskInstances(String processId, CoreSession session) throws ClientException
TaskProvider
processId
.
The query is done in unrestricted mode and so the documents linked to the tasks are detached.
getAllTaskInstances
in interface TaskProvider
ClientException
public List<Task> getAllTaskInstances(String processId, NuxeoPrincipal user, CoreSession session) throws ClientException
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
ClientException
public List<Task> getAllTaskInstances(String processId, List<String> actors, CoreSession session) throws ClientException
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
ClientException
public String getTaskRootParentPath(CoreSession coreSession)
TaskService
getTaskRootParentPath
in interface TaskService
public List<Task> getAllTaskInstances(String processId, String nodeId, CoreSession session) throws ClientException
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
ClientException
public void reassignTask(CoreSession session, String taskId, List<String> newActors, String comment) throws ClientException
TaskService
reassignTask
in interface TaskService
ClientException
public void delegateTask(CoreSession session, String taskId, List<String> delegatedActors, String comment) throws ClientException
TaskService
delegateTask
in interface TaskService
ClientException
public List<Task> getTaskInstances(DocumentModel dm, List<String> actors, boolean includeDelegatedTasks, CoreSession session) throws ClientException
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
ClientException
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) throws ClientException
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.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 nullClientException
Copyright © 2015 Nuxeo SA. All rights reserved.