simple_workflow.json 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. {
  2. "version": "3.6",
  3. "name": "Simple Approval Workflow",
  4. "registry": {
  5. "services": [
  6. "SubmitRequest(description(STRING), amount(INT)) RETURN requestId(STRING)",
  7. "CheckApprovalPolicy(amount(INT)) RETURN needsApproval(BOOL), approver(STRING)",
  8. "NotifyApprover(requestId(STRING), approver(STRING)) RETURN notified(BOOL)"
  9. ],
  10. "components": [
  11. "FileOps"
  12. ],
  13. "vars": [
  14. "$description(STRING)",
  15. "$amount(INT)",
  16. "$requestId(STRING)",
  17. "$needsApproval(BOOL)",
  18. "$approver(STRING)",
  19. "$status(STRING)"
  20. ],
  21. "files": {
  22. "inputs": [
  23. "Process/Input/*"
  24. ],
  25. "artifacts": [
  26. "Process/Artifacts/*"
  27. ]
  28. }
  29. },
  30. "steps": [
  31. {
  32. "id": "Service_SubmitRequest",
  33. "in": {
  34. "description": "$description",
  35. "amount": "$amount"
  36. },
  37. "out": {
  38. "$requestId": "_result.requestId"
  39. },
  40. "next": "Service_CheckApprovalPolicy"
  41. },
  42. {
  43. "id": "Service_CheckApprovalPolicy",
  44. "in": {
  45. "amount": "$amount"
  46. },
  47. "out": {
  48. "$needsApproval": "_result.needsApproval",
  49. "$approver": "_result.approver"
  50. },
  51. "next": "Branch_CheckIfNeedsApproval"
  52. },
  53. {
  54. "id": "Branch_CheckIfNeedsApproval",
  55. "cases": [
  56. ["$needsApproval == true", "Service_NotifyApprover"],
  57. ["ELSE", "Set_AutoApproved"]
  58. ],
  59. "next": "Write_Result"
  60. },
  61. {
  62. "id": "Service_NotifyApprover",
  63. "in": {
  64. "requestId": "$requestId",
  65. "approver": "$approver"
  66. },
  67. "next": "Set_PendingApproval"
  68. },
  69. {
  70. "id": "Set_PendingApproval",
  71. "target": "$status",
  72. "value": "\"pending_approval\""
  73. },
  74. {
  75. "id": "Set_AutoApproved",
  76. "target": "$status",
  77. "value": "\"auto_approved\"",
  78. "next": "Write_Result"
  79. },
  80. {
  81. "id": "Write_Result",
  82. "target": "\"Process/Artifacts/request_\" + $requestId + \".json\"",
  83. "value": "$status",
  84. "mode": "overwrite",
  85. "next": "Stop_End"
  86. },
  87. {
  88. "id": "Stop_End"
  89. }
  90. ]
  91. }