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:
  • Field Details

    • template

      protected final Template template
      The wrapped template.
  • Constructor Details

    • AbstractWrappingTemplate

      protected AbstractWrappingTemplate(Template template)
      Default constructor.
      Parameters:
      template -
  • Method Details

    • getDataElementsForNode

      public int[] getDataElementsForNode(int nodeId, ActivityConstants.AccessType... accessType)
      Description copied from interface: Template
      Gets the IDs of all data elements which are accessed by the designated node with the designated access types.
      Specified by:
      getDataElementsForNode in interface Template
      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: Template
      Gets the IDs of all nodes accessing the designated data element with the designated access types.
      Specified by:
      getNodesForDataElement in interface Template
      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: Template
      Gets the configuration of this process template that corresponds to the configuration 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 (see ActivityConfiguration).
      Specified by:
      getConfiguration in interface Template
      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: Template
      Gets 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:
      getConfigurationDescription in interface Template
      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: Template
      Gets 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 the normal (merged) configuration. Note that the test configuration allows to override fixed values of the normal configuration.
      Specified by:
      getTestConfiguration in interface Template
      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: Template
      Returns the connector of the given node which accesses the given data element (reading or writing). See Node for further details.
      Specified by:
      getConnector in interface Template
      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: Template
      Returns 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:
      getDataEdge in interface Template
      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: Template
      Convenient method which returns all data edges including their structural data. This method is intended e.g. to easily export the data.
      Specified by:
      getDataEdgeStructure in interface Template
      Returns:
      All data edges including structural data.
    • getDataElement

      public DataElement getDataElement(int dataElementID)
      Description copied from interface: Template
      Returns 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:
      getDataElement in interface Template
      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: Template
      The data element which is associated to the given node and the given connector of the node. For further detail concerning the connector, please refer to Node. If the template does not contain a data element specified by nodeID and connector, the method returns null.
      Specified by:
      getDataElement in interface Template
      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: Template
      Returns all data elements of the template.
      Specified by:
      getDataElements in interface Template
      Returns:
      All data elements of the template.
    • getDeltaLayer

      public TemplateDeltaLayer getDeltaLayer()
      Description copied from interface: Template
      Returns the delta layer of the template. The delta layer stores the differences between two template versions. See the description of TemplateDeltaLayer for further detail.
      Specified by:
      getDeltaLayer in interface Template
      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:
      getDisabledConnectors in interface Template
      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: Template
      Returns 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.
      Specified by:
      getEdge in interface Template
      Parameters:
      srcNodeID - The source node of the edge.
      destNodeID - The destination node of the edge.
      type - The type of the edge, e.g. control edge.
      Returns:
      The edge identified by the argument.
    • getEdgeStructure

      public Set<StructuredEdge> getEdgeStructure(ProcessConstants.EdgeType... edgeTypes)
      Description copied from interface: Template
      Convenient method which returns all edges including their structural data. This method is intended e.g. to easily export the data.
      Specified by:
      getEdgeStructure in interface Template
      Parameters:
      edgeTypes - The edge types to consider.
      Returns:
      All edges including structural data.
    • getEndNode

      public Node getEndNode()
      Description copied from interface: Template
      Returns the end node of the process.
      Specified by:
      getEndNode in interface Template
      Returns:
      The end node of the process.
    • getID

      public UUID getID()
      Description copied from interface: Template
      Returns the ID of the template. The ID is system-wide unique.
      Specified by:
      getID in interface Template
      Returns:
      The template id.
    • getInstanceNameTemplate

      public String getInstanceNameTemplate()
      Description copied from interface: Template
      Gets 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:
      getInstanceNameTemplate in interface Template
      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: Template
      Returns the minimal block of the given set of nodes. TODO add description / image (or refer to a description)
      Specified by:
      getMinBlock in interface Template
      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: Template
      Returns the name of the process.
      Specified by:
      getName in interface Template
      Returns:
      The name of the process.
    • getDescription

      public String getDescription()
      Description copied from interface: Template
      Returns the description of the process. This may be null.
      Specified by:
      getDescription in interface Template
      Returns:
      The description of the process or null.
    • getNode

      public Node getNode(int nodeID)
      Description copied from interface: Template
      Returns the node with the given ID. If the template does not contain a node with the given id, the method returns null.
      Specified by:
      getNode in interface Template
      Parameters:
      nodeID - The id of the node.
      Returns:
      The node with the given ID.
    • getNodeBranchID

      public int getNodeBranchID(int nodeID)
      Description copied from interface: Template
      Returns 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:
      getNodeBranchID in interface Template
      Parameters:
      nodeID - The id of the node.
      Returns:
      The id of the branch.
    • getNodeCorrespondingBlockNodeID

      public int getNodeCorrespondingBlockNodeID(int nodeID)
      Description copied from interface: Template
      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. 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:
      getNodeCorrespondingBlockNodeID in interface Template
      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: Template
      Returns the static node ID for the given topological node ID. This is the inverse of Template.getNodeTopologicalID(int).
      Specified by:
      getNodeIDForTopologicalID in interface Template
      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: Template
      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. 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:
      getNodeIDsInArea in interface Template
      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: Template
      Returns all nodes which are linked with the given activity.
      Specified by:
      getNodeIDsWithActivityTemplate in interface Template
      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: Template
      Returns 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:
      getNodeSplitNodeID in interface Template
      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: Template
      Returns 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:
      getNodeTopologicalID in interface Template
      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: Template
      Returns the constant representing the type of the designated node.
      Specified by:
      getNodeType in interface Template
      Parameters:
      nodeID - The ID of the node.
      Returns:
      The type of the node, for instance Start, End, Split or Join.
      See Also:
    • getNodes

      public Set<Node> getNodes()
      Description copied from interface: Template
      Returns a set of all nodes which are in the template.
      Specified by:
      getNodes in interface Template
      Returns:
      All nodes of the graph.
    • getParameters

      public Set<ProcessModelParameter> getParameters(ActivityConstants.AccessType accessType)
      Description copied from interface: Template
      Returns 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:
      getParameters in interface Template
      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: Template
      Returns 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:
      getPredByEdgeType in interface Template
      Parameters:
      nodeID - The ID of the node.
      type - The edge types to consider.
      Returns:
      A List of nodes.
      See Also:
    • getProcessType

      public String getProcessType()
      Description copied from interface: Template
      Returns the process type, which is a short term which kind of schema this template represents. This may be null.
      Specified by:
      getProcessType in interface Template
      Returns:
      The type of the process, the template is representing or null.
    • getStartNode

      public Node getStartNode()
      Description copied from interface: Template
      Returns the start node of the process.
      Specified by:
      getStartNode in interface Template
      Returns:
      The start node of the process.
    • getSuccByEdgeType

      public int[] getSuccByEdgeType(int nodeID, ProcessConstants.EdgeType... type)
      Description copied from interface: Template
      Returns 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:
      getSuccByEdgeType in interface Template
      Parameters:
      nodeID - The ID of the node.
      type - The edge types to consider.
      Returns:
      A set of nodes.
      See Also:
    • getSupervisorAgent

      public QualifiedAgent getSupervisorAgent()
      Description copied from interface: Template
      Returns the supervisor agent of the process template.
      Specified by:
      getSupervisorAgent in interface Template
      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:
      getUnconnectedConnectors in interface Template
      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: Template
      Returns 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 be null.
      Specified by:
      getVersion in interface Template
      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: Template
      Returns 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:
      isTransPredOf in interface Template
      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: PluginDataContainer
      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.
      Specified by:
      getPluginData in interface PluginDataContainer
      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: PluginDataContainer
      Returns a map from the ID of a plug-in to the plug-in data objects.
      Specified by:
      getPluginDatas in interface PluginDataContainer
      Returns:
      An unmodifiable map from plug-in IDs to plug-in data objects.
    • getSupportedPlugins

      public Map<String,Set<String>> getSupportedPlugins()
      Description copied from interface: PluginDataContainer
      Returns a map from the ID of an extension point to the IDs of the plug-ins within the extension point.
      Specified by:
      getSupportedPlugins in interface PluginDataContainer
      Returns:
      An unmodifiable map from extension point IDs to plug-in IDs.
    • getUserAttributes

      public Map<String,String> getUserAttributes()
      Description copied from interface: UserAttributeContainer
      Returns 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. See UserAttributeContainer.setUserAttributeValue(String, String) and UserAttributeContainer.removeUserAttributeValue(String) on how to change user attributes.
      Specified by:
      getUserAttributes in interface UserAttributeContainer
      Returns:
      A (copy of the) map with all user defined attributes.
    • getUserAttributeValue

      public String getUserAttributeValue(String attributeName)
      Description copied from interface: UserAttributeContainer
      Returns the value of the user attribute.
      Specified by:
      getUserAttributeValue in interface UserAttributeContainer
      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: UserAttributeContainer
      Removes 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:
      removeUserAttributeValue in interface UserAttributeContainer
      Parameters:
      attributeName - The key of the value to remove.
    • setUserAttributeValue

      @Deprecated public void setUserAttributeValue(String attributeName, String attributeValue)
      Deprecated.
      Description copied from interface: UserAttributeContainer
      Set 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:
      setUserAttributeValue in interface UserAttributeContainer
      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: LocalisedString
      Gets the localised representation of the implementing object. The localisation should be for the designated locale, model objects being Localised should use the designated localisation factory for automatic localisation.
      Specified by:
      toLocalisedString in interface LocalisedString
      Parameters:
      locFac - The localisation factory to be used by Localised model objects. If this is null, do not localise the used Localised attributes.
      loc - The locale for which to get the localised string. If this is null, treat it like Locale.ROOT has been requested.
      Returns:
      The localised (string) representation of the implementing object for the designated locale using the designated localisation factory if appropriate.