Interface RepositoryService

  • All Known Implementing Classes:
    RepositoryServiceImpl

    public interface RepositoryService
    Service providing access to the repository of process definitions and deployments.
    Author:
    Tom Baeyens, Falko Menge, Tijs Rademakers, Joram Barrez, Henry Yan, Yvo Swillens
    • Method Detail

      • createDeployment

        DeploymentBuilder createDeployment()
        Starts creating a new deployment
      • deleteDeployment

        void deleteDeployment​(String deploymentId)
        Deletes the given deployment.
        Parameters:
        deploymentId - id of the deployment, cannot be null.
        Throws:
        RuntimeException - if there are still runtime or history process instances or jobs.
      • deleteDeployment

        void deleteDeployment​(String deploymentId,
                              boolean cascade)
        Deletes the given deployment and cascade deletion to process instances, history process instances and jobs.
        Parameters:
        deploymentId - id of the deployment, cannot be null.
      • setDeploymentCategory

        void setDeploymentCategory​(String deploymentId,
                                   String category)
        Sets the category of the deployment. Deployments can be queried by category: see DeploymentQuery.deploymentCategory(String).
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - if no deployment with the provided id can be found.
      • setDeploymentKey

        void setDeploymentKey​(String deploymentId,
                              String key)
        Sets the key of the deployment. Deployments can be queried by key: see DeploymentQuery.deploymentKey(String).
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - if no deployment with the provided id can be found.
      • getDeploymentResourceNames

        List<String> getDeploymentResourceNames​(String deploymentId)
        Retrieves a list of deployment resources for the given deployment, ordered alphabetically.
        Parameters:
        deploymentId - id of the deployment, cannot be null.
      • getResourceAsStream

        InputStream getResourceAsStream​(String deploymentId,
                                        String resourceName)
        Gives access to a deployment resource through a stream of bytes.
        Parameters:
        deploymentId - id of the deployment, cannot be null.
        resourceName - name of the resource, cannot be null.
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - when the resource doesn't exist in the given deployment or when no deployment exists for the given deploymentId.
      • changeDeploymentTenantId

        void changeDeploymentTenantId​(String deploymentId,
                                      String newTenantId)
        EXPERIMENTAL FEATURE! Changes the tenant identifier of a deployment to match the given tenant identifier. This change will cascade to any related entity: - process definitions related to the deployment - process instances related to those process definitions - executions related to those process instances - tasks related to those process instances - jobs related to the process definitions and process instances This method can be used in the case that there was no tenant identifier set on the deployment or those entities before. This method can be used to remove a tenant identifier from the deployment and related entities (simply pass null). Important: no optimistic locking will be done while executing the tenant identifier change! This is an experimental feature, mainly because it WILL NOT work properly in a clustered environment without special care: suppose some process instance is in flight. The process definition is in the process definition cache. When a task or job is created when continuing the process instance, the process definition cache will be consulted to get the process definition and from it the tenant identifier. Since it's cached, it will not be the new tenant identifier. This method does clear the cache for this engineinstance , but it will not be cleared on other nodes in a cluster (unless using a shared process definition cache).
        Parameters:
        deploymentId - The id of the deployment of which the tenant identifier will be changed.
        newTenantId - The new tenant identifier.
      • changeDeploymentTenantId

        void changeDeploymentTenantId​(String deploymentId,
                                      String newTenantId,
                                      MergeMode mergeMode)
        EXPERIMENTAL FEATURE! See more usage information changeDeploymentTenantId(String, String)
        Parameters:
        deploymentId - The id of the deployment of which the tenant identifier will be changed.
        newTenantId - The new tenant identifier.
        mergeMode - Mode which is used to merge the deployment into the new tenant, in case the second tenant already has the same deployment key
      • changeDeploymentTenantId

        void changeDeploymentTenantId​(String deploymentId,
                                      String newTenantId,
                                      DeploymentMergeStrategy deploymentMergeStrategy)
        EXPERIMENTAL FEATURE! See more usage information changeDeploymentTenantId(String, String)
        Parameters:
        deploymentId - The id of the deployment of which the tenant identifier will be changed.
        newTenantId - The new tenant identifier.
        deploymentMergeStrategy - Strategy to be used to merge the deployment into the new tenant, in case the second tenant already has this deployment key
      • changeDeploymentParentDeploymentId

        void changeDeploymentParentDeploymentId​(String deploymentId,
                                                String newParentDeploymentId)
        Changes the parent deployment id of a deployment. This is used to move deployments to a different app deployment parent.
        Parameters:
        deploymentId - The id of the deployment of which the parent deployment identifier will be changed.
        newParentDeploymentId - The new parent deployment identifier.
      • createProcessDefinitionQuery

        ProcessDefinitionQuery createProcessDefinitionQuery()
        Query process definitions.
      • createNativeProcessDefinitionQuery

        NativeProcessDefinitionQuery createNativeProcessDefinitionQuery()
        Returns a new NativeQuery for process definitions.
      • createDeploymentQuery

        DeploymentQuery createDeploymentQuery()
        Query deployment.
      • createNativeDeploymentQuery

        NativeDeploymentQuery createNativeDeploymentQuery()
        Returns a new NativeQuery for deployment.
      • suspendProcessDefinitionById

        void suspendProcessDefinitionById​(String processDefinitionId)
        Suspends the process definition with the given id. If a process definition is in state suspended, it will not be possible to start new process instances based on the process definition. Note: all the process instances of the process definition will still be active (ie. not suspended)!
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - if no such processDefinition can be found
        org.flowable.common.engine.api.FlowableException - if the process definition is already in state suspended.
      • suspendProcessDefinitionById

        void suspendProcessDefinitionById​(String processDefinitionId,
                                          boolean suspendProcessInstances,
                                          Date suspensionDate)
        Suspends the process definition with the given id. If a process definition is in state suspended, it will not be possible to start new process instances based on the process definition.
        Parameters:
        suspendProcessInstances - If true, all the process instances of the provided process definition will be suspended too.
        suspensionDate - The date on which the process definition will be suspended. If null, the process definition is suspended immediately. Note: The job executor needs to be active to use this!
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - if no such processDefinition can be found.
        org.flowable.common.engine.api.FlowableException - if the process definition is already in state suspended.
      • suspendProcessDefinitionByKey

        void suspendProcessDefinitionByKey​(String processDefinitionKey)
        Suspends the all process definitions with the given key (= id in the bpmn20.xml file). If a process definition is in state suspended, it will not be possible to start new process instances based on the process definition. Note: all the process instances of the process definition will still be active (ie. not suspended)!
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - if no such processDefinition can be found
        org.flowable.common.engine.api.FlowableException - if the process definition is already in state suspended.
      • suspendProcessDefinitionByKey

        void suspendProcessDefinitionByKey​(String processDefinitionKey,
                                           boolean suspendProcessInstances,
                                           Date suspensionDate)
        Suspends the all process definitions with the given key (= id in the bpmn20.xml file). If a process definition is in state suspended, it will not be possible to start new process instances based on the process definition.
        Parameters:
        suspendProcessInstances - If true, all the process instances of the provided process definition will be suspended too.
        suspensionDate - The date on which the process definition will be suspended. If null, the process definition is suspended immediately. Note: The job executor needs to be active to use this!
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - if no such processDefinition can be found
        org.flowable.common.engine.api.FlowableException - if the process definition is already in state suspended.
      • activateProcessDefinitionById

        void activateProcessDefinitionById​(String processDefinitionId)
        Activates the process definition with the given id.
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - if no such processDefinition can be found or if the process definition is already in state active.
      • activateProcessDefinitionById

        void activateProcessDefinitionById​(String processDefinitionId,
                                           boolean activateProcessInstances,
                                           Date activationDate)
        Activates the process definition with the given id.
        Parameters:
        activationDate - The date on which the process definition will be activated. If null, the process definition is activated immediately. Note: The job executor needs to be active to use this!
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - if no such processDefinition can be found.
        org.flowable.common.engine.api.FlowableException - if the process definition is already in state active.
      • activateProcessDefinitionByKey

        void activateProcessDefinitionByKey​(String processDefinitionKey)
        Activates the process definition with the given key (=id in the bpmn20.xml file).
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - if no such processDefinition can be found.
        org.flowable.common.engine.api.FlowableException - if the process definition is already in state active.
      • activateProcessDefinitionByKey

        void activateProcessDefinitionByKey​(String processDefinitionKey,
                                            boolean activateProcessInstances,
                                            Date activationDate)
        Activates the process definition with the given key (=id in the bpmn20.xml file).
        Parameters:
        activationDate - The date on which the process definition will be activated. If null, the process definition is activated immediately. Note: The job executor needs to be active to use this!
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - if no such processDefinition can be found.
        org.flowable.common.engine.api.FlowableException - if the process definition is already in state active.
      • setProcessDefinitionCategory

        void setProcessDefinitionCategory​(String processDefinitionId,
                                          String category)
        Sets the category of the process definition. Process definitions can be queried by category: see ProcessDefinitionQuery.processDefinitionCategory(String).
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - if no process definition with the provided id can be found.
      • getProcessModel

        InputStream getProcessModel​(String processDefinitionId)
        Gives access to a deployed process model, e.g., a BPMN 2.0 XML file, through a stream of bytes.
        Parameters:
        processDefinitionId - id of a ProcessDefinition, cannot be null.
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - when the process model doesn't exist.
      • getProcessDiagram

        InputStream getProcessDiagram​(String processDefinitionId)
        Gives access to a deployed process diagram, e.g., a PNG image, through a stream of bytes.
        Parameters:
        processDefinitionId - id of a ProcessDefinition, cannot be null.
        Returns:
        null when the diagram resource name of a ProcessDefinition is null.
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - when the process diagram doesn't exist.
      • getProcessDefinition

        ProcessDefinition getProcessDefinition​(String processDefinitionId)
        Returns the ProcessDefinition including all BPMN information like additional Properties (e.g. documentation).
      • isFlowable5ProcessDefinition

        Boolean isFlowable5ProcessDefinition​(String processDefinitionId)
        Checks if the process definition should be executed by the V5 engine.
      • isProcessDefinitionSuspended

        boolean isProcessDefinitionSuspended​(String processDefinitionId)
        Checks if the process definition is suspended.
      • getBpmnModel

        org.flowable.bpmn.model.BpmnModel getBpmnModel​(String processDefinitionId)
        Returns the BpmnModel corresponding with the process definition with the provided process definition id. The BpmnModel is a pojo versions of the BPMN 2.0 xml and can be used to introspect the process definition using regular Java.
      • getProcessDiagramLayout

        DiagramLayout getProcessDiagramLayout​(String processDefinitionId)
        Provides positions and dimensions of elements in a process diagram as provided by getProcessDiagram(String). This method requires a process model and a diagram image to be deployed.
        Parameters:
        processDefinitionId - id of a ProcessDefinition, cannot be null.
        Returns:
        DiagramLayout instance containing diagram info, null when the input stream of a process diagram is null.
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - when the process model or diagram doesn't exist.
      • getAppResourceObject

        Object getAppResourceObject​(String deploymentId)
        Returns the app resource object (.app file) for a deployment.
      • getAppResourceModel

        AppModel getAppResourceModel​(String deploymentId)
        Returns the app model object (.app file) for a deployment.
      • newModel

        Model newModel()
        Creates a new model. The model is transient and must be saved using saveModel(Model).
      • saveModel

        void saveModel​(Model model)
        Saves the model. If the model already existed, the model is updated otherwise a new model is created.
        Parameters:
        model - model to save, cannot be null.
      • deleteModel

        void deleteModel​(String modelId)
        Parameters:
        modelId - id of model to delete, cannot be null. When an id is passed for a non-existent model, this operation is ignored.
      • addModelEditorSource

        void addModelEditorSource​(String modelId,
                                  byte[] bytes)
        Saves the model editor source for a model
        Parameters:
        modelId - id of model to delete, cannot be null. When an id is passed for a non-existent model, this operation is ignored.
      • addModelEditorSourceExtra

        void addModelEditorSourceExtra​(String modelId,
                                       byte[] bytes)
        Saves the model editor source extra for a model
        Parameters:
        modelId - id of model to delete, cannot be null. When an id is passed for an unexisting model, this operation is ignored.
      • createModelQuery

        ModelQuery createModelQuery()
        Query models.
      • createNativeModelQuery

        NativeModelQuery createNativeModelQuery()
        Returns a new NativeQuery for process definitions.
      • getModel

        Model getModel​(String modelId)
        Returns the Model
        Parameters:
        modelId - id of model
      • getModelEditorSource

        byte[] getModelEditorSource​(String modelId)
        Returns the model editor source as a byte array
        Parameters:
        modelId - id of model
      • getModelEditorSourceExtra

        byte[] getModelEditorSourceExtra​(String modelId)
        Returns the model editor source extra as a byte array
        Parameters:
        modelId - id of model
      • addCandidateStarterUser

        void addCandidateStarterUser​(String processDefinitionId,
                                     String userId)
        Authorizes a candidate user for a process definition.
        Parameters:
        processDefinitionId - id of the process definition, cannot be null.
        userId - id of the user involve, cannot be null.
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - when the process definition or user doesn't exist.
      • addCandidateStarterGroup

        void addCandidateStarterGroup​(String processDefinitionId,
                                      String groupId)
        Authorizes a candidate group for a process definition.
        Parameters:
        processDefinitionId - id of the process definition, cannot be null.
        groupId - id of the group involve, cannot be null.
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - when the process definition or group doesn't exist.
      • deleteCandidateStarterUser

        void deleteCandidateStarterUser​(String processDefinitionId,
                                        String userId)
        Removes the authorization of a candidate user for a process definition.
        Parameters:
        processDefinitionId - id of the process definition, cannot be null.
        userId - id of the user involve, cannot be null.
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - when the process definition or user doesn't exist.
      • deleteCandidateStarterGroup

        void deleteCandidateStarterGroup​(String processDefinitionId,
                                         String groupId)
        Removes the authorization of a candidate group for a process definition.
        Parameters:
        processDefinitionId - id of the process definition, cannot be null.
        groupId - id of the group involve, cannot be null.
        Throws:
        org.flowable.common.engine.api.FlowableObjectNotFoundException - when the process definition or group doesn't exist.
      • getIdentityLinksForProcessDefinition

        List<org.flowable.identitylink.api.IdentityLink> getIdentityLinksForProcessDefinition​(String processDefinitionId)
        Retrieves the IdentityLinks associated with the given process definition. Such an IdentityLink informs how a certain identity (eg. group or user) is authorized for a certain process definition
      • validateProcess

        List<org.flowable.validation.ValidationError> validateProcess​(org.flowable.bpmn.model.BpmnModel bpmnModel)
        Validates the given process definition against the rules for executing a process definition on the process engine. To create such a BpmnModel from a String, following code may be used: XMLInputFactory xif = XMLInputFactory.newInstance(); InputStreamReader in = new InputStreamReader(new ByteArrayInputStream(myProcess.getBytes()), "UTF-8"); // Change to other streams for eg from classpath XMLStreamReader xtr = xif.createXMLStreamReader(in); bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
      • getDecisionsForProcessDefinition

        List<org.flowable.dmn.api.DmnDecision> getDecisionsForProcessDefinition​(String processDefinitionId)
        Retrieves the DmnDecisions associated with the given process definition.
        Parameters:
        processDefinitionId - id of the process definition, cannot be null.
      • getDecisionTablesForProcessDefinition

        @Deprecated
        List<org.flowable.dmn.api.DmnDecision> getDecisionTablesForProcessDefinition​(String processDefinitionId)
        Deprecated.
        replaced by getDecisionsForProcessDefinition(String processDefinitionId)
        Retrieves the DmnDecisions associated with the given process definition.
        Parameters:
        processDefinitionId - id of the process definition, cannot be null.
      • getFormDefinitionsForProcessDefinition

        List<org.flowable.form.api.FormDefinition> getFormDefinitionsForProcessDefinition​(String processDefinitionId)
        Retrieves the FormDefinitions associated with the given process definition.
        Parameters:
        processDefinitionId - id of the process definition, cannot be null.