Interface ProcessInstanceService
- All Known Implementing Classes:
ProcessInstanceServiceImpl
public interface ProcessInstanceService
- Since:
- 6.0
- Author:
- Elias Ricken de Medeiros, Yanyan Liu, Baptiste Mesta, Matthieu Chaffotte, Celine Souchet
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateProcessInstance(SProcessInstance processInstance) Create process instance in DB according to the given process instance objectvoiddeleteArchivedProcessInstance(SAProcessInstance archivedProcessInstance) Delete specified archived process instanceintdeleteArchivedProcessInstances(List<Long> sourceProcessInstanceIds) delete archived process instances using a list of root source process instance ids If the given id is not a root process instance (but a called process) it will not be deleted along with its elements.voiddeleteFlowNodeInstance(SFlowNodeInstance flowNodeInstance, SProcessDefinition processDefinition) longdeleteParentProcessInstanceAndElements(List<SProcessInstance> sProcessInstances) Delete the specified process instances with id, and their elements archived and not, if are not a subProcessvoiddeleteParentProcessInstanceAndElements(SProcessInstance processInstance) Delete the specified process instance, and its elements archived and not, if are not a subProcessvoiddeleteProcessInstance(long processInstanceId) Delete the id specified process instancevoiddeleteProcessInstance(SProcessInstance processInstance) Delete the specified process instancegetArchivedChildrenSourceObjectIdsFromRootProcessInstance(long rootProcessIntanceId, int fromIndex, int maxResults, OrderByType sortingOrder) Get the list of sourceObjectIds for archived process instances children of process instance identified by rootProcessIntanceIdgetArchivedProcessInstance(long archivedProcessInstanceId) Get the latest archived process instance object for the specific process instancegetArchivedProcessInstancesInAllStates(List<Long> processInstanceIds) Get the archived process instances corresponding to the identifiersgetChildInstanceIdsOfProcessInstance(long processInstanceId, int fromIndex, int maxResults, String sortingField, OrderByType sortingOrder) Get child instance identifiers for specific process instance, this can be used for paginationgetChildOfActivity(long activityInstId) Get child process instance for the specific call activity or subprocess activitygetLastArchivedProcessInstance(long sourceObjectProcessInstanceId) getLastArchivedProcessInstanceStartDates(long sinceDateInMillis) Get the list of all archived process instance start dates since the given datelonggetNumberOfArchivedProcessInstances(QueryOptions queryOptions) Get total number of archived process instances according to specific criterialonggetNumberOfArchivedProcessInstancesInvolvingUser(long userId, QueryOptions countOptions) Get total number of archived process instance involving the specific userlonggetNumberOfArchivedProcessInstancesSupervisedBy(long userId, QueryOptions countOptions) Get total number of archived process instance for the specific supervisorlongGet total number of archived process instance according to the search criterialonggetNumberOfChildInstancesOfProcessInstance(long processInstanceId) Get total number of child instance for specific process instancelonggetNumberOfFailedProcessInstances(QueryOptions queryOptions) Get the number of theSProcessInstancewith at least one failed task or theProcessInstanceState.ERRORstate.longgetNumberOfFailedProcessInstancesSupervisedBy(long userId, QueryOptions queryOptions) Get total number ofSProcessInstancewith at least one failed task or theProcessInstanceState.ERRORstate for the specific supervisorlonggetNumberOfOpenProcessInstancesInvolvingUser(long userId, QueryOptions queryOptions) Get total number of open process instance involving the specific userlonggetNumberOfOpenProcessInstancesInvolvingUsersManagedBy(long managerUserId, QueryOptions queryOptions) Get total number of open process instance involving all users of the specific managerlonggetNumberOfOpenProcessInstancesSupervisedBy(long userId, QueryOptions queryOptions) Get total number of open process instances for the specific supervisorlonggetNumberOfProcessInstances(long processDefinitionId) longgetNumberOfProcessInstances(QueryOptions queryOptions) Get total number of process instancesgetProcessInstance(long processInstanceId) Get process instance by its idgetProcessInstanceIdsToRecover(Duration considerElementsOlderThan, QueryOptions queryOptions) Retrieve ids of process instances nodes that needs to be recovered.getSourceProcessInstanceIdsOfArchProcessInstancesFromDefinition(long processDefinitionId, int fromIndex, int maxResults, OrderByType sortingOrder) searchArchivedProcessInstances(QueryOptions queryOptions) Search all archived process instance according to specific criteriasearchArchivedProcessInstancesInvolvingUser(long userId, QueryOptions queryOptions) Search all archived process instance involving the specific usersearchArchivedProcessInstancesSupervisedBy(long userId, QueryOptions queryOptions) Search all archived process instance for the specific supervisorsearchArchivedProcessInstancesWithoutSubProcess(QueryOptions queryOptions) Search all archived process instance according to the search criteriasearchFailedProcessInstances(QueryOptions queryOptions) List allSProcessInstancewith at least one failed task or theProcessInstanceState.ERRORstate.searchFailedProcessInstancesSupervisedBy(long userId, QueryOptions queryOptions) Search allSProcessInstancewith at least one failed task or theProcessInstanceState.ERRORstate for the specific supervisorsearchOpenProcessInstancesInvolvingUser(long userId, QueryOptions queryOptions) Search all open process instance involving the specific usersearchOpenProcessInstancesInvolvingUsersManagedBy(long managerUserId, QueryOptions queryOptions) Search all open process instance involving all users of the specific managersearchOpenProcessInstancesSupervisedBy(long userId, QueryOptions queryOptions) Search all open process instances for the specific supervisorsearchProcessInstances(QueryOptions queryOptions) Search all process instance according to specific criteriavoidsetInterruptingEventId(long parentProcessInstanceId, long eventInstanceId) Set which event interrupted the process instancevoidsetState(SProcessInstance processInstance, org.bonitasoft.engine.bpm.process.ProcessInstanceState state) Set state for the processInstancevoidsetStateCategory(SProcessInstance processInstance, SStateCategory stateCatetory) Set process state category for the given process instancevoidupdateProcess(SProcessInstance processInstance, EntityUpdateDescriptor descriptor) Update the specific process instance
-
Field Details
-
PROCESSINSTANCE
- See Also:
-
PROCESSINSTANCE_STATE
- See Also:
-
PROCESS_INSTANCE_CATEGORY_STATE
- See Also:
-
PROCESSINSTANCE_STATE_UPDATED
- See Also:
-
PROCESSINSTANCE_TOKEN_COUNT
- See Also:
-
EVENT_TRIGGER_INSTANCE
- See Also:
-
-
Method Details
-
createProcessInstance
void createProcessInstance(SProcessInstance processInstance) throws SProcessInstanceCreationException Create process instance in DB according to the given process instance object- Parameters:
processInstance- the processInstance- Throws:
SProcessInstanceCreationException
-
deleteProcessInstance
void deleteProcessInstance(long processInstanceId) throws SProcessInstanceNotFoundException, SProcessInstanceReadException, SFlowNodeReadException, SProcessInstanceModificationException, SProcessInstanceHierarchicalDeletionException Delete the id specified process instance- Parameters:
processInstanceId- identifier of process instance- Throws:
SProcessInstanceNotFoundExceptionSProcessInstanceReadExceptionSFlowNodeReadExceptionSProcessInstanceModificationExceptionSProcessInstanceHierarchicalDeletionException
-
deleteProcessInstance
void deleteProcessInstance(SProcessInstance processInstance) throws SFlowNodeReadException, SProcessInstanceModificationException, SProcessInstanceHierarchicalDeletionException Delete the specified process instance- Parameters:
processInstance- the process instance- Throws:
SFlowNodeReadExceptionSProcessInstanceModificationExceptionSProcessInstanceHierarchicalDeletionException- Since:
- 6.0
-
deleteParentProcessInstanceAndElements
long deleteParentProcessInstanceAndElements(List<SProcessInstance> sProcessInstances) throws SBonitaException Delete the specified process instances with id, and their elements archived and not, if are not a subProcess- Parameters:
sProcessInstances- list of process instances to deleted- Returns:
- Number of deleted process instances
- Throws:
SBonitaException- Since:
- 6.1
-
deleteParentProcessInstanceAndElements
void deleteParentProcessInstanceAndElements(SProcessInstance processInstance) throws SBonitaException Delete the specified process instance, and its elements archived and not, if are not a subProcess- Parameters:
processInstance- TheSProcessInstanceto delete- Throws:
SBonitaException- Since:
- 6.4.0
-
getProcessInstance
SProcessInstance getProcessInstance(long processInstanceId) throws SProcessInstanceNotFoundException, SProcessInstanceReadException Get process instance by its id- Parameters:
processInstanceId- identifier of process instance- Returns:
- the process instance object
- Throws:
SProcessInstanceNotFoundExceptionSProcessInstanceReadException
-
setState
void setState(SProcessInstance processInstance, org.bonitasoft.engine.bpm.process.ProcessInstanceState state) throws SProcessInstanceNotFoundException, SProcessInstanceModificationException Set state for the processInstance- Parameters:
processInstance- the process instance will be updatedstate- the state will be set to the process instance- Throws:
SProcessInstanceNotFoundExceptionSProcessInstanceModificationException
-
setStateCategory
void setStateCategory(SProcessInstance processInstance, SStateCategory stateCatetory) throws SProcessInstanceNotFoundException, SProcessInstanceModificationException Set process state category for the given process instance- Parameters:
processInstance- process instance to updatestateCatetory- new category state for the process instance- Throws:
SProcessInstanceNotFoundExceptionSProcessInstanceModificationException- Since:
- 6.0
-
setInterruptingEventId
void setInterruptingEventId(long parentProcessInstanceId, long eventInstanceId) throws SProcessInstanceNotFoundException, SProcessInstanceReadException, SProcessInstanceModificationException Set which event interrupted the process instance -
deleteArchivedProcessInstance
void deleteArchivedProcessInstance(SAProcessInstance archivedProcessInstance) throws SProcessInstanceModificationException, SFlowNodeReadException Delete specified archived process instance- Parameters:
archivedProcessInstance- the archived process instance- Throws:
SProcessInstanceModificationExceptionSFlowNodeReadException- Since:
- 6.0
-
deleteArchivedProcessInstances
delete archived process instances using a list of root source process instance ids If the given id is not a root process instance (but a called process) it will not be deleted along with its elements.- Parameters:
sourceProcessInstanceIds- list of root source process instance ids- Returns:
- the number of archived elements deleted (might be greater than the number of ids given)
- Throws:
SBonitaException
-
getChildInstanceIdsOfProcessInstance
List<Long> getChildInstanceIdsOfProcessInstance(long processInstanceId, int fromIndex, int maxResults, String sortingField, OrderByType sortingOrder) throws SProcessInstanceReadException Get child instance identifiers for specific process instance, this can be used for pagination- Parameters:
processInstanceId- identifier of process instancefromIndex- Index of the record to be retrieved from. First record has index 0maxResults- Number of result we want to get. Maximum number of result returnedsortingField- the field used to do ordersortingOrder- ASC or DESC- Returns:
- a list of identifiers
- Throws:
SProcessInstanceReadException
-
getChildOfActivity
SProcessInstance getChildOfActivity(long activityInstId) throws SProcessInstanceNotFoundException, SBonitaReadException Get child process instance for the specific call activity or subprocess activity- Parameters:
activityInstId- identifier of call activity or subprocess activity- Returns:
- an SProcessInstance object
- Throws:
SProcessInstanceNotFoundExceptionSBonitaReadException
-
getNumberOfChildInstancesOfProcessInstance
long getNumberOfChildInstancesOfProcessInstance(long processInstanceId) throws SProcessInstanceReadException Get total number of child instance for specific process instance- Parameters:
processInstanceId- identifier of process instance- Returns:
- number of child instance for the process instance
- Throws:
SProcessInstanceReadException
-
getArchivedProcessInstancesInAllStates
List<SAProcessInstance> getArchivedProcessInstancesInAllStates(List<Long> processInstanceIds) throws SProcessInstanceReadException Get the archived process instances corresponding to the identifiers- Parameters:
archivedProcessInstanceIds- Identifier of theSAProcessInstances- Returns:
- The list of
SAProcessInstance - Throws:
SProcessInstanceReadException- Since:
- 6.4.0
-
getNumberOfArchivedProcessInstances
Get total number of archived process instances according to specific criteria- Parameters:
queryOptions- the search criteria containing a map of specific parameters of a query- Returns:
- number of archived process instances
- Throws:
SBonitaReadException
-
searchArchivedProcessInstances
List<SAProcessInstance> searchArchivedProcessInstances(QueryOptions queryOptions) throws SBonitaReadException Search all archived process instance according to specific criteria- Parameters:
queryOptions- the search criteria containing a map of specific parameters of a query- Returns:
- A list of all archived process instance according to specific criteria
- Throws:
SBonitaReadException
-
getArchivedProcessInstance
SAProcessInstance getArchivedProcessInstance(long archivedProcessInstanceId) throws SProcessInstanceReadException Get the latest archived process instance object for the specific process instance- Parameters:
archivedProcessInstanceId- identifier of the archived process instance (not the process instance)persistenceService-- Returns:
- an SAProcessInstance object
- Throws:
SProcessInstanceReadException
-
getNumberOfProcessInstances
Get total number of process instances- Parameters:
queryOptions- a map of specific parameters of a query- Returns:
- total number of process instances
- Throws:
SBonitaReadException
-
searchProcessInstances
List<SProcessInstance> searchProcessInstances(QueryOptions queryOptions) throws SBonitaReadException Search all process instance according to specific criteria- Parameters:
queryOptions- a map of specific parameters of a query- Returns:
- a list of SProcessInstance objects
- Throws:
SBonitaReadException
-
getNumberOfOpenProcessInstancesSupervisedBy
long getNumberOfOpenProcessInstancesSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException Get total number of open process instances for the specific supervisor- Parameters:
userId- identifier of supervisor userqueryOptions- a map of specific parameters of a query- Returns:
- number of open process instance for the specific supervisor
- Throws:
SBonitaReadException
-
getNumberOfFailedProcessInstancesSupervisedBy
long getNumberOfFailedProcessInstancesSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException Get total number ofSProcessInstancewith at least one failed task or theProcessInstanceState.ERRORstate for the specific supervisor- Parameters:
userId- identifier of supervisor userqueryOptions- a map of specific parameters of a query- Returns:
- The number of the
SProcessInstancewith at least one failed task or theProcessInstanceState.ERRORstate for the specific supervisor - Throws:
SBonitaReadException- Since:
- 7.0
-
searchFailedProcessInstancesSupervisedBy
List<SProcessInstance> searchFailedProcessInstancesSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException Search allSProcessInstancewith at least one failed task or theProcessInstanceState.ERRORstate for the specific supervisor- Parameters:
userId- identifier of supervisor userqueryOptions- a map of specific parameters of a query- Returns:
- The list of
SProcessInstancewith at least one failed task or theProcessInstanceState.ERRORstate for the specific supervisor - Throws:
SBonitaReadException- Since:
- 7.0
-
searchOpenProcessInstancesSupervisedBy
List<SProcessInstance> searchOpenProcessInstancesSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException Search all open process instances for the specific supervisor- Parameters:
userId- identifier of supervisor userqueryOptions- a map of specific parameters of a query- Returns:
- a list of SProcessInstance objects
- Throws:
SBonitaReadException
-
getNumberOfOpenProcessInstancesInvolvingUser
long getNumberOfOpenProcessInstancesInvolvingUser(long userId, QueryOptions queryOptions) throws SBonitaReadException Get total number of open process instance involving the specific user- Parameters:
userId- identifier of user who can perform or be assigned to tasks in process instance.queryOptions- a map of specific parameters of a query- Returns:
- number of open process instance for the specific user
- Throws:
SBonitaReadException
-
searchOpenProcessInstancesInvolvingUser
List<SProcessInstance> searchOpenProcessInstancesInvolvingUser(long userId, QueryOptions queryOptions) throws SBonitaReadException Search all open process instance involving the specific user- Parameters:
userId- identifier of user who can perform or be assigned to tasks in process instance.queryOptions-- Returns:
- a list of SProcessInstance objects
- Throws:
SBonitaReadException
-
getNumberOfOpenProcessInstancesInvolvingUsersManagedBy
long getNumberOfOpenProcessInstancesInvolvingUsersManagedBy(long managerUserId, QueryOptions queryOptions) throws SBonitaReadException Get total number of open process instance involving all users of the specific manager- Parameters:
managerUserId-queryOptions-- Returns:
- Throws:
SBonitaReadException
-
searchOpenProcessInstancesInvolvingUsersManagedBy
List<SProcessInstance> searchOpenProcessInstancesInvolvingUsersManagedBy(long managerUserId, QueryOptions queryOptions) throws SBonitaReadException Search all open process instance involving all users of the specific manager- Parameters:
managerUserId-queryOptions-- Returns:
- Throws:
SBonitaReadException
-
getLastArchivedProcessInstanceStartDates
List<Long> getLastArchivedProcessInstanceStartDates(long sinceDateInMillis) throws SProcessInstanceReadException Get the list of all archived process instance start dates since the given date- Parameters:
sinceDateInMillis- the date since when we want to get the list of start dates (in milliseconds)- Returns:
- the list of all archived process instance start dates, expressed in millis since EPOCH.
- Throws:
SProcessInstanceReadException- if an exception occurs while reading the process instances
-
getArchivedChildrenSourceObjectIdsFromRootProcessInstance
List<Long> getArchivedChildrenSourceObjectIdsFromRootProcessInstance(long rootProcessIntanceId, int fromIndex, int maxResults, OrderByType sortingOrder) throws SBonitaReadException Get the list of sourceObjectIds for archived process instances children of process instance identified by rootProcessIntanceId- Parameters:
rootProcessIntanceId- the root process instance idfromIndex- index of first result to be retriedmaxResults- max number of results to be retrievedsortingOrder- the searching order (ASC or DESC)- Returns:
- the list of sourceObjectIds for archived process instances children of process instance identified by rootProcessIntanceId
- Throws:
SBonitaReadException- Since:
- 6.0
-
getNumberOfArchivedProcessInstancesWithoutSubProcess
long getNumberOfArchivedProcessInstancesWithoutSubProcess(QueryOptions queryOptions) throws SBonitaReadException Get total number of archived process instance according to the search criteria- Parameters:
queryOptions- the search criteria containing a map of specific parameters of a query- Returns:
- number of archived process instance satisfied to the search criteria
- Throws:
SBonitaReadException
-
searchArchivedProcessInstancesWithoutSubProcess
List<SAProcessInstance> searchArchivedProcessInstancesWithoutSubProcess(QueryOptions queryOptions) throws SBonitaReadException Search all archived process instance according to the search criteria- Parameters:
queryOptions- the search criteria containing a map of specific parameters of a query- Returns:
- a list of SAProcessInstance objects
- Throws:
SBonitaReadException
-
getNumberOfArchivedProcessInstancesSupervisedBy
long getNumberOfArchivedProcessInstancesSupervisedBy(long userId, QueryOptions countOptions) throws SBonitaReadException Get total number of archived process instance for the specific supervisor- Parameters:
userId- identifier of user who is the supervisor of archived process instance.countOptions- the search criteria containing a map of specific parameters of a query- Returns:
- number of archived process instance for the specific supervisor
- Throws:
SBonitaReadException
-
searchArchivedProcessInstancesSupervisedBy
List<SAProcessInstance> searchArchivedProcessInstancesSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException Search all archived process instance for the specific supervisor- Parameters:
userId- identifier of user who is the supervisor of archived process instance.queryOptions- the search criteria containing a map of specific parameters of a query- Returns:
- a list of SAProcessInstance objects
- Throws:
SBonitaReadException
-
getNumberOfArchivedProcessInstancesInvolvingUser
long getNumberOfArchivedProcessInstancesInvolvingUser(long userId, QueryOptions countOptions) throws SBonitaReadException Get total number of archived process instance involving the specific user- Parameters:
userId- the identifier of user who is assignee of tasks of process instancecountOptions- the search criteria containing a map of specific parameters of a query- Returns:
- number of archived process instance involving the specific user
- Throws:
SBonitaReadException
-
searchArchivedProcessInstancesInvolvingUser
List<SAProcessInstance> searchArchivedProcessInstancesInvolvingUser(long userId, QueryOptions queryOptions) throws SBonitaReadException Search all archived process instance involving the specific user- Parameters:
userId- the identifier of user who is assignee of tasks of process instancequeryOptions- the search criteria containing a map of specific parameters of a query- Returns:
- a list of SAProcessInstance objects
- Throws:
SBonitaReadException
-
updateProcess
void updateProcess(SProcessInstance processInstance, EntityUpdateDescriptor descriptor) throws SProcessInstanceModificationException Update the specific process instance- Parameters:
processInstance- the processInstance will be updateddescriptor- update description- Throws:
SProcessInstanceModificationException
-
deleteFlowNodeInstance
void deleteFlowNodeInstance(SFlowNodeInstance flowNodeInstance, SProcessDefinition processDefinition) throws SFlowNodeReadException, SProcessInstanceModificationException - Parameters:
flowNodeInstance-processDefinition-- Throws:
SFlowNodeReadExceptionSProcessInstanceModificationException
-
getSourceProcessInstanceIdsOfArchProcessInstancesFromDefinition
List<Long> getSourceProcessInstanceIdsOfArchProcessInstancesFromDefinition(long processDefinitionId, int fromIndex, int maxResults, OrderByType sortingOrder) throws SProcessInstanceReadException - Parameters:
processDefinitionId-fromIndex-maxResults-sortingOrder-- Returns:
- Throws:
SProcessInstanceReadException
-
getLastArchivedProcessInstance
SAProcessInstance getLastArchivedProcessInstance(long sourceObjectProcessInstanceId) throws SBonitaReadException - Parameters:
sourceObjectProcessInstanceId- The source identifier of the process instance- Returns:
- The last archived process instance
- Throws:
SBonitaReadException- Since:
- 6.3
-
getNumberOfFailedProcessInstances
Get the number of theSProcessInstancewith at least one failed task or theProcessInstanceState.ERRORstate.- Parameters:
queryOptions- the search criteria containing a map of specific parameters of a query- Returns:
- The number of the
SProcessInstancewith at least one failed task or theProcessInstanceState.ERRORstate. - Throws:
SBonitaExceptionSBonitaReadException- Since:
- 6.4.0
-
searchFailedProcessInstances
List<SProcessInstance> searchFailedProcessInstances(QueryOptions queryOptions) throws SBonitaReadException List allSProcessInstancewith at least one failed task or theProcessInstanceState.ERRORstate.- Parameters:
queryOptions- the search criteria containing a map of specific parameters of a query- Returns:
- The list of
SProcessInstancewith at least one failed task or theProcessInstanceState.ERRORstate. - Throws:
SBonitaExceptionSBonitaReadException- Since:
- 6.4.0
-
getNumberOfProcessInstances
- Throws:
SBonitaReadException
-
getProcessInstanceIdsToRecover
List<Long> getProcessInstanceIdsToRecover(Duration considerElementsOlderThan, QueryOptions queryOptions) throws SBonitaReadException Retrieve ids of process instances nodes that needs to be recovered. This is used by recover mechanism ProcessInstanceRecoveryService- Parameters:
considerElementsOlderThan- consider elements older than that durationqueryOptions- used for pagination- Throws:
SBonitaReadException
-