Class ModelService

java.lang.Object
org.imixs.workflow.engine.ModelService

@DeclareRoles({"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) @RolesAllowed({"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) public class ModelService extends Object
The ModelService provides methods to load and save BPMNModel data form the Database and methods to find model versions based on meta information.

Note: BPMModel instances are not Thread save. For this reason the service the method getBPMNModel returns an exclusive version of a BPMNModel object.

Author:
rsoika
See Also:
  • Field Details

    • documentService

      @Inject protected DocumentService documentService
    • ctx

      protected jakarta.ejb.SessionContext ctx
  • Constructor Details

    • ModelService

      public ModelService()
  • Method Details

    • init

      @PostConstruct public void init()
      Lazy loading of ModelManager
    • addModelData

      public void addModelData(String version, org.openbpmn.bpmn.BPMNModel model, ItemCollection metadata)
      Adds a BPMNModel with its metadata into the local model store.

      The method pre initialize all processes within the BPMNModel to avoid the lazing loading.

      The Method does not store the data in the database. To store new model data call saveModel

    • getVersions

      public List<String> getVersions()
      returns a sorted String list of all stored model versions
      Returns:
    • loadModelMetaData

      public ItemCollection loadModelMetaData(String version)
      This method loads a Model metadata form the internal model store.

      To access a BPMNModel object directly use the method getModel(version)

      Returns:
      the ItemCollection with the model meta data
    • getBPMNModel

      public org.openbpmn.bpmn.BPMNModel getBPMNModel(String version)
      This method should return a thread save version of a stored BPMN Model
      Parameters:
      version -
      Returns:
    • removeModelData

      public void removeModelData(String version)
      Removes a BPMNModel form the local model store
    • hasModelVersion

      public boolean hasModelVersion(String version)
      Returns true if the given Model Version exists in the local store

      Parameters:
      group -
      Returns:
    • findAllWorkflowGroups

      public List<String> findAllWorkflowGroups()
      This method returns a sorted list of all model groups over all models.

      Note: A workflow group may exist in different models by the same name!

      Parameters:
      group -
      Returns:
    • findVersionByGroup

      public String findVersionByGroup(String group) throws ModelException
      Returns a version by Group. The method computes 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
    • saveModel

      public void saveModel(org.openbpmn.bpmn.BPMNModel model) throws ModelException
      This method saves a BPMNModel into the database and adds the model into the internal model store.

      If a model with the same model version exists in the database the old version will be deleted form the database first.

      Parameters:
      model -
      Throws:
      ModelException
    • saveModel

      public void saveModel(org.openbpmn.bpmn.BPMNModel model, String _filename) throws ModelException
      This method saves a BPMNModel with its meta data into the database and adds the model into the internal model store. In the database entry the BPMNmodel is attached as an embedded XML file with the given filename.

      If a model with the same model version exists in the database the old version will be deleted form the database first.

      The param 'filename' is used to store the bpmn file in the corresponding model document.

      Parameters:
      model -
      Throws:
      ModelException
    • deleteModelData

      public void deleteModelData(String version)
      This method deletes an existing Model from the database and removes the model data form the internal ModelStore.

      A model entity is identified by the type='model' and its name (model version). After the model entity was deleted form the database, the method will also remove the model from the ModelManager

      Parameters:
      bpmnModel -