@Controller @RequestMapping(value="/api") public class RestController extends Object
{"arg1":{"refNum":1, "date":"22.09.2014"}, "arg2":[true, 1, "text"]} is forwarded by the following map:
Map map = new LinkedHashMap<>();
Map arg1 = new LinkedHashMap<>();
arg1.put("refNum",1);
arg1.put("date","22.09.2014");
List> arg2 = new ArrayList<>();
arg2.add(true);
arg2.add(1);
arg2.add("text");
map.put("arg1",arg1);
map.put("arg2",arg2);
| Constructor and Description |
|---|
RestController() |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.http.ResponseEntity<WorkflowInstanceRestModel> |
create(String body)
Creates a new workflow instance.
|
String |
errorHandler(Exception e) |
org.springframework.http.ResponseEntity<WorkflowInstanceRestModel> |
find(long woinRefNum)
Finds a workflow instance.
|
org.springframework.http.ResponseEntity<List<HumanTaskModel>> |
findActiveHumanTasks(String role,
String user)
Searches active human tasks by role and/or user.
|
org.springframework.http.ResponseEntity<List<WorkflowInstanceRestModel>> |
findInstances(String label1,
String label2,
Boolean activeOnly)
Searches workflow instance's that match the given criteria.
|
void |
init() |
org.springframework.http.ResponseEntity<Void> |
sendSignal(long woinRefNum,
String signal,
String argument)
Notifies all waiting signal work items of the given workflow instance and the given signal name.
|
org.springframework.http.ResponseEntity<HumanTaskModel> |
updateHumanTask(long woinRefNum,
int tokenId,
String body)
(Un)assigns a human task to a user or submits its result.
|
org.springframework.http.ResponseEntity<WorkflowInstanceRestModel> |
updateIntance(long woinRefNum,
UpdateInstanceStatusForm form)
Aborts, suspends or resumes a workflow instance.
|
@PostConstruct public void init()
@ExceptionHandler @ResponseStatus(value=INTERNAL_SERVER_ERROR) @ResponseBody public String errorHandler(Exception e)
@RequestMapping(method=POST,
value="/workflowInstance",
produces={"application/json","text/xml"})
public org.springframework.http.ResponseEntity<WorkflowInstanceRestModel> create(@RequestBody
String body)
Request: POST /workflowInstance {workflowName: "credit.step1", workflowVersion: null, arguments: {"arg1":{"refNum":1, "date":"22.09.2014"}, "arg2":[true, 1, "text"]}, label1: "one", label2: null }
Response: OK, {refNum: 1, workflowName: "credit.step1", workflowVersion: null, label1: "one", label2: null, status: NEW}
@RequestMapping(method=GET,
value="/workflowInstance/{woinRefNum}",
produces={"application/json","text/xml"})
public org.springframework.http.ResponseEntity<WorkflowInstanceRestModel> find(@PathVariable
long woinRefNum)
Request: GET /workflowInstance/1
Response: OK {refNum: 1, workflowName: "credit.step1", workflowVersion: null, label1: "one", label2: null, status: NEW}
Response: NOT_FOUND, if no such workflow instance exists
@RequestMapping(method=POST,
value="/workflowInstance/{woinRefNum}",
produces={"application/json","text/xml"})
public org.springframework.http.ResponseEntity<WorkflowInstanceRestModel> updateIntance(@PathVariable
long woinRefNum,
@RequestBody
UpdateInstanceStatusForm form)
Request: POST /workflowInstance/{woinRefNum} {status: "ABORT"}
Response: OK, {refNum: 1, workflowName: "credit.step1", workflowVersion: null, label1: "one", label2: null, status: ABORT}
Response: NOT_FOUND, if no such workflow instance exists
Response: CONFLICT, if the workflow's current status does not allow the requested status transition
Response: BAD_REQUEST, if the new status is not allowed.
@RequestMapping(method=POST,
value="/workflowInstance/{woinRefNum}/signal/{signal}",
produces={"application/json","text/xml"})
public org.springframework.http.ResponseEntity<Void> sendSignal(@PathVariable
long woinRefNum,
@PathVariable
String signal,
@RequestBody
String argument)
Request: POST /workflowInstance/1/signal/invoice {argument: {refNum:3, invoiceAmount: "10 Euro"}}
Response: NO_CONTENT
@RequestMapping(method=POST,
value="/workflowInstance/{woinRefNum}/humanTask/{tokenId}",
produces={"application/json","text/xml"})
public org.springframework.http.ResponseEntity<HumanTaskModel> updateHumanTask(@PathVariable
long woinRefNum,
@PathVariable
int tokenId,
@RequestBody
String body)
Request: POST /workflowInstance/1/humanTask/2 {result: {resolution: "completed"}}
Response: OK, {refNum:3, woinRefNum:1, tokenId:2, status:EXECUTED, role:"auditor", user:"hans", arguments:{task:"audit customer 500"}, result: {resolution: "completed"}}
Response: NOT_FOUND, if no such human task exists
Response: CONFLICT, if the human task's status does not allow the requested status transition
@RequestMapping(method=GET,
value="/workflowInstance/search",
produces={"application/json","text/xml"})
public org.springframework.http.ResponseEntity<List<WorkflowInstanceRestModel>> findInstances(@RequestParam(required=false)
String label1,
@RequestParam(required=false)
String label2,
@RequestParam(required=false)
Boolean activeOnly)
Request: GET /workflowInstance/search?label1=aClientId
Response: OK, [{refNum: 1, workflowName: "credit.step1", workflowVersion: null, label1: "aClientId", label2: null, status: NEW}, {refNum: 2, workflowName: "credit.client.step1", workflowVersion: null, label1: "aClientId", label2: "anotherIdentificator", status: NEW}]
@RequestMapping(method=GET,
value="/humanTask/search",
produces={"application/json","text/xml"})
public org.springframework.http.ResponseEntity<List<HumanTaskModel>> findActiveHumanTasks(@RequestParam(required=false)
String role,
@RequestParam(required=false)
String user)
Request: GET /humanTask/search?role=auditor&user=hans
Response: OK, [{refNum:3, woinRefNum:1, tokenId:2, status:EXECUTED, role:"auditor", user:"hans", arguments:{task:"audit customer 500"}}]
Copyright © 2016. All rights reserved.