Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit ad21243

Browse files
authored
Merge pull request #119 from marklogic-community/feature-115
Feature 115
2 parents 09d14c6 + 30cdbf3 commit ad21243

File tree

17 files changed

+154
-60
lines changed

17 files changed

+154
-60
lines changed

deploy/ml-config.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,26 @@
253253
-->
254254
</range-element-indexes>
255255
<range-element-attribute-indexes>
256+
<range-element-attribute-index>
257+
<scalar-type>string</scalar-type>
258+
<parent-namespace-uri>http://marklogic.com/workflow</parent-namespace-uri>
259+
<parent-localname>process</parent-localname>
260+
<namespace-uri/>
261+
<localname>id</localname>
262+
<collation>http://marklogic.com/collation/</collation>
263+
<range-value-positions>false</range-value-positions>
264+
<invalid-values>ignore</invalid-values>
265+
</range-element-attribute-index>
266+
<range-element-attribute-index>
267+
<scalar-type>string</scalar-type>
268+
<parent-namespace-uri>http://marklogic.com/workflow</parent-namespace-uri>
269+
<parent-localname>attachment</parent-localname>
270+
<namespace-uri/>
271+
<localname>uri</localname>
272+
<collation>http://marklogic.com/collation/</collation>
273+
<range-value-positions>false</range-value-positions>
274+
<invalid-values>ignore</invalid-values>
275+
</range-element-attribute-index>
256276
<!--
257277
Sample for:
258278
<person name="bob" xmlns="http://marklogic.com/ns/sample"/>

documentation/INSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Roxy Installation
1+
### Roxy Installation
22

33
To install via roxy, within the roxy directory, edit the properties file for the target environment - for example, ``deploy/local.properties`` and run the following commands:
44

rest-api/ext/process.xqy

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
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"; :)
119
import module namespace json = "http://marklogic.com/xdmp/json" at "/MarkLogic/json/json.xqy";
12-
1310
import module namespace cpf = "http://marklogic.com/cpf" at "/MarkLogic/cpf/cpf.xqy";
1411
import module namespace wfu="http://marklogic.com/workflow-util" at "/workflowengine/models/workflow-util.xqy";
1512
import module namespace wfa="http://marklogic.com/workflow-actions" at "/workflowengine/models/workflow-actions.xqy";
1613

14+
declare namespace rapi = "http://marklogic.com/rest-api";
1715
declare namespace roxy = "http://marklogic.com/roxy";
1816
declare 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+

rest-api/ext/processasset.xqy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ xquery version "1.0-ml";
33
module namespace ext = "http://marklogic.com/rest-api/resource/processasset";
44

55
import module namespace json = "http://marklogic.com/xdmp/json" at "/MarkLogic/json/json.xqy";
6-
76
import module namespace wfi="http://marklogic.com/workflow-import" at "/workflowengine/models/workflow-import.xqy";
87
import module namespace wfu="http://marklogic.com/workflow-util" at "/workflowengine/models/workflow-util.xqy";
98

109
declare namespace wf="http://marklogic.com/workflow";
11-
1210
declare namespace roxy = "http://marklogic.com/roxy";
13-
1411
declare namespace rapi = "http://marklogic.com/rest-api";
1512

1613

@@ -52,6 +49,7 @@ function ext:get(
5249
:)
5350
declare
5451
%roxy:params("")
52+
%rapi:transaction-mode("update")
5553
function ext:put(
5654
$context as map:map,
5755
$params as map:map,

rest-api/ext/processinbox.xqy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import module namespace json = "http://marklogic.com/xdmp/json" at "/MarkLogic/j
88
import module namespace cpf = "http://marklogic.com/cpf" at "/MarkLogic/cpf/cpf.xqy";
99
import module namespace wfu="http://marklogic.com/workflow-util" at "/workflowengine/models/workflow-util.xqy";
1010

11+
declare namespace rapi= "http://marklogic.com/rest-api";
1112
declare namespace roxy = "http://marklogic.com/roxy";
1213
declare namespace wf="http://marklogic.com/workflow";
1314

@@ -17,7 +18,7 @@ declare namespace wf="http://marklogic.com/workflow";
1718
: Returns the full process document
1819
:)
1920
declare
20-
%roxy:params("inbox=xs:string")
21+
%roxy:params("user=xs:string")
2122
function ext:get(
2223
$context as map:map,
2324
$params as map:map
@@ -30,7 +31,7 @@ function ext:get(
3031

3132
let $out :=
3233
<ext:readResponse><ext:outcome>SUCCESS</ext:outcome>
33-
{wfu:inbox( () )}
34+
{wfu:inbox( map:get($params,"user") )}
3435
</ext:readResponse>
3536

3637
return

rest-api/ext/processmodel.xqy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ xquery version "1.0-ml";
33
module namespace ext = "http://marklogic.com/rest-api/resource/processmodel";
44

55
import module namespace json = "http://marklogic.com/xdmp/json" at "/MarkLogic/json/json.xqy";
6-
76
import module namespace wfi="http://marklogic.com/workflow-import" at "/workflowengine/models/workflow-import.xqy";
87
import module namespace wfu="http://marklogic.com/workflow-util" at "/workflowengine/models/workflow-util.xqy";
98

109
declare namespace wf="http://marklogic.com/workflow";
11-
10+
declare namespace rapi= "http://marklogic.com/rest-api";
1211
declare namespace roxy = "http://marklogic.com/roxy";
1312

14-
1513
(:
1614
: Get the process model by exact name
1715
: ?publishedId=name
@@ -53,6 +51,7 @@ function ext:get(
5351
:)
5452
declare
5553
%roxy:params("")
54+
%rapi:transaction-mode("update")
5655
function ext:put(
5756
$context as map:map,
5857
$params as map:map,
@@ -105,6 +104,7 @@ function ext:put(
105104
:)
106105
declare
107106
%roxy:params("")
107+
%rapi:transaction-mode("update")
108108
function ext:post(
109109
$context as map:map,
110110
$params as map:map,

rest-api/ext/processqueue.xqy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import module namespace json = "http://marklogic.com/xdmp/json" at "/MarkLogic/j
88
import module namespace cpf = "http://marklogic.com/cpf" at "/MarkLogic/cpf/cpf.xqy";
99
import module namespace wfu="http://marklogic.com/workflow-util" at "/workflowengine/models/workflow-util.xqy";
1010

11+
declare namespace rapi= "http://marklogic.com/rest-api";
1112
declare namespace roxy = "http://marklogic.com/roxy";
1213
declare namespace wf="http://marklogic.com/workflow";
1314

@@ -17,7 +18,7 @@ declare namespace wf="http://marklogic.com/workflow";
1718
: Returns the full process document
1819
:)
1920
declare
20-
%roxy:params("inbox=xs:string")
21+
%roxy:params("queue=xs:string")
2122
function ext:get(
2223
$context as map:map,
2324
$params as map:map

rest-api/ext/processroleinbox.xqy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import module namespace json = "http://marklogic.com/xdmp/json" at "/MarkLogic/j
88
import module namespace cpf = "http://marklogic.com/cpf" at "/MarkLogic/cpf/cpf.xqy";
99
import module namespace wfu="http://marklogic.com/workflow-util" at "/workflowengine/models/workflow-util.xqy";
1010

11+
declare namespace rapi= "http://marklogic.com/rest-api";
1112
declare namespace roxy = "http://marklogic.com/roxy";
1213
declare namespace wf="http://marklogic.com/workflow";
1314

@@ -16,7 +17,7 @@ declare namespace wf="http://marklogic.com/workflow";
1617
: Fetch a process inbox for the current role
1718
:)
1819
declare
19-
%roxy:params("inbox=xs:string")
20+
%roxy:params("role=xs:string")
2021
function ext:get(
2122
$context as map:map,
2223
$params as map:map

rest-api/ext/processsubscription.xqy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ module namespace ext = "http://marklogic.com/rest-api/resource/processsubscripti
55

66
(: import module namespace config = "http://marklogic.com/roxy/config" at "/app/config/config.xqy"; :)
77
import module namespace json = "http://marklogic.com/xdmp/json" at "/MarkLogic/json/json.xqy";
8-
98
import module namespace cpf = "http://marklogic.com/cpf" at "/MarkLogic/cpf/cpf.xqy";
109
import module namespace wfu="http://marklogic.com/workflow-util" at "/workflowengine/models/workflow-util.xqy";
1110

11+
declare namespace rapi= "http://marklogic.com/rest-api";
1212
declare namespace roxy = "http://marklogic.com/roxy";
1313
declare namespace wf="http://marklogic.com/workflow";
1414

@@ -31,6 +31,7 @@ declare namespace wf="http://marklogic.com/workflow";
3131
:)
3232
declare
3333
%roxy:params("")
34+
%rapi:transaction-mode("update")
3435
function ext:put(
3536
$context as map:map,
3637
$params as map:map,

rest-api/ext/workplace.xqy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ xquery version "1.0-ml";
33
module namespace ext = "http://marklogic.com/rest-api/resource/workplace";
44

55
declare namespace roxy = "http://marklogic.com/roxy";
6-
76
declare namespace rapi = "http://marklogic.com/rest-api";
87

98
(:

0 commit comments

Comments
 (0)