Class AbstractWrappingTemplate
- java.lang.Object
-
- de.aristaflow.adept2.model.processmodel.AbstractWrappingTemplate
-
- All Implemented Interfaces:
LocalisedString,PluginDataContainer,UserAttributeContainer,Template,Serializable
- Direct Known Subclasses:
IDWrappingTemplate
public abstract class AbstractWrappingTemplate extends Object implements Template
Abstract implementation for wrapping a template object.- Author:
- Kevin Goeser
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractWrappingTemplate(Template template)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ConfigurationgetConfiguration()Gets the configuration of this process template that corresponds to theconfiguration description.ConfigurationDescriptiongetConfigurationDescription()Gets the configuration description for this process template, that is a description of all configuration values that are needed or supported in the configuration.intgetConnector(int nodeID, int dataElementID, ActivityConstants.AccessType dataEdgeType)Returns the connector of the given node which accesses the given data element (reading or writing).DataEdgegetDataEdge(int nodeID, int dataElementID, ActivityConstants.AccessType type)Returns the data edge which is identified by the given node, the data element and the direction (reading or writing).Set<StructuredDataEdge>getDataEdgeStructure()Convenient method which returns all data edges including their structural data.DataElementgetDataElement(int dataElementID)Returns the data element with the given ID.DataElementgetDataElement(int nodeID, int connector)The data element which is associated to the given node and the given connector of the node.Set<DataElement>getDataElements()Returns all data elements of the template.int[]getDataElementsForNode(int nodeId, ActivityConstants.AccessType... accessType)Gets the IDs of all data elements which are accessed by the designated node with the designated access types.TemplateDeltaLayergetDeltaLayer()Returns the delta layer of the template.StringgetDescription()Returns the description of the process.int[]getDisabledConnectors(int nodeID, ActivityConstants.AccessType accessType)(needs to be stored)EdgegetEdge(int srcNodeID, int destNodeID, ProcessConstants.EdgeType type)Returns the edge which is identified by the given source nodeID, destination nodeID and the edge type.Set<StructuredEdge>getEdgeStructure(ProcessConstants.EdgeType... edgeTypes)Convenient method which returns all edges including their structural data.NodegetEndNode()Returns the end node of the process.UUIDgetID()Returns the ID of the template.StringgetInstanceNameTemplate()Gets a (string) template for the name of instances created on this process template.int[]getMinBlock(Set<Node> nodes)Returns the minimal block of the given set of nodes.StringgetName()Returns the name of the process.NodegetNode(int nodeID)Returns the node with the given ID.intgetNodeBranchID(int nodeID)Returns the ID of the branch the given node belongs to.intgetNodeCorrespondingBlockNodeID(int nodeID)Returns the ID of the corresponding block node.
There are always two nodes in a block which are the first and the last node of the block.intgetNodeIDForTopologicalID(int topologicalNodeID)Returns the static node ID for the given topological node ID.int[]getNodeIDsInArea(int first, int last, boolean includeBlocks)Returns the IDs of the nodes which are in the area given by the ID of a first and a last node on a branch.int[]getNodeIDsWithActivityTemplate(UUID activityTemplateVersionID)Returns all nodes which are linked with the given activity.Set<Node>getNodes()Returns a set of all nodes which are in the template.int[]getNodesForDataElement(int deId, ActivityConstants.AccessType... accessType)Gets the IDs of all nodes accessing the designated data element with the designated access types.intgetNodeSplitNodeID(int nodeID)Returns the ID of the first split node of the branch of the given node, following the control flow backward.intgetNodeTopologicalID(int nodeID)Returns corresponding topological ID of the node.ProcessConstants.NodeTypegetNodeType(int nodeID)Returns the constant representing the type of the designated node.Set<ProcessModelParameter>getParameters(ActivityConstants.AccessType accessType)Returns the input or output parameters of the process.PluginDatagetPluginData(String pluginID)Returns the plug-in data object for the given plug-in ID, or null if the plug-in is not in the set of supported plug-ins.Map<String,PluginData>getPluginDatas()Returns a map from the ID of a plug-in to the plug-in data objects.int[]getPredByEdgeType(int nodeID, ProcessConstants.EdgeType... type)Returns the IDs of the nodes, which are direct predecessors of the node, using edges of the given types.StringgetProcessType()Returns the process type, which is a short term which kind of schema this template represents.NodegetStartNode()Returns the start node of the process.int[]getSuccByEdgeType(int nodeID, ProcessConstants.EdgeType... type)Returns the IDs of the nodes, which are direct successors of the node, following edges of the given types.QualifiedAgentgetSupervisorAgent()Returns the supervisor agent of the process template.Map<String,Set<String>>getSupportedPlugins()Returns a map from the ID of an extension point to the IDs of the plug-ins within the extension point.ConfigurationgetTestConfiguration()Gets the (stand-alone) test configuration of this process template.int[]getUnconnectedConnectors(int nodeID, ActivityConstants.AccessType dataEdgeType)(convenience method, calculated on the fly)Map<String,String>getUserAttributes()Returns all user attributes as map, the key of the map is the name of the attribute.StringgetUserAttributeValue(String attributeName)Returns the value of the user attribute.StringgetVersion()Returns the logic version of the template, which distinguishes between, for instance, the major and minor versions (1.1.x vs.booleanisTransPredOf(int currentNodeID, int potentialPredecessorID, ProcessConstants.EdgeType... edgeType)Returns true, if this node is a (transitive) predecessor of the given node, respecting the given edge type.voidremoveUserAttributeValue(String attributeName)Deprecated.voidsetUserAttributeValue(String attributeName, String attributeValue)Deprecated.ObjecttoLocalisedString(LocalisationFactory locFac, Locale loc)Gets the localised representation of the implementing object.
-
-
-
Field Detail
-
template
protected final Template template
The wrapped template.
-
-
Constructor Detail
-
AbstractWrappingTemplate
protected AbstractWrappingTemplate(Template template)
Default constructor.- Parameters:
template-
-
-
Method Detail
-
getDataElementsForNode
public int[] getDataElementsForNode(int nodeId, ActivityConstants.AccessType... accessType)Description copied from interface:TemplateGets the IDs of all data elements which are accessed by the designated node with the designated access types.- Specified by:
getDataElementsForNodein interfaceTemplate- Parameters:
nodeId- The ID of the node which accesses the data elements.accessType- The types of access of the node (e.g. reading and/or writing).- Returns:
- The IDs of all data elements which are accessed by the node.
-
getNodesForDataElement
public int[] getNodesForDataElement(int deId, ActivityConstants.AccessType... accessType)Description copied from interface:TemplateGets the IDs of all nodes accessing the designated data element with the designated access types.- Specified by:
getNodesForDataElementin interfaceTemplate- Parameters:
deId- The ID of the data element which is accessed.accessType- The types of access of the node (e.g. reading and/or writing).- Returns:
- The IDs of the nodes which access the designated data element.
-
getConfiguration
public Configuration getConfiguration()
Description copied from interface:TemplateGets the configuration of this process template that corresponds to theconfiguration description. All mandatory configuration entries need to have an appropriate value. These configuration also needs to provide values for mandatory configuration values of activities that are retrieved from the process configuration (seeActivityConfiguration).- Specified by:
getConfigurationin interfaceTemplate- Returns:
- The configuration values set for this process template based on the configuration description and providing all values for all mandatory entries.
-
getConfigurationDescription
public ConfigurationDescription getConfigurationDescription()
Description copied from interface:TemplateGets the configuration description for this process template, that is a description of all configuration values that are needed or supported in the configuration. This also provides whether a configuration value is mandatory and its type.- Specified by:
getConfigurationDescriptionin interfaceTemplate- Returns:
- The description for all configuration values of this process template, that is, the name of the configuration entries, their type and whether they are mandatory.
-
getTestConfiguration
public Configuration getTestConfiguration()
Description copied from interface:TemplateGets the (stand-alone) test configuration of this process template. These configuration values only apply when the process template is executed in test mode, that is the operation is provided this configuration instead of the normal configuration. This test configuration is already merged with thenormal (merged) configuration. Note that the test configuration allows to override fixed values of the normal configuration.- Specified by:
getTestConfigurationin interfaceTemplate- Returns:
- The configuration values set for the test mode of the operation of this process template providing all values for all mandatory entries. This will also contain the values of the normal (merged) configuration.
-
getConnector
public int getConnector(int nodeID, int dataElementID, ActivityConstants.AccessType dataEdgeType)Description copied from interface:TemplateReturns the connector of the given node which accesses the given data element (reading or writing). SeeNodefor further details.- Specified by:
getConnectorin interfaceTemplate- Parameters:
nodeID- The ID of the node.dataElementID- The ID of the data element.dataEdgeType- The type of the data edge which is connected to the returned connector.- Returns:
- The connector which is represented by its ID or
CommonConstants.INT_ID_NOT_EXISTING.
-
getDataEdge
public DataEdge getDataEdge(int nodeID, int dataElementID, ActivityConstants.AccessType type)
Description copied from interface:TemplateReturns the data edge which is identified by the given node, the data element and the direction (reading or writing). If the template does not contain the specified data-edge, the method returns null.- Specified by:
getDataEdgein interfaceTemplate- Parameters:
nodeID- The node which reads or writes the data element.dataElementID- The data element being accessed by the node.type- The access type of the node (reading, or writing)- Returns:
- The described data edge.
-
getDataEdgeStructure
public Set<StructuredDataEdge> getDataEdgeStructure()
Description copied from interface:TemplateConvenient method which returns all data edges including their structural data. This method is intended e.g. to easily export the data.- Specified by:
getDataEdgeStructurein interfaceTemplate- Returns:
- All data edges including structural data.
-
getDataElement
public DataElement getDataElement(int dataElementID)
Description copied from interface:TemplateReturns the data element with the given ID. If the template does not contain a data element with the given id, the method returns null.- Specified by:
getDataElementin interfaceTemplate- Parameters:
dataElementID- The ID of the data element.- Returns:
- The data element with the given ID.
-
getDataElement
public DataElement getDataElement(int nodeID, int connector)
Description copied from interface:TemplateThe data element which is associated to the given node and the given connector of the node. For further detail concerning the connector, please refer toNode. If the template does not contain a data element specified by nodeID and connector, the method returns null.- Specified by:
getDataElementin interfaceTemplate- Parameters:
nodeID- The node which accesses the data element.connector- The connector of the given node, which is associated with the data element.- Returns:
- The associated data element.
-
getDataElements
public Set<DataElement> getDataElements()
Description copied from interface:TemplateReturns all data elements of the template.- Specified by:
getDataElementsin interfaceTemplate- Returns:
- All data elements of the template.
-
getDeltaLayer
public TemplateDeltaLayer getDeltaLayer()
Description copied from interface:TemplateReturns the delta layer of the template. The delta layer stores the differences between two template versions. See the description ofTemplateDeltaLayerfor further detail.- Specified by:
getDeltaLayerin interfaceTemplate- Returns:
- The delta layer of the template.
-
getDisabledConnectors
public int[] getDisabledConnectors(int nodeID, ActivityConstants.AccessType accessType)Description copied from interface:Template(needs to be stored)- Specified by:
getDisabledConnectorsin interfaceTemplate- Parameters:
nodeID- The ID of the node.accessType- The activity related access type that could be disabled- Returns:
- An array of connectors of the given node, which have been disabled by the user. Only activity related connectors could be disabled, connectors of system access types will never be disabled.
-
getEdge
public Edge getEdge(int srcNodeID, int destNodeID, ProcessConstants.EdgeType type)
Description copied from interface:TemplateReturns the edge which is identified by the given source nodeID, destination nodeID and the edge type. If the template does not contain the specified edge, the method returns null.
-
getEdgeStructure
public Set<StructuredEdge> getEdgeStructure(ProcessConstants.EdgeType... edgeTypes)
Description copied from interface:TemplateConvenient method which returns all edges including their structural data. This method is intended e.g. to easily export the data.- Specified by:
getEdgeStructurein interfaceTemplate- Parameters:
edgeTypes- The edge types to consider.- Returns:
- All edges including structural data.
-
getEndNode
public Node getEndNode()
Description copied from interface:TemplateReturns the end node of the process.- Specified by:
getEndNodein interfaceTemplate- Returns:
- The end node of the process.
-
getID
public UUID getID()
Description copied from interface:TemplateReturns the ID of the template. The ID is system-wide unique.
-
getInstanceNameTemplate
public String getInstanceNameTemplate()
Description copied from interface:TemplateGets a (string) template for the name of instances created on this process template. When instantiating this template, the variables in the returned string are replaced and the result is used as the name of the created process instance. Note that this name usually does have variables referring to data elements but this is not necessary. A statically defined instance name is also fine.
If this instance name template is not set at all, the method returns null and during execution a default value is used.- Specified by:
getInstanceNameTemplatein interfaceTemplate- Returns:
- A string as a template for the names of the process instance of this process template, or null if not set.
-
getMinBlock
public int[] getMinBlock(Set<Node> nodes)
Description copied from interface:TemplateReturns the minimal block of the given set of nodes. TODO add description / image (or refer to a description)- Specified by:
getMinBlockin interfaceTemplate- Parameters:
nodes- The set of nodes, the minimal block will be build upon.- Returns:
- The start and end node id of the corresponding minimal block.
-
getName
public String getName()
Description copied from interface:TemplateReturns the name of the process.
-
getDescription
public String getDescription()
Description copied from interface:TemplateReturns the description of the process. This may benull.- Specified by:
getDescriptionin interfaceTemplate- Returns:
- The description of the process or
null.
-
getNode
public Node getNode(int nodeID)
Description copied from interface:TemplateReturns the node with the given ID. If the template does not contain a node with the given id, the method returns null.
-
getNodeBranchID
public int getNodeBranchID(int nodeID)
Description copied from interface:TemplateReturns the ID of the branch the given node belongs to. Different branches occur by a split node which separates the control flow into two new branches.- Specified by:
getNodeBranchIDin interfaceTemplate- Parameters:
nodeID- The id of the node.- Returns:
- The id of the branch.
-
getNodeCorrespondingBlockNodeID
public int getNodeCorrespondingBlockNodeID(int nodeID)
Description copied from interface:TemplateReturns the ID of the corresponding block node.
There are always two nodes in a block which are the first and the last node of the block. E.g. the node which represents an and-split, and the the one which represents an and-join (same for other block building nodes). If, and only if, the current node builds a block (e.g. split or join), this function returns the corresponding block building node at the other end. Nodes subject to have a corresponding block node: split, join, loop.- Specified by:
getNodeCorrespondingBlockNodeIDin interfaceTemplate- Parameters:
nodeID- The id of the node.- Returns:
- The ID of the corresponding block node.
-
getNodeIDForTopologicalID
public int getNodeIDForTopologicalID(int topologicalNodeID)
Description copied from interface:TemplateReturns the static node ID for the given topological node ID. This is the inverse ofTemplate.getNodeTopologicalID(int).- Specified by:
getNodeIDForTopologicalIDin interfaceTemplate- Parameters:
topologicalNodeID- The topological ID of the node.- Returns:
- The (static) node ID for the given topological node ID.
-
getNodeIDsInArea
public int[] getNodeIDsInArea(int first, int last, boolean includeBlocks)Description copied from interface:TemplateReturns the IDs of the nodes which are in the area given by the ID of a first and a last node on a branch. If the parameter includeBlocks is set to true, the result set will contain the nodes which are on block within the given area. Else, it will only contain nodes on the same branch (i.e. nodes having the same branch ID). Note: First and last node must be on the same branch, i.e. their branch ID must be the same. Otherwise, an IllegalArgumentException may be thrown. Node: The area is returned excluding the boundaries: (first,last).- Specified by:
getNodeIDsInAreain interfaceTemplate- Parameters:
first- The first node of the area.last- The last node of the area.includeBlocks- If true, the result includes nodes on blocks which are in the area, too.- Returns:
- All IDs of nodes in the given area.
-
getNodeIDsWithActivityTemplate
public int[] getNodeIDsWithActivityTemplate(UUID activityTemplateVersionID)
Description copied from interface:TemplateReturns all nodes which are linked with the given activity.- Specified by:
getNodeIDsWithActivityTemplatein interfaceTemplate- Parameters:
activityTemplateVersionID- The ID of the activity template.- Returns:
- The ids of all nodes which are linked with the given activity.
-
getNodeSplitNodeID
public int getNodeSplitNodeID(int nodeID)
Description copied from interface:TemplateReturns the ID of the first split node of the branch of the given node, following the control flow backward. I.e. the node which is the "starter" of the branch of the current stored in the template and does not need to be calculated dynamically. TODO attach image- Specified by:
getNodeSplitNodeIDin interfaceTemplate- Parameters:
nodeID- The id of the node.- Returns:
- The ID of the first split node following the control flow backward.
-
getNodeTopologicalID
public int getNodeTopologicalID(int nodeID)
Description copied from interface:TemplateReturns corresponding topological ID of the node. The topological sorting is used to have a unambiguously ID within the graph. It counts from left to right and from top to down in case of split nodes.- Specified by:
getNodeTopologicalIDin interfaceTemplate- Parameters:
nodeID- The (static) ID of the node.- Returns:
- The topological ID of the node.
-
getNodeType
public ProcessConstants.NodeType getNodeType(int nodeID)
Description copied from interface:TemplateReturns the constant representing the type of the designated node.- Specified by:
getNodeTypein interfaceTemplate- Parameters:
nodeID- The ID of the node.- Returns:
- The type of the node, for instance Start, End, Split or Join.
- See Also:
ProcessConstants.NodeType
-
getNodes
public Set<Node> getNodes()
Description copied from interface:TemplateReturns a set of all nodes which are in the template.
-
getParameters
public Set<ProcessModelParameter> getParameters(ActivityConstants.AccessType accessType)
Description copied from interface:TemplateReturns the input or output parameters of the process. The actual content of the set depends on the parameter accessType which determines, if the parameters for READ or WRITE access are required.- Specified by:
getParametersin interfaceTemplate- Parameters:
accessType- the type of the parameter, i.e. READ or WRITE access- Returns:
- The input or output parameters.
-
getPredByEdgeType
public int[] getPredByEdgeType(int nodeID, ProcessConstants.EdgeType... type)Description copied from interface:TemplateReturns the IDs of the nodes, which are direct predecessors of the node, using edges of the given types. If no edge type is given, any kind of edge is considered.- Specified by:
getPredByEdgeTypein interfaceTemplate- Parameters:
nodeID- The ID of the node.type- The edge types to consider.- Returns:
- A List of nodes.
- See Also:
Node
-
getProcessType
public String getProcessType()
Description copied from interface:TemplateReturns the process type, which is a short term which kind of schema this template represents. This may benull.- Specified by:
getProcessTypein interfaceTemplate- Returns:
- The type of the process, the template is representing or
null.
-
getStartNode
public Node getStartNode()
Description copied from interface:TemplateReturns the start node of the process.- Specified by:
getStartNodein interfaceTemplate- Returns:
- The start node of the process.
-
getSuccByEdgeType
public int[] getSuccByEdgeType(int nodeID, ProcessConstants.EdgeType... type)Description copied from interface:TemplateReturns the IDs of the nodes, which are direct successors of the node, following edges of the given types. If no edge type is given, any kind of edge is considered.- Specified by:
getSuccByEdgeTypein interfaceTemplate- Parameters:
nodeID- The ID of the node.type- The edge types to consider.- Returns:
- A set of nodes.
- See Also:
ProcessConstants.EdgeType
-
getSupervisorAgent
public QualifiedAgent getSupervisorAgent()
Description copied from interface:TemplateReturns the supervisor agent of the process template.- Specified by:
getSupervisorAgentin interfaceTemplate- Returns:
- The supervisor agent of the process template.
-
getUnconnectedConnectors
public int[] getUnconnectedConnectors(int nodeID, ActivityConstants.AccessType dataEdgeType)Description copied from interface:Template(convenience method, calculated on the fly)- Specified by:
getUnconnectedConnectorsin interfaceTemplate- Parameters:
nodeID- The ID of the node.dataEdgeType- The type of the data edge which need to be connected.- Returns:
- An array of connectors of a node, which still need to be connected.
-
getVersion
public String getVersion()
Description copied from interface:TemplateReturns the logic version of the template, which distinguishes between, for instance, the major and minor versions (1.1.x vs. 1.x.y). The version has merely a semantic meaning. This may benull.- Specified by:
getVersionin interfaceTemplate- Returns:
- A string representing a logical version number to be able to distinguish between minor
and major changes or
null.
-
isTransPredOf
public boolean isTransPredOf(int currentNodeID, int potentialPredecessorID, ProcessConstants.EdgeType... edgeType)Description copied from interface:TemplateReturns true, if this node is a (transitive) predecessor of the given node, respecting the given edge type. If no edge type is given, any kind of edge is considered (at the moment control and sync-edges only).- Specified by:
isTransPredOfin interfaceTemplate- Parameters:
currentNodeID- The node.potentialPredecessorID- The potential predecessor.edgeType- The edge types to consider.- Returns:
- True, if this node is a predecessor of the given node.
-
getPluginData
public PluginData getPluginData(String pluginID)
Description copied from interface:PluginDataContainerReturns the plug-in data object for the given plug-in ID, or null if the plug-in is not in the set of supported plug-ins.- Specified by:
getPluginDatain interfacePluginDataContainer- Parameters:
pluginID- The ID of the plug-in, the data object has been requested for.- Returns:
- The plug-in data of the plug-in specified by its ID or null.
-
getPluginDatas
public Map<String,PluginData> getPluginDatas()
Description copied from interface:PluginDataContainerReturns a map from the ID of a plug-in to the plug-in data objects.- Specified by:
getPluginDatasin interfacePluginDataContainer- Returns:
- An unmodifiable map from plug-in IDs to plug-in data objects.
-
getSupportedPlugins
public Map<String,Set<String>> getSupportedPlugins()
Description copied from interface:PluginDataContainerReturns a map from the ID of an extension point to the IDs of the plug-ins within the extension point.- Specified by:
getSupportedPluginsin interfacePluginDataContainer- Returns:
- An unmodifiable map from extension point IDs to plug-in IDs.
-
getUserAttributes
public Map<String,String> getUserAttributes()
Description copied from interface:UserAttributeContainerReturns all user attributes as map, the key of the map is the name of the attribute. Do not change the returned map even if it is modifiable. Implementations will usually return a copy of the map. SeeUserAttributeContainer.setUserAttributeValue(String, String)andUserAttributeContainer.removeUserAttributeValue(String)on how to change user attributes.- Specified by:
getUserAttributesin interfaceUserAttributeContainer- Returns:
- A (copy of the) map with all user defined attributes.
-
getUserAttributeValue
public String getUserAttributeValue(String attributeName)
Description copied from interface:UserAttributeContainerReturns the value of the user attribute.- Specified by:
getUserAttributeValuein interfaceUserAttributeContainer- Parameters:
attributeName- The name of the user attribute.- Returns:
- The value of the user attribute.
-
removeUserAttributeValue
@Deprecated public void removeUserAttributeValue(String attributeName)
Deprecated.Description copied from interface:UserAttributeContainerRemoves the user attribute with the given name.This method must not be called directly! Use the change primitive of the corresponding model instead! In case of the process model, refer to
ChangePrimitives.updateUserAttribute(UserAttributeContainer, String, String).- Specified by:
removeUserAttributeValuein interfaceUserAttributeContainer- Parameters:
attributeName- The key of the value to remove.
-
setUserAttributeValue
@Deprecated public void setUserAttributeValue(String attributeName, String attributeValue)
Deprecated.Description copied from interface:UserAttributeContainerSet the value of an user attribute.This method must not be called directly! Use the change primitive of the corresponding model instead! In case of the process model, refer to
ChangePrimitives.updateUserAttribute(UserAttributeContainer, String, String).- Specified by:
setUserAttributeValuein interfaceUserAttributeContainer- Parameters:
attributeName- The name of the attribute.attributeValue- The new value of the attribute.
-
toLocalisedString
public Object toLocalisedString(LocalisationFactory locFac, Locale loc)
Description copied from interface:LocalisedStringGets the localised representation of the implementing object. The localisation should be for the designated locale, model objects beingLocalisedshould use the designated localisation factory for automatic localisation.- Specified by:
toLocalisedStringin interfaceLocalisedString- Parameters:
locFac- The localisation factory to be used byLocalisedmodel objects. If this isnull, do not localise the usedLocalisedattributes.loc- The locale for which to get the localised string. If this isnull, treat it likeLocale.ROOThas been requested.- Returns:
- The localised (string) representation of the implementing object for the designated locale using the designated localisation factory if appropriate.
-
-