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 java.lang.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
Constructors Constructor Description FlowNodeInstancesServiceImpl(Recorder recorder, PersistenceService persistenceService, EventService eventService, TechnicalLoggerService logger, ArchiveService archiveService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteArchivedFlowNodeInstances(java.util.List<java.lang.Long> sourceObjectIds)voiddeleteFlowNodeInstance(SFlowNodeInstance sFlowNodeInstance)java.util.List<SFlowNodeInstance>getAllChildrenOfProcessInstance(long parentProcessInstanceId, int fromIndex, int maxResults)get the flow node instances directly contained in the given process instanceSAFlowNodeInstancegetArchivedFlowNodeInstance(long archivedFlowNodeInstanceId)java.util.List<SAFlowNodeInstance>getArchivedFlowNodeInstances(long rootContainerId, int fromIndex, int maxResults)ArchiveServicegetArchiveService()java.util.List<SFlowNodeInstance>getDirectChildrenOfActivityInstance(long parentActivityInstanceId, int fromIndex, int maxResults)get the flow node instances directly contained in the given activity instancejava.util.List<SFlowNodeInstance>getDirectChildrenOfProcessInstance(long parentProcessInstanceId, int fromIndex, int maxResults)get the flow node instances directly contained in the given process instanceSFlowNodeInstancegetFlowNodeInstance(long flowNodeInstanceId)java.util.List<java.lang.Long>getFlowNodeInstanceIdsToRecover(java.time.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 SGatewayInstancesjava.util.List<SFlowNodeInstance>getFlowNodeInstancesByIds(java.util.List<java.lang.Long> ids)java.util.List<SFlowNodeInstance>getFlowNodeInstancesByNameAndParentContainerId(java.lang.String name, java.lang.Long parentContainerId)java.util.List<java.lang.Long>getGatewayInstanceIdsToRecover(java.time.Duration considerElementsOlderThan, QueryOptions queryOptions)Retrieve ids of SGatewayInstances that need to be recovered<T extends SAFlowNodeInstance>
TgetLastArchivedFlowNodeInstance(java.lang.Class<T> entityClass, long sourceObjectFlowNodeInstanceId)protected TechnicalLoggerServicegetLogger()longgetNumberOfArchivedFlowNodeInstances(java.lang.Class<? extends SAFlowNodeInstance> entityClass, QueryOptions countOptions)Retrieve the total number of the archived flow nodes matching the given search criteria.longgetNumberOfArchivedFlowNodeInstancesSupervisedBy(long supervisorId, java.lang.Class<? extends SAFlowNodeInstance> entityClass, QueryOptions queryOptions)Retrieve the total number of the archived flow nodes matching the given search criteria, for a specific supervisor.java.util.List<SFlowNodeInstanceStateCounter>getNumberOfArchivedFlownodesInAllStates(long parentProcessInstanceId)Counts the number of archived flownode instances in a specific state.longgetNumberOfFlowNodeInstances(java.lang.Class<? extends SFlowNodeInstance> entityClass, QueryOptions countOptions)longgetNumberOfFlowNodeInstancesSupervisedBy(java.lang.Long supervisorId, java.lang.Class<? extends SFlowNodeInstance> entityClass, QueryOptions queryOptions)intgetNumberOfFlowNodes(long parentProcessInstanceId)get the number of flow node is this root containerjava.util.List<SFlowNodeInstanceStateCounter>getNumberOfFlownodesInAllStates(long parentProcessInstanceId)Counts the number of flownode instances in all states.java.util.List<SFlowNodeInstanceStateCounter>getNumberOfFlownodesOfProcessDefinitionInAllStates(long processDefinitionId)Counts the number of flownode instances in all states.protected PersistenceServicegetPersistenceService()protected RecordergetRecorder()java.util.Set<java.lang.Long>getSourceObjectIdsOfArchivedFlowNodeInstances(java.util.List<java.lang.Long> sourceProcessInstanceIds)get all flow nodes contained in the list of root source process instance idsprotected <T> java.util.List<T>getUnmodifiableList(java.util.List<T> selectList)<T extends SAFlowNodeInstance>
java.util.List<T>searchArchivedFlowNodeInstances(java.lang.Class<T> entityClass, QueryOptions searchOptions)Retrieve the total number of the archived flow nodes matching the given search criteria.<T extends SAFlowNodeInstance>
java.util.List<T>searchArchivedFlowNodeInstancesSupervisedBy(long supervisorId, java.lang.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>
java.util.List<T>searchFlowNodeInstances(java.lang.Class<T> entityClass, QueryOptions searchOptions)<T extends SFlowNodeInstance>
java.util.List<T>searchFlowNodeInstancesSupervisedBy(java.lang.Long supervisorId, java.lang.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, java.lang.Long dueDate)voidsetState(SFlowNodeInstance flowNodeInstance, FlowNodeState state)voidsetStateCategory(SFlowNodeInstance flowElementInstance, SStateCategory stateCategory)voidsetTaskPriority(SFlowNodeInstance flowNodeInstance, STaskPriority priority)voidupdateDisplayDescription(SFlowNodeInstance flowNodeInstance, java.lang.String displayDescription)voidupdateDisplayName(SFlowNodeInstance flowNodeInstance, java.lang.String displayName)protected voidupdateFlowNode(SFlowNodeInstance flowNodeInstance, java.lang.String eventName, EntityUpdateDescriptor descriptor)
-
-
-
Constructor Detail
-
FlowNodeInstancesServiceImpl
public FlowNodeInstancesServiceImpl(Recorder recorder, PersistenceService persistenceService, EventService eventService, TechnicalLoggerService logger, ArchiveService archiveService)
-
-
Method Detail
-
getArchiveService
public ArchiveService getArchiveService()
-
setState
public void setState(SFlowNodeInstance flowNodeInstance, FlowNodeState state) throws SFlowNodeModificationException
- Specified by:
setStatein interfaceFlowNodeInstanceService- Throws:
SFlowNodeModificationException
-
setExecuting
public void setExecuting(SFlowNodeInstance flowNodeInstance) throws SFlowNodeModificationException
- Specified by:
setExecutingin interfaceFlowNodeInstanceService- Throws:
SFlowNodeModificationException
-
updateDisplayName
public void updateDisplayName(SFlowNodeInstance flowNodeInstance, java.lang.String displayName) throws SFlowNodeModificationException
- Specified by:
updateDisplayNamein interfaceFlowNodeInstanceService- Throws:
SFlowNodeModificationException
-
updateDisplayDescription
public void updateDisplayDescription(SFlowNodeInstance flowNodeInstance, java.lang.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 java.util.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 java.util.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 java.util.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 java.util.List<SAFlowNodeInstance> getArchivedFlowNodeInstances(long rootContainerId, int fromIndex, int maxResults) throws SFlowNodeReadException
- Specified by:
getArchivedFlowNodeInstancesin interfaceFlowNodeInstanceService- Returns:
- Throws:
SFlowNodeReadException
-
getSourceObjectIdsOfArchivedFlowNodeInstances
public java.util.Set<java.lang.Long> getSourceObjectIdsOfArchivedFlowNodeInstances(java.util.List<java.lang.Long> sourceProcessInstanceIds) throws SBonitaReadExceptionDescription 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
public void deleteArchivedFlowNodeInstances(java.util.List<java.lang.Long> sourceObjectIds) throws SBonitaException- 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(java.lang.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, java.lang.Long dueDate) throws SFlowNodeModificationException
- Specified by:
setExpectedEndDatein interfaceFlowNodeInstanceService- Throws:
SFlowNodeModificationException
-
updateFlowNode
protected void updateFlowNode(SFlowNodeInstance flowNodeInstance, java.lang.String eventName, EntityUpdateDescriptor descriptor) throws SFlowNodeModificationException
- Throws:
SFlowNodeModificationException
-
getUnmodifiableList
protected <T> java.util.List<T> getUnmodifiableList(java.util.List<T> selectList)
-
getNumberOfFlowNodeInstances
public long getNumberOfFlowNodeInstances(java.lang.Class<? extends SFlowNodeInstance> entityClass, QueryOptions countOptions) throws SBonitaReadException
- Specified by:
getNumberOfFlowNodeInstancesin interfaceFlowNodeInstanceService- Returns:
- Throws:
SBonitaReadException
-
searchFlowNodeInstances
public <T extends SFlowNodeInstance> java.util.List<T> searchFlowNodeInstances(java.lang.Class<T> entityClass, QueryOptions searchOptions) throws SBonitaReadException
- Specified by:
searchFlowNodeInstancesin interfaceFlowNodeInstanceService- Returns:
- Throws:
SBonitaReadException
-
getNumberOfFlowNodeInstancesSupervisedBy
public long getNumberOfFlowNodeInstancesSupervisedBy(java.lang.Long supervisorId, java.lang.Class<? extends SFlowNodeInstance> entityClass, QueryOptions queryOptions) throws SBonitaReadException- Specified by:
getNumberOfFlowNodeInstancesSupervisedByin interfaceFlowNodeInstanceService- Returns:
- Throws:
SBonitaReadException
-
searchFlowNodeInstancesSupervisedBy
public <T extends SFlowNodeInstance> java.util.List<T> searchFlowNodeInstancesSupervisedBy(java.lang.Long supervisorId, java.lang.Class<T> entityClass, QueryOptions queryOptions) throws SBonitaReadException
- Specified by:
searchFlowNodeInstancesSupervisedByin interfaceFlowNodeInstanceService- Returns:
- Throws:
SBonitaReadException
-
getNumberOfFlownodesOfProcessDefinitionInAllStates
public java.util.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 java.util.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 java.util.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(java.lang.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> java.util.List<T> searchArchivedFlowNodeInstances(java.lang.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, java.lang.Class<? extends SAFlowNodeInstance> entityClass, QueryOptions queryOptions) throws SBonitaReadExceptionDescription 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> java.util.List<T> searchArchivedFlowNodeInstancesSupervisedBy(long supervisorId, java.lang.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
protected Recorder getRecorder()
-
getPersistenceService
protected PersistenceService getPersistenceService()
-
getLogger
protected TechnicalLoggerService getLogger()
-
deleteFlowNodeInstance
public void deleteFlowNodeInstance(SFlowNodeInstance sFlowNodeInstance) throws SFlowNodeDeletionException
- Specified by:
deleteFlowNodeInstancein interfaceFlowNodeInstanceService- Throws:
SFlowNodeDeletionException
-
getFlowNodeInstanceIdsToRecover
public java.util.List<java.lang.Long> getFlowNodeInstanceIdsToRecover(java.time.Duration considerElementsOlderThan, QueryOptions queryOptions) throws SBonitaReadExceptionDescription 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 java.util.List<java.lang.Long> getGatewayInstanceIdsToRecover(java.time.Duration considerElementsOlderThan, QueryOptions queryOptions) throws SBonitaReadExceptionDescription copied from interface:FlowNodeInstanceServiceRetrieve ids of SGatewayInstances that need to be recovered- Specified by:
getGatewayInstanceIdsToRecoverin interfaceFlowNodeInstanceService- Returns:
- Throws:
SBonitaReadException
-
getFlowNodeInstancesByIds
public java.util.List<SFlowNodeInstance> getFlowNodeInstancesByIds(java.util.List<java.lang.Long> ids) throws SBonitaReadException
- Specified by:
getFlowNodeInstancesByIdsin interfaceFlowNodeInstanceService- Throws:
SBonitaReadException
-
getNumberOfFlowNodes
public int getNumberOfFlowNodes(long parentProcessInstanceId) throws SBonitaReadExceptionDescription 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 java.util.List<SFlowNodeInstance> getFlowNodeInstancesByNameAndParentContainerId(java.lang.String name, java.lang.Long parentContainerId) throws SBonitaReadException
- Specified by:
getFlowNodeInstancesByNameAndParentContainerIdin interfaceFlowNodeInstanceService- Throws:
SBonitaReadException
-
-