|
| 1 | +// SPDX-License-Identifier: Apache-2.0 |
| 2 | + |
| 3 | +package syntax |
| 4 | + |
| 5 | +func init() { |
| 6 | + Register(SyntaxFeature{ |
| 7 | + Path: "workflow", |
| 8 | + Summary: "Multi-step business processes with user tasks, decisions, and parallel paths", |
| 9 | + Keywords: []string{ |
| 10 | + "workflow", "business process", "approval", "review", |
| 11 | + "user task", "decision", "parallel", |
| 12 | + }, |
| 13 | + Syntax: "CREATE WORKFLOW Module.Name\n PARAMETER $Context: Module.Entity\nBEGIN\n <activities>\nEND WORKFLOW;", |
| 14 | + Example: "CREATE WORKFLOW HR.LeaveApproval\n PARAMETER $Context: HR.LeaveRequest\nBEGIN\n USER TASK Review 'Review request'\n PAGE HR.ReviewPage\n OUTCOMES 'Approve' { } 'Reject' { };\nEND WORKFLOW;", |
| 15 | + SeeAlso: []string{"workflow.user-task", "workflow.decision", "workflow.parallel-split"}, |
| 16 | + }) |
| 17 | + |
| 18 | + Register(SyntaxFeature{ |
| 19 | + Path: "workflow.show", |
| 20 | + Summary: "List and describe existing workflows", |
| 21 | + Keywords: []string{ |
| 22 | + "list workflows", "show workflows", "describe workflow", |
| 23 | + }, |
| 24 | + Syntax: "SHOW WORKFLOWS;\nSHOW WORKFLOWS IN <module>;\nDESCRIBE WORKFLOW Module.Name;", |
| 25 | + Example: "SHOW WORKFLOWS IN HR;\nDESCRIBE WORKFLOW HR.LeaveApproval;", |
| 26 | + }) |
| 27 | + |
| 28 | + Register(SyntaxFeature{ |
| 29 | + Path: "workflow.create", |
| 30 | + Summary: "Create a new workflow definition with activities and flow", |
| 31 | + Keywords: []string{ |
| 32 | + "create workflow", "new workflow", "define workflow", |
| 33 | + "parameter", "overview page", "due date", |
| 34 | + }, |
| 35 | + Syntax: "CREATE [OR MODIFY] WORKFLOW Module.Name\n PARAMETER $Context: Module.Entity\n [OVERVIEW PAGE Module.OverviewPage]\n [DUE DATE '<expression>']\nBEGIN\n <activities>\nEND WORKFLOW;", |
| 36 | + Example: "CREATE WORKFLOW Module.ApprovalFlow\n PARAMETER $Context: Module.Request\n OVERVIEW PAGE Module.WF_Overview\nBEGIN\n USER TASK ReviewTask 'Review the request'\n PAGE Module.ReviewPage\n OUTCOMES 'Approve' { } 'Reject' { };\nEND WORKFLOW;", |
| 37 | + SeeAlso: []string{"workflow.user-task", "workflow.decision", "workflow.drop"}, |
| 38 | + }) |
| 39 | + |
| 40 | + Register(SyntaxFeature{ |
| 41 | + Path: "workflow.user-task", |
| 42 | + Summary: "User task activity — assigns work to users with outcomes", |
| 43 | + Keywords: []string{ |
| 44 | + "user task", "human task", "assign", "assignee", |
| 45 | + "outcomes", "approve", "reject", "page", |
| 46 | + }, |
| 47 | + Syntax: "USER TASK <name> '<caption>'\n [PAGE Module.Page]\n [TARGETING MICROFLOW Module.MF | TARGETING XPATH '<xpath>']\n [ENTITY Module.Entity]\n OUTCOMES '<outcome1>' { <activities> } '<outcome2>' { <activities> };", |
| 48 | + Example: "USER TASK ReviewTask 'Review the request'\n PAGE HR.ReviewPage\n TARGETING XPATH '[Module.Employee/Active = true()]'\n OUTCOMES 'Approve' { } 'Reject' { };", |
| 49 | + SeeAlso: []string{"workflow.user-task.targeting", "workflow.create"}, |
| 50 | + }) |
| 51 | + |
| 52 | + Register(SyntaxFeature{ |
| 53 | + Path: "workflow.user-task.targeting", |
| 54 | + Summary: "Control who can pick up a user task — microflow or XPath based", |
| 55 | + Keywords: []string{ |
| 56 | + "targeting", "user targeting", "who can execute", |
| 57 | + "assignee", "candidate", "xpath", "microflow", |
| 58 | + "task assignment", "user filter", |
| 59 | + }, |
| 60 | + Syntax: "TARGETING MICROFLOW Module.MF\nTARGETING XPATH '<xpath-expression>'", |
| 61 | + Example: "-- XPath targeting: only active managers\nUSER TASK Approve 'Approve request'\n TARGETING XPATH '[HR.Employee/Role = \"Manager\" and Active = true()]'\n OUTCOMES 'Done' { };\n\n-- Microflow targeting: custom logic\nUSER TASK Approve 'Approve request'\n TARGETING MICROFLOW HR.GetApprovers\n OUTCOMES 'Done' { };", |
| 62 | + MinVersion: "9.0.0", |
| 63 | + SeeAlso: []string{"workflow.user-task"}, |
| 64 | + }) |
| 65 | + |
| 66 | + Register(SyntaxFeature{ |
| 67 | + Path: "workflow.decision", |
| 68 | + Summary: "Decision activity — conditional branching based on expression outcomes", |
| 69 | + Keywords: []string{ |
| 70 | + "decision", "conditional", "branch", "if", "condition", |
| 71 | + "exclusive gateway", "XOR", |
| 72 | + }, |
| 73 | + Syntax: "DECISION ['<caption>'] [COMMENT '<text>']\n OUTCOMES '<outcome>' { <activities> } ...;", |
| 74 | + Example: "DECISION 'Check amount'\n OUTCOMES 'Under 1000' { } 'Over 1000' {\n USER TASK ManagerApproval 'Manager must approve'\n OUTCOMES 'OK' { };\n };", |
| 75 | + SeeAlso: []string{"workflow.create", "workflow.parallel-split"}, |
| 76 | + }) |
| 77 | + |
| 78 | + Register(SyntaxFeature{ |
| 79 | + Path: "workflow.parallel-split", |
| 80 | + Summary: "Parallel split — execute multiple paths concurrently", |
| 81 | + Keywords: []string{ |
| 82 | + "parallel", "concurrent", "split", "fork", "join", |
| 83 | + "parallel gateway", "AND", |
| 84 | + }, |
| 85 | + Syntax: "PARALLEL SPLIT [COMMENT '<text>']\n PATH 1 { <activities> }\n PATH 2 { <activities> };", |
| 86 | + Example: "PARALLEL SPLIT\n PATH 1 {\n USER TASK LegalReview 'Legal review'\n OUTCOMES 'Done' { };\n }\n PATH 2 {\n USER TASK TechReview 'Technical review'\n OUTCOMES 'Done' { };\n };", |
| 87 | + SeeAlso: []string{"workflow.decision", "workflow.create"}, |
| 88 | + }) |
| 89 | + |
| 90 | + Register(SyntaxFeature{ |
| 91 | + Path: "workflow.call-microflow", |
| 92 | + Summary: "Call a microflow as a workflow activity", |
| 93 | + Keywords: []string{ |
| 94 | + "call microflow", "microflow task", "automated step", |
| 95 | + "system task", |
| 96 | + }, |
| 97 | + Syntax: "CALL MICROFLOW Module.MF [COMMENT '<text>']\n [OUTCOMES '<outcome>' { <activities> } ...];", |
| 98 | + Example: "CALL MICROFLOW HR.SendNotification\n COMMENT 'Notify manager';", |
| 99 | + SeeAlso: []string{"workflow.create", "workflow.call-workflow"}, |
| 100 | + }) |
| 101 | + |
| 102 | + Register(SyntaxFeature{ |
| 103 | + Path: "workflow.call-workflow", |
| 104 | + Summary: "Call a sub-workflow from within a workflow", |
| 105 | + Keywords: []string{ |
| 106 | + "call workflow", "sub-workflow", "nested workflow", |
| 107 | + }, |
| 108 | + Syntax: "CALL WORKFLOW Module.WF [COMMENT '<text>'];", |
| 109 | + Example: "CALL WORKFLOW HR.SubApproval COMMENT 'Delegate to sub-process';", |
| 110 | + SeeAlso: []string{"workflow.create", "workflow.call-microflow"}, |
| 111 | + }) |
| 112 | + |
| 113 | + Register(SyntaxFeature{ |
| 114 | + Path: "workflow.drop", |
| 115 | + Summary: "Delete a workflow definition", |
| 116 | + Keywords: []string{ |
| 117 | + "drop workflow", "delete workflow", "remove workflow", |
| 118 | + }, |
| 119 | + Syntax: "DROP WORKFLOW Module.Name;", |
| 120 | + Example: "DROP WORKFLOW HR.LeaveApproval;", |
| 121 | + SeeAlso: []string{"workflow.create"}, |
| 122 | + }) |
| 123 | + |
| 124 | + Register(SyntaxFeature{ |
| 125 | + Path: "workflow.catalog", |
| 126 | + Summary: "Query workflow metadata via catalog tables", |
| 127 | + Keywords: []string{ |
| 128 | + "catalog", "query workflows", "workflow metadata", |
| 129 | + "cross-reference", "callers", "callees", |
| 130 | + }, |
| 131 | + Syntax: "REFRESH CATALOG FULL;\nSELECT * FROM CATALOG.WORKFLOWS;\nSHOW CALLERS OF Module.WorkflowName;\nSHOW REFERENCES TO Module.WorkflowName;", |
| 132 | + Example: "REFRESH CATALOG FULL;\nSELECT QualifiedName, ActivityCount, UserTaskCount\n FROM CATALOG.WORKFLOWS WHERE UserTaskCount > 0;", |
| 133 | + SeeAlso: []string{"workflow.show"}, |
| 134 | + }) |
| 135 | + |
| 136 | + Register(SyntaxFeature{ |
| 137 | + Path: "workflow.boundary-event", |
| 138 | + Summary: "Attach boundary events (timer) to user tasks for timeouts", |
| 139 | + Keywords: []string{ |
| 140 | + "boundary event", "timer", "timeout", "deadline", |
| 141 | + "SLA", "escalation", |
| 142 | + }, |
| 143 | + Syntax: "BOUNDARY TIMER ON <task-name> AFTER '<duration>' {\n <activities>\n}", |
| 144 | + Example: "BOUNDARY TIMER ON ReviewTask AFTER 'P3D' {\n CALL MICROFLOW Module.Escalate;\n}", |
| 145 | + MinVersion: "10.6.0", |
| 146 | + SeeAlso: []string{"workflow.user-task"}, |
| 147 | + }) |
| 148 | + |
| 149 | + Register(SyntaxFeature{ |
| 150 | + Path: "workflow.alter", |
| 151 | + Summary: "Modify an existing workflow — change properties, add/remove activities", |
| 152 | + Keywords: []string{ |
| 153 | + "alter workflow", "modify workflow", "update workflow", |
| 154 | + "add activity", "drop activity", "replace activity", |
| 155 | + }, |
| 156 | + Syntax: "ALTER WORKFLOW Module.Name SET <property> = <value>;\nALTER WORKFLOW Module.Name INSERT <activity> [BEFORE|AFTER <name>];\nALTER WORKFLOW Module.Name DROP <activity-name>;\nALTER WORKFLOW Module.Name REPLACE <name> WITH <activity>;", |
| 157 | + Example: "ALTER WORKFLOW HR.LeaveApproval SET DUE DATE = 'addDays([%CurrentDateTime%], 7)';\nALTER WORKFLOW HR.LeaveApproval INSERT\n CALL MICROFLOW HR.NotifyHR\n AFTER ReviewTask;", |
| 158 | + SeeAlso: []string{"workflow.create", "workflow.drop"}, |
| 159 | + }) |
| 160 | +} |
0 commit comments