Class ModelService

  • All Implemented Interfaces:
    ModelManager

    @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
    implements ModelManager
    The ModelManager is independent form the IX JEE Entity EJBs and uses the standard IntemCollection Object as a data transfer object to communicate with clients. Since Version 1.7.0 The Implementation handles multiple model versions. Different Versions of an Model Entity can be saved and updated. The Getter methods can be furthermore Controlled by providing a valid Model Version. If no model version is set this Implementation automatically defaults to the highest available ModelVersion
    Author:
    rsoika
    See Also:
    ModelManager, org.imixs.workflow.jee.ejb.ModelManager
    • Constructor Detail

      • ModelService

        public ModelService()
    • Method Detail

      • addModel

        public void addModel​(Model model)
                      throws ModelException
        This Method adds a model into the internal model store. The model will not be saved in the database! Use saveModel to store the model permanently.
        Specified by:
        addModel in interface ModelManager
        Throws:
        ModelException
      • removeModel

        public void removeModel​(String modelversion)
        This method removes a specific ModelVersion form the internal model store. If modelVersion is null the method will remove all models. The model will not be removed from the database. Use deleteModel to delete the model from the database.
        Specified by:
        removeModel in interface ModelManager
        Throws:
        AccessDeniedException
      • getModelByWorkitem

        public Model getModelByWorkitem​(ItemCollection workitem)
                                 throws ModelException
        Returns a Model matching a given workitem. In case not matching model version exits, the method returns the highest Model Version matching the corresponding workflow group. The method throws a ModelException in case the model version did not exits.
        Specified by:
        getModelByWorkitem in interface ModelManager
        Throws:
        ModelException
      • getVersions

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

        public List<String> getLatestVersions()
        Returns a sorted String list of the latest version for each workflowGroup
        Returns:
      • getGroups

        public List<String> getGroups()
        The method returns a sorted list of all available workflow groups
        Returns:
      • findVersionsByGroup

        public List<String> findVersionsByGroup​(String group)
        This method returns a sorted list of 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 -
        Returns:
      • findVersionsByRegEx

        public List<String> findVersionsByRegEx​(String modelRegex)
        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:
      • saveModel

        public void saveModel​(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​(BPMNModel model,
                              String _filename)
                       throws ModelException
        This method saves a BPMNModel into the database and adds the model into the internal model store. The model is attached as an embedded 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 correspondig model document.

        Parameters:
        model -
        Throws:
        ModelException
      • deleteModel

        public void deleteModel​(String version)
        This method deletes an existing Model from the database and removes the model 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:
        model -
      • loadModelEntity

        public ItemCollection loadModelEntity​(String version)
        This method loads an existing Model Entities from the database. A model entity is identified by its name (model version).
        Parameters:
        model -
      • getDataObject

        public String getDataObject​(ItemCollection bpmnElement,
                                    String name)
        Returns a BPMN DataObject, part of a Task or Event element, by its name

        DataObjects can be associated in a BPMN Diagram with a Task or an Event element

        Parameters:
        bpmnElement -
        Returns: