Class ProcessRestController

  • All Implemented Interfaces:
    ProcessRestOpenApi

    @RestController
    @RequestMapping("/v2.1.1/process-manager/")
    public class ProcessRestController
    extends Object
    implements ProcessRestOpenApi
    Process Manager Rest Controller.
    Author:
    Mauricio Ruiz Beltrán <mauricio.ruiz@kuwaiba.org>
    • Constructor Detail

      • ProcessRestController

        public ProcessRestController()
    • Method Detail

      • getArtifactForActivity

        @RequestMapping(method=GET,
                        value="getArtifactForActivity/{processInstanceId}/{activityId}/{sessionId}",
                        produces="application/json")
        public Artifact getArtifactForActivity​(@PathVariable("processInstanceId")
                                               String processInstanceId,
                                               @PathVariable("activityId")
                                               String activityId,
                                               @PathVariable("sessionId")
                                               String sessionId)
        Gets the artifact associated to an activity (for example, a form that was already filled in by a user in a previous, already committed activity).
        Specified by:
        getArtifactForActivity in interface ProcessRestOpenApi
        Parameters:
        processInstanceId - The id of the process instance. This process may have been ended already.
        activityId - The id of the activity the artifact belongs to.
        sessionId - The session token id.
        Returns:
        The artifact corresponding to the given activity.
      • getArtifactDefinitionForActivity

        @RequestMapping(method=GET,
                        value="getArtifactDefinitionForActivity/{processDefinitionId}/{activityDefinitionId}/{sessionId}",
                        produces="application/json")
        public ArtifactDefinition getArtifactDefinitionForActivity​(@PathVariable("processDefinitionId")
                                                                   String processDefinitionId,
                                                                   @PathVariable("activityDefinitionId")
                                                                   String activityDefinitionId,
                                                                   @PathVariable("sessionId")
                                                                   String sessionId)
        Given an activity definition, returns the artifact definition associated to it.
        Specified by:
        getArtifactDefinitionForActivity in interface ProcessRestOpenApi
        Parameters:
        processDefinitionId - The id of the process the activity is related to.
        activityDefinitionId - The id of the activity.
        sessionId - The session token id.
        Returns:
        An object containing the artifact definition.
      • commitActivity

        @RequestMapping(method=PUT,
                        value="commitActivity/{processInstanceId}/{activityDefinitionId}/{sessionId}",
                        produces="application/json")
        public void commitActivity​(@PathVariable("processInstanceId")
                                   String processInstanceId,
                                   @PathVariable("activityDefinitionId")
                                   String activityDefinitionId,
                                   @RequestBody
                                   TransientArtifact artifact,
                                   @PathVariable("sessionId")
                                   String sessionId)
        Saves the artifact generated once an activity has been completed (for example, the user filled in a form).
        Specified by:
        commitActivity in interface ProcessRestOpenApi
        Parameters:
        processInstanceId - The process instance the activity belongs to.
        activityDefinitionId - The activity id.
        artifact - The artifact to be saved.
        sessionId - The session token id.
      • updateActivity

        @RequestMapping(method=PUT,
                        value="updateActivity/{processInstanceId}/{activityDefinitionId}/{sessionId}",
                        produces="application/json")
        public void updateActivity​(@PathVariable("processInstanceId")
                                   String processInstanceId,
                                   @PathVariable("activityDefinitionId")
                                   String activityDefinitionId,
                                   @RequestBody
                                   TransientArtifact artifact,
                                   @PathVariable("sessionId")
                                   String sessionId)
        Updates the artifact generated once an activity has been completed (for example, the user filled in a form).
        Specified by:
        updateActivity in interface ProcessRestOpenApi
        Parameters:
        processInstanceId - The process instance the activity belongs to.
        activityDefinitionId - The activity id.
        artifact - The artifact to be saved.
        sessionId - The session token id.
      • getProcessInstanceActivitiesPath

        @RequestMapping(method=GET,
                        value="getProcessInstanceActivitiesPath/{processInstanceId}/{sessionId}",
                        produces="application/json")
        public List<ActivityDefinition> getProcessInstanceActivitiesPath​(@PathVariable("processInstanceId")
                                                                         String processInstanceId,
                                                                         @PathVariable("sessionId")
                                                                         String sessionId)
        Gets Process Instance Activities Path.
        Specified by:
        getProcessInstanceActivitiesPath in interface ProcessRestOpenApi
        Parameters:
        processInstanceId - Process Instance Id to get path.
        sessionId - The session token id.
        Returns:
        The activity definition.
      • getNextActivityForProcessInstance

        @RequestMapping(method=GET,
                        value="getNextActivityForProcessInstance/{processInstanceId}/{sessionId}",
                        produces="application/json")
        public ActivityDefinition getNextActivityForProcessInstance​(@PathVariable("processInstanceId")
                                                                    String processInstanceId,
                                                                    @PathVariable("sessionId")
                                                                    String sessionId)
        Requests for the next activity to be executed in a process instance.
        Specified by:
        getNextActivityForProcessInstance in interface ProcessRestOpenApi
        Parameters:
        processInstanceId - The running process to get the next activity from.
        sessionId - The session token id.
        Returns:
        The activity definition.
      • getProcessDefinition

        @RequestMapping(method=GET,
                        value="getProcessDefinition/{processDefinitionId}/{sessionId}",
                        produces="application/json")
        public ProcessDefinition getProcessDefinition​(@PathVariable("processDefinitionId")
                                                      String processDefinitionId,
                                                      @PathVariable("sessionId")
                                                      String sessionId)
        Retrieves a process definition.
        Specified by:
        getProcessDefinition in interface ProcessRestOpenApi
        Parameters:
        processDefinitionId - The id of the process.
        sessionId - The session token id.
        Returns:
        The process definition. It contains an XML document to be parsed by the consumer.
      • getActivityDefinition

        @RequestMapping(method=GET,
                        value="getActivityDefinition/{processDefinitionId}/{activityDefinitionId}/{sessionId}",
                        produces="application/json")
        public ActivityDefinition getActivityDefinition​(@PathVariable("processDefinitionId")
                                                        String processDefinitionId,
                                                        @PathVariable("activityDefinitionId")
                                                        String activityDefinitionId,
                                                        @PathVariable("sessionId")
                                                        String sessionId)
        Retrieves an activity definition.
        Specified by:
        getActivityDefinition in interface ProcessRestOpenApi
        Parameters:
        processDefinitionId - The id of the process definition.
        activityDefinitionId - The id of the activity definition.
        sessionId - The session token id.
        Returns:
        The activity definition.
      • deleteProcessDefinition

        @RequestMapping(method=DELETE,
                        value="deleteProcessDefinition/{processDefinitionId}/{sessionId}",
                        produces="application/json")
        public void deleteProcessDefinition​(@PathVariable("processDefinitionId")
                                            String processDefinitionId,
                                            @PathVariable("sessionId")
                                            String sessionId)
        Deletes a process definition.
        Specified by:
        deleteProcessDefinition in interface ProcessRestOpenApi
        Parameters:
        processDefinitionId - The process definition to be deleted.
        sessionId - The session token id.
      • updateProcessDefinition

        @RequestMapping(method=PUT,
                        value="updateProcessDefinition/{processDefinitionId}/{structure}/{sessionId}",
                        produces="application/json")
        public void updateProcessDefinition​(@PathVariable("processDefinitionId")
                                            String processDefinitionId,
                                            @RequestBody
                                            List<StringPair> properties,
                                            @PathVariable("structure")
                                            String structure,
                                            @PathVariable("sessionId")
                                            String sessionId)
        Updates a process definition, either its standard properties or its structure.
        Specified by:
        updateProcessDefinition in interface ProcessRestOpenApi
        Parameters:
        processDefinitionId - The process definition id.
        properties - A key value dictionary with the standard properties to be updated. These properties are: name, description, version and enabled (use 'true' or 'false' for the latter).
        structure - The structure of the process definition as string Base64, from an XML document that represents a BPMN process definition
         
          <processDefinition version="" id="" name="" description="" creationDate="" startActivityId="" enabled="">
              <actors>
                  <actor id="" name="" type=""/>
              </actors>
              <activityDefinitions>
                 <activityDefinition id="" name="" description="" actorId="" type="">
                      <paths>
                          <path>value</path>
                      </paths>
                      <artifactDefinition id="" type="">
                          <parameters>
                              <parameter name="">value</parameter>
                          </parameters>
                      </artifactDefinition>
                 </activityDefinition>
              </activityDefinitions>
              <bpmnDiagram>
                  <bpmnSwimlane bpmnElement="" width="" height="" x="" y=""/>
                  <bpmnShape id="" actorId="" width="" height="" x="" y="" isLabel="" type="">value</bpmnShape>
                  <bpmnShape id="" actorId="" width="" height="" x="" y="" isLabel="" type="">value</bpmnShape>
                  <bpmnEdge source="" target="" name=""/>
              </bpmnDiagram>
          </processDefinition>
         
         
        sessionId - The session token id.
      • createProcessDefinition

        @RequestMapping(method=POST,
                        value="createProcessDefinition/{name}/{description}/{version}/{enabled}/{structure}/{sessionId}",
                        produces="application/json")
        public String createProcessDefinition​(@PathVariable("name")
                                              String name,
                                              @PathVariable("description")
                                              String description,
                                              @PathVariable("version")
                                              String version,
                                              @PathVariable("enabled")
                                              boolean enabled,
                                              @PathVariable("structure")
                                              String structure,
                                              @PathVariable("sessionId")
                                              String sessionId)
        Creates a process definition.A process definition is the metadata that defines the steps and constraints of a given project.
        Specified by:
        createProcessDefinition in interface ProcessRestOpenApi
        Parameters:
        name - The name of the new process definition.
        description - The description of the new process definition.
        version - The version of the new process definition. This is a three numbers, dot separated string (e.g. 2.4.1).
        enabled - If the project is enabled to create instances from it.
        structure - The structure of the process definition as string Base64, from an XML document that represents a BPMN process definition
         
          <processDefinition version="" id="" name="" description="" creationDate="" startActivityId="" enabled="">
              <actors>
                  <actor id="" name="" type=""/>
              </actors>
              <activityDefinitions>
                 <activityDefinition id="" name="" description="" actorId="" type="">
                      <paths>
                          <path>value</path>
                      </paths>
                      <artifactDefinition id="" type="">
                          <parameters>
                              <parameter name="">value</parameter>
                          </parameters>
                      </artifactDefinition>
                 </activityDefinition>
              </activityDefinitions>
              <bpmnDiagram>
                  <bpmnSwimlane bpmnElement="" width="" height="" x="" y=""/>
                  <bpmnShape id="" actorId="" width="" height="" x="" y="" isLabel="" type="">value</bpmnShape>
                  <bpmnShape id="" actorId="" width="" height="" x="" y="" isLabel="" type="">value</bpmnShape>
                  <bpmnEdge source="" target="" name=""/>
              </bpmnDiagram>
          </processDefinition>
         
         
        sessionId - The session token id.
        Returns:
        The id of the newly created process definition.
      • getProcessInstances

        @RequestMapping(method=GET,
                        value="getProcessInstances/{processDefinitionId}/{sessionId}",
                        produces="application/json")
        public List<ProcessInstance> getProcessInstances​(@PathVariable("processDefinitionId")
                                                         String processDefinitionId,
                                                         @PathVariable("sessionId")
                                                         String sessionId)
        Gets a process instances of a process definition.
        Specified by:
        getProcessInstances in interface ProcessRestOpenApi
        Parameters:
        processDefinitionId - The process definition id.
        sessionId - The session token id.
        Returns:
        The process instances.
      • getProcessDefinitions

        @RequestMapping(method=GET,
                        value="getProcessDefinitions/{sessionId}",
                        produces="application/json")
        public List<ProcessDefinition> getProcessDefinitions​(@PathVariable("sessionId")
                                                             String sessionId)
        Gets a process definition instances.
        Specified by:
        getProcessDefinitions in interface ProcessRestOpenApi
        Parameters:
        sessionId - The session token id.
        Returns:
        The process instances.
      • getProcessInstance

        @RequestMapping(method=GET,
                        value="getProcessInstance/{processInstanceId}/{sessionId}",
                        produces="application/json")
        public ProcessInstance getProcessInstance​(@PathVariable("processInstanceId")
                                                  String processInstanceId,
                                                  @PathVariable("sessionId")
                                                  String sessionId)
        Gets a process instance.
        Specified by:
        getProcessInstance in interface ProcessRestOpenApi
        Parameters:
        processInstanceId - Process Instance Id.
        sessionId - The session token id.
        Returns:
        A Process Instance for the given id.
      • reloadProcessDefinitions

        @RequestMapping(method=PUT,
                        value="reloadProcessDefinitions/{sessionId}",
                        produces="application/json")
        public void reloadProcessDefinitions​(@PathVariable("sessionId")
                                             String sessionId)
        Updates the process definitions.
        Specified by:
        reloadProcessDefinitions in interface ProcessRestOpenApi
        Parameters:
        sessionId - The session token id.
      • createProcessInstance

        @RequestMapping(method=POST,
                        value="createProcessInstance/{processDefinitionId}/{name}/{description}/{sessionId}",
                        produces="application/json")
        public String createProcessInstance​(@PathVariable("processDefinitionId")
                                            String processDefinitionId,
                                            @PathVariable("name")
                                            String name,
                                            @PathVariable("description")
                                            String description,
                                            @PathVariable("sessionId")
                                            String sessionId)
        Creates an instance of a process, that is, starts one.
        Specified by:
        createProcessInstance in interface ProcessRestOpenApi
        Parameters:
        processDefinitionId - The id of the process to be started.
        name - The name of the new process.
        description - The description of the new process.
        sessionId - The session token id.
        Returns:
        The id of the newly created process instance.
      • updateProcessInstance

        @RequestMapping(method=PUT,
                        value="updateProcessInstance/{processInstanceId}/{name}/{description}/{sessionId}",
                        produces="application/json")
        public void updateProcessInstance​(@PathVariable("processInstanceId")
                                          String processInstanceId,
                                          @PathVariable("name")
                                          String name,
                                          @PathVariable("description")
                                          String description,
                                          @PathVariable("sessionId")
                                          String sessionId)
        Updates the process instance name and description.
        Specified by:
        updateProcessInstance in interface ProcessRestOpenApi
        Parameters:
        processInstanceId - The process instance id.
        name - The process instance name to update.
        description - The process instance description to update.
        sessionId - The session token id.
      • deleteProcessInstance

        @RequestMapping(method=DELETE,
                        value="deleteProcessInstance/{processInstanceId}/{sessionId}",
                        produces="application/json")
        public void deleteProcessInstance​(@PathVariable("processInstanceId")
                                          String processInstanceId,
                                          @PathVariable("sessionId")
                                          String sessionId)
        Deletes a process instance.
        Specified by:
        deleteProcessInstance in interface ProcessRestOpenApi
        Parameters:
        processInstanceId - Process Instance Id.
        sessionId - The session token id.