Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.jbpm
Interface JbpmService

All Known Implementing Classes:
JbpmServiceImpl

public interface JbpmService

The entry point for the JbpmService.

The returned value are detached from their hibernate session.

The methods on document assume a single document attached to a process. The variables 'documentId' and 'documentRepositoryName' should exists. Security is only implemented in such a case.

Warning: The returned result of most of the methods are list issue from hibernate query. Also the object are fully loaded, their dependent objects might not have been fetch. If you need dependent object, use the executeJbpmOperation making sure those object are properly loaded inside the operation.

Author:
Alexandre Russel

Nested Class Summary
static class JbpmService.HibernateQueries
          Named hibernate queries.
static class JbpmService.TaskVariableName
          Task variable.
static class JbpmService.VariableName
          The variable used as process instance variables.
 
Field Summary
static String ACL_PREFIX
          Marker for acls managed by workflow.
 
Method Summary
 ProcessInstance createProcessInstance(NuxeoPrincipal user, String processInstanceName, DocumentModel dm, Map<String,Serializable> variables, Map<String,Serializable> transientVariables)
          Returns the created and started process instance.
 void deleteProcessInstance(NuxeoPrincipal principal, Long processId)
          Deletes the process instance and related tasks.
 void deleteTaskInstance(NuxeoPrincipal principal, Long taskId)
          Deletes a task instance (attached to a process or not)
 void endProcessInstance(Long processId)
          Terminates this process and all the tokens in it.
 void endTask(Long taskInstanceId, String transition, Map<String,Serializable> taskVariables, Map<String,Serializable> variables, Map<String,Serializable> transientVariables, NuxeoPrincipal principal)
          Ends the task following the transition.
 Serializable executeJbpmOperation(JbpmOperation operation)
          Executes a JbpmOperation.
 List<String> getAvailableTransitions(Long taskInstanceId, NuxeoPrincipal principal)
          Returns a list of of possible transition for this user.
 JbpmConfiguration getConfiguration()
          Return the configuration.
 List<ProcessInstance> getCurrentProcessInstances(List<String> actors, JbpmActorsListFilter filter)
          Returns a list of all current process instances that has been started by one of the actors in the list.
 List<ProcessInstance> getCurrentProcessInstances(NuxeoPrincipal principal, JbpmListFilter filter)
          Returns a list of all current process instances this user has started.
 List<TaskInstance> getCurrentTaskInstances(List<String> actors, JbpmActorsListFilter filter)
          Returns a list of task instances assigned to one of the actors in the list or to its pool.
 List<TaskInstance> getCurrentTaskInstances(NuxeoPrincipal currentUser, JbpmListFilter filter)
          Returns a list of task instances assigned to this user or one of its group.
 DocumentModel getDocumentModel(ProcessInstance pi, NuxeoPrincipal user)
          Returns the document used in this process.
 DocumentModel getDocumentModel(TaskInstance ti, NuxeoPrincipal user)
          Returns the document used in this task.
 Boolean getPermission(ProcessInstance pi, JbpmSecurityPolicy.Action action, DocumentModel dm, NuxeoPrincipal principal)
          Returns true if this user has this permission for this process instance and document.
 ProcessDefinition getProcessDefinitionByName(String name)
          Returns the latest process definition with this name.
 List<ProcessDefinition> getProcessDefinitions(NuxeoPrincipal user, DocumentModel dm, JbpmListFilter filter)
          Returns a list of available Process Definition Name available for this document and user.
 List<ProcessDefinition> getProcessDefinitionsByType(String type)
          Returns the latest process definitions attached to a type.
 ProcessInstance getProcessInstance(Long processInstanceId)
          Return the process instance.
 List<ProcessInstance> getProcessInstances(DocumentModel dm, NuxeoPrincipal user, JbpmListFilter jbpmListFilter)
          Returns the list of process instances associated with this document.
 List<TaskInstance> getTaskInstances(DocumentModel dm, List<String> actors, JbpmActorsListFilter jbpmActorsListFilter)
          Returns the list of task instances associated with this document assigned to one of the actor in the list or its pool.
 List<TaskInstance> getTaskInstances(DocumentModel dm, NuxeoPrincipal user, JbpmListFilter jbpmListFilter)
          Returns the list of task instances associated with this document for which the user is the actor or belongs to the pooled actor list.
 List<TaskInstance> getTaskInstances(Long processInstanceId, NuxeoPrincipal principal, JbpmListFilter filter)
          Returns a list of task instance for this process instance.
 Map<String,List<String>> getTypeFilterConfiguration()
          Returns a map, whose key is the type of document, and value is a list of process definitions.
 void notifyEventListeners(String name, String comment, String[] recipients, CoreSession session, NuxeoPrincipal principal, DocumentModel doc)
          Notify the event producer on the machine the jbpm service is.
 ProcessInstance persistProcessInstance(ProcessInstance pi)
          Persists a process instance.
 void saveTaskInstances(List<TaskInstance> taskInstances)
          Saves the task instances.
 

Field Detail

ACL_PREFIX

static final String ACL_PREFIX
Marker for acls managed by workflow.

See Also:
Constant Field Values
Method Detail

getConfiguration

JbpmConfiguration getConfiguration()
Return the configuration.


executeJbpmOperation

Serializable executeJbpmOperation(JbpmOperation operation)
                                  throws NuxeoJbpmException
Executes a JbpmOperation.

The JbpmOperation will be executed inside a context block.

Parameters:
operation -
Returns:
The object returned by the run method of the JbpmOperation.
Throws:
NuxeoJbpmException

getCurrentTaskInstances

List<TaskInstance> getCurrentTaskInstances(NuxeoPrincipal currentUser,
                                           JbpmListFilter filter)
                                           throws NuxeoJbpmException
Returns a list of task instances assigned to this user or one of its group.

Parameters:
currentUser - the user.
Returns:
A list of task instances.
Throws:
IllegalStateException - If the currentUser is null.
NuxeoJbpmException

getCurrentTaskInstances

List<TaskInstance> getCurrentTaskInstances(List<String> actors,
                                           JbpmActorsListFilter filter)
                                           throws NuxeoJbpmException
Returns a list of task instances assigned to one of the actors in the list or to its pool.

Parameters:
actors - a list used as actorId to retrieve the tasks.
filter -
Returns:
Throws:
NuxeoJbpmException

getTaskInstances

List<TaskInstance> getTaskInstances(Long processInstanceId,
                                    NuxeoPrincipal principal,
                                    JbpmListFilter filter)
                                    throws NuxeoJbpmException
Returns a list of task instance for this process instance. It returns all task instances, not only the tasks for this principal. The principal is used as an argument to the filter.

Parameters:
processInstanceId - the id of the process instance.
principal -
Returns:
Throws:
NuxeoJbpmException

endTask

void endTask(Long taskInstanceId,
             String transition,
             Map<String,Serializable> taskVariables,
             Map<String,Serializable> variables,
             Map<String,Serializable> transientVariables,
             NuxeoPrincipal principal)
             throws NuxeoJbpmException
Ends the task following the transition. If transition is null, follow the default transition.

Parameters:
taskInstanceId -
transition - the transition to follow
taskVariables - the variables attached to the task.
variables - A list a variables to add to the process instance.
transientVariables - the list of transient variables.
principal - the user ending the task. Might be different from task.getActorId()
Throws:
NuxeoJbpmSecurityRuntimeException - If a document is attached to the process and the transition is not allowed for user.
NuxeoJbpmException

getAvailableTransitions

List<String> getAvailableTransitions(Long taskInstanceId,
                                     NuxeoPrincipal principal)
                                     throws NuxeoJbpmException
Returns a list of of possible transition for this user. (If a document is attached to the process, then return only the allowed transition)

Parameters:
taskInstanceId - the id of the taskInstance.
principal - the user
Returns:
Throws:
NuxeoJbpmException

saveTaskInstances

void saveTaskInstances(List<TaskInstance> taskInstances)
                       throws NuxeoJbpmException
Saves the task instances.

Tasks are created or updated if they already exist.

Parameters:
taskInstances -
Throws:
NuxeoJbpmException

deleteProcessInstance

void deleteProcessInstance(NuxeoPrincipal principal,
                           Long processId)
                           throws NuxeoJbpmException
Deletes the process instance and related tasks.

If you don't want to delete the process, add a abandon state and suitable transitions.

Parameters:
principal - the canceller.
Throws:
NuxeoJbpmException

deleteTaskInstance

void deleteTaskInstance(NuxeoPrincipal principal,
                        Long taskId)
                        throws NuxeoJbpmException
Deletes a task instance (attached to a process or not)

Parameters:
principal - the canceller.
Throws:
NuxeoJbpmException

getCurrentProcessInstances

List<ProcessInstance> getCurrentProcessInstances(NuxeoPrincipal principal,
                                                 JbpmListFilter filter)
                                                 throws NuxeoJbpmException
Returns a list of all current process instances this user has started.

Parameters:
principal -
Returns:
A list of ProcessInstance
Throws:
IllegalStateException - If the principal is null.
NuxeoJbpmException

getCurrentProcessInstances

List<ProcessInstance> getCurrentProcessInstances(List<String> actors,
                                                 JbpmActorsListFilter filter)
                                                 throws NuxeoJbpmException
Returns a list of all current process instances that has been started by one of the actors in the list.

Parameters:
actors - A list of string that would be used as actorId to retrieve the process instances.
filter -
Returns:
Throws:
NuxeoJbpmException

getProcessInstance

ProcessInstance getProcessInstance(Long processInstanceId)
                                   throws NuxeoJbpmException
Return the process instance.

Parameters:
processInstanceId - the id of the process instance.
Returns:
Throws:
NuxeoJbpmException

createProcessInstance

ProcessInstance createProcessInstance(NuxeoPrincipal user,
                                      String processInstanceName,
                                      DocumentModel dm,
                                      Map<String,Serializable> variables,
                                      Map<String,Serializable> transientVariables)
                                      throws NuxeoJbpmException
Returns the created and started process instance.

Parameters:
processInstanceName - the name of the process
user - the initiator of the process.
dm - the document attached to this process.
variables - A list a variables to add to the process instance.
transientVariables - the list of transient variables.
Returns:
the created process instance.
Throws:
NuxeoJbpmException
NuxeoJbpmSecurityException - If the user is not allowed to create a process instance for this document.

getProcessDefinitions

List<ProcessDefinition> getProcessDefinitions(NuxeoPrincipal user,
                                              DocumentModel dm,
                                              JbpmListFilter filter)
                                              throws NuxeoJbpmException
Returns a list of available Process Definition Name available for this document and user. All process definition if dm is null. The returned process definition is always the latest.

Parameters:
user - the caller.
dm - the document concerned by the process
Returns:
A list of process definition
Throws:
NuxeoJbpmException

getProcessDefinitionsByType

List<ProcessDefinition> getProcessDefinitionsByType(String type)
                                                    throws NuxeoJbpmException
Returns the latest process definitions attached to a type.

Matching between type and process definition is done in the typeFilter extension point of the service.

Parameters:
type - the type.
Returns:
A list of process definition.
Throws:
NuxeoJbpmException

getProcessDefinitionByName

ProcessDefinition getProcessDefinitionByName(String name)
                                             throws NuxeoJbpmException
Returns the latest process definition with this name.

Parameters:
name - the Name.
Returns:
the process definition.
Throws:
NuxeoJbpmException

endProcessInstance

void endProcessInstance(Long processId)
                        throws NuxeoJbpmException
Terminates this process and all the tokens in it.

Parameters:
processId - the id of the process instance.
Throws:
NuxeoJbpmException

persistProcessInstance

ProcessInstance persistProcessInstance(ProcessInstance pi)
                                       throws NuxeoJbpmException
Persists a process instance.

Returns:
the updated instance.
Throws:
NuxeoJbpmException

getDocumentModel

DocumentModel getDocumentModel(TaskInstance ti,
                               NuxeoPrincipal user)
                               throws NuxeoJbpmException
Returns the document used in this task.

Parameters:
ti - the task.
user - the user.
Returns:
a list of DocumentModel.
Throws:
NuxeoJbpmException

getDocumentModel

DocumentModel getDocumentModel(ProcessInstance pi,
                               NuxeoPrincipal user)
                               throws NuxeoJbpmException
Returns the document used in this process.

Parameters:
pi - the process instance.
user - the user.
Returns:
a DocumentModel.
Throws:
NuxeoJbpmException

getTaskInstances

List<TaskInstance> getTaskInstances(DocumentModel dm,
                                    NuxeoPrincipal user,
                                    JbpmListFilter jbpmListFilter)
                                    throws NuxeoJbpmException
Returns the list of task instances associated with this document for which the user is the actor or belongs to the pooled actor list.

If the user is null, then it returns all task instances for the document.

Parameters:
dm - the document.
user -
Returns:
Throws:
NuxeoJbpmException

getTaskInstances

List<TaskInstance> getTaskInstances(DocumentModel dm,
                                    List<String> actors,
                                    JbpmActorsListFilter jbpmActorsListFilter)
                                    throws NuxeoJbpmException
Returns the list of task instances associated with this document assigned to one of the actor in the list or its pool.

Parameters:
dm -
actors -
jbpmActorsListFilter -
Returns:
Throws:
NuxeoJbpmException

getProcessInstances

List<ProcessInstance> getProcessInstances(DocumentModel dm,
                                          NuxeoPrincipal user,
                                          JbpmListFilter jbpmListFilter)
                                          throws NuxeoJbpmException
Returns the list of process instances associated with this document.

Parameters:
dm -
user -
Returns:
Throws:
NuxeoJbpmException

getTypeFilterConfiguration

Map<String,List<String>> getTypeFilterConfiguration()
Returns a map, whose key is the type of document, and value is a list of process definitions.

Returns:

getPermission

Boolean getPermission(ProcessInstance pi,
                      JbpmSecurityPolicy.Action action,
                      DocumentModel dm,
                      NuxeoPrincipal principal)
                      throws NuxeoJbpmException
Returns true if this user has this permission for this process instance and document.

Parameters:
pi -
action -
dm -
principal -
Returns:
Throws:
NuxeoJbpmException
See Also:
extention point

notifyEventListeners

void notifyEventListeners(String name,
                          String comment,
                          String[] recipients,
                          CoreSession session,
                          NuxeoPrincipal principal,
                          DocumentModel doc)
                          throws ClientException
Notify the event producer on the machine the jbpm service is.

Parameters:
name - the name of the event
comment - the comment
recipients - the recipients property of the event context
Throws:
ClientException

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.