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
ConstructorsConstructorDescriptionFlowNodeInstancesServiceImpl(Recorder recorder, PersistenceService persistenceService, ArchiveService archiveService) -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteArchivedFlowNodeInstances(List<Long> sourceObjectIds) voiddeleteFlowNodeInstance(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) longgetNumberOfArchivedFlowNodeInstances(Class<? extends SAFlowNodeInstance> entityClass, QueryOptions countOptions) Retrieve the total number of the archived flow nodes matching the given search criteria.longgetNumberOfArchivedFlowNodeInstancesSupervisedBy(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.longgetNumberOfFlowNodeInstances(Class<? extends SFlowNodeInstance> entityClass, QueryOptions countOptions) longgetNumberOfFlowNodeInstancesSupervisedBy(Long supervisorId, Class<? extends SFlowNodeInstance> entityClass, QueryOptions queryOptions) intgetNumberOfFlowNodes(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 PersistenceServiceprotected RecordergetSourceObjectIdsOfArchivedFlowNodeInstances(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) voidsetExecutedBy(SFlowNodeInstance flowNodeInstance, long userId) Set execute by for the specific flow node instancevoidsetExecutedBySubstitute(SFlowNodeInstance flowNodeInstance, long executerSubstituteId) Set execute by delegate for the specific flow node instancevoidsetExecuting(SFlowNodeInstance flowNodeInstance) voidsetExpectedEndDate(SFlowNodeInstance flowNodeInstance, Long dueDate) voidsetState(SFlowNodeInstance flowNodeInstance, FlowNodeState state) voidsetStateCategory(SFlowNodeInstance flowElementInstance, SStateCategory stateCategory) voidsetTaskPriority(SFlowNodeInstance flowNodeInstance, STaskPriority priority) voidupdateDisplayDescription(SFlowNodeInstance flowNodeInstance, String displayDescription) voidupdateDisplayName(SFlowNodeInstance flowNodeInstance, String displayName) protected voidupdateFlowNode(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:
setStatein interfaceFlowNodeInstanceService- Throws:
SFlowNodeModificationException
-
setExecuting
- Specified by:
setExecutingin interfaceFlowNodeInstanceService- Throws:
SFlowNodeModificationException
-
updateDisplayName
public void updateDisplayName(SFlowNodeInstance flowNodeInstance, String displayName) throws SFlowNodeModificationException - Specified by:
updateDisplayNamein interfaceFlowNodeInstanceService- Throws:
SFlowNodeModificationException
-
updateDisplayDescription
public void updateDisplayDescription(SFlowNodeInstance flowNodeInstance, String displayDescription) throws SFlowNodeModificationException - Specified by:
updateDisplayDescriptionin interfaceFlowNodeInstanceService- Throws:
SFlowNodeModificationException
-
setTaskPriority
public void setTaskPriority(SFlowNodeInstance flowNodeInstance, STaskPriority priority) throws SFlowNodeModificationException - Specified by:
setTaskPriorityin interfaceFlowNodeInstanceService- Throws:
SFlowNodeModificationException
-
getFlowNodeInstance
public SFlowNodeInstance getFlowNodeInstance(long flowNodeInstanceId) throws SFlowNodeNotFoundException, SFlowNodeReadException - Specified by:
getFlowNodeInstancein interfaceFlowNodeInstanceService- Returns:
- Throws:
SFlowNodeNotFoundExceptionSFlowNodeReadException
-
getAllChildrenOfProcessInstance
public List<SFlowNodeInstance> getAllChildrenOfProcessInstance(long parentProcessInstanceId, int fromIndex, int maxResults) throws SBonitaReadException Description copied from interface:FlowNodeInstanceServiceget the flow node instances directly contained in the given process instance- Specified by:
getAllChildrenOfProcessInstancein 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:FlowNodeInstanceServiceget the flow node instances directly contained in the given process instance- Specified by:
getDirectChildrenOfProcessInstancein 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:FlowNodeInstanceServiceget the flow node instances directly contained in the given activity instance- Specified by:
getDirectChildrenOfActivityInstancein interfaceFlowNodeInstanceService- Parameters:
parentActivityInstanceId- the parent process instance- Throws:
SBonitaReadException
-
getArchivedFlowNodeInstances
public List<SAFlowNodeInstance> getArchivedFlowNodeInstances(long rootContainerId, int fromIndex, int maxResults) throws SFlowNodeReadException - Specified by:
getArchivedFlowNodeInstancesin interfaceFlowNodeInstanceService- Returns:
- Throws:
SFlowNodeReadException
-
getSourceObjectIdsOfArchivedFlowNodeInstances
public Set<Long> getSourceObjectIdsOfArchivedFlowNodeInstances(List<Long> sourceProcessInstanceIds) throws SBonitaReadException Description copied from interface:FlowNodeInstanceServiceget all flow nodes contained in the list of root source process instance ids- Specified by:
getSourceObjectIdsOfArchivedFlowNodeInstancesin interfaceFlowNodeInstanceService- Parameters:
sourceProcessInstanceIds- root source process instance ids- Returns:
- list of root source process instance ids
- Throws:
SBonitaReadException
-
deleteArchivedFlowNodeInstances
- Specified by:
deleteArchivedFlowNodeInstancesin interfaceFlowNodeInstanceService- Throws:
SBonitaException
-
getArchivedFlowNodeInstance
public SAFlowNodeInstance getArchivedFlowNodeInstance(long archivedFlowNodeInstanceId) throws SFlowNodeReadException, SFlowNodeNotFoundException - Specified by:
getArchivedFlowNodeInstancein interfaceFlowNodeInstanceService- Returns:
- Throws:
SFlowNodeReadExceptionSFlowNodeNotFoundException
-
getLastArchivedFlowNodeInstance
public <T extends SAFlowNodeInstance> T getLastArchivedFlowNodeInstance(Class<T> entityClass, long sourceObjectFlowNodeInstanceId) throws SBonitaReadException - Specified by:
getLastArchivedFlowNodeInstancein interfaceFlowNodeInstanceServicesourceObjectFlowNodeInstanceId- 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:
setStateCategoryin interfaceFlowNodeInstanceService- Throws:
SFlowNodeModificationException
-
setExecutedBy
public void setExecutedBy(SFlowNodeInstance flowNodeInstance, long userId) throws SFlowNodeModificationException Description copied from interface:FlowNodeInstanceServiceSet execute by for the specific flow node instance- Specified by:
setExecutedByin 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:FlowNodeInstanceServiceSet execute by delegate for the specific flow node instance- Specified by:
setExecutedBySubstitutein 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:
setExpectedEndDatein 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:
getNumberOfFlowNodeInstancesin interfaceFlowNodeInstanceService- Returns:
- Throws:
SBonitaReadException
-
searchFlowNodeInstances
public <T extends SFlowNodeInstance> List<T> searchFlowNodeInstances(Class<T> entityClass, QueryOptions searchOptions) throws SBonitaReadException - Specified by:
searchFlowNodeInstancesin interfaceFlowNodeInstanceService- Returns:
- Throws:
SBonitaReadException
-
getNumberOfFlowNodeInstancesSupervisedBy
public long getNumberOfFlowNodeInstancesSupervisedBy(Long supervisorId, Class<? extends SFlowNodeInstance> entityClass, QueryOptions queryOptions) throws SBonitaReadException - Specified by:
getNumberOfFlowNodeInstancesSupervisedByin interfaceFlowNodeInstanceService- Returns:
- Throws:
SBonitaReadException
-
searchFlowNodeInstancesSupervisedBy
public <T extends SFlowNodeInstance> List<T> searchFlowNodeInstancesSupervisedBy(Long supervisorId, Class<T> entityClass, QueryOptions queryOptions) throws SBonitaReadException - Specified by:
searchFlowNodeInstancesSupervisedByin interfaceFlowNodeInstanceService- Returns:
- Throws:
SBonitaReadException
-
getNumberOfFlownodesOfProcessDefinitionInAllStates
public List<SFlowNodeInstanceStateCounter> getNumberOfFlownodesOfProcessDefinitionInAllStates(long processDefinitionId) throws SBonitaReadException Description copied from interface:FlowNodeInstanceServiceCounts 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:
getNumberOfFlownodesOfProcessDefinitionInAllStatesin 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:FlowNodeInstanceServiceCounts 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:
getNumberOfFlownodesInAllStatesin 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:FlowNodeInstanceServiceCounts 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:
getNumberOfArchivedFlownodesInAllStatesin 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:FlowNodeInstanceServiceRetrieve the total number of the archived flow nodes matching the given search criteria.- Specified by:
getNumberOfArchivedFlowNodeInstancesin 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:FlowNodeInstanceServiceRetrieve the total number of the archived flow nodes matching the given search criteria.- Specified by:
searchArchivedFlowNodeInstancesin 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:FlowNodeInstanceServiceRetrieve the total number of the archived flow nodes matching the given search criteria, for a specific supervisor.- Specified by:
getNumberOfArchivedFlowNodeInstancesSupervisedByin 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:FlowNodeInstanceServiceRetrieve the total number of the archived flow nodes matching the given search criteria, for a specific supervisor.- Specified by:
searchArchivedFlowNodeInstancesSupervisedByin 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:
deleteFlowNodeInstancein interfaceFlowNodeInstanceService- Throws:
SFlowNodeDeletionException
-
getFlowNodeInstanceIdsToRecover
public List<Long> getFlowNodeInstanceIdsToRecover(Duration considerElementsOlderThan, QueryOptions queryOptions) throws SBonitaReadException Description copied from interface:FlowNodeInstanceServiceretrieve 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:
getFlowNodeInstanceIdsToRecoverin 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:FlowNodeInstanceServiceRetrieve ids of SGatewayInstances that need to be recovered- Specified by:
getGatewayInstanceIdsToRecoverin interfaceFlowNodeInstanceService- Returns:
- Throws:
SBonitaReadException
-
getFlowNodeInstancesByIds
public List<SFlowNodeInstance> getFlowNodeInstancesByIds(List<Long> ids) throws SBonitaReadException - Specified by:
getFlowNodeInstancesByIdsin interfaceFlowNodeInstanceService- Throws:
SBonitaReadException
-
getNumberOfFlowNodes
Description copied from interface:FlowNodeInstanceServiceget the number of flow node is this root container- Specified by:
getNumberOfFlowNodesin interfaceFlowNodeInstanceService- Returns:
- the number of flow node
- Throws:
SBonitaReadException
-
getFlowNodeInstancesByNameAndParentContainerId
public List<SFlowNodeInstance> getFlowNodeInstancesByNameAndParentContainerId(String name, Long parentContainerId) throws SBonitaReadException - Specified by:
getFlowNodeInstancesByNameAndParentContainerIdin interfaceFlowNodeInstanceService- Throws:
SBonitaReadException
-