public class ProcessInstanceServiceImpl extends java.lang.Object implements ProcessInstanceService
EVENT_TRIGGER_INSTANCE, PROCESS_INSTANCE_CATEGORY_STATE, PROCESSINSTANCE, PROCESSINSTANCE_STATE, PROCESSINSTANCE_STATE_UPDATED, PROCESSINSTANCE_TOKEN_COUNT| Constructor and Description |
|---|
ProcessInstanceServiceImpl(Recorder recorder,
ReadPersistenceService persistenceRead,
ActivityInstanceService activityService,
TechnicalLoggerService logger,
EventInstanceService bpmEventInstanceService,
DataInstanceService dataInstanceService,
ArchiveService archiveService,
ProcessDefinitionService processDefinitionService,
ConnectorInstanceService connectorInstanceService,
ClassLoaderService classLoaderService,
DocumentService documentService,
SCommentService commentService,
RefBusinessDataService refBusinessDataService,
ContractDataService contractDataService) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkIfCallerIsNotActive(long callerId) |
void |
createProcessInstance(SProcessInstance processInstance)
Create process instance in DB according to the given process instance object
|
void |
deleteArchivedProcessInstance(SAProcessInstance archivedProcessInstance)
Delete specified archived process instance
|
int |
deleteArchivedProcessInstances(java.util.List<java.lang.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.
|
protected void |
deleteConnectorInstancesIfNecessary(SFlowNodeInstance flowNodeInstance,
SProcessDefinition processDefinition) |
void |
deleteFlowNodeInstance(SFlowNodeInstance flowNodeInstance,
SProcessDefinition processDefinition) |
long |
deleteParentProcessInstanceAndElements(java.util.List<SProcessInstance> sProcessInstances)
Delete the specified process instances with id, and their elements archived and not, if are not a subProcess
|
void |
deleteParentProcessInstanceAndElements(SProcessInstance sProcessInstance)
Delete the specified process instance, and its elements archived and not, if are not a subProcess
|
void |
deleteProcessInstance(long processInstanceId)
Delete the id specified process instance
|
void |
deleteProcessInstance(SProcessInstance sProcessInstance)
Delete the specified process instance
|
protected void |
deleteProcessInstanceElements(SProcessInstance processInstance) |
java.util.List<java.lang.Long> |
getArchivedChildrenSourceObjectIdsFromRootProcessInstance(long rootProcessInstanceId,
int fromIndex,
int maxResults,
OrderByType sortingOrder)
Get the list of sourceObjectIds for archived process instances children of process instance identified by rootProcessIntanceId
|
SAProcessInstance |
getArchivedProcessInstance(long archivedProcessInstanceId)
Get the latest archived process instance object for the specific process instance
|
java.util.List<SAProcessInstance> |
getArchivedProcessInstancesInAllStates(java.util.List<java.lang.Long> processInstanceIds)
Get the archived process instances corresponding to the identifiers
|
java.util.List<java.lang.Long> |
getChildInstanceIdsOfProcessInstance(long processInstanceId,
int fromIndex,
int maxResults,
java.lang.String sortingField,
OrderByType sortingOrder)
Get child instance identifiers for specific process instance, this can be used for pagination
|
SProcessInstance |
getChildOfActivity(long activityInstId)
Get child process instance for the specific call activity or subprocess activity
|
SAProcessInstance |
getLastArchivedProcessInstance(long processInstanceId) |
long |
getNumberOfArchivedProcessInstances(QueryOptions queryOptions)
Get total number of archived process instances according to specific criteria
|
long |
getNumberOfArchivedProcessInstancesInvolvingUser(long userId,
QueryOptions countOptions)
Get total number of archived process instance involving the specific user
|
long |
getNumberOfArchivedProcessInstancesSupervisedBy(long userId,
QueryOptions countOptions)
Get total number of archived process instance for the specific supervisor
|
long |
getNumberOfArchivedProcessInstancesWithoutSubProcess(QueryOptions queryOptions)
Get total number of archived process instance according to the search criteria
|
long |
getNumberOfChildInstancesOfProcessInstance(long processInstanceId)
Get total number of child instance for specific process instance
|
long |
getNumberOfFailedProcessInstances(QueryOptions queryOptions)
Get the number of the
SProcessInstance with at least one failed task or the ProcessInstanceState.ERROR
state. |
long |
getNumberOfFailedProcessInstancesSupervisedBy(long userId,
QueryOptions queryOptions)
Get total number of
SProcessInstance with at least one failed task or the ProcessInstanceState.ERROR
state for the specific supervisor |
long |
getNumberOfOpenProcessInstancesInvolvingUser(long userId,
QueryOptions queryOptions)
Get total number of open process instance involving the specific user
|
long |
getNumberOfOpenProcessInstancesInvolvingUsersManagedBy(long managerUserId,
QueryOptions queryOptions)
Get total number of open process instance involving all users of the specific manager
|
long |
getNumberOfOpenProcessInstancesSupervisedBy(long userId,
QueryOptions queryOptions)
Get total number of open process instances for the specific supervisor
|
long |
getNumberOfProcessInstances(long processDefinitionId) |
long |
getNumberOfProcessInstances(QueryOptions queryOptions)
Get total number of process instances
|
protected java.lang.Iterable<java.util.List<java.lang.Long>> |
getPartitionFromLargeList(java.lang.Iterable<java.lang.Long> allSourceObjectIds) |
SProcessInstance |
getProcessInstance(long processInstanceId)
Get process instance by its id
|
java.util.List<SProcessInstance> |
getProcessInstancesInStates(QueryOptions queryOptions,
org.bonitasoft.engine.bpm.process.ProcessInstanceState... states)
Returns the list of
SProcessInstances in a given list of states. |
java.util.List<java.lang.Long> |
getSourceProcessInstanceIdsOfArchProcessInstancesFromDefinition(long processDefinitionId,
int fromIndex,
int maxResults,
OrderByType sortingOrder) |
protected java.util.Set<java.lang.Integer> |
getStateIdsFromStates(org.bonitasoft.engine.bpm.process.ProcessInstanceState... states) |
protected void |
logProcessInstanceNotFound(SProcessInstanceModificationException e) |
java.util.List<SAProcessInstance> |
searchArchivedProcessInstances(QueryOptions queryOptions)
Search all archived process instance according to specific criteria
|
java.util.List<SAProcessInstance> |
searchArchivedProcessInstancesInvolvingUser(long userId,
QueryOptions queryOptions)
Search all archived process instance involving the specific user
|
java.util.List<SAProcessInstance> |
searchArchivedProcessInstancesSupervisedBy(long userId,
QueryOptions queryOptions)
Search all archived process instance for the specific supervisor
|
java.util.List<SAProcessInstance> |
searchArchivedProcessInstancesWithoutSubProcess(QueryOptions queryOptions)
Search all archived process instance according to the search criteria
|
java.util.List<SProcessInstance> |
searchFailedProcessInstances(QueryOptions queryOptions)
List all
SProcessInstance with at least one failed task or the ProcessInstanceState.ERROR state. |
java.util.List<SProcessInstance> |
searchFailedProcessInstancesSupervisedBy(long userId,
QueryOptions queryOptions)
Search all
SProcessInstance with at least one failed task or the ProcessInstanceState.ERROR state
for the specific supervisor |
java.util.List<SProcessInstance> |
searchOpenProcessInstancesInvolvingUser(long userId,
QueryOptions queryOptions)
Search all open process instance involving the specific user
|
java.util.List<SProcessInstance> |
searchOpenProcessInstancesInvolvingUsersManagedBy(long managerUserId,
QueryOptions queryOptions)
Search all open process instance involving all users of the specific manager
|
java.util.List<SProcessInstance> |
searchOpenProcessInstancesSupervisedBy(long userId,
QueryOptions queryOptions)
Search all open process instances for the specific supervisor
|
java.util.List<SProcessInstance> |
searchProcessInstances(QueryOptions queryOptions)
Search all process instance according to specific criteria
|
void |
setState(SProcessInstance processInstance,
org.bonitasoft.engine.bpm.process.ProcessInstanceState state)
Set state for the processInstance
|
void |
setStateCategory(SProcessInstance processInstance,
SStateCategory stateCatetory)
Set process state category for the given process instance
|
void |
updateProcess(SProcessInstance processInstance,
EntityUpdateDescriptor descriptor)
Update the specific process instance
|
public ProcessInstanceServiceImpl(Recorder recorder, ReadPersistenceService persistenceRead, ActivityInstanceService activityService, TechnicalLoggerService logger, EventInstanceService bpmEventInstanceService, DataInstanceService dataInstanceService, ArchiveService archiveService, ProcessDefinitionService processDefinitionService, ConnectorInstanceService connectorInstanceService, ClassLoaderService classLoaderService, DocumentService documentService, SCommentService commentService, RefBusinessDataService refBusinessDataService, ContractDataService contractDataService)
public void createProcessInstance(SProcessInstance processInstance) throws SProcessInstanceCreationException
ProcessInstanceServicecreateProcessInstance in interface ProcessInstanceServiceprocessInstance - the processInstanceSProcessInstanceCreationExceptionpublic SProcessInstance getProcessInstance(long processInstanceId) throws SProcessInstanceReadException, SProcessInstanceNotFoundException
ProcessInstanceServicegetProcessInstance in interface ProcessInstanceServiceprocessInstanceId - identifier of process instanceSProcessInstanceReadExceptionSProcessInstanceNotFoundExceptionpublic void deleteProcessInstance(long processInstanceId)
throws SProcessInstanceModificationException,
SProcessInstanceReadException,
SProcessInstanceNotFoundException
ProcessInstanceServicedeleteProcessInstance in interface ProcessInstanceServiceprocessInstanceId - identifier of process instanceSProcessInstanceModificationExceptionSProcessInstanceReadExceptionSProcessInstanceNotFoundExceptionpublic long deleteParentProcessInstanceAndElements(java.util.List<SProcessInstance> sProcessInstances) throws SBonitaException
ProcessInstanceServicedeleteParentProcessInstanceAndElements in interface ProcessInstanceServicesProcessInstances - list of process instances to deletedSBonitaExceptionpublic void deleteParentProcessInstanceAndElements(SProcessInstance sProcessInstance) throws SBonitaException
ProcessInstanceServicedeleteParentProcessInstanceAndElements in interface ProcessInstanceServicesProcessInstance - The SProcessInstance to deleteSBonitaExceptionprotected void logProcessInstanceNotFound(SProcessInstanceModificationException e)
protected java.lang.Iterable<java.util.List<java.lang.Long>> getPartitionFromLargeList(java.lang.Iterable<java.lang.Long> allSourceObjectIds)
public int deleteArchivedProcessInstances(java.util.List<java.lang.Long> sourceProcessInstanceIds)
throws SBonitaException
ProcessInstanceServicedeleteArchivedProcessInstances in interface ProcessInstanceServicesourceProcessInstanceIds - list of root source process instance idsSBonitaExceptionpublic void deleteArchivedProcessInstance(SAProcessInstance archivedProcessInstance) throws SProcessInstanceModificationException
ProcessInstanceServicedeleteArchivedProcessInstance in interface ProcessInstanceServicearchivedProcessInstance - the archived process instanceSProcessInstanceModificationExceptionpublic java.util.List<java.lang.Long> getSourceProcessInstanceIdsOfArchProcessInstancesFromDefinition(long processDefinitionId,
int fromIndex,
int maxResults,
OrderByType sortingOrder)
throws SProcessInstanceReadException
getSourceProcessInstanceIdsOfArchProcessInstancesFromDefinition in interface ProcessInstanceServiceSProcessInstanceReadExceptionpublic void deleteProcessInstance(SProcessInstance sProcessInstance) throws SProcessInstanceModificationException
ProcessInstanceServicedeleteProcessInstance in interface ProcessInstanceServicesProcessInstance - the process instanceSProcessInstanceModificationExceptionprotected void checkIfCallerIsNotActive(long callerId)
throws SFlowNodeReadException,
SProcessInstanceHierarchicalDeletionException
protected void deleteProcessInstanceElements(SProcessInstance processInstance) throws SBonitaException
SBonitaExceptionprotected void deleteConnectorInstancesIfNecessary(SFlowNodeInstance flowNodeInstance, SProcessDefinition processDefinition) throws SConnectorInstanceReadException, SConnectorInstanceDeletionException
public void deleteFlowNodeInstance(SFlowNodeInstance flowNodeInstance, SProcessDefinition processDefinition) throws SProcessInstanceModificationException
deleteFlowNodeInstance in interface ProcessInstanceServiceSProcessInstanceModificationExceptionpublic void setState(SProcessInstance processInstance, org.bonitasoft.engine.bpm.process.ProcessInstanceState state) throws SProcessInstanceModificationException
ProcessInstanceServicesetState in interface ProcessInstanceServiceprocessInstance - the process instance will be updatedstate - the state will be set to the process instanceSProcessInstanceModificationExceptionpublic void setStateCategory(SProcessInstance processInstance, SStateCategory stateCatetory) throws SProcessInstanceModificationException
ProcessInstanceServicesetStateCategory in interface ProcessInstanceServiceprocessInstance - process instance to updatestateCatetory - new category state for the process instanceSProcessInstanceModificationExceptionpublic java.util.List<java.lang.Long> getChildInstanceIdsOfProcessInstance(long processInstanceId,
int fromIndex,
int maxResults,
java.lang.String sortingField,
OrderByType sortingOrder)
throws SProcessInstanceReadException
ProcessInstanceServicegetChildInstanceIdsOfProcessInstance in interface ProcessInstanceServiceprocessInstanceId - 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 DESCSProcessInstanceReadExceptionpublic SProcessInstance getChildOfActivity(long activityInstId) throws SProcessInstanceNotFoundException, SBonitaReadException
ProcessInstanceServicegetChildOfActivity in interface ProcessInstanceServiceactivityInstId - identifier of call activity or subprocess activitySProcessInstanceNotFoundExceptionSBonitaReadExceptionpublic long getNumberOfChildInstancesOfProcessInstance(long processInstanceId)
throws SProcessInstanceReadException
ProcessInstanceServicegetNumberOfChildInstancesOfProcessInstance in interface ProcessInstanceServiceprocessInstanceId - identifier of process instanceSProcessInstanceReadExceptionpublic long getNumberOfProcessInstances(QueryOptions queryOptions) throws SBonitaReadException
ProcessInstanceServicegetNumberOfProcessInstances in interface ProcessInstanceServicequeryOptions - a map of specific parameters of a querySBonitaReadExceptionpublic java.util.List<SProcessInstance> searchProcessInstances(QueryOptions queryOptions) throws SBonitaReadException
ProcessInstanceServicesearchProcessInstances in interface ProcessInstanceServicequeryOptions - a map of specific parameters of a querySBonitaReadExceptionpublic long getNumberOfOpenProcessInstancesSupervisedBy(long userId,
QueryOptions queryOptions)
throws SBonitaReadException
ProcessInstanceServicegetNumberOfOpenProcessInstancesSupervisedBy in interface ProcessInstanceServiceuserId - identifier of supervisor userqueryOptions - a map of specific parameters of a querySBonitaReadExceptionpublic java.util.List<SProcessInstance> searchOpenProcessInstancesSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException
ProcessInstanceServicesearchOpenProcessInstancesSupervisedBy in interface ProcessInstanceServiceuserId - identifier of supervisor userqueryOptions - a map of specific parameters of a querySBonitaReadExceptionpublic long getNumberOfFailedProcessInstancesSupervisedBy(long userId,
QueryOptions queryOptions)
throws SBonitaReadException
ProcessInstanceServiceSProcessInstance with at least one failed task or the ProcessInstanceState.ERROR
state for the specific supervisorgetNumberOfFailedProcessInstancesSupervisedBy in interface ProcessInstanceServiceuserId - identifier of supervisor userqueryOptions - a map of specific parameters of a querySProcessInstance with at least one failed task or the
ProcessInstanceState.ERROR state for the specific supervisorSBonitaReadExceptionpublic java.util.List<SProcessInstance> searchFailedProcessInstancesSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException
ProcessInstanceServiceSProcessInstance with at least one failed task or the ProcessInstanceState.ERROR state
for the specific supervisorsearchFailedProcessInstancesSupervisedBy in interface ProcessInstanceServiceuserId - identifier of supervisor userqueryOptions - a map of specific parameters of a querySProcessInstance with at least one failed task or the ProcessInstanceState.ERROR
state for the specific supervisorSBonitaReadExceptionpublic long getNumberOfOpenProcessInstancesInvolvingUser(long userId,
QueryOptions queryOptions)
throws SBonitaReadException
ProcessInstanceServicegetNumberOfOpenProcessInstancesInvolvingUser in interface ProcessInstanceServiceuserId - identifier of user who can perform or be assigned to tasks in process instance.queryOptions - a map of specific parameters of a querySBonitaReadExceptionpublic java.util.List<SProcessInstance> searchOpenProcessInstancesInvolvingUser(long userId, QueryOptions queryOptions) throws SBonitaReadException
ProcessInstanceServicesearchOpenProcessInstancesInvolvingUser in interface ProcessInstanceServiceuserId - identifier of user who can perform or be assigned to tasks in process instance.SBonitaReadExceptionpublic long getNumberOfOpenProcessInstancesInvolvingUsersManagedBy(long managerUserId,
QueryOptions queryOptions)
throws SBonitaReadException
ProcessInstanceServicegetNumberOfOpenProcessInstancesInvolvingUsersManagedBy in interface ProcessInstanceServiceSBonitaReadExceptionpublic java.util.List<SProcessInstance> searchOpenProcessInstancesInvolvingUsersManagedBy(long managerUserId, QueryOptions queryOptions) throws SBonitaReadException
ProcessInstanceServicesearchOpenProcessInstancesInvolvingUsersManagedBy in interface ProcessInstanceServiceSBonitaReadExceptionpublic long getNumberOfArchivedProcessInstancesWithoutSubProcess(QueryOptions queryOptions) throws SBonitaReadException
ProcessInstanceServicegetNumberOfArchivedProcessInstancesWithoutSubProcess in interface ProcessInstanceServicequeryOptions - the search criteria containing a map of specific parameters of a querySBonitaReadExceptionpublic java.util.List<SAProcessInstance> searchArchivedProcessInstancesWithoutSubProcess(QueryOptions queryOptions) throws SBonitaReadException
ProcessInstanceServicesearchArchivedProcessInstancesWithoutSubProcess in interface ProcessInstanceServicequeryOptions - the search criteria containing a map of specific parameters of a querySBonitaReadExceptionpublic java.util.List<SAProcessInstance> searchArchivedProcessInstancesSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException
ProcessInstanceServicesearchArchivedProcessInstancesSupervisedBy in interface ProcessInstanceServiceuserId - identifier of user who is the supervisor of archived process instance.queryOptions - the search criteria containing a map of specific parameters of a querySBonitaReadExceptionpublic long getNumberOfArchivedProcessInstancesSupervisedBy(long userId,
QueryOptions countOptions)
throws SBonitaReadException
ProcessInstanceServicegetNumberOfArchivedProcessInstancesSupervisedBy in interface ProcessInstanceServiceuserId - identifier of user who is the supervisor of archived process instance.countOptions - the search criteria containing a map of specific parameters of a querySBonitaReadExceptionpublic long getNumberOfArchivedProcessInstancesInvolvingUser(long userId,
QueryOptions countOptions)
throws SBonitaReadException
ProcessInstanceServicegetNumberOfArchivedProcessInstancesInvolvingUser in interface ProcessInstanceServiceuserId - the identifier of user who is assignee of tasks of process instancecountOptions - the search criteria containing a map of specific parameters of a querySBonitaReadExceptionpublic long getNumberOfArchivedProcessInstances(QueryOptions queryOptions) throws SBonitaReadException
ProcessInstanceServicegetNumberOfArchivedProcessInstances in interface ProcessInstanceServicequeryOptions - the search criteria containing a map of specific parameters of a querySBonitaReadExceptionpublic java.util.List<SAProcessInstance> searchArchivedProcessInstances(QueryOptions queryOptions) throws SBonitaReadException
ProcessInstanceServicesearchArchivedProcessInstances in interface ProcessInstanceServicequeryOptions - the search criteria containing a map of specific parameters of a querySBonitaReadExceptionpublic java.util.List<SAProcessInstance> searchArchivedProcessInstancesInvolvingUser(long userId, QueryOptions queryOptions) throws SBonitaReadException
ProcessInstanceServicesearchArchivedProcessInstancesInvolvingUser in interface ProcessInstanceServiceuserId - the identifier of user who is assignee of tasks of process instancequeryOptions - the search criteria containing a map of specific parameters of a querySBonitaReadExceptionpublic void updateProcess(SProcessInstance processInstance, EntityUpdateDescriptor descriptor) throws SProcessInstanceModificationException
ProcessInstanceServiceupdateProcess in interface ProcessInstanceServiceprocessInstance - the processInstance will be updateddescriptor - update descriptionSProcessInstanceModificationExceptionpublic SAProcessInstance getArchivedProcessInstance(long archivedProcessInstanceId) throws SProcessInstanceReadException
ProcessInstanceServicegetArchivedProcessInstance in interface ProcessInstanceServicearchivedProcessInstanceId - identifier of the archived process instance (not the process instance)SProcessInstanceReadExceptionpublic java.util.List<SAProcessInstance> getArchivedProcessInstancesInAllStates(java.util.List<java.lang.Long> processInstanceIds) throws SProcessInstanceReadException
ProcessInstanceServicegetArchivedProcessInstancesInAllStates in interface ProcessInstanceServiceSAProcessInstanceSProcessInstanceReadExceptionpublic java.util.List<SProcessInstance> getProcessInstancesInStates(QueryOptions queryOptions, org.bonitasoft.engine.bpm.process.ProcessInstanceState... states) throws SProcessInstanceReadException
ProcessInstanceServiceSProcessInstances in a given list of states.getProcessInstancesInStates in interface ProcessInstanceServicequeryOptions - the search criteria containing a map of specific parameters of a querystates - the list of valid states to retrieve.SProcessInstancesSProcessInstanceReadException - if a read error occursprotected java.util.Set<java.lang.Integer> getStateIdsFromStates(org.bonitasoft.engine.bpm.process.ProcessInstanceState... states)
public java.util.List<java.lang.Long> getArchivedChildrenSourceObjectIdsFromRootProcessInstance(long rootProcessInstanceId,
int fromIndex,
int maxResults,
OrderByType sortingOrder)
throws SBonitaReadException
ProcessInstanceServicegetArchivedChildrenSourceObjectIdsFromRootProcessInstance in interface ProcessInstanceServicerootProcessInstanceId - 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)SBonitaReadExceptionpublic SAProcessInstance getLastArchivedProcessInstance(long processInstanceId) throws SBonitaReadException
getLastArchivedProcessInstance in interface ProcessInstanceServiceprocessInstanceId - The source identifier of the process instanceSBonitaReadExceptionpublic long getNumberOfFailedProcessInstances(QueryOptions queryOptions) throws SBonitaReadException
ProcessInstanceServiceSProcessInstance with at least one failed task or the ProcessInstanceState.ERROR
state.getNumberOfFailedProcessInstances in interface ProcessInstanceServicequeryOptions - the search criteria containing a map of specific parameters of a querySProcessInstance with at least one failed task or the
ProcessInstanceState.ERROR state.SBonitaReadExceptionpublic java.util.List<SProcessInstance> searchFailedProcessInstances(QueryOptions queryOptions) throws SBonitaReadException
ProcessInstanceServiceSProcessInstance with at least one failed task or the ProcessInstanceState.ERROR state.searchFailedProcessInstances in interface ProcessInstanceServicequeryOptions - the search criteria containing a map of specific parameters of a querySProcessInstance with at least one failed task or the ProcessInstanceState.ERROR
state.SBonitaReadExceptionpublic long getNumberOfProcessInstances(long processDefinitionId)
throws SBonitaReadException
getNumberOfProcessInstances in interface ProcessInstanceServiceSBonitaReadException