Class ModelManager
ModelManager
provides methods to get thread save instances of
org.openbpmn.bpmn.BPMNModel
and provides convenience methods to
resolve model flow details.
The ModelManager is used by the WorkflowKernel
to
manage the processing life cycle of a workitem.
A client can use the to resolve a valid model version and fetch a thread save instance of a model. The model version is defined in the item `$modelversion` of a workitem. This may also be a regular expression. Also a valid model version can be resolved by the WorkflowContext based on the $workflowGroup.
The ModelManager provides methods to get instances of ItemCollection for Tasks and Events and other common BPMNElements.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionModelManager
(WorkflowContext workflowContext) Constructor initializes the RuleEngine. -
Method Summary
Modifier and TypeMethodDescriptionboolean
evaluateCondition
(String expression, ItemCollection workitem) Evaluates a conditionfindAllGroupsByModel
(org.openbpmn.bpmn.BPMNModel _model) This method returns a sorted list of all workflow groups contained in an Imixs BPMN model.List<org.openbpmn.bpmn.elements.BPMNProcess>
findAllImixsProcesses
(org.openbpmn.bpmn.BPMNModel _model) Returns a list of all executable Imixs Processes in a BPMN Model.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.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 Grouporg.openbpmn.bpmn.BPMNModel
This method return a thread save instance of a BPMN Model.org.openbpmn.bpmn.BPMNModel
getModelByWorkitem
(ItemCollection workitem) This method returns a thread save instance of a BPMNModel based on the given workitem meta data.boolean
isImixsProcess
(org.openbpmn.bpmn.elements.BPMNProcess _process) This method returns true if the geiven process contains at least one Imixs Task Element.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.loadDefinition
(org.openbpmn.bpmn.BPMNModel model) Returns the BPMN Definition entity associated with a given workitem, based on its attribute "$modelVersion".loadEvent
(ItemCollection workitem, org.openbpmn.bpmn.BPMNModel model) Returns the BPMN Event entity associated with a given workitem, based on its attributes "$modelVersion", "$taskID" and "$eventID".loadProcess
(ItemCollection workitem, org.openbpmn.bpmn.BPMNModel model) Returns the BPMN Process entity associated with a given workitem, based on its attributes "$modelVersion", "$taskID".loadTask
(ItemCollection workitem, org.openbpmn.bpmn.BPMNModel model) Returns the BPMN Task entity associated with a given workitem, based on its attributes "$modelVersion" and "$taskID".nextModelElement
(org.openbpmn.bpmn.BPMNModel model, ItemCollection event, ItemCollection workitem) Finds the next BPMN Element associated with a given event element.
-
Field Details
-
TASK_ELEMENT
- See Also:
-
EVENT_ELEMENT
- See Also:
-
PARALLELGATEWAY_ELEMENT
- See Also:
-
-
Constructor Details
-
ModelManager
Constructor initializes the RuleEngine.
-
-
Method Details
-
getModelByWorkitem
public org.openbpmn.bpmn.BPMNModel getModelByWorkitem(ItemCollection workitem) throws ModelException This method returns a thread save instance of a BPMNModel based on the given workitem meta data. The method lookups the matching model version by theWorkflowContext
- Parameters:
workitem
-- Returns:
- Throws:
ModelException
-
getModel
This method return a thread save instance of a BPMN Model. If the model does not yet exist in the ModelManager a new model instance is fetched and cached in the local model store.- Parameters:
version
-- Returns:
- 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
public ItemCollection loadProcess(ItemCollection workitem, org.openbpmn.bpmn.BPMNModel model) throws ModelException 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
public ItemCollection loadTask(ItemCollection workitem, org.openbpmn.bpmn.BPMNModel model) throws ModelException 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
public ItemCollection loadEvent(ItemCollection workitem, org.openbpmn.bpmn.BPMNModel model) throws ModelException 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(org.openbpmn.bpmn.BPMNModel model, 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
-
findAllGroupsByModel
This method returns a sorted list of all workflow groups contained in an Imixs 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
-
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 if it does not contain at least one start task.
- 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
-
findAllImixsProcesses
public List<org.openbpmn.bpmn.elements.BPMNProcess> findAllImixsProcesses(org.openbpmn.bpmn.BPMNModel _model) Returns a list of all executable Imixs Processes in a BPMN Model.- Parameters:
_model
-- Returns:
- List of BPMNProcess that contain at least one Imixs Task Element
-
isImixsProcess
public boolean isImixsProcess(org.openbpmn.bpmn.elements.BPMNProcess _process) throws ModelException This method returns true if the geiven process contains at least one Imixs Task Element. Only in this case the process is executable at all.- Parameters:
_process
-- Returns:
- Throws:
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
-