Package org.silverpeas.processmanager.service

## Class DefaultProcessManagerService

- java.lang.Object
- - org.silverpeas.processmanager.service.DefaultProcessManagerService

- All Implemented Interfaces:
    `ProcessManagerService`

      @Service
      @Singleton
      public class DefaultProcessManagerService
      extends Object
      implements ProcessManagerService

  Process manager service which manage processes

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `DEFAULT_ROLE` | Default role for creating workflow processes.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultProcessManagerService()` |

  - ### Method Summary

    All Methods Instance Methods Concrete 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)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_ROLE

          public static final String DEFAULT_ROLE

      Default role for creating workflow processes.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DefaultProcessManagerService

          public DefaultProcessManagerService()

  - ### Method Detail

    - #### createProcess

          public String createProcess​(String componentId,
                                      String userId,
                                      String fileName,
                                      byte[] fileContent)
                               throws ProcessManagerException,
                                      org.silverpeas.core.workflow.api.WorkflowException,
                                      InterruptedException

      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.
      Specified by:
        `createProcess` in interface `ProcessManagerService`
      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.
        `org.silverpeas.core.workflow.api.WorkflowException`
        `InterruptedException`

    - #### createProcess

          public String createProcess​(String componentId,
                                      String userId,
                                      String userRole,
                                      Map<String,​Object> metadata)
                               throws ProcessManagerException,
                                      org.silverpeas.core.workflow.api.WorkflowException,
                                      InterruptedException

      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.

      Specified by:
        `createProcess` in interface `ProcessManagerService`
      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.
        `org.silverpeas.core.workflow.api.WorkflowException`
        `InterruptedException`

    - #### doAction

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

      Specified by:
        `doAction` in interface `ProcessManagerService`
      Throws:
        `ProcessManagerException`

    - #### getProcessInstance

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

      Specified by:
        `getProcessInstance` in interface `ProcessManagerService`
      Throws:
        `ProcessManagerException`