Klasse ModelManager

java.lang.Object
org.imixs.workflow.ModelManager

public class ModelManager extends Object
This 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.

  • Felddetails

  • Konstruktordetails

    • ModelManager

      public ModelManager(WorkflowContext workflowContext)
      Constructor initializes the RuleEngine.
  • Methodendetails

    • 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 the WorkflowContext
      Parameter:
      workitem -
      Gibt zurück:
      Löst aus:
      ModelException
    • getModel

      public org.openbpmn.bpmn.BPMNModel getModel(String version) throws ModelException
      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.
      Parameter:
      version -
      Gibt zurück:
      Löst aus:
      ModelException
    • loadDefinition

      public ItemCollection loadDefinition(org.openbpmn.bpmn.BPMNModel model) throws ModelException
      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.

      Parameter:
      workitem -
      Gibt zurück:
      BPMN Event entity - ItemCollection
      Löst aus:
      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 $worklfowGroup

      The 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.

      Parameter:
      workitem -
      Gibt zurück:
      BPMN Event entity - ItemCollection
      Löst aus:
      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.

      Parameter:
      workitem -
      Gibt zurück:
      BPMN Event entity - ItemCollection
      Löst aus:
      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.

      Parameter:
      workitem -
      Gibt zurück:
      BPMN Event entity - ItemCollection
      Löst aus:
      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.

      Parameter:
      event - - current event
      workitem - - current Workitem
      Gibt zurück:
      a BPMN Element entity - ItemCollection
      Löst aus:
      ModelException - - if no valid element was found
      org.openbpmn.bpmn.exceptions.BPMNValidationException
    • findAllGroupsByModel

      public Set<String> findAllGroupsByModel(org.openbpmn.bpmn.BPMNModel _model) throws ModelException
      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)!

      Parameter:
      _model - - BPMN model instance
      Gibt zurück:
      list of workflow groups
      Löst aus:
      ModelException - if model is undefined
    • findTaskByID

      public ItemCollection findTaskByID(org.openbpmn.bpmn.BPMNModel model, int taskID)
      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.

      Parameter:
      model -
      taskID -
      Gibt zurück:
    • findEventByID

      public ItemCollection findEventByID(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. 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 Group

      In 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.

      Parameter:
      model - - the BPMN model
      processGroup - - the name of the process group to match
      Gibt zurück:
      list of all Task entities or null if not process with the given name was found.
      Löst aus:
      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.
      Parameter:
      _model -
      Gibt zurück:
      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.
      Parameter:
      _process -
      Gibt zurück:
      Löst aus:
      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 Group

      In case of a collaboration diagram only Pool names are compared. The default process (Public Process) will be ignored.

      Parameter:
      model - - the BPMN model
      processGroup - - the name of the process group to match
      Gibt zurück:
      list of all Start Task entities or null if not process with the given name was found.
      Löst aus:
      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 Group

      In case of a collaboration diagram only Pool names are compared. The default process (Public Process) will be ignored.

      Parameter:
      model - - the BPMN model
      processGroup - - the name of the process group to match
      Gibt zurück:
      list of all End Task entities or null if not process with the given name was found.
      Löst aus:
      org.openbpmn.bpmn.exceptions.BPMNModelException
      ModelException
    • findEventsByTask

      public List<ItemCollection> findEventsByTask(org.openbpmn.bpmn.BPMNModel model, int taskID)
      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).
      Parameter:
      model -
      taskID -
      Gibt zurück:
      list of all events assigned to the task as an processing event.
    • findDataObject

      public String findDataObject(ItemCollection bpmnElement, String name)
      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.

      Parameter:
      bpmnElement - - bpmn element, either a Task or a Event
      name - - name of the dataobject
      Gibt zurück:
    • evaluateCondition

      public boolean evaluateCondition(String expression, ItemCollection workitem)
      Evaluates a BPMN sequence flow condition with extensible observer support.
      Parameter:
      expression - the condition expression from a BPMN SequenceFlow. Can be JavaScript code or a prompt for an observer.
      workitem - the workflow item providing context data for condition evaluation
      Gibt zurück:
      true if the condition evaluates to true, false otherwise
    • 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!

      Parameter:
      gatewayNode - - ParallelGateway Node
      targetNode - - Target Node (either a Task or a Event)
      workitem - - current workitem
      Gibt zurück:
      true if targetNode defines the main flow