Skip to content

Commit 2e154de

Browse files
Ajit GeorgeAjit George
Ajit George
authored and
Ajit George
committed
No Task - Updated copyright year
1 parent 3a86dec commit 2e154de

File tree

13 files changed

+511
-511
lines changed

13 files changed

+511
-511
lines changed
Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,74 @@
1-
/*
2-
* Copyright 2014-2015 MarkLogic Corporation
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
17-
// module that exports get, post, put and delete
18-
function get(context, params) {
19-
context.outputTypes = ["application/json"];
20-
var arg1 = params.arg1;
21-
var arg2 = params.arg2;
22-
var x = arg1.toString();
23-
24-
25-
return {
26-
"argument1": x,
27-
"argument2": arg2,
28-
"database-name":xdmp.databaseName(xdmp.database()),
29-
"document-count":fn.count(fn.doc()),
30-
"content": "This is a JSON document",
31-
"document-content": fn.doc(),
32-
"response": xdmp.getResponseCode(),
33-
"outputTypes": context.outputTypes,
34-
35-
}
36-
};
37-
function post(context, params, input) {
38-
39-
var argUrl = params.uri;
40-
41-
xdmp.eval(" \
42-
declareUpdate(); \
43-
var argUrl; \
44-
var sibling=cts.doc(argUrl).root.content; \
45-
var inputObject; \
46-
var newNode = new NodeBuilder(); \
47-
newNode.addNode(inputObject); \
48-
var named = newNode.toNode().xpath('.//array-node()'); xdmp.nodeInsertAfter(sibling,named);\
49-
",{"inputObject":input,"argUrl":argUrl},{"isolation":"different-transaction"});
50-
return ({"response": xdmp.getResponseCode()})
51-
52-
};
53-
54-
// Function responding to PUT method - must use local name 'put'.
55-
function put(context, params, input) {
56-
var argUrl = params.uri;
57-
var inputObject = input;
58-
//xdmp.documentInsert(argUrl,input);
59-
xdmp.eval("declareUpdate(); var argUrl; var input;xdmp.documentInsert(argUrl,input)",{"argUrl":argUrl,"input":inputObject},{"isolation":"different-transaction"});
60-
var count = xdmp.eval("fn.count(fn.doc())");
61-
xdmp.log(count);
62-
return ({"response": xdmp.getResponseCode()})
63-
};
64-
65-
// Function responding to DELETE method - must use local name 'delete'.
66-
function deleteFunction(context, params) {
67-
var docuri = params.uri;
68-
xdmp.documentDelete(docuri);
69-
return({"response": xdmp.getResponseCode()})
70-
};
71-
exports.GET = get;
72-
exports.POST = post;
73-
exports.PUT = put;
74-
exports.DELETE = deleteFunction;
1+
/*
2+
* Copyright 2014-2017 MarkLogic Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// module that exports get, post, put and delete
18+
function get(context, params) {
19+
context.outputTypes = ["application/json"];
20+
var arg1 = params.arg1;
21+
var arg2 = params.arg2;
22+
var x = arg1.toString();
23+
24+
25+
return {
26+
"argument1": x,
27+
"argument2": arg2,
28+
"database-name":xdmp.databaseName(xdmp.database()),
29+
"document-count":fn.count(fn.doc()),
30+
"content": "This is a JSON document",
31+
"document-content": fn.doc(),
32+
"response": xdmp.getResponseCode(),
33+
"outputTypes": context.outputTypes,
34+
35+
}
36+
};
37+
function post(context, params, input) {
38+
39+
var argUrl = params.uri;
40+
41+
xdmp.eval(" \
42+
declareUpdate(); \
43+
var argUrl; \
44+
var sibling=cts.doc(argUrl).root.content; \
45+
var inputObject; \
46+
var newNode = new NodeBuilder(); \
47+
newNode.addNode(inputObject); \
48+
var named = newNode.toNode().xpath('.//array-node()'); xdmp.nodeInsertAfter(sibling,named);\
49+
",{"inputObject":input,"argUrl":argUrl},{"isolation":"different-transaction"});
50+
return ({"response": xdmp.getResponseCode()})
51+
52+
};
53+
54+
// Function responding to PUT method - must use local name 'put'.
55+
function put(context, params, input) {
56+
var argUrl = params.uri;
57+
var inputObject = input;
58+
//xdmp.documentInsert(argUrl,input);
59+
xdmp.eval("declareUpdate(); var argUrl; var input;xdmp.documentInsert(argUrl,input)",{"argUrl":argUrl,"input":inputObject},{"isolation":"different-transaction"});
60+
var count = xdmp.eval("fn.count(fn.doc())");
61+
xdmp.log(count);
62+
return ({"response": xdmp.getResponseCode()})
63+
};
64+
65+
// Function responding to DELETE method - must use local name 'delete'.
66+
function deleteFunction(context, params) {
67+
var docuri = params.uri;
68+
xdmp.documentDelete(docuri);
69+
return({"response": xdmp.getResponseCode()})
70+
};
71+
exports.GET = get;
72+
exports.POST = post;
73+
exports.PUT = put;
74+
exports.DELETE = deleteFunction;
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
(:
2-
Copyright 2014-2015 MarkLogic Corporation
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
:)
16-
17-
18-
19-
xquery version "1.0-ml";
20-
21-
module namespace custom-lib =
22-
"http://marklogic.com/ext/patch/custom-lib";
23-
24-
declare function custom-lib:underwrite(
25-
$node as node()?,
26-
$content as item()*
27-
) as node()*
28-
{
29-
let $element := $content[1]
30-
return
31-
if (empty($node))
32-
then $element
33-
else
34-
let $atts := $element/@*
35-
let $att-names := $atts/node-name(.)
36-
return element {node-name($node)} {
37-
$node/@*[not(node-name(.) = $att-names)],
38-
$atts,
39-
$node/node(),
40-
$element/node()
41-
}
42-
1+
(:
2+
Copyright 2014-2017 MarkLogic Corporation
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
:)
16+
17+
18+
19+
xquery version "1.0-ml";
20+
21+
module namespace custom-lib =
22+
"http://marklogic.com/ext/patch/custom-lib";
23+
24+
declare function custom-lib:underwrite(
25+
$node as node()?,
26+
$content as item()*
27+
) as node()*
28+
{
29+
let $element := $content[1]
30+
return
31+
if (empty($node))
32+
then $element
33+
else
34+
let $atts := $element/@*
35+
let $att-names := $atts/node-name(.)
36+
return element {node-name($node)} {
37+
$node/@*[not(node-name(.) = $att-names)],
38+
$atts,
39+
$node/node(),
40+
$element/node()
41+
}
42+
4343
};
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
/*
2-
* Copyright 2014-2015 MarkLogic Corporation
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
1+
/*
2+
* Copyright 2014-2017 MarkLogic Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
1717
fn.doc()
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
xquery version "1.0-ml";
2-
(:
3-
Copyright 2014-2015 MarkLogic Corporation
4-
5-
Licensed under the Apache License, Version 2.0 (the "License");
6-
you may not use this file except in compliance with the License.
7-
You may obtain a copy of the License at
8-
9-
http://www.apache.org/licenses/LICENSE-2.0
10-
11-
Unless required by applicable law or agreed to in writing, software
12-
distributed under the License is distributed on an "AS IS" BASIS,
13-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
See the License for the specific language governing permissions and
15-
limitations under the License.
16-
:)
17-
18-
19-
20-
module namespace my = "http://my.test.module";
21-
declare function my:useless()
22-
{
23-
let $x := (1,2,3,4,5)
24-
return subsequence($x, 2)
25-
};
26-
1+
xquery version "1.0-ml";
2+
(:
3+
Copyright 2014-2017 MarkLogic Corporation
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
:)
17+
18+
19+
20+
module namespace my = "http://my.test.module";
21+
declare function my:useless()
22+
{
23+
let $x := (1,2,3,4,5)
24+
return subsequence($x, 2)
25+
};
26+

0 commit comments

Comments
 (0)