Class ChangeOperationTools
- java.lang.Object
-
- de.aristaflow.adept2.core.changeoperations.ChangeOperationTools
-
public class ChangeOperationTools extends Object
A helper class with tools which are used by the change operations.
-
-
Constructor Summary
Constructors Constructor Description ChangeOperationTools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<ActivityConstants.AccessType,Map<ProcessModelParameter,ProcessConstants.DataMappingType>>
createParameterSystemValueMappingForNewEBP(ExecutableBusinessProcess ebp, Map<ActivityConstants.AccessType,List<ProcessModelParameter>> alreadyMappedParameters, ProcessConstants.DataMappingType initType)
Returns an initial mapping between still unmapped parameters and the system value given by initType.static Map<ActivityConstants.AccessType,Map<ProcessModelParameter,DataElement>>
createRandomisedParameterDataElementMappingForNewEBP(Template template, int nodeID, ExecutableBusinessProcess ebp)
Creates a mapping between the parameters of the given EBP and already existent data elements (where possible).static DataEdge
createSimpleDataEdgeObject(SessionToken session, ActivityConstants.AccessType type)
Creates a simple DataEdge container Objectstatic DataElement
createSimpleDataElementObject(SessionToken session, String name, ProcessConstants.AdeptDataType type)
Creates a simple DataElement container objectstatic Edge
createSimpleEdgeObject(SessionToken session, ProcessConstants.EdgeType type)
Creates a simple edge container object of the given typestatic Node
createSimpleNodeObject(SessionToken session)
Creates a simple node container objectstatic ProcessModelParameter
createSimpleProcessParameterObject(SessionToken session, String name, ProcessConstants.AdeptDataType type, String userDefinedType, boolean isVirtual, UUID identifierID, boolean isInputParameter)
Creates a simple process (in-/out-) parameter.static ProcessModelParameter
createSimpleProcessParameterObject(ProcessModelFactory pmf, String name, ProcessConstants.AdeptDataType type, String userDefinedType, boolean isVirtual, UUID identifierId, boolean isInputParameter)
Creates a simple process (in-/out-) parameter.static boolean
ebpEqualsAssignedEbp(Node node, ExecutableBusinessProcess ebp)
Returns true if the given EBP equals the EBP which has been assigned to the given node.static void
fireNodeStateChangedEvent(UpdateManager updateManager, Instance instance, Node node)
Fires updates for changed node statesstatic int
getClosestVisiblePred(Template template, int nodeId)
Gets the closest predecessor of the designated node that is not hidden.static int
getClosestVisibleSucc(Template template, int nodeId)
Gets the closest successor of the designated node that is not hidden.static Set<DataElement>
getCompliantConnectedDataElementsForParameter(ProcessModelParameter parameter, Template template, int nodeID, ActivityConstants.AccessType type)
Returns a set of compliant data elements for the given parameter which are connected to the given node (i.e there is a data edge between the node and the compliant data element) in the correct direction.static Set<DataElement>
getCompliantDataElements(Template templ, ProcessConstants.AdeptDataType type, UUID identifierID, boolean inclSysDes)
Returns the set of data elements, which are compatible to the given type and identifier for reading the data element.static Collection<DataElement>
getCompliantDataElements(Template templ, ProcessConstants.AdeptDataType type, UUID identifierID, int nodeId)
Gets the data elements that are compatible to the designated type and identifier for reading the data element.static Set<DataElement>
getCompliantUnConnectedDataElementsForParameter(ProcessModelParameter parameter, Template template, int nodeID, ActivityConstants.AccessType type)
Returns a set of compliant data elements for the given parameter which are not connected to the given node (i.e there is no data edge between the node and the compliant data element).static UpdateManager.ActivityProperties[]
getCorrespondingActivityProperties(ProcessConstants.ExecutableBusinessProcessProperty... ebpProperties)
Convert an array of ExecutableBusinessProcessProperty to an array of corresponding ActivityProperties.static UpdateManager.DataEdgeProperties[]
getCorrespondingDataEdgeProperties(ProcessConstants.DataEdgeProperty... dataEdgeProperties)
Convert an array ofDataEdgeProperty
to an array of correspondingDataEdgeProperties
.static UpdateManager.DataElementProperties[]
getCorrespondingDataElementProperties(ProcessConstants.DataElementProperty... dataElementProperties)
Convert an array of DataElementProperty to an array of corresponding DataElementProperties.static UpdateManager.NodeProperties[]
getCorrespondingNodeProperties(ProcessConstants.NodeProperty... nodeProperties)
Convert an array of NodeProperty to an array of corresponding NodeProperties.static Map<ActivityConstants.AccessType,Map<ProcessModelParameter,Integer>>
getParameterDataElementMappingForAlreadyAssignedEBP(Template template, int nodeID)
Returns an already existent mapping between parameters and existent data elements.static Map<ActivityConstants.AccessType,Map<ProcessModelParameter,ProcessConstants.DataMappingType>>
getParameterSystemValueMappingForAlreadyAssignedEBP(Template template, int nodeID)
Returns an already existent mapping between parameters and system values (e.g.static Set<Node>
getSavePredecessors(Template template, int nodeID)
Returns the set of nodes, which not null nodes and are predecessors of the given node and are executed on all circumstances (i.e. on all possible traces through the graph).
-
-
-
Method Detail
-
createSimpleNodeObject
public static Node createSimpleNodeObject(SessionToken session)
Creates a simple node container object- Parameters:
session
- The session which is used to check for access rights on this method.- Returns:
- a Node
-
createSimpleEdgeObject
public static Edge createSimpleEdgeObject(SessionToken session, ProcessConstants.EdgeType type)
Creates a simple edge container object of the given type- Parameters:
session
- The session which is used to check for access rights on this method.type
- the type of the edge- Returns:
- an Edge
-
createSimpleDataElementObject
public static DataElement createSimpleDataElementObject(SessionToken session, String name, ProcessConstants.AdeptDataType type)
Creates a simple DataElement container object- Parameters:
session
- The session which is used to check for access rights on this method.name
- the name of DataElementtype
- the AdeptDataType of the DataElement- Returns:
- a DataElement
-
createSimpleDataEdgeObject
public static DataEdge createSimpleDataEdgeObject(SessionToken session, ActivityConstants.AccessType type)
Creates a simple DataEdge container Object- Parameters:
session
- The session which is used to check for access rights on this method.type
- the AccessType of the Data Edge- Returns:
- a DataEdge
-
createSimpleProcessParameterObject
public static ProcessModelParameter createSimpleProcessParameterObject(SessionToken session, String name, ProcessConstants.AdeptDataType type, String userDefinedType, boolean isVirtual, UUID identifierID, boolean isInputParameter)
Creates a simple process (in-/out-) parameter.- Parameters:
session
- The session which is used to check for access rights on this method.name
- The name of the parameter that correspondence to the name of the connected data element.type
- The ADEPT2 data type the parameter should be of.userDefinedType
- The identifier of the UDF type if the type of the parameter is of UDT or null otherwise.isVirtual
- true if the parameter is virtualidentifierID
- The identifier that should be assigned to the parameter.isInputParameter
- Specifies if the parameter is an input (TRUE) or an output parameter (FALSE).- Returns:
- The parameter object configured with the given values.
-
createSimpleProcessParameterObject
public static ProcessModelParameter createSimpleProcessParameterObject(ProcessModelFactory pmf, String name, ProcessConstants.AdeptDataType type, String userDefinedType, boolean isVirtual, UUID identifierId, boolean isInputParameter)
Creates a simple process (in-/out-) parameter.- Parameters:
pmf
- The process model factory used to create the returned parameter.name
- The name of the parameter that correspondence to the name of the connected data element.type
- The ADEPT2 data type the parameter should be of.userDefinedType
- The identifier of the UDF type if the type of the parameter is of UDT or null otherwise.isVirtual
- true if the parameter is virtualidentifierId
- The identifier that should be assigned to the parameter.isInputParameter
- Specifies if the parameter is an input (TRUE) or an output parameter (FALSE).- Returns:
- The parameter object configured with the given values.
-
getCorrespondingNodeProperties
public static UpdateManager.NodeProperties[] getCorrespondingNodeProperties(ProcessConstants.NodeProperty... nodeProperties)
Convert an array of NodeProperty to an array of corresponding NodeProperties.- Parameters:
nodeProperties
-- Returns:
- The corresponding NodeProperties enums for the given NodeProperty enums
-
getCorrespondingDataElementProperties
public static UpdateManager.DataElementProperties[] getCorrespondingDataElementProperties(ProcessConstants.DataElementProperty... dataElementProperties)
Convert an array of DataElementProperty to an array of corresponding DataElementProperties.- Parameters:
dataElementProperties
-- Returns:
- The corresponding DataElementProperties enums for the given DataElementProperty enums
-
getCorrespondingDataEdgeProperties
public static UpdateManager.DataEdgeProperties[] getCorrespondingDataEdgeProperties(ProcessConstants.DataEdgeProperty... dataEdgeProperties)
Convert an array ofDataEdgeProperty
to an array of correspondingDataEdgeProperties
.- Parameters:
dataEdgeProperties
-- Returns:
- The corresponding
DataEdgeProperties
enums for the givenDataEdgeProperty
enums
-
getCorrespondingActivityProperties
public static UpdateManager.ActivityProperties[] getCorrespondingActivityProperties(ProcessConstants.ExecutableBusinessProcessProperty... ebpProperties)
Convert an array of ExecutableBusinessProcessProperty to an array of corresponding ActivityProperties.- Parameters:
ebpProperties
- the EBP properties- Returns:
- The corresponding ActivityProperties enums for the given ExecutableBusinessProcessProperty enums
-
getParameterDataElementMappingForAlreadyAssignedEBP
public static Map<ActivityConstants.AccessType,Map<ProcessModelParameter,Integer>> getParameterDataElementMappingForAlreadyAssignedEBP(Template template, int nodeID)
Returns an already existent mapping between parameters and existent data elements. Call this method if the EBP already has an existent mapping. If the given EBP should be assigned to the node for the first time call createRandomisedParameterDataElementMappingForNewEBP instead.- Parameters:
template
- the related templatenodeID
- the ID of the related node- Returns:
- a map which uses AccessType.READ/WRITE to specify if the inner map contains a mapping between input or output parameters and already existing data element IDs
-
getParameterSystemValueMappingForAlreadyAssignedEBP
public static Map<ActivityConstants.AccessType,Map<ProcessModelParameter,ProcessConstants.DataMappingType>> getParameterSystemValueMappingForAlreadyAssignedEBP(Template template, int nodeID)
Returns an already existent mapping between parameters and system values (e.g. NEW_DATAELEMENT, CONNECT_LATER, etc.). Call this method if the EBP already has an existent mapping. If the given EBP should be assigned to the node for the first time call createParameterSystemValueMappingForNewEBP instead.- Parameters:
template
- the related templatenodeID
- the ID of the related node- Returns:
- a map which uses AccessType.READ/WRITE to specify if the inner map contains a mapping between input or output parameters and system values
-
createRandomisedParameterDataElementMappingForNewEBP
public static Map<ActivityConstants.AccessType,Map<ProcessModelParameter,DataElement>> createRandomisedParameterDataElementMappingForNewEBP(Template template, int nodeID, ExecutableBusinessProcess ebp)
Creates a mapping between the parameters of the given EBP and already existent data elements (where possible). Note: The method returns only those parameters which could be mapped to a compliant data element, i.e. there could be parameters of the EBP which are still unmapped.- Parameters:
template
- the related templatenodeID
- the id of the related nodeebp
- the EBP which should be assigned to the node- Returns:
- a map which uses AccessType.READ/WRITE to specify if the inner map contains a mapping between input or output parameters and data elements
-
createParameterSystemValueMappingForNewEBP
public static Map<ActivityConstants.AccessType,Map<ProcessModelParameter,ProcessConstants.DataMappingType>> createParameterSystemValueMappingForNewEBP(ExecutableBusinessProcess ebp, Map<ActivityConstants.AccessType,List<ProcessModelParameter>> alreadyMappedParameters, ProcessConstants.DataMappingType initType)
Returns an initial mapping between still unmapped parameters and the system value given by initType. Thereby the method excludes all parameters which are given in the alreadyMappedParameter argument.- Parameters:
ebp
- the EBP which is to be assigned to the node with the given idalreadyMappedParameters
- a map of already mapped parametersinitType
- the data mapping type to which the parameters should be mapped- Returns:
- a map which uses AccessType.READ/WRITE to specify if the inner map contains a mapping between input or output parameters and system values
-
getCompliantConnectedDataElementsForParameter
public static Set<DataElement> getCompliantConnectedDataElementsForParameter(ProcessModelParameter parameter, Template template, int nodeID, ActivityConstants.AccessType type)
Returns a set of compliant data elements for the given parameter which are connected to the given node (i.e there is a data edge between the node and the compliant data element) in the correct direction. Compliance is defined as follows: A data element is compliant to a parameter if the following attributes are equal: 1. type, 2. virtual attribute, and 3. identifier id. Also it is compliant if 1. and 2. are equal and the identifier id of a data element is UNIVERSAL_IDENTIFIER_ID or IDENTIFIER_NOT_SET. Furthermore a special case have to be treated: If the type is USERDEFINED the user defined types must be equal.- Parameters:
parameter
- the parametertemplate
- the related templatenodeID
- the id of the nodetype
- the type of the parameter input (READ) or output (WRITE)- Returns:
- an unmodifiable set of compliant, and to the node connected data elements
-
getCompliantUnConnectedDataElementsForParameter
public static Set<DataElement> getCompliantUnConnectedDataElementsForParameter(ProcessModelParameter parameter, Template template, int nodeID, ActivityConstants.AccessType type)
Returns a set of compliant data elements for the given parameter which are not connected to the given node (i.e there is no data edge between the node and the compliant data element). Compliance Definition:getCompliantConnectedDataElementsForParameter(ProcessModelParameter, Template, int, AccessType)
- Parameters:
parameter
- the parametertemplate
- the related templatenodeID
- the id of the nodetype
- the type of the parameter input (READ) or output (WRITE)- Returns:
- an unmodifiable set of compliant but unconnected data elements
-
ebpEqualsAssignedEbp
public static boolean ebpEqualsAssignedEbp(Node node, ExecutableBusinessProcess ebp)
Returns true if the given EBP equals the EBP which has been assigned to the given node.- Parameters:
node
- the node whose EBP is compared to the given EBPebp
- the EBP which is to be compared to the EBP of the given node- Returns:
- true if the given EBP equals the assigned EBP of the node
-
fireNodeStateChangedEvent
public static void fireNodeStateChangedEvent(UpdateManager updateManager, Instance instance, Node node)
Fires updates for changed node states- Parameters:
updateManager
- the update manager which is to be informedinstance
- the related instancenode
- the node whose state changed
-
getCompliantDataElements
public static Set<DataElement> getCompliantDataElements(Template templ, ProcessConstants.AdeptDataType type, UUID identifierID, boolean inclSysDes)
Returns the set of data elements, which are compatible to the given type and identifier for reading the data element.- Parameters:
templ
- The process template.type
- The data type.identifierID
- The identifier ID or null for any identifier.inclSysDes
- true, to include system data elements- Returns:
- The set of data elements, which are compatible to the given type and identifier.
-
getCompliantDataElements
public static Collection<DataElement> getCompliantDataElements(Template templ, ProcessConstants.AdeptDataType type, UUID identifierID, int nodeId)
Gets the data elements that are compatible to the designated type and identifier for reading the data element. This excludes all system data elements except for the system data elements (system-)accessed by the designated node.- Parameters:
templ
- The process template from which to get all compliant data elements.type
- The data type (of the data element) to read.identifierID
- The identifier ID (of the data element) to read ornull
for any identifier.nodeId
- The ID of the node for which system data elements are allowed, that is, all system data elements are compliant that are system-accessed by this node. All other system data elements will be excluded. If this isCommonConstants.INT_ID_NOT_EXISTING
, no system data element will be considered compliant.- Returns:
- The data elements which are compatible to the designated type and identifier and which are not system data elements (except for the designated node).
-
getSavePredecessors
public static Set<Node> getSavePredecessors(Template template, int nodeID)
Returns the set of nodes, which not null nodes and are predecessors of the given node and are executed on all circumstances (i.e. on all possible traces through the graph).- Parameters:
template
- The process template.nodeID
- The ID of the node.- Returns:
- The set of nodes, which are executed before the given node on any circumstance and are not null nodes.
-
getClosestVisiblePred
public static int getClosestVisiblePred(Template template, int nodeId)
Gets the closest predecessor of the designated node that is not hidden.- Parameters:
template
- The template containing the node.nodeId
- The node for which to get the closest predecessor that is not hidden.- Returns:
- The ID of the first predecessor of the designated node that is not hidden.
-
getClosestVisibleSucc
public static int getClosestVisibleSucc(Template template, int nodeId)
Gets the closest successor of the designated node that is not hidden.- Parameters:
template
- The template containing the node.nodeId
- The node for which to get the closest successor that is not hidden.- Returns:
- The ID of the first successor of the designated node that is not hidden.
-
-