Class ProcessElementIdentifierTools
- java.lang.Object
-
- de.aristaflow.adept2.model.processmodel.tools.ProcessElementIdentifierTools
-
public abstract class ProcessElementIdentifierTools extends Object
This is a helper class to create and parse URIs identifying process elements. URIs for identifying process elements are structured like this:URI := [<elementType>BASE_TYPE_DELIMITER]BASE[IDENTIFIER_PATH_REL_TO_BASE][?<Field>][#RANGE]
BASE_TYPE_DELIMITER :=BASE_TYPE_DELIMITER
BASE := <baseType>[//AUTHORITY]/BASE_ID
AUTHORITY := <symbolicNameOfAuthority>
BASE_ID := PATH_ID
IDENTIFIER_PATH_REL_TO_BASE := /PATH_ID[/PATH_ID]*
PATH_ID := <id> | (<id>[PATH_ID_DELIMITER<id>]+)
PATH_ID_DELIMITER :=PATH_ID_DELIMITER
RANGE := (<startIndex>RANGE_DELIMITER<endIndex>)
RANGE_DELIMITER :=RANGE_DELIMITER
TYPE := [<elementType>BASE_TYPE_DELIMITER]<baseType>
IDENTIFIER_PATH := /BASE_ID[IDENTIFIER_PATH_REL_TO_BASE]
The BASE identifies the template or the instance the referenced process element belongs to. The authority the designated template or instance belongs to is specified by a symbolic name. The currently valid authority has to be looked up with the aid of a naming service. The given symbolic name is the key. This ensures that the designated template or instance may be migrated to another authority (i. e. server) without the need of adapting the URIs that reference it.
The RANGE argument narrows the referenced element further (see example).
Example: In order to report that the staff assignment rule of the node with nodeID = 5 that belongs to the instance with instanceID = 0 is incorrect in the range 2nd to 4th character the following process element URI may be offered to the user:
node-instance://localhost/0/5?StaffAssignmentRule#(2-4)
It is assumed that the instance is hosted in the locally executed ADEPT2 system. The BASE 'instance://localhost/0
' references the affected instance. The URI generation of the following process elements is supported:- Template
- Instance
- Node
- DataElement
- DataEdge
- Author:
- Markus Lauer
-
-
Field Summary
Fields Modifier and Type Field Description static String
BASE_TYPE_DELIMITER
Determines the delimiter used to separate the type of the base (Template/Instance) from the type the identified process element is of.protected static Logger
logger
The logger instance used to log error messages.static String
PATH_ID_DELIMITER
Determines the delimiter used to separate the parts of a locally valid process element ID.static String
RANGE_DELIMITER
Determines the delimiter that seperates the start and the end index of the RANGE part of the process element URI:
-
Constructor Summary
Constructors Constructor Description ProcessElementIdentifierTools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
generateIdentifierPathRelToBase(Node node, ExecutableBusinessProcess ebp, ProcessModelParameter parameter)
static String
generateIdentifierPathRelToBase(Node startNode, Node endNode)
static URI
generateProcessElementIdentifierURI(URI baseURI, String elementType, String identifierPathRelToBase)
Sets up the process element identifier URI by the aid of the passed information.static URI
generateProcessElementIdentifierURI(URI baseURI, String elementType, String identifierPathRelToBase, String field)
Sets up the URI that references a certain field of a process element by the aid of the passed information.static URI
generateProcessElementIdentifierURI(URI baseURI, String elementType, String identifierPathRelToBase, String field, String range)
Sets up the URI that references a certain field of a process element by the aid of the passed information.static URI
getBase(URI elementIdentifier)
Returns the process element identifer URI of the base mentioned within the passed element identifier URI.static String
getBaseID(URI elementIdentifier)
Returns the ID of the Template or Instance that is the base of the referenced process element.static String
getBaseType(URI elementIdentifier)
Returns type of the process element identified as the base of the passed process element identifier URI.static URI
getBlockIdentifier(URI baseURI, Node startNode, Node endNode)
static URI
getBranchIdentifier(URI baseURI, Node startNode, Node endNode)
static URI
getDataEdgeIdentifier(URI baseURI, Node node, DataElement dataElement, ActivityConstants.AccessType direction)
Sets up the process element identifier URI for the specified data edge(node, dataElement, direction)
.static URI
getDataElementIdentifier(URI baseURI, DataElement dataElement)
Sets up the process element identifier URI for the given data element.static URI
getDataElementIdentifier(URI baseURI, DataElement dataElement, String field)
Sets up the process element identifier URI for the given data element.static URI
getDataElementIdentifier(URI baseURI, DataElement dataElement, String field, String range)
Sets up the process element identifier URI for the given data element.static URI
getEBPIdentifier(URI baseURI, Node node, ExecutableBusinessProcess ebp)
Sets up the process element identifier URI for the given EBP.static URI
getEdgeIdentifier(URI baseURI, Node startNode, Node endNode, ProcessConstants.EdgeType type)
static String
getElementID(URI elementIdentifier)
Returns the locally valid ID assigned to the process element referenced by the given URI.static String
getElementType(URI elementIdentifier)
Returns the type of the element referenced by the URI.static String
getField(URI elementIdentifier)
Returns the field referenced be the passed URI or null if no field is referenced by the URI.static String
getIdentifierPath(URI elementIdentifier)
Returns the identifier path of the passed URI.static String
getIdentifierPathRelToBase(URI elementIdentifier)
Returns the identifier path without the leading baseID.static URI
getInstanceIdentifier(String symbolicNameOfAuthority, Instance instance)
Constructs the process element identifier URI for the given instance.static URI
getNodeIdentifier(URI baseURI, Node node)
Sets up the process element identifier URI for the given node.static URI
getNodeIdentifier(URI baseURI, Node node, String field)
Sets up the process element identifier URI for specified field of the given node.static URI
getNodeIdentifier(URI baseURI, Node node, String field, String range)
Sets up the process element identifier URI for specified field of the given node and detail it with the given range.static URI
getParameterIdentifier(URI baseURI, Node node, ExecutableBusinessProcess ebp, ProcessModelParameter parameter)
static URI
getParameterIdentifier(URI baseURI, Node node, ExecutableBusinessProcess ebp, ProcessModelParameter parameter, String field)
static URI
getParameterIdentifier(URI baseURI, Node node, ExecutableBusinessProcess ebp, ProcessModelParameter parameter, String field, String range)
static String[]
getPathIDsOfIdentifierPath(URI elementIdentifier)
Returns the single IDs mentioned within the identifier path ordered by their occurrence.static String
getRange(URI elementIdentifier)
Returns the range specified within the process element identifier URI or null if no range is specified.static URI
getTemplateIdentifier(Template template, String symbolicNameOfAuthority)
Constructs the process element identifier URI for the given template.static String
getType(URI elementIdentifier)
Returns the type of the process element URI.static String[]
getTypesOfIdentifierPath(URI elementIdentifier)
Returns the types of the process elements the IDs of the identifier path are linked to.
-
-
-
Field Detail
-
logger
protected static final Logger logger
The logger instance used to log error messages.
-
BASE_TYPE_DELIMITER
public static final String BASE_TYPE_DELIMITER
Determines the delimiter used to separate the type of the base (Template/Instance) from the type the identified process element is of. For example: Within the URI 'node-template://localhost/0/1' identifying a node the BASE_TYPE_DELIMITER is '-'.- See Also:
- Constant Field Values
-
PATH_ID_DELIMITER
public static final String PATH_ID_DELIMITER
Determines the delimiter used to separate the parts of a locally valid process element ID. For example: With the given PATH_ID_DELIMITER'-'
a data edge is locally identified by(nodeID-dataelementID-dataAccess)
. Be aware: The PATH_ID_DELIMITER must not be '/'!- See Also:
- Constant Field Values
-
RANGE_DELIMITER
public static final String RANGE_DELIMITER
Determines the delimiter that seperates the start and the end index of the RANGE part of the process element URI:- See Also:
- Constant Field Values
-
-
Method Detail
-
getType
public static String getType(URI elementIdentifier)
Returns the type of the process element URI.TYPE := [<elementType>BASE_TYPE_DELIMITER]<baseType>
- Parameters:
elementIdentifier
- the process element URI to be parsed.- Returns:
- the TYPE of the process element URI.
-
getBase
public static URI getBase(URI elementIdentifier)
Returns the process element identifer URI of the base mentioned within the passed element identifier URI.- Parameters:
elementIdentifier
- the process element URI to be parsed- Returns:
- The process element identifier URI of the template or instance thats the identified process element belongs to.
-
getBaseID
public static String getBaseID(URI elementIdentifier)
Returns the ID of the Template or Instance that is the base of the referenced process element. The structure of the BASE_ID depends on the base process element referenced. The general structure is:BASE_ID:= <id> | (<id>[PATH_ID_DELIMITER<id>]+)
- Parameters:
elementIdentifier
- the process element URI to be parsed.- Returns:
- the ID of the base of the referenced process element.
-
getBaseType
public static String getBaseType(URI elementIdentifier)
Returns type of the process element identified as the base of the passed process element identifier URI.- Parameters:
elementIdentifier
- the process element URI to be parsed.- Returns:
- The type of the process element identified as the base.
-
getElementType
public static String getElementType(URI elementIdentifier)
Returns the type of the element referenced by the URI.- Parameters:
elementIdentifier
- the process element URI to be parsed.- Returns:
- the type of the process element referenced by the URI.
-
getIdentifierPath
public static String getIdentifierPath(URI elementIdentifier)
Returns the identifier path of the passed URI. The identifier path is structured conform toIDENTIFIER_PATH := /BASE_ID[IDENTIFIER_PATH_REL_TO_BASE]
with
BASE_ID := PATH_ID
.
IDENTIFIER_PATH_REL_TO_BASE := /PATH_ID[/PATH_ID]*
PATH_ID := <id> | (<id>[PATH_ID_DELIMITER<id>]+)
PATH_ID_DELIMITER :=PATH_ID_DELIMITER
- Parameters:
elementIdentifier
- elementIdentifier the process element URI to be parsed.- Returns:
- the identifier path with a leading '/' and without a trailing '/'.
-
getIdentifierPathRelToBase
public static String getIdentifierPathRelToBase(URI elementIdentifier)
Returns the identifier path without the leading baseID. The identifier path relative is structured conform to:IDENTIFIER_PATH_REL_TO_BASE := /PATH_ID[/PATH_ID]*
PATH_ID := <id> | (<id>[PATH_ID_DELIMITER<id>]+)
.
PATH_ID_DELIMITER :=PATH_ID_DELIMITER
- Parameters:
elementIdentifier
- the process element URI to be parsed.- Returns:
- the identifier path relative to the base with a leading '/' and without a trailing '/'.
-
getTypesOfIdentifierPath
public static String[] getTypesOfIdentifierPath(URI elementIdentifier)
Returns the types of the process elements the IDs of the identifier path are linked to.Example: This method being applied to the process element identifier '
dataedge-template://localhost/0/(4-5-Read)
' returns the array('template', 'dataedge')
because the first ID '0' represents a templateID and second one '(4-5-Read)' identifies the dataedge belonging to the mentioned template.- Parameters:
elementIdentifier
- the process element URI to be parsed.- Returns:
- An array containing the types the IDs of the identifier path are linked to ordered by the IDs' position within the identifier path.
-
getPathIDsOfIdentifierPath
public static String[] getPathIDsOfIdentifierPath(URI elementIdentifier)
Returns the single IDs mentioned within the identifier path ordered by their occurrence.Example: This method being applied to the process element identifier '
dataedge-template://localhost/0/(4-5-Read)
' returns the array('0', '(4-5-Read)')
.- Parameters:
elementIdentifier
- the process element URI to be parsed.- Returns:
- Array of the IDs mentioned within the identifier path.
-
getElementID
public static String getElementID(URI elementIdentifier)
Returns the locally valid ID assigned to the process element referenced by the given URI. The returned ID is the last ID mentioned within the identifier path.Example: This method being applied to the process element identifier '
dataedge-template://localhost/0/(4-5-Read)
' returns(4-5-READ)
as the ID of the dataedge.- Parameters:
elementIdentifier
- the process element URI to be parsed.- Returns:
- The locally valid ID of the process element referenced by the given URI:
-
getField
public static String getField(URI elementIdentifier)
Returns the field referenced be the passed URI or null if no field is referenced by the URI.- Parameters:
elementIdentifier
- The process element URI to be parsed.- Returns:
- the referenced field or null if no field is referenced.
-
getRange
public static String getRange(URI elementIdentifier)
Returns the range specified within the process element identifier URI or null if no range is specified.- Parameters:
elementIdentifier
- The process element URI to be parsed.- Returns:
- the specified range or null if no range is referenced.
-
generateProcessElementIdentifierURI
public static URI generateProcessElementIdentifierURI(URI baseURI, String elementType, String identifierPathRelToBase)
Sets up the process element identifier URI by the aid of the passed information.- Parameters:
baseURI
- The template or instance the process element to identify belongs to.elementType
- the type of the process element to identify.identifierPathRelToBase
- the identifier path without the base ID- Returns:
- The process element identifier URI corresponding to the passed data
or
null
if an error occurred.
-
generateProcessElementIdentifierURI
public static URI generateProcessElementIdentifierURI(URI baseURI, String elementType, String identifierPathRelToBase, String field)
Sets up the URI that references a certain field of a process element by the aid of the passed information. The 'field' parameter may be set to null if the field argument of the process element identifier URI should be ignored.- Parameters:
baseURI
- The template or instance the process element to identify belongs to.elementType
- the type of the process element to identify.identifierPathRelToBase
- the identifier path without the base IDfield
- field of the process element to reference- Returns:
- the process element identifier URI corresponding to the passed data
or
null
if an error occurred.
-
generateProcessElementIdentifierURI
public static URI generateProcessElementIdentifierURI(URI baseURI, String elementType, String identifierPathRelToBase, String field, String range)
Sets up the URI that references a certain field of a process element by the aid of the passed information. The null value may be passed to the 'field' and the 'range' parameter if the field or the range statement is not determined. But if the 'range' parameter is supplied the 'field' parameter must be supplied, too. If this rule is violated thennull
is returned.- Parameters:
baseURI
- The template or instance the process element to identify belongs to.elementType
- the type of the process element to identify.identifierPathRelToBase
- the identifier path without the base IDfield
- field of the process element to referencerange
- The start and the end index of the range- Returns:
- The process element identifier URI corresponding to the passed data
or
null
if an error occurred (e. g. an URISyntaxException was thrown or the 'range' parameter is supplied but not the 'field' parameter).
-
generateIdentifierPathRelToBase
public static String generateIdentifierPathRelToBase(Node startNode, Node endNode)
- Parameters:
startNode
-endNode
-- Returns:
- The identifier path relative to the base, for the given parameter ant its access type.
-
generateIdentifierPathRelToBase
public static String generateIdentifierPathRelToBase(Node node, ExecutableBusinessProcess ebp, ProcessModelParameter parameter)
- Parameters:
node
- The node of the ebp the parameter is assigned to.ebp
- The ebp the parameter is assigned to.parameter
- the parameter that should be identified.- Returns:
- The identifier path relative to the base, for the given parameter ant its access type.
-
getTemplateIdentifier
public static URI getTemplateIdentifier(Template template, String symbolicNameOfAuthority)
Constructs the process element identifier URI for the given template.The authority the template belongs to is referenced by a symbolic name. The symbolic name must be resolved with the aid of a naming service.
- Parameters:
template
- The template that should be referenced by the URI.symbolicNameOfAuthority
- The symbolic name of the authority the template belongs to, used for naming service lookups.- Returns:
- The process element identifier URI for the given template of null if an error occurred.
-
getInstanceIdentifier
public static URI getInstanceIdentifier(String symbolicNameOfAuthority, Instance instance)
Constructs the process element identifier URI for the given instance.- Parameters:
symbolicNameOfAuthority
- The symbolic name of the authority the template belongs to, used for naming service lookups.instance
- The template that should be referenced by the URI.- Returns:
- The process element identifier URI for the given instance or
null
if an error occurred.
-
getNodeIdentifier
public static URI getNodeIdentifier(URI baseURI, Node node)
Sets up the process element identifier URI for the given node.- Parameters:
baseURI
- The process element identifier URI of the template or instance the node belongs to.node
- the node that should be identified.- Returns:
- the process element identifier URI for the given node or
null
if an error occurred.
-
getNodeIdentifier
public static URI getNodeIdentifier(URI baseURI, Node node, String field)
Sets up the process element identifier URI for specified field of the given node.- Parameters:
baseURI
- The process element identifier URI of the template or instance the given node belongs to.node
- The node whose field should be referenced.field
- The field of the node that should be referenced- Returns:
- the process element identifier URI for the given field or
null
if an error occurred.
-
getNodeIdentifier
public static URI getNodeIdentifier(URI baseURI, Node node, String field, String range)
Sets up the process element identifier URI for specified field of the given node and detail it with the given range.- Parameters:
baseURI
- The process element identifier URI of the template or instance the given node belongs to.node
- The node whose field should be referenced.field
- The field of the node that should be referenced in part.range
- The section of the given field that is referenced.- Returns:
- the process element identifier URI for the given section of the
field or or
null
if an error occurred.
-
getDataElementIdentifier
public static URI getDataElementIdentifier(URI baseURI, DataElement dataElement)
Sets up the process element identifier URI for the given data element.- Parameters:
baseURI
- The process element identifier URI of the template or instance the data element belongs to.dataElement
- the data element that should be identified.- Returns:
- the process element identifier URI for the given data element or
null
if an error occurred.
-
getDataElementIdentifier
public static URI getDataElementIdentifier(URI baseURI, DataElement dataElement, String field)
Sets up the process element identifier URI for the given data element.- Parameters:
baseURI
- The process element identifier URI of the template or instance the data element belongs to.dataElement
- the data element that should be identified.field
- The field that should be referenced.- Returns:
- the process element identifier URI for the given data element or
null
if an error occurred.
-
getDataElementIdentifier
public static URI getDataElementIdentifier(URI baseURI, DataElement dataElement, String field, String range)
Sets up the process element identifier URI for the given data element.- Parameters:
baseURI
- The process element identifier URI of the template or instance the data element belongs to.dataElement
- the data element that should be identified.field
- The field, that should be referenced in part.range
- The range of the field that should be referenced.- Returns:
- the process element identifier URI for the given data element or
null
if an error occurred.
-
getDataEdgeIdentifier
public static URI getDataEdgeIdentifier(URI baseURI, Node node, DataElement dataElement, ActivityConstants.AccessType direction)
Sets up the process element identifier URI for the specified data edge(node, dataElement, direction)
.- Parameters:
baseURI
- The process element identifier URI of the template or instance the data edge belongs to.node
- The node the data edge is connected to.dataElement
- The data element the data edge is connected to.direction
- Statement if it is a reading data edge or if it is a writing data edge.- Returns:
- The process element identifier URI for the given data edge or
null
if an error occurred.
-
getEBPIdentifier
public static URI getEBPIdentifier(URI baseURI, Node node, ExecutableBusinessProcess ebp)
Sets up the process element identifier URI for the given EBP.- Parameters:
baseURI
- The process element identifier URI of the template or instance the EBP belongs to.node
- The node the given EBP is assigned to.ebp
- The EBP a process element identifier URI should be created for.- Returns:
- The process element identifier URI for the given EBP or
null
if an error occurred (e. g. the given EBP is not of type Activity or LightWeightProcess).
-
getEdgeIdentifier
public static URI getEdgeIdentifier(URI baseURI, Node startNode, Node endNode, ProcessConstants.EdgeType type)
- Parameters:
baseURI
- The process element identifier URI of the template or instance the edge belongs to.startNode
- The node where the edge starts.endNode
- The node where the edge ends.type
- The type of the given edge.- Returns:
- The process element identifier URI for the given edge or
null
if an error occurred.
-
getBranchIdentifier
public static URI getBranchIdentifier(URI baseURI, Node startNode, Node endNode)
- Parameters:
baseURI
- The process element identifier URI of the template or instance the branch belongs to.startNode
- The node where the branch starts.endNode
- The first node in a branch or node where the branch ends.- Returns:
- The process element identifier URI for the given branch or
null
if an error occurred.
-
getBlockIdentifier
public static URI getBlockIdentifier(URI baseURI, Node startNode, Node endNode)
- Parameters:
baseURI
- The process element identifier URI of the template or instance the block belongs to.startNode
- The node where the block starts.endNode
- The node where the block ends.- Returns:
- The process element identifier URI for the given block or
null
if an error occurred.
-
getParameterIdentifier
public static URI getParameterIdentifier(URI baseURI, Node node, ExecutableBusinessProcess ebp, ProcessModelParameter parameter)
- Parameters:
baseURI
- The process element identifier URI of the template or instance the parameter belongs to.node
- The node of the ebp the parameter is assigned to.ebp
- The ebp the parameter is assigned to.parameter
- The parameter, that URI should point to.- Returns:
- The process element identifier URI for the given parameter or
null
if an error occurred.
-
getParameterIdentifier
public static URI getParameterIdentifier(URI baseURI, Node node, ExecutableBusinessProcess ebp, ProcessModelParameter parameter, String field)
- Parameters:
baseURI
- The process element identifier URI of the template or instance the parameter belongs to.node
- The node of the ebp the parameter is assigned to.ebp
- The ebp the parameter is assigned to.parameter
- The parameter, that URI should point to.field
- The field of the parameter that should be referenced- Returns:
- The process element identifier URI for the given parameter or
null
if an error occurred.
-
getParameterIdentifier
public static URI getParameterIdentifier(URI baseURI, Node node, ExecutableBusinessProcess ebp, ProcessModelParameter parameter, String field, String range)
- Parameters:
baseURI
- The process element identifier URI of the template or instance the parameter belongs to.node
- The node of the ebp the parameter is assigned to.ebp
- The ebp the parameter is assigned to.parameter
- The parameter, that URI should point to.field
- The field of the parameter that should be referenced.range
- The section of the given field that is referenced.- Returns:
- The process element identifier URI for the given parameter or
null
if an error occurred.
-
-