7
7
namespace WorkflowServer . CallbackApi . Controllers ;
8
8
9
9
/// <summary>
10
- /// This controller implements all possible requests from Callback API of WFS 3.0.0.
10
+ /// This controller implements all possible requests from Callback API of Workflow Server 3.0.0.
11
11
/// Callback API allows hosting your code of Actions, Conditions or Rules on third-party servers.
12
12
/// Callback server should be connected in the admin panel on the Callback API page.
13
13
/// More details on the <see href="https://workflowserver.io/documentation/callback-api">workflowserver.io</see>
@@ -23,17 +23,28 @@ public ApiController(ILogger<ApiController> logger)
23
23
_actionProvider = new ActionProvider ( ) ;
24
24
_conditionProvider = new ConditionProvider ( ) ;
25
25
_identityProvider = new IdentityProvider ( ) ;
26
+
27
+ //The parameters will not be saved, this is an example. You should add the provider as a dependency injection.
26
28
_parameterProvider = new ParameterProvider ( ) ;
27
29
}
28
30
29
31
#region Actions & Conditions Execution
30
32
33
+ /// <summary>
34
+ /// Returns a list of actions that can be executed on the callback server.
35
+ /// When the Workflow Server should execute an Action with a certain name,
36
+ /// it calls the action execution method on the server that has returned this
37
+ /// name in response to the request for the list of actions.
38
+ /// </summary>
31
39
[ HttpGet ]
32
40
public Task < IActionResult > GetActions ( string schemeCode , string token )
33
41
{
34
42
return Task . FromResult < IActionResult > ( Ok ( ApiResponse . Ok ( _actionProvider . ActionNames ) ) ) ;
35
43
}
36
44
45
+ /// <summary>
46
+ /// Request to execute the action. Which of callback servers is called to execute this method, depends on the list of actions returned.
47
+ /// </summary>
37
48
[ HttpPost ]
38
49
public async Task < IActionResult > ExecuteAction ( InstanceRequest request )
39
50
{
@@ -42,12 +53,22 @@ public async Task<IActionResult> ExecuteAction(InstanceRequest request)
42
53
return Ok ( ApiResponse . Ok ( ) ) ;
43
54
}
44
55
56
+ /// <summary>
57
+ /// Returns a list of conditions that can be executed on the callback server.
58
+ /// When the Workflow Server should execute a condition with a certain name,
59
+ /// it calls the condition execution method on the server that has returned
60
+ /// this name in response to the request for the list of conditions.
61
+ /// </summary>
45
62
[ HttpGet ]
46
63
public Task < IActionResult > GetConditions ( string schemeCode , string token )
47
64
{
48
65
return Task . FromResult < IActionResult > ( Ok ( ApiResponse . Ok ( _conditionProvider . ConditionNames ) ) ) ;
49
66
}
50
67
68
+ /// <summary>
69
+ /// Request to execute the condition. Which of the callback servers
70
+ /// is called to execute this method, depends on the list of conditions returned.
71
+ /// </summary>
51
72
[ HttpPost ]
52
73
public async Task < IActionResult > ExecuteCondition ( InstanceRequest request )
53
74
{
@@ -63,19 +84,31 @@ public async Task<IActionResult> ExecuteCondition(InstanceRequest request)
63
84
64
85
#region Authorization Rules Execution
65
86
87
+ /// <summary>
88
+ /// Returns a list of Authorization Rules that can be executed on the callback server.
89
+ /// When the Workflow Server should execute an Authorization Rule with a certain name,
90
+ /// it calls the Authorization Rule execution method on the server that has returned
91
+ /// this name in response to the request for the list of Authorization Rules.
92
+ /// </summary>
66
93
[ HttpGet ]
67
94
public Task < IActionResult > GetRules ( string schemeCode , string token )
68
95
{
69
96
return Task . FromResult < IActionResult > ( Ok ( ApiResponse . Ok ( _identityProvider . RuleNames ) ) ) ;
70
97
}
71
98
99
+ /// <summary>
100
+ /// Check if the User has the access to the command.
101
+ /// </summary>
72
102
[ HttpPost ]
73
103
public async Task < IActionResult > CheckRule ( CheckRuleRequest request )
74
104
{
75
105
var result = await _identityProvider . RuleCheck ( request . Name , request . IdentityId , request . Parameter , request . ProcessInstance ) ;
76
106
return Ok ( ApiResponse . Ok ( result ) ) ;
77
107
}
78
108
109
+ /// <summary>
110
+ /// Returns the list of all Users who have the access.
111
+ /// </summary>
79
112
[ HttpPost ]
80
113
public async Task < IActionResult > GetIdentities ( InstanceRequest request )
81
114
{
@@ -89,6 +122,11 @@ public async Task<IActionResult> GetIdentities(InstanceRequest request)
89
122
90
123
#region Remote Scheme Generation
91
124
125
+ /// <summary>
126
+ /// Workflow Engine (is a part of WorkflowServer) supports scheme generation. If you include this method, then,
127
+ /// to initialize a new scheme, the Workflow Server calls it on all the connected
128
+ /// servers with the settings containing the address of this method.
129
+ /// </summary>
92
130
[ HttpPost ]
93
131
public Task < IActionResult > Generate ( GenerateRequest request )
94
132
{
@@ -103,6 +141,10 @@ public Task<IActionResult> Generate(GenerateRequest request)
103
141
104
142
#region Event Handlers
105
143
144
+ /// <summary>
145
+ /// The ProcessStatusChanged event is called only after switching to
146
+ /// the statuses of Idled and Finalized. It is not called for subprocesses.
147
+ /// </summary>
106
148
[ HttpPost ]
107
149
public Task < IActionResult > ProcessStatusChanged ( StatusChangedRequest request )
108
150
{
@@ -114,6 +156,9 @@ public Task<IActionResult> ProcessStatusChanged(StatusChangedRequest request)
114
156
return Task . FromResult < IActionResult > ( Ok ( ApiResponse . Ok ( ) ) ) ;
115
157
}
116
158
159
+ /// <summary>
160
+ /// The ProcessActivityChanged event.
161
+ /// </summary>
117
162
[ HttpPost ]
118
163
public Task < IActionResult > ProcessActivityChanged ( ActivityChangedRequest request )
119
164
{
@@ -125,6 +170,9 @@ public Task<IActionResult> ProcessActivityChanged(ActivityChangedRequest request
125
170
return Task . FromResult < IActionResult > ( Ok ( ApiResponse . Ok ( ) ) ) ;
126
171
}
127
172
173
+ /// <summary>
174
+ /// The processLogs event.
175
+ /// </summary>
128
176
[ HttpPost ]
129
177
public Task < IActionResult > ProcessLog ( LogRequest request )
130
178
{
@@ -137,19 +185,28 @@ public Task<IActionResult> ProcessLog(LogRequest request)
137
185
138
186
#region Parameters Providing
139
187
188
+ /// <summary>
189
+ /// Used to get parameters list.
190
+ /// </summary>
140
191
[ HttpGet ]
141
192
public Task < IActionResult > GetParameterNames ( string schemeCode , string token )
142
193
{
143
194
return Task . FromResult < IActionResult > ( Ok ( ApiResponse . Ok ( _parameterProvider . GetNames ) ) ) ;
144
195
}
145
196
197
+ /// <summary>
198
+ /// The method returns a JSON serialized parameter value.
199
+ /// </summary>
146
200
[ HttpPost ]
147
201
public Task < IActionResult > GetParameter ( ParameterRequest request )
148
202
{
149
203
var result = _parameterProvider . GetParameter ( request . Name ) ;
150
204
return Task . FromResult < IActionResult > ( Ok ( ApiResponse . Ok ( result ) ) ) ;
151
205
}
152
206
207
+ /// <summary>
208
+ /// Used for set parameter value.
209
+ /// </summary>
153
210
[ HttpPost ]
154
211
public Task < IActionResult > SetParameter ( ParameterRequest request )
155
212
{
0 commit comments