Package org.jbpm.services.api

## Interface DefinitionService

- All Known Subinterfaces:
    `DefinitionServiceEJBLocal`, `DefinitionServiceEJBRemote`
  All Known Implementing Classes:
    `BPMN2DataServiceCDIImpl`, `BPMN2DataServiceImpl`, `DefinitionServiceEJBImpl`

      public interface DefinitionService

  Provides details from definition point of view which is extracted from BPMN2 definitions. Delivers information about:
  - process such as id, name, version
  - process variables (name and type)
  - defined reusable subprocesses
  - defined service tasks (domain specific services)
  - defined user tasks
  - user task input and outputs

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addProcessDefinition​(String deploymentId, String processId, Object processDescriptor, org.kie.api.runtime.KieContainer kieContainer)` |
    `ProcessDefinition` | `buildProcessDefinition​(String deploymentId, String bpmn2Content, org.kie.api.runtime.KieContainer kieContainer, boolean cache)` | Performs build operation for given bpmn2content to produce fully populated `ProcessDefinition`
    `Map<String,​Collection<String>>` | `getAssociatedEntities​(String deploymentId, String processId)` | Returns all organizational entities identifiers involved in the process - like users and groups.
    `Collection<String>` | `getJavaClasses​(String deploymentId, String processId)` | Returns a list of all referenced java classes defined in the given process.
    `ProcessDefinition` | `getProcessDefinition​(String deploymentId, String processId)` | Returns previously built `ProcessDefinition`.
    `Map<String,​String>` | `getProcessVariables​(String deploymentId, String processId)` | Returns all process variables defined in the given process where: key in the map is name of the process variable value in the map is type of the process variable NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method
    `Collection<String>` | `getReusableSubProcesses​(String deploymentId, String processId)` | Returns collection of process identifiers of reusable processes used by given process.
    `Collection<String>` | `getRuleSets​(String deploymentId, String processId)` | Returns a list of all referenced rules used in the given process.
    `Map<String,​String>` | `getServiceTasks​(String deploymentId, String processId)` | Returns service (domain specific) tasks defined in the process where: key in the map is name of the task node value in the map is name of the domain specific service (name that handler should be registered with) NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method
    `Map<String,​String>` | `getTaskInputMappings​(String deploymentId, String processId, String taskName)` | Returns map of data input defined for given user task key in the map is identifier of dataInput value in the map is name dataInput NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method
    `Map<String,​String>` | `getTaskOutputMappings​(String deploymentId, String processId, String taskName)` | Returns map of data output defined for given user task key in the map is identifier of dataOutput value in the map is name dataOutput NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method
    `Collection<UserTaskDefinition>` | `getTasksDefinitions​(String deploymentId, String processId)` | Returns all user task definitions defined in given process NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method

- - ### Method Detail

    - #### buildProcessDefinition

          ProcessDefinition buildProcessDefinition​(String deploymentId,
                                                   String bpmn2Content,
                                                   org.kie.api.runtime.KieContainer kieContainer,
                                                   boolean cache)
                                            throws IllegalArgumentException

      Performs build operation for given bpmn2content to produce fully populated `ProcessDefinition`
      Parameters:
        `deploymentId` - identifier of deployment this process belongs to, might be null if built definition does not need to be stored
        `bpmn2Content` - actual BPMN xml content as string to be parsed and processed
        `kieContainer` - the `KieContainer` instance that contains the deployment project: this should be used when parsing the BPMN2 in case custom classes or other project resources (processes, rules) are referenced
        `cache` - indicates if the definition service should cache this `ProcessDefinition`
      Returns:
        fully populated `ProcessDefinition`
      Throws:
        `IllegalArgumentException` - in case build operation cannot be completed

    - #### addProcessDefinition

          void addProcessDefinition​(String deploymentId,
                                    String processId,
                                    Object processDescriptor,
                                    org.kie.api.runtime.KieContainer kieContainer)

    - #### getProcessDefinition

          ProcessDefinition getProcessDefinition​(String deploymentId,
                                                 String processId)

      Returns previously built `ProcessDefinition`.
      NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method
      Parameters:
        `deploymentId` - identifier of deployment that process belongs to
        `processId` - identifier of the process
      Returns:
        returns complete `ProcessDefinition`
      Throws:
        `DeploymentNotFoundException` - in case deployment with given deploymentId cannot be found
        `ProcessDefinitionNotFoundException` - in case process definition with given processId cannot be found

    - #### getReusableSubProcesses

          Collection<String> getReusableSubProcesses​(String deploymentId,
                                                     String processId)

      Returns collection of process identifiers of reusable processes used by given process.
      NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method
      Parameters:
        `deploymentId` - identifier of deployment that process belongs to
        `processId` - identifier of the process
      Returns:
        returns collection of found reusable subprocess identifiers, maybe an empty list if none were found

    - #### getProcessVariables

          Map<String,​String> getProcessVariables​(String deploymentId,
                                                       String processId)

      Returns all process variables defined in the given process where:
      - key in the map is name of the process variable
      - value in the map is type of the process variable
      NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method
      Parameters:
        `deploymentId` - identifier of deployment that process belongs to
        `processId` - identifier of the process
      Returns:
        map of all process variables defined or empty map if none are found

    - #### getJavaClasses

          Collection<String> getJavaClasses​(String deploymentId,
                                            String processId)

      Returns a list of all referenced java classes defined in the given process.
      NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method
      Parameters:
        `deploymentId` - identifier of deployment that process belongs to
        `processId` - identifier of the process
      Returns:
        a list of all referenced classes defined or an empty list if none are found

    - #### getRuleSets

          Collection<String> getRuleSets​(String deploymentId,
                                         String processId)

      Returns a list of all referenced rules used in the given process.
      NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method
      Parameters:
        `deploymentId` - identifier of deployment that process belongs to
        `processId` - identifier of the process
      Returns:
        a list of all referenced rules or an empty list if none are found

    - #### getServiceTasks

          Map<String,​String> getServiceTasks​(String deploymentId,
                                                   String processId)

      Returns service (domain specific) tasks defined in the process where:
      - key in the map is name of the task node
      - value in the map is name of the domain specific service (name that handler should be registered with)
      NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method
      Parameters:
        `deploymentId` - identifier of deployment that process belongs to
        `processId` - identifier of the process
      Returns:
        returns map of all found service tasks or empty map if none are found

    - #### getAssociatedEntities

          Map<String,​Collection<String>> getAssociatedEntities​(String deploymentId,
                                                                     String processId)

      Returns all organizational entities identifiers involved in the process - like users and groups. Since this is based on definition and not runtime it can return references to process variables
      NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method
      Parameters:
        `deploymentId` - identifier of deployment that process belongs to
        `processId` - identifier of the process
      Returns:
        returns map of all found organizational entities grouped by task they are assigned to

    - #### getTasksDefinitions

          Collection<UserTaskDefinition> getTasksDefinitions​(String deploymentId,
                                                             String processId)

      Returns all user task definitions defined in given process
      NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method
      Parameters:
        `deploymentId` - identifier of deployment that process belongs to
        `processId` - identifier of the process
      Returns:
        returns collection of `UserTaskDefinition`s or empty collection if none were found

    - #### getTaskInputMappings

          Map<String,​String> getTaskInputMappings​(String deploymentId,
                                                        String processId,
                                                        String taskName)

      Returns map of data input defined for given user task
      - key in the map is identifier of dataInput
      - value in the map is name dataInput
      NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method
      Parameters:
        `deploymentId` - identifier of deployment that process belongs to
        `processId` - identifier of the process
        `taskName` - name of a task the data input should be collected for
      Returns:
        returns map of found data inputs or empty map if none were found

    - #### getTaskOutputMappings

          Map<String,​String> getTaskOutputMappings​(String deploymentId,
                                                         String processId,
                                                         String taskName)

      Returns map of data output defined for given user task
      - key in the map is identifier of dataOutput
      - value in the map is name dataOutput
      NOTE: This method assumes process has already been built by invoking `buildProcessDefinition` method
      Parameters:
        `deploymentId` - identifier of deployment that process belongs to
        `processId` - identifier of the process
        `taskName` - name of a task the data output should be collected for
      Returns:
        returns map of found data outputs or empty map if none were found