Skip to content

Commit 5809c62

Browse files
authored
updates to diagram-rest module (#218)
Signed-off-by: Tihomir Surdilovic <[email protected]>
1 parent 83e1c21 commit 5809c62

File tree

19 files changed

+100
-697
lines changed

19 files changed

+100
-697
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,3 +355,27 @@ FunctionDefinition finalizeApplicationFunctionDefinition =
355355
List<Action> actionsForFunctionDefinition =
356356
WorkflowUtils.getActionsForFunctionDefinition(workflow, functionRefName);
357357
```
358+
359+
#### Extra
360+
361+
SDK includes extra functionalities which are not part of core modules but
362+
are very useful and can be used as addons to the core:
363+
364+
##### Diagram REST
365+
This is a Spring Boot app which builds a rest api for diagram generation.
366+
It was contributed by our community member David Marques.
367+
368+
To start using it:
369+
370+
```
371+
cd diagram-rest
372+
mvn clean install spring-boot:run
373+
```
374+
375+
Then you can get the diagram SVG for a workflow definition for example:
376+
377+
```
378+
curl -X POST localhost:8090/diagram -d '{"id":"booklending","name":"Book Lending Workflow","version":"1.0","specVersion":"0.8","start":"Book Lending Request","states":[{"name":"Book Lending Request","type":"event","onEvents":[{"eventRefs":["Book Lending Request Event"]}],"transition":"Get Book Status"},{"name":"Get Book Status","type":"operation","actions":[{"functionRef":{"refName":"Get status for book","arguments":{"bookid":"${ .book.id }"}}}],"transition":"Book Status Decision"},{"name":"Book Status Decision","type":"switch","dataConditions":[{"name":"Book is on loan","condition":"${ .book.status == \"onloan\" }","transition":"Report Status To Lender"},{"name":"Check is available","condition":"${ .book.status == \"available\" }","transition":"Check Out Book"}]},{"name":"Report Status To Lender","type":"operation","actions":[{"functionRef":{"refName":"Send status to lender","arguments":{"bookid":"${ .book.id }","message":"Book ${ .book.title } is already on loan"}}}],"transition":"Wait for Lender response"},{"name":"Wait for Lender response","type":"switch","eventConditions":[{"name":"Hold Book","eventRef":"Hold Book Event","transition":"Request Hold"},{"name":"Decline Book Hold","eventRef":"Decline Hold Event","transition":"Cancel Request"}]},{"name":"Request Hold","type":"operation","actions":[{"functionRef":{"refName":"Request hold for lender","arguments":{"bookid":"${ .book.id }","lender":"${ .lender }"}}}],"transition":"Wait two weeks"},{"name":"Wait two weeks","type":"sleep","duration":"P2W","transition":"Get Book Status"},{"name":"Check Out Book","type":"operation","actions":[{"functionRef":{"refName":"Check out book with id","arguments":{"bookid":"${ .book.id }"}}},{"functionRef":{"refName":"Notify Lender for checkout","arguments":{"bookid":"${ .book.id }","lender":"${ .lender }"}}}],"end":true}],"functions":[],"events":[]}'
379+
```
380+
381+

api/src/main/java/io/serverlessworkflow/api/workflow/DataInputSchema.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ public class DataInputSchema {
2424

2525
public DataInputSchema() {}
2626

27-
public DataInputSchema(String refValue){
27+
public DataInputSchema(String refValue) {
2828
this.refValue = refValue;
2929
}
30+
3031
public String getRefValue() {
3132
return refValue;
3233
}

api_rest/mvnw

Lines changed: 0 additions & 316 deletions
This file was deleted.

0 commit comments

Comments
 (0)