Package org.silverpeas.processmanager.service

## Interface ProcessManagerService

- All Known Implementing Classes:
    `DefaultProcessManagerService`

      public interface ProcessManagerService

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `String` | `createProcess​(String componentId, String userId, String fileName, byte[] fileContent)` | Create a process instance for a specific workflow component, by a specific user using one role of those defined in a given workflow definition.
    `String` | `createProcess​(String componentId, String userId, String userRole, Map<String,​Object> metadata)` | Create a process instance for a specific workflow component, by a specific user using one role of those defined in a given workflow definition.
    `void` | `doAction​(String action, String processId, String componentId, String userId, String userRole, Map<String,​Object> metadata)` |
    `org.silverpeas.core.workflow.api.instance.ProcessInstance` | `getProcessInstance​(String processId)` |

- - ### Method Detail

    - #### createProcess

          String createProcess​(String componentId,
                               String userId,
                               String fileName,
                               byte[] fileContent)
                        throws ProcessManagerException

      Create a process instance for a specific workflow component, by a specific user using one role of those defined in a given workflow definition. The contents of a file is passed in as a single parameter. This file is uploaded into the process data and stored in the first field of the file type.
      Parameters:
        `componentId` - the ID of the component which defines the workflow (must be a workflow component).
        `userId` - the current user ID.
        `fileName` - the name of the file being pushed during process creation.
        `fileContent` - the full content of the file being pushed during process creation (as an array of bytes).
      Returns:
        the instance ID of the newly started process
      Throws:
        `ProcessManagerException` - when the creation of the process failed.

    - #### createProcess

          String createProcess​(String componentId,
                               String userId,
                               String userRole,
                               Map<String,​Object> metadata)
                        throws ProcessManagerException

      Create a process instance for a specific workflow component, by a specific user using one role of those defined in a given workflow definition.

      Some information may be specified that will fill in the creation form of the new process instance. Such data should be placed into a map structure of key-value pairs where keys are the name of the intended fields of the creation form and values are strings (text fields), dates (date fields), collections of strings, collections of dates, or a single `FileContent` object.

      `FileContent` are used to pass in as an argument a complete file of binary data, loaded into memory.

      Parameters:
        `componentId` - the ID of the component which defines the workflow (must be a workflow component).
        `userId` - the current user ID.
        `userRole` - the role of the user while creating the process instance (this role must have been defined in the workflow process definition).
        `metadata` - a map of all input metadata, coming with the file and describing it. The key is expected to be the name of a field in the process form definition (with specification of the type name of the field), and the value must be the value to put into this field (it may be a collection of value if the field is multivalued, else only the first value is considered).
      Returns:
        the instance ID of the newly started process
      Throws:
        `ProcessManagerException` - when the creation of the process failed.

    - #### doAction

          void doAction​(String action,
                        String processId,
                        String componentId,
                        String userId,
                        String userRole,
                        Map<String,​Object> metadata)
                 throws ProcessManagerException

      Throws:
        `ProcessManagerException`

    - #### getProcessInstance

          org.silverpeas.core.workflow.api.instance.ProcessInstance getProcessInstance​(String processId)
                                                                                throws ProcessManagerException

      Throws:
        `ProcessManagerException`