Class ProcessManagerTools
- java.lang.Object
-
- de.aristaflow.adept2.core.processmanager.ProcessManagerTools
-
public class ProcessManagerTools extends Object
This class provides some useful methods for process manager logic, e. g. retrieving the latest template of a process type and aggregating states of subprocess instances.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ProcessConstants.InstanceExecutionStatus
aggregateStatus(SessionToken session, Collection<UUID> parallels, InstanceManager im)
Aggregates several instance execution statuses to one, that is the designated subprocess instances (running in parallel) are retrieved from the designated subprocess manager instance and their execution statuses are aggregated.static ProcessConstants.NodeState
aggregateSubprocessStatuses(SessionToken session, Collection<UUID> parallels, InstanceManager im)
Aggregates several instance execution statuses to the corresponding node state of the parent node.static TemplateReference
getLatestTemplateVersion(SessionToken session, String processType, TemplateManager templMgr, FilterFactory filtFactory)
Tries to retrieve the template of the designated process type having the highest version number in the template manager.static ProcessConstants.NodeState
mapToNodeState(ProcessConstants.InstanceExecutionStatus instanceExecutionStatus)
Maps an instance execution status to a node state.static boolean
templatesStored(CheckReport checkReport, ADEPT2Service processManager)
Gets whether the designated check report indicates no problems and a successful storing (in the designated process manager).
-
-
-
Method Detail
-
getLatestTemplateVersion
public static TemplateReference getLatestTemplateVersion(SessionToken session, String processType, TemplateManager templMgr, FilterFactory filtFactory)
Tries to retrieve the template of the designated process type having the highest version number in the template manager. Only released, instantiable and top-level usable templates will be recognised. If no such template is found (the process type is unknown or the filter yields an empty result,null
will be returned.Important! This method has some serious restrictions:
Due to the non-linear versioning of templates, the result of this method is ambiguous. It just retrieves the template with the highest version number which need not be the latest version at all. Additionally, the template manager need not know all templates of a process type and therefore only a subset of all templates of the process type may be considered.
Last but not least, the "interface" of a process type may change between two versions, that is, templates of the same process type may have different input and output parameters. Therefore the "latest" template may be incompatible to the calling context.- Parameters:
session
- The session with which to retrieve the templates.processType
- The name of the process type of which to get the "latest" template.templMgr
- The template manager from which to retrieve the template.filtFactory
- The filter factory for creating the filters that apply to the templates.- Returns:
- The "latest" template of the designated process type from
the designated template manager. This is the instantiable top-level
template having the highest version number. If no template is found
for the designated process type,
null
will be returned.
-
aggregateSubprocessStatuses
public static ProcessConstants.NodeState aggregateSubprocessStatuses(SessionToken session, Collection<UUID> parallels, InstanceManager im)
Aggregates several instance execution statuses to the corresponding node state of the parent node.- Parameters:
session
- The session token for accessing the instance manager for retrieving the instance execution statuses.parallels
- The list of instances IDs of which to aggregate the instance execution statuses.im
- The subprocess manager to retrieve the subprocess instances from.- Returns:
- The aggregated execution status for all of the designated instances running in parallel.
- See Also:
aggregateStatus(SessionToken, Collection, InstanceManager)
,mapToNodeState(InstanceExecutionStatus)
-
aggregateStatus
public static ProcessConstants.InstanceExecutionStatus aggregateStatus(SessionToken session, Collection<UUID> parallels, InstanceManager im)
Aggregates several instance execution statuses to one, that is the designated subprocess instances (running in parallel) are retrieved from the designated subprocess manager instance and their execution statuses are aggregated. Instance execution statuses have the following priority:- IE_RUNNING
- IE_SOFTLY_SUSPENDED
- IE_SUSPENDED
- IE_SOFTLY_ABORTED
- IE_ABORTED
- IE_FINISHED
- Parameters:
session
- The session token for accessing the instance manager for retrieving the instance execution statuses.parallels
- The list of instances IDs of which to aggregate the instance execution statuses.im
- The subprocess manager to retrieve the subprocess instances from.- Returns:
- The aggregated execution status for all of the designated instances running in parallel.
-
mapToNodeState
public static ProcessConstants.NodeState mapToNodeState(ProcessConstants.InstanceExecutionStatus instanceExecutionStatus)
Maps an instance execution status to a node state. This is needed for setting the state of an LWP.- Parameters:
instanceExecutionStatus
- The instance execution status which to map to a corresponding node state.- Returns:
- The node state corresponding to the designated instance execution status.
-
templatesStored
public static boolean templatesStored(CheckReport checkReport, ADEPT2Service processManager)
Gets whether the designated check report indicates no problems and a successful storing (in the designated process manager). This depends on the check result and for process managers after15.0.0
also on the last report entry. Some checks may lead to a warning but this alone does not indicate whether storing has or has not been successful.- Parameters:
checkReport
- The check report of the template upload (attempt).processManager
- The process manager to which the templates have been uploaded (or not).- Returns:
- Whether the templates have been successfully uploaded as indicated by the designated check report.
-
-