Class ProcessRestController
- java.lang.Object
-
- org.neotropic.kuwaiba.northbound.rest.aem.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 Summary
Constructors Constructor Description ProcessRestController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
commitActivity(String processInstanceId, String activityDefinitionId, TransientArtifact artifact, String sessionId)
Saves the artifact generated once an activity has been completed (for example, the user filled in a form).String
createProcessDefinition(String name, String description, String version, boolean enabled, String structure, String sessionId)
Creates a process definition.A process definition is the metadata that defines the steps and constraints of a given project.String
createProcessInstance(String processDefinitionId, String name, String description, String sessionId)
Creates an instance of a process, that is, starts one.void
deleteProcessDefinition(String processDefinitionId, String sessionId)
Deletes a process definition.void
deleteProcessInstance(String processInstanceId, String sessionId)
Deletes a process instance.ActivityDefinition
getActivityDefinition(String processDefinitionId, String activityDefinitionId, String sessionId)
Retrieves an activity definition.ArtifactDefinition
getArtifactDefinitionForActivity(String processDefinitionId, String activityDefinitionId, String sessionId)
Given an activity definition, returns the artifact definition associated to it.Artifact
getArtifactForActivity(String processInstanceId, String activityId, 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).ActivityDefinition
getNextActivityForProcessInstance(String processInstanceId, String sessionId)
Requests for the next activity to be executed in a process instance.ProcessDefinition
getProcessDefinition(String processDefinitionId, String sessionId)
Retrieves a process definition.List<ProcessDefinition>
getProcessDefinitions(String sessionId)
Gets a process definition instances.ProcessInstance
getProcessInstance(String processInstanceId, String sessionId)
Gets a process instance.List<ActivityDefinition>
getProcessInstanceActivitiesPath(String processInstanceId, String sessionId)
Gets Process Instance Activities Path.List<ProcessInstance>
getProcessInstances(String processDefinitionId, String sessionId)
Gets a process instances of a process definition.void
reloadProcessDefinitions(String sessionId)
Updates the process definitions.void
updateActivity(String processInstanceId, String activityDefinitionId, TransientArtifact artifact, String sessionId)
Updates the artifact generated once an activity has been completed (for example, the user filled in a form).void
updateProcessDefinition(String processDefinitionId, List<StringPair> properties, String structure, String sessionId)
Updates a process definition, either its standard properties or its structure.void
updateProcessInstance(String processInstanceId, String name, String description, String sessionId)
Updates the process instance name and description.
-
-
-
Field Detail
-
PATH
public static final String PATH
Path that includes the Kuwaiba version and the module id- See Also:
- Constant Field Values
-
-
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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- 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 interfaceProcessRestOpenApi
- Parameters:
processInstanceId
- Process Instance Id.sessionId
- The session token id.
-
-