Class FlowNodeInstancesServiceImpl
java.lang.Object
org.bonitasoft.engine.core.process.instance.impl.FlowNodeInstancesServiceImpl
- All Implemented Interfaces:
FlowNodeInstanceService
- Direct Known Subclasses:
ActivityInstanceServiceImpl
public abstract class FlowNodeInstancesServiceImpl
extends Object
implements FlowNodeInstanceService
- Author:
- Elias Ricken de Medeiros, Frederic Bouquet, Celine Souchet
-
Field Summary
Fields inherited from interface org.bonitasoft.engine.core.process.instance.api.FlowNodeInstanceService
ACTIVITY_INSTANCE_TOKEN_COUNT, ACTIVITYINSTANCE_DISPLAY_DESCRIPTION, ACTIVITYINSTANCE_DISPLAY_NAME, ACTIVITYINSTANCE_STATE, EXECUTED_BY_MODIFIED, EXECUTED_BY_SUBSTITUTE_MODIFIED, EXPECTED_END_DATE_MODIFIED, FLOWNODE_INSTANCE, LOOPINSTANCE_LOOPMAX_MODIFIED, MULTIINSTANCE_LOOPCARDINALITY_MODIFIED, MULTIINSTANCE_NUMBEROFINSTANCE_MODIFIED, STATE_CATEGORY
-
Constructor Summary
ConstructorDescriptionFlowNodeInstancesServiceImpl
(Recorder recorder, PersistenceService persistenceService, ArchiveService archiveService) -
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteArchivedFlowNodeInstances
(List<Long> sourceObjectIds) void
deleteFlowNodeInstance
(SFlowNodeInstance sFlowNodeInstance) getAllChildrenOfProcessInstance
(long parentProcessInstanceId, int fromIndex, int maxResults) get the flow node instances directly contained in the given process instancegetArchivedFlowNodeInstance
(long archivedFlowNodeInstanceId) getArchivedFlowNodeInstances
(long rootContainerId, int fromIndex, int maxResults) getDirectChildrenOfActivityInstance
(long parentActivityInstanceId, int fromIndex, int maxResults) get the flow node instances directly contained in the given activity instancegetDirectChildrenOfProcessInstance
(long parentProcessInstanceId, int fromIndex, int maxResults) get the flow node instances directly contained in the given process instancegetFlowNodeInstance
(long flowNodeInstanceId) getFlowNodeInstanceIdsToRecover
(Duration considerElementsOlderThan, QueryOptions queryOptions) retrieve ids of elements that need to be recovered Called on start node to set the flag to tell the engine to restart these flow nodes Should not be called when the engine is started! This does not retrieve SGatewayInstancesgetFlowNodeInstancesByNameAndParentContainerId
(String name, Long parentContainerId) getGatewayInstanceIdsToRecover
(Duration considerElementsOlderThan, QueryOptions queryOptions) Retrieve ids of SGatewayInstances that need to be recovered<T extends SAFlowNodeInstance>
TgetLastArchivedFlowNodeInstance
(Class<T> entityClass, long sourceObjectFlowNodeInstanceId) long
getNumberOfArchivedFlowNodeInstances
(Class<? extends SAFlowNodeInstance> entityClass, QueryOptions countOptions) Retrieve the total number of the archived flow nodes matching the given search criteria.long
getNumberOfArchivedFlowNodeInstancesSupervisedBy
(long supervisorId, Class<? extends SAFlowNodeInstance> entityClass, QueryOptions queryOptions) Retrieve the total number of the archived flow nodes matching the given search criteria, for a specific supervisor.getNumberOfArchivedFlownodesInAllStates
(long parentProcessInstanceId) Counts the number of archived flownode instances in a specific state.long
getNumberOfFlowNodeInstances
(Class<? extends SFlowNodeInstance> entityClass, QueryOptions countOptions) long
getNumberOfFlowNodeInstancesSupervisedBy
(Long supervisorId, Class<? extends SFlowNodeInstance> entityClass, QueryOptions queryOptions) int
getNumberOfFlowNodes
(long parentProcessInstanceId) get the number of flow node is this root containergetNumberOfFlownodesInAllStates
(long parentProcessInstanceId) Counts the number of flownode instances in all states.getNumberOfFlownodesOfProcessDefinitionInAllStates
(long processDefinitionId) Counts the number of flownode instances in all states.protected PersistenceService
protected Recorder
getSourceObjectIdsOfArchivedFlowNodeInstances
(List<Long> sourceProcessInstanceIds) get all flow nodes contained in the list of root source process instance idsprotected <T> List<T>
getUnmodifiableList
(List<T> selectList) <T extends SAFlowNodeInstance>
List<T>searchArchivedFlowNodeInstances
(Class<T> entityClass, QueryOptions searchOptions) Retrieve the total number of the archived flow nodes matching the given search criteria.<T extends SAFlowNodeInstance>
List<T>searchArchivedFlowNodeInstancesSupervisedBy
(long supervisorId, Class<T> entityClass, QueryOptions queryOptions) Retrieve the total number of the archived flow nodes matching the given search criteria, for a specific supervisor.<T extends SFlowNodeInstance>
List<T>searchFlowNodeInstances
(Class<T> entityClass, QueryOptions searchOptions) <T extends SFlowNodeInstance>
List<T>searchFlowNodeInstancesSupervisedBy
(Long supervisorId, Class<T> entityClass, QueryOptions queryOptions) void
setExecutedBy
(SFlowNodeInstance flowNodeInstance, long userId) Set execute by for the specific flow node instancevoid
setExecutedBySubstitute
(SFlowNodeInstance flowNodeInstance, long executerSubstituteId) Set execute by delegate for the specific flow node instancevoid
setExecuting
(SFlowNodeInstance flowNodeInstance) void
setExpectedEndDate
(SFlowNodeInstance flowNodeInstance, Long dueDate) void
setState
(SFlowNodeInstance flowNodeInstance, FlowNodeState state) void
setStateCategory
(SFlowNodeInstance flowElementInstance, SStateCategory stateCategory) void
setTaskPriority
(SFlowNodeInstance flowNodeInstance, STaskPriority priority) void
updateDisplayDescription
(SFlowNodeInstance flowNodeInstance, String displayDescription) void
updateDisplayName
(SFlowNodeInstance flowNodeInstance, String displayName) protected void
updateFlowNode
(SFlowNodeInstance flowNodeInstance, String eventName, EntityUpdateDescriptor descriptor)
-
Constructor Details
-
FlowNodeInstancesServiceImpl
public FlowNodeInstancesServiceImpl(Recorder recorder, PersistenceService persistenceService, ArchiveService archiveService)
-
-
Method Details
-
getArchiveService
-
setState
public void setState(SFlowNodeInstance flowNodeInstance, FlowNodeState state) throws SFlowNodeModificationException - Specified by:
setState
in interfaceFlowNodeInstanceService
- Throws:
SFlowNodeModificationException
-
setExecuting
- Specified by:
setExecuting
in interfaceFlowNodeInstanceService
- Throws:
SFlowNodeModificationException
-
updateDisplayName
public void updateDisplayName(SFlowNodeInstance flowNodeInstance, String displayName) throws SFlowNodeModificationException - Specified by:
updateDisplayName
in interfaceFlowNodeInstanceService
- Throws:
SFlowNodeModificationException
-
updateDisplayDescription
public void updateDisplayDescription(SFlowNodeInstance flowNodeInstance, String displayDescription) throws SFlowNodeModificationException - Specified by:
updateDisplayDescription
in interfaceFlowNodeInstanceService
- Throws:
SFlowNodeModificationException
-
setTaskPriority
public void setTaskPriority(SFlowNodeInstance flowNodeInstance, STaskPriority priority) throws SFlowNodeModificationException - Specified by:
setTaskPriority
in interfaceFlowNodeInstanceService
- Throws:
SFlowNodeModificationException
-
getFlowNodeInstance
public SFlowNodeInstance getFlowNodeInstance(long flowNodeInstanceId) throws SFlowNodeNotFoundException, SFlowNodeReadException - Specified by:
getFlowNodeInstance
in interfaceFlowNodeInstanceService
- Returns:
- Throws:
SFlowNodeNotFoundException
SFlowNodeReadException
-
getAllChildrenOfProcessInstance
public List<SFlowNodeInstance> getAllChildrenOfProcessInstance(long parentProcessInstanceId, int fromIndex, int maxResults) throws SBonitaReadException Description copied from interface:FlowNodeInstanceService
get the flow node instances directly contained in the given process instance- Specified by:
getAllChildrenOfProcessInstance
in interfaceFlowNodeInstanceService
- Parameters:
parentProcessInstanceId
- the parent process instance- Throws:
SBonitaReadException
-
getDirectChildrenOfProcessInstance
public List<SFlowNodeInstance> getDirectChildrenOfProcessInstance(long parentProcessInstanceId, int fromIndex, int maxResults) throws SBonitaReadException Description copied from interface:FlowNodeInstanceService
get the flow node instances directly contained in the given process instance- Specified by:
getDirectChildrenOfProcessInstance
in interfaceFlowNodeInstanceService
- Parameters:
parentProcessInstanceId
- the parent process instance- Throws:
SBonitaReadException
-
getDirectChildrenOfActivityInstance
public List<SFlowNodeInstance> getDirectChildrenOfActivityInstance(long parentActivityInstanceId, int fromIndex, int maxResults) throws SBonitaReadException Description copied from interface:FlowNodeInstanceService
get the flow node instances directly contained in the given activity instance- Specified by:
getDirectChildrenOfActivityInstance
in interfaceFlowNodeInstanceService
- Parameters:
parentActivityInstanceId
- the parent process instance- Throws:
SBonitaReadException
-
getArchivedFlowNodeInstances
public List<SAFlowNodeInstance> getArchivedFlowNodeInstances(long rootContainerId, int fromIndex, int maxResults) throws SFlowNodeReadException - Specified by:
getArchivedFlowNodeInstances
in interfaceFlowNodeInstanceService
- Returns:
- Throws:
SFlowNodeReadException
-
getSourceObjectIdsOfArchivedFlowNodeInstances
public Set<Long> getSourceObjectIdsOfArchivedFlowNodeInstances(List<Long> sourceProcessInstanceIds) throws SBonitaReadException Description copied from interface:FlowNodeInstanceService
get all flow nodes contained in the list of root source process instance ids- Specified by:
getSourceObjectIdsOfArchivedFlowNodeInstances
in interfaceFlowNodeInstanceService
- Parameters:
sourceProcessInstanceIds
- root source process instance ids- Returns:
- list of root source process instance ids
- Throws:
SBonitaReadException
-
deleteArchivedFlowNodeInstances
- Specified by:
deleteArchivedFlowNodeInstances
in interfaceFlowNodeInstanceService
- Throws:
SBonitaException
-
getArchivedFlowNodeInstance
public SAFlowNodeInstance getArchivedFlowNodeInstance(long archivedFlowNodeInstanceId) throws SFlowNodeReadException, SFlowNodeNotFoundException - Specified by:
getArchivedFlowNodeInstance
in interfaceFlowNodeInstanceService
- Returns:
- Throws:
SFlowNodeReadException
SFlowNodeNotFoundException
-
getLastArchivedFlowNodeInstance
public <T extends SAFlowNodeInstance> T getLastArchivedFlowNodeInstance(Class<T> entityClass, long sourceObjectFlowNodeInstanceId) throws SBonitaReadException - Specified by:
getLastArchivedFlowNodeInstance
in interfaceFlowNodeInstanceService
sourceObjectFlowNodeInstanceId
- The source identifier of the flow node instance- Returns:
- The last archived flow node
- Throws:
SBonitaReadException
-
setStateCategory
public void setStateCategory(SFlowNodeInstance flowElementInstance, SStateCategory stateCategory) throws SFlowNodeModificationException - Specified by:
setStateCategory
in interfaceFlowNodeInstanceService
- Throws:
SFlowNodeModificationException
-
setExecutedBy
public void setExecutedBy(SFlowNodeInstance flowNodeInstance, long userId) throws SFlowNodeModificationException Description copied from interface:FlowNodeInstanceService
Set execute by for the specific flow node instance- Specified by:
setExecutedBy
in interfaceFlowNodeInstanceService
- Parameters:
flowNodeInstance
- the flowNodeInstance will be updateduserId
- value for executedBy- Throws:
SFlowNodeModificationException
-
setExecutedBySubstitute
public void setExecutedBySubstitute(SFlowNodeInstance flowNodeInstance, long executerSubstituteId) throws SFlowNodeModificationException Description copied from interface:FlowNodeInstanceService
Set execute by delegate for the specific flow node instance- Specified by:
setExecutedBySubstitute
in interfaceFlowNodeInstanceService
- Parameters:
flowNodeInstance
- the flowNodeInstance will be updatedexecuterSubstituteId
- value for executedBySubstitute- Throws:
SFlowNodeModificationException
-
setExpectedEndDate
public void setExpectedEndDate(SFlowNodeInstance flowNodeInstance, Long dueDate) throws SFlowNodeModificationException - Specified by:
setExpectedEndDate
in interfaceFlowNodeInstanceService
- Throws:
SFlowNodeModificationException
-
updateFlowNode
protected void updateFlowNode(SFlowNodeInstance flowNodeInstance, String eventName, EntityUpdateDescriptor descriptor) throws SFlowNodeModificationException - Throws:
SFlowNodeModificationException
-
getUnmodifiableList
-
getNumberOfFlowNodeInstances
public long getNumberOfFlowNodeInstances(Class<? extends SFlowNodeInstance> entityClass, QueryOptions countOptions) throws SBonitaReadException - Specified by:
getNumberOfFlowNodeInstances
in interfaceFlowNodeInstanceService
- Returns:
- Throws:
SBonitaReadException
-
searchFlowNodeInstances
public <T extends SFlowNodeInstance> List<T> searchFlowNodeInstances(Class<T> entityClass, QueryOptions searchOptions) throws SBonitaReadException - Specified by:
searchFlowNodeInstances
in interfaceFlowNodeInstanceService
- Returns:
- Throws:
SBonitaReadException
-
getNumberOfFlowNodeInstancesSupervisedBy
public long getNumberOfFlowNodeInstancesSupervisedBy(Long supervisorId, Class<? extends SFlowNodeInstance> entityClass, QueryOptions queryOptions) throws SBonitaReadException - Specified by:
getNumberOfFlowNodeInstancesSupervisedBy
in interfaceFlowNodeInstanceService
- Returns:
- Throws:
SBonitaReadException
-
searchFlowNodeInstancesSupervisedBy
public <T extends SFlowNodeInstance> List<T> searchFlowNodeInstancesSupervisedBy(Long supervisorId, Class<T> entityClass, QueryOptions queryOptions) throws SBonitaReadException - Specified by:
searchFlowNodeInstancesSupervisedBy
in interfaceFlowNodeInstanceService
- Returns:
- Throws:
SBonitaReadException
-
getNumberOfFlownodesOfProcessDefinitionInAllStates
public List<SFlowNodeInstanceStateCounter> getNumberOfFlownodesOfProcessDefinitionInAllStates(long processDefinitionId) throws SBonitaReadException Description copied from interface:FlowNodeInstanceService
Counts the number of flownode instances in all states. Only considers flownodes direcly contained in given process definition. Results are counted per flownode name and per state.- Specified by:
getNumberOfFlownodesOfProcessDefinitionInAllStates
in interfaceFlowNodeInstanceService
- Parameters:
processDefinitionId
- the ID of the process definition to search flownodes for.- Returns:
- a list of FlowNodeInstanceStateCounter. If no results, returns an empty list.
- Throws:
SBonitaReadException
- if a read exception occurs.
-
getNumberOfFlownodesInAllStates
public List<SFlowNodeInstanceStateCounter> getNumberOfFlownodesInAllStates(long parentProcessInstanceId) throws SBonitaReadException Description copied from interface:FlowNodeInstanceService
Counts the number of flownode instances in all states. Only considers flownodes direcly contained in given process instance, not flownodes in sub-process instances. Results are counted per flownode name and per state.- Specified by:
getNumberOfFlownodesInAllStates
in interfaceFlowNodeInstanceService
- Parameters:
parentProcessInstanceId
- the ID of the process instance to search flownodes for.- Returns:
- a list of FlowNodeInstanceStateCounter. If no results, returns an empty list.
- Throws:
SBonitaReadException
- if a read exception occurs.
-
getNumberOfArchivedFlownodesInAllStates
public List<SFlowNodeInstanceStateCounter> getNumberOfArchivedFlownodesInAllStates(long parentProcessInstanceId) throws SBonitaReadException Description copied from interface:FlowNodeInstanceService
Counts the number of archived flownode instances in a specific state. Only considers archived flownodes direcly contained in given process instance, not flownodes in sub-process instances. Results are counted per flownode name and per state.- Specified by:
getNumberOfArchivedFlownodesInAllStates
in interfaceFlowNodeInstanceService
- Parameters:
parentProcessInstanceId
- the ID of the process instance to search flownodes for. This is the ID of the process instance before it was archived (corresponding to the sourceObjectId in the archives)- Returns:
- a list of FlowNodeInstanceStateCounter. If no results, returns an empty list.
- Throws:
SBonitaReadException
- if a read exception occurs.
-
getNumberOfArchivedFlowNodeInstances
public long getNumberOfArchivedFlowNodeInstances(Class<? extends SAFlowNodeInstance> entityClass, QueryOptions countOptions) throws SBonitaReadException Description copied from interface:FlowNodeInstanceService
Retrieve the total number of the archived flow nodes matching the given search criteria.- Specified by:
getNumberOfArchivedFlowNodeInstances
in interfaceFlowNodeInstanceService
- Parameters:
entityClass
- The type of the archived flow node to search forcountOptions
- The search options to filter the results- Returns:
- The number found, 0 if none matching search criteria
- Throws:
SBonitaReadException
-
searchArchivedFlowNodeInstances
public <T extends SAFlowNodeInstance> List<T> searchArchivedFlowNodeInstances(Class<T> entityClass, QueryOptions searchOptions) throws SBonitaReadException Description copied from interface:FlowNodeInstanceService
Retrieve the total number of the archived flow nodes matching the given search criteria.- Specified by:
searchArchivedFlowNodeInstances
in interfaceFlowNodeInstanceService
- Parameters:
entityClass
- The type of the archived flow node to search forsearchOptions
- The search options to filter the results- Returns:
- The list of paginated results, according to the QueryOptions search criteria
- Throws:
SBonitaReadException
-
getNumberOfArchivedFlowNodeInstancesSupervisedBy
public long getNumberOfArchivedFlowNodeInstancesSupervisedBy(long supervisorId, Class<? extends SAFlowNodeInstance> entityClass, QueryOptions queryOptions) throws SBonitaReadException Description copied from interface:FlowNodeInstanceService
Retrieve the total number of the archived flow nodes matching the given search criteria, for a specific supervisor.- Specified by:
getNumberOfArchivedFlowNodeInstancesSupervisedBy
in interfaceFlowNodeInstanceService
- Parameters:
supervisorId
- The identifier of the supervisorentityClass
- The type of the archived flow node to search forqueryOptions
- The search options to filter the results- Returns:
- The number found, 0 if no matching search criteria
- Throws:
SBonitaReadException
-
searchArchivedFlowNodeInstancesSupervisedBy
public <T extends SAFlowNodeInstance> List<T> searchArchivedFlowNodeInstancesSupervisedBy(long supervisorId, Class<T> entityClass, QueryOptions queryOptions) throws SBonitaReadException Description copied from interface:FlowNodeInstanceService
Retrieve the total number of the archived flow nodes matching the given search criteria, for a specific supervisor.- Specified by:
searchArchivedFlowNodeInstancesSupervisedBy
in interfaceFlowNodeInstanceService
- Parameters:
supervisorId
- The identifier of the supervisorentityClass
- The type of the archived flow node to search forqueryOptions
- The search options to filter the results- Returns:
- The list of paginated results, according to the QueryOptions search criteria
- Throws:
SBonitaReadException
-
getRecorder
-
getPersistenceService
-
deleteFlowNodeInstance
public void deleteFlowNodeInstance(SFlowNodeInstance sFlowNodeInstance) throws SFlowNodeDeletionException - Specified by:
deleteFlowNodeInstance
in interfaceFlowNodeInstanceService
- Throws:
SFlowNodeDeletionException
-
getFlowNodeInstanceIdsToRecover
public List<Long> getFlowNodeInstanceIdsToRecover(Duration considerElementsOlderThan, QueryOptions queryOptions) throws SBonitaReadException Description copied from interface:FlowNodeInstanceService
retrieve ids of elements that need to be recovered Called on start node to set the flag to tell the engine to restart these flow nodes Should not be called when the engine is started! This does not retrieve SGatewayInstances- Specified by:
getFlowNodeInstanceIdsToRecover
in interfaceFlowNodeInstanceService
- Parameters:
considerElementsOlderThan
- consider elements older than that durationqueryOptions
- used for pagination- Throws:
SBonitaReadException
-
getGatewayInstanceIdsToRecover
public List<Long> getGatewayInstanceIdsToRecover(Duration considerElementsOlderThan, QueryOptions queryOptions) throws SBonitaReadException Description copied from interface:FlowNodeInstanceService
Retrieve ids of SGatewayInstances that need to be recovered- Specified by:
getGatewayInstanceIdsToRecover
in interfaceFlowNodeInstanceService
- Returns:
- Throws:
SBonitaReadException
-
getFlowNodeInstancesByIds
public List<SFlowNodeInstance> getFlowNodeInstancesByIds(List<Long> ids) throws SBonitaReadException - Specified by:
getFlowNodeInstancesByIds
in interfaceFlowNodeInstanceService
- Throws:
SBonitaReadException
-
getNumberOfFlowNodes
Description copied from interface:FlowNodeInstanceService
get the number of flow node is this root container- Specified by:
getNumberOfFlowNodes
in interfaceFlowNodeInstanceService
- Returns:
- the number of flow node
- Throws:
SBonitaReadException
-
getFlowNodeInstancesByNameAndParentContainerId
public List<SFlowNodeInstance> getFlowNodeInstancesByNameAndParentContainerId(String name, Long parentContainerId) throws SBonitaReadException - Specified by:
getFlowNodeInstancesByNameAndParentContainerId
in interfaceFlowNodeInstanceService
- Throws:
SBonitaReadException
-