Class ModelManager
ModelManager
provides methods to get model entities from a
model instance. The ModelManager is used by the WorkflowKernel
to
manage the processing life cycle of a workitem.
The implementation is based on the OpenBPMN Meta model.
By analyzing the workitem model version the WorkflowKernel determines the corresponding model and get the Tasks and Events from the ModelManager to process the workitem and assign the workitem to the next Task defined by the BPMN Model.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addModel
(org.openbpmn.bpmn.BPMNModel model) Adds a new model into the local model storeboolean
evaluateCondition
(String expression, ItemCollection workitem) Evaluates a conditionThis method returns a sorted list of all unique workflow groups contained in the model store.findAllGroupsByModel
(org.openbpmn.bpmn.BPMNModel _model) This method returns a sorted list of all workflow groups contained in a BPMN model.findAllVersionsByGroup
(String group) Returns a sorted list of all model versions containing the requested workflow group.findDataObject
(ItemCollection bpmnElement, String name) Returns the content of a BPMN DataObject, part of a Task or Event element.findEndTasks
(org.openbpmn.bpmn.BPMNModel model, String processGroup) Returns a list of End Tasks of a given Process GroupfindEventByID
(org.openbpmn.bpmn.BPMNModel model, int taskID, int eventID) This method finds a Imixs Event element by its ID (imixs:activityid) associated with a given Task.findEventsByTask
(org.openbpmn.bpmn.BPMNModel model, int taskID) Returns a list of all Events assigned to a Task.org.openbpmn.bpmn.BPMNModel
findModelByWorkitem
(ItemCollection workitem) Returns a Model matching the $modelversion of a given workitem.findStartTasks
(org.openbpmn.bpmn.BPMNModel model, String processGroup) Returns a list of start Tasks of a given Process GroupfindTaskByID
(org.openbpmn.bpmn.BPMNModel model, int taskID) This method finds a Imixs task element by its ID (imixs:activityid).Returns a list of all Tasks of a given Process GroupfindVersionByGroup
(String group) Returns the first matching model version by a given workflow group.findVersionsByRegEx
(String modelRegex) This method returns a sorted list of model versions matching a given regex for a model version.List<org.openbpmn.bpmn.BPMNModel>
Returns a List with all BPMNModel instancesorg.openbpmn.bpmn.BPMNModel
Returns a BPMNModel by its version from the local model storeorg.openbpmn.bpmn.BPMNModel
getModelByWorkitem
(ItemCollection workitem) Returns the internal ModelStore holding all BPMNModels by version.returns a sorted String list of all stored model versionsboolean
isMainParallelGatewayFlow
(org.openbpmn.bpmn.elements.core.BPMNElementNode gatewayNode, org.openbpmn.bpmn.elements.core.BPMNElementNode targetNode, ItemCollection workitem) This method evaluates the outgoing sequenceFlows of a ParallelGateway.loadDefinition
(org.openbpmn.bpmn.BPMNModel model) Returns the BPMN Definition entity associated with a given workitem, based on its attribute "$modelVersion".loadEvent
(ItemCollection workitem) Returns the BPMN Event entity associated with a given workitem, based on its attributes "$modelVersion", "$taskID" and "$eventID".loadProcess
(ItemCollection workitem) Returns the BPMN Process entity associated with a given workitem, based on its attributes "$modelVersion", "$taskID".loadTask
(ItemCollection workitem) Returns the BPMN Task entity associated with a given workitem, based on its attributes "$modelVersion" and "$taskID".nextModelElement
(ItemCollection event, ItemCollection workitem) Finds the next BPMN Element associated with a given event element.void
removeModel
(String version) Removes a BPMNModel form the local model store
-
Field Details
-
TASK_ELEMENT
- See Also:
-
EVENT_ELEMENT
- See Also:
-
PARALLELGATEWAY_ELEMENT
- See Also:
-
-
Constructor Details
-
ModelManager
public ModelManager()Private constructor to prevent instantiation
-
-
Method Details
-
getModelStore
Returns the internal ModelStore holding all BPMNModels by version.- Returns:
-
addModel
Adds a new model into the local model store- Throws:
ModelException
-
removeModel
Removes a BPMNModel form the local model store -
getModel
Returns a BPMNModel by its version from the local model store- Parameters:
version
- - a bpmn model version ($modelVersion)- Returns:
- a BPMNModel instance.
- Throws:
ModelException
-
getAllModels
Returns a List with all BPMNModel instances- Returns:
-
getModelByWorkitem
public org.openbpmn.bpmn.BPMNModel getModelByWorkitem(ItemCollection workitem) throws ModelException - Throws:
ModelException
-
loadDefinition
Returns the BPMN Definition entity associated with a given workitem, based on its attribute "$modelVersion". The definition holds the bpmn meta data.The method throws a
ModelException
if no Process can be resolved based on the given model information.The method is called by the
WorkflowKernel
during the processing life cycle to update the process group information.- Parameters:
workitem
-- Returns:
- BPMN Event entity -
ItemCollection
- Throws:
ModelException
- if no event was found
-
loadProcess
Returns the BPMN Process entity associated with a given workitem, based on its attributes "$modelVersion", "$taskID". The process holds the name for the attribute $worklfowGroupThe taskID has to be unique in a process. The method throws a
ModelException
if no Process can be resolved based on the given model information.The method is called by the
WorkflowKernel
during the processing life cycle to update the process group information.- Parameters:
workitem
-- Returns:
- BPMN Event entity -
ItemCollection
- Throws:
ModelException
- if no event was found
-
loadTask
Returns the BPMN Task entity associated with a given workitem, based on its attributes "$modelVersion" and "$taskID".The method throws a
ModelException
if no Task can be resolved based on the given model information.The method is called by the
WorkflowKernel
during the the processing life cycle.- Parameters:
workitem
-- Returns:
- BPMN Event entity -
ItemCollection
- Throws:
ModelException
- if no event was found
-
loadEvent
Returns the BPMN Event entity associated with a given workitem, based on its attributes "$modelVersion", "$taskID" and "$eventID".The method throws a
ModelException
if no Event can be resolved based on the given model information.The method is called by the
WorkflowKernel
to start the processing life cycle.A Event is typically connected with a Task by outgoing SequenceFlows. A special case is a Start event followed by one or more Events connected with a Task (Start-Task) element.
- Parameters:
workitem
-- Returns:
- BPMN Event entity -
ItemCollection
- Throws:
ModelException
- if no event was found
-
nextModelElement
public ItemCollection nextModelElement(ItemCollection event, ItemCollection workitem) throws ModelException Finds the next BPMN Element associated with a given event element. The returned BPMN Element must either be an Activity (Task) element, an Intermediate Catch Event (follow-up-event) or a End Event. The method must not return any other BPMN elements (e.g. Gateways, Intermediate Throw Events).The method throws a
ModelException
if no Element can be resolved based on the given model information.- Parameters:
event
- - current eventworkitem
- - current Workitem- Returns:
- a BPMN Element entity -
ItemCollection
- Throws:
ModelException
- - if no valid element was foundorg.openbpmn.bpmn.exceptions.BPMNValidationException
-
getVersions
returns a sorted String list of all stored model versions- Returns:
-
findModelByWorkitem
public org.openbpmn.bpmn.BPMNModel findModelByWorkitem(ItemCollection workitem) throws ModelException Returns a Model matching the $modelversion of a given workitem. The $modelversion can optional be provided as a regular expression.In case no matching model version exits, the method tries to find the highest Model Version matching the corresponding workflow group.
The method throws a ModelException in case the model version did not exits.
- Throws:
ModelException
-
findAllGroupsByModel
This method returns a sorted list of all workflow groups contained in a BPMN model.In case the model is a collaboration diagram, the method returns only group names from private process instances (Pools)!
- Parameters:
_model
- - BPMN model instance- Returns:
- list of workflow groups
- Throws:
ModelException
- if model is undefined
-
findAllGroups
This method returns a sorted list of all unique workflow groups contained in the model store.In case the model is a collaboration diagram, the method returns only group names from private process instances (Pools)!
- Parameters:
group
-- Returns:
- Throws:
ModelException
-
findAllVersionsByGroup
Returns a sorted list of all model versions containing the requested workflow group. The result is sorted in reverse order, so the highest version number is the first in the result list.- Parameters:
group
- - name of the workflow group- Returns:
- list of matching model versions
- Throws:
ModelException
-
findVersionByGroup
Returns the first matching model version by a given workflow group.If multiple models are containing the same group the latest version will be returned.
In case the model is a collaboration diagram, the method compares the given group name only with private process instances (Pools)!
- Parameters:
group
-- Returns:
- Throws:
ModelException
-
findVersionsByRegEx
This method returns a sorted list of model versions matching a given regex for a model version. The result is sorted in reverse order, so the highest version number is the first in the result list.- Parameters:
group
-- Returns:
-
findTaskByID
This method finds a Imixs task element by its ID (imixs:activityid). The method returns a cloned Instance of the model entity to avoid manipulation by the client.The method implements an effectively generic, thread-safe way of a compute-once, cache-for-later pattern.
- Parameters:
model
-taskID
-- Returns:
-
findEventByID
This method finds a Imixs Event element by its ID (imixs:activityid) associated with a given Task. The method returns a cloned Instance of the model entity to avoid manipulation by the client.The method implements an effectively generic, thread-safe way of a compute-once, cache-for-later pattern.
-
findTasks
public List<ItemCollection> findTasks(org.openbpmn.bpmn.BPMNModel model, String processGroup) throws ModelException Returns a list of all Tasks of a given Process GroupIn case of a collaboration diagram only Pool names are compared. The default process (Public Process) will be ignored.
- Parameters:
model
- - the BPMN modelprocessGroup
- - the name of the process group to match- Returns:
- list of all Task entities or null if not process with the given name was found.
- Throws:
org.openbpmn.bpmn.exceptions.BPMNModelException
ModelException
-
findStartTasks
public List<ItemCollection> findStartTasks(org.openbpmn.bpmn.BPMNModel model, String processGroup) throws ModelException Returns a list of start Tasks of a given Process GroupIn case of a collaboration diagram only Pool names are compared. The default process (Public Process) will be ignored.
- Parameters:
model
- - the BPMN modelprocessGroup
- - the name of the process group to match- Returns:
- list of all Start Task entities or null if not process with the given name was found.
- Throws:
org.openbpmn.bpmn.exceptions.BPMNModelException
ModelException
-
findEndTasks
public List<ItemCollection> findEndTasks(org.openbpmn.bpmn.BPMNModel model, String processGroup) throws ModelException Returns a list of End Tasks of a given Process GroupIn case of a collaboration diagram only Pool names are compared. The default process (Public Process) will be ignored.
- Parameters:
model
- - the BPMN modelprocessGroup
- - the name of the process group to match- Returns:
- list of all End Task entities or null if not process with the given name was found.
- Throws:
org.openbpmn.bpmn.exceptions.BPMNModelException
ModelException
-
findEventsByTask
Returns a list of all Events assigned to a Task. The event can be either connected by an outgoing sequence flow or by an ingoing sequence flow (init-event-node).- Parameters:
model
-taskID
-- Returns:
- list of all events assigned to the task as an processing event.
-
findDataObject
Returns the content of a BPMN DataObject, part of a Task or Event element.DataObjects can be associated in a BPMN Diagram with a Task or an Event element.
- Parameters:
bpmnElement
- - bpmn element, either a Task or a Eventname
- - name of the dataobject- Returns:
-
evaluateCondition
Evaluates a condition- Parameters:
expression
-workitem
-- Returns:
-
isMainParallelGatewayFlow
public boolean isMainParallelGatewayFlow(org.openbpmn.bpmn.elements.core.BPMNElementNode gatewayNode, org.openbpmn.bpmn.elements.core.BPMNElementNode targetNode, ItemCollection workitem) This method evaluates the outgoing sequenceFlows of a ParallelGateway.The method returns true if the given targetNode is connected with a TASK_ELEMENT or with a EVENT_ELEMENT by a conditional flow that evaluates to true. These are the only two cases that indicate the Main Version flow!
- Parameters:
gatewayNode
- - ParallelGateway NodetargetNode
- - Target Node (either a Task or a Event)workitem
- - current workitem- Returns:
- true if targetNode defines the main flow
-