1-
2-
31(: process.xqy - Start a new, or modify an existing, MarkLogic Workflow process
42 :
53 :)
@@ -9,16 +7,14 @@ module namespace ext = "http://marklogic.com/rest-api/resource/process";
97
108(: import module namespace config = "http://marklogic.com/roxy/config" at "/app/config/config.xqy"; :)
119import module namespace json = "http://marklogic.com/xdmp/json" at "/MarkLogic/json/json.xqy" ;
12-
1310import module namespace cpf = "http://marklogic.com/cpf" at "/MarkLogic/cpf/cpf.xqy" ;
1411import module namespace wfu="http://marklogic.com/workflow-util" at "/workflowengine/models/workflow-util.xqy" ;
1512import module namespace wfa="http://marklogic.com/workflow-actions" at "/workflowengine/models/workflow-actions.xqy" ;
1613
14+ declare namespace rapi = "http://marklogic.com/rest-api" ;
1715declare namespace roxy = "http://marklogic.com/roxy" ;
1816declare namespace wf="http://marklogic.com/workflow" ;
1917
20- declare namespace rapi = "http://marklogic.com/rest-api" ;
21-
2218(:
2319 : To add parameters to the functions, specify them in the params annotations.
2420 : Example
@@ -174,7 +170,8 @@ function ext:post(
174170
175171 (: call wfu complete on it :)
176172 let $_ := xdmp:log ("Calling wfa:complete-userTask" )
177- let $feedback := wfa:complete-userTask ($pid,$input/wf:data/node (),$input/wf:attachments/node ())
173+ let $feedback := wfa:complete-userTask ($pid, $input/wf:data/node (), $input/wf:attachments/node ())
174+ (: let $feedback := wfa:complete-userTask($pid,$input/ext:updateRequest/wf:data/node(),$input/ext:updateRequest/wf:attachments/node()) :)
178175 (: Could return errors with data or attachments :)
179176 return
180177 if (fn:not (fn:empty ($feedback))) then
@@ -243,7 +240,8 @@ function ext:post(
243240 else
244241 $update
245242 else
246- () (: Just default to updating the data, but doing nothing around locking :)
243+ (: Just default to updating the data, but doing nothing around locking :)
244+ wfa:update-userTask ($pid,$input/ext:updateRequest/wf:data/node (),$input/ext:updateRequest/wf:attachments/node ())
247245
248246
249247 let $out := ($res,<ext:updateResponse><ext:outcome>SUCCESS</ext:outcome></ext:updateResponse>)[1 ]
@@ -264,3 +262,26 @@ function ext:post(
264262 }
265263 )
266264};
265+
266+ declare
267+ %roxy:params("" )
268+ function ext:delete (
269+ $context as map:map,
270+ $params as map:map,
271+ $input as document-node ()*
272+ ) as document-node ()* {
273+
274+ let $preftype := if ("application/xml" = map:get ($context,"accept-types" )) then "application/xml" else "application/json"
275+
276+ let $pid := map:get ($params,"processid" )
277+ let $_ := xdmp:log ("REST EXT ProcessId: " || $pid)
278+ let $_ := wfu:delete ($pid)
279+
280+ return
281+ (
282+ map:put ($context, "output-types" , $preftype),
283+ xdmp:set-response-code (200 , "OK" ),
284+ document {()}
285+ )
286+ };
287+
0 commit comments