diff --git a/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.atom.ftl b/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.atom.ftl
index 5019412239..d4a1a9c43f 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.atom.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.atom.ftl
@@ -15,7 +15,7 @@
[#assign typedef = cmistype(object)]
[#list typedef.propertyDefinitions?values as propdef]
- [@filter propfilter propdef.propertyId.id][@prop propdef.propertyId.id object propdef.dataType/][/@filter]
+ [@filter propfilter propdef.propertyId.id][@prop propdef.propertyId.id object propdef.dataType.label/][/@filter]
[/#list]
[/#macro]
@@ -30,10 +30,10 @@
${node.properties.creator!""}
[@contentstream node/]
urn:uuid:${node.id}
-
-[@linkstream node "enclosure"/]
-
-[@linkstream node "edit-media"/]
+[@linksLib.linknodeself node/]
+[@linksLib.linkstream node "enclosure"/]
+[@linksLib.linknodeedit node/]
+[@linksLib.linkstream node "edit-media"/]
[@documentCMISLinks node=node/]
${xmldate(node.properties.created)}
[@contentsummary node/]
@@ -49,12 +49,12 @@
[/#macro]
[#macro documentCMISLinks node]
-[@linkallowableactions node/]
-[@linkrelationships node/]
-[@linkparents node/]
-[@linkversions node/]
-[@linktype node/]
-[@linkservice/]
+[@linksLib.linkallowableactions node/]
+[@linksLib.linkrelationships node/]
+[@linksLib.linkparents node/]
+[@linksLib.linkversions node/]
+[@linksLib.linktype node/]
+[@linksLib.linkservice/]
[/#macro]
@@ -67,8 +67,8 @@
${node.properties.creator}
[@contentstream node/]
urn:uuid:${node.id}
-
-[@linkstream node "enclosure"/]
+[@linksLib.linknodeself node/]
+[@linksLib.linkstream node "enclosure"/]
[@documentCMISLinks node=node/]
${xmldate(node.properties.created)}
[@contentsummary node/]
@@ -92,17 +92,17 @@
${node.properties.creator}
[@contentstream node/]
urn:uuid:${node.id}
-
-[@linkstream node "enclosure"/]
-
-[@linkstream node "edit-media"/]
+[#assign pwcuri]/api/pwc/[@linksLib.noderef node/][/#assign]
+[@linksLib.linkself href="${pwcuri}"/]
+[@linksLib.linkstream node "enclosure"/]
+[@linksLib.linknodeedit node/]
+[@linksLib.linkstream node "edit-media"/]
[@documentCMISLinks node=node/]
${xmldate(node.properties.created)}
[@contentsummary node/]
${node.name}
${xmldate(node.properties.modified)}
${xmldate(node.properties.modified)}
-[#-- TODO: the edit link refers to the updatable node resource, allowing updates on PWCs without checkin --]
${absurl(url.context)}${node.icon16}
[@objectCMISProps node propfilter/]
@@ -125,8 +125,8 @@
${node.properties.creator}
${node.id} [#-- TODO --]
urn:uuid:${node.id}
-
-
+[@linksLib.linknodeself node/]
+[@linksLib.linknodeedit node/]
[@folderCMISLinks node/]
${xmldate(node.properties.created)}
${node.properties.description!node.properties.title!""} [#-- TODO --]
@@ -143,7 +143,9 @@
[#assign nested = cmischildren(node, typesfilter)/]
[#if nested?size > 0]
-[@feedLib.node node "${nestedkind}"/]
+[@feedLib.node node "${nestedkind}"]
+ [#if nestedkind == "tree"][@linksLib.linktree node "self"/][#else][@linksLib.linkdescendants node "self"/][/#if]
+[/@feedLib.node]
[#list nested as child]
[#if child.isDocument]
[@document child propfilter includeallowableactions includerelationships/]
@@ -158,16 +160,16 @@
[/#macro]
[#macro folderCMISLinks node]
-[@linkallowableactions node/]
-[@linkrelationships node/]
+[@linksLib.linkallowableactions node/]
+[@linksLib.linkrelationships node/]
[#if cmisproperty(node, cmisconstants.PROP_PARENT_ID)?is_string]
-[@linkparent node/]
+[@linksLib.linkparent node/]
[/#if]
-[@linkchildren node/]
-[@linkdescendants node/]
-[@linktree node/]
-[@linktype node/]
-[@linkservice/]
+[@linksLib.linkchildren node/]
+[@linksLib.linkdescendants node/]
+[@linksLib.linktree node/]
+[@linksLib.linktype node/]
+[@linksLib.linkservice/]
[/#macro]
@@ -180,8 +182,8 @@
${xmldate(date)} [#-- TODO: [@namedvalue cmisconstants.PROP_CREATED_BY assoc cmisconstants.DATATYPE_STRING/] --]
[@namedvalue cmisconstants.PROP_OBJECT_ID assoc cmisconstants.DATATYPE_ID/] [#-- TODO: spec id, how to map? --]
[@namedvalue cmisconstants.PROP_OBJECT_ID assoc cmisconstants.DATATYPE_ID/] [#-- TODO: id compliant --]
-
-
+[@linksLib.linkassocself assoc/]
+[@linksLib.linkassocedit assoc/]
[@assocCMISLinks assoc=assoc/]
${xmldate(date)} [#-- TODO: [@namedvalue cmisconstants.PROP_CREATION_DATE assoc cmisconstants.DATATYPE_DATETIME/] --]
[@namedvalue cmisconstants.PROP_OBJECT_ID assoc cmisconstants.DATATYPE_ID/] [#-- TODO: spec id, how to map? --]
@@ -197,10 +199,10 @@
[#macro assocCMISLinks assoc]
[#-- TODO: --]
-[@linktype assoc/]
-[@linktosource assoc.source/]
-[@linktotarget assoc.target/]
-[@linkservice/]
+[@linksLib.linktype assoc/]
+[@linksLib.linktosource assoc.source/]
+[@linksLib.linktotarget assoc.target/]
+[@linksLib.linkservice/]
[/#macro]
@@ -211,23 +213,22 @@
[#-- TODO: spec issue 47 --]
[#macro row row includeallowableactions=false]
[@entry]
-[#if row.nodes??]
-[#assign node = row.nodes?first]
+[#-- TODO: calculate multiNodeResultSet from result set --]
+[#if row.nodes?? && row.nodes?size == 1][#assign node = row.nodes?first/][/#if]
+[#if node??]
${node.properties.creator!""}
-
[#-- TODO: review if consistent with ATOM --]
[#if node.isDocument]
[@contentstream node/]
[#else]
${node.id} [#-- TODO --]
[/#if]
-
urn:uuid:${node.id}
-
-
+[@linksLib.linknodeself node/]
+[@linksLib.linknodeedit node/]
[#if node.isDocument]
- [@linkstream node "enclosure"/]
- [@linkstream node "edit-media"/]
+ [@linksLib.linkstream node "enclosure"/]
+ [@linksLib.linkstream node "edit-media"/]
[@documentCMISLinks node=node/]
[#else]
[@folderCMISLinks node=node/]
@@ -235,10 +236,14 @@
${node.name}
${xmldate(node.properties.modified)}
${absurl(url.context)}${node.icon16}
+[#else]
+${person.properties.userName}
+urn:uuid:row-${row.index?c}
+Row ${row.index?c}
+${xmldate(now)}
[/#if]
-
[#assign rowvalues = row.values]
[#list rowvalues?keys as colname]
[#assign coltype = row.getColumnType(colname)]
@@ -249,7 +254,7 @@
[/#if]
[/#list]
-[#if row.nodes?? && includeallowableactions][@allowableactions node/][/#if]
+[#if node?? && includeallowableactions][@allowableactions node/][/#if]
[/@entry]
[/#macro]
@@ -273,39 +278,39 @@
[/#macro]
[#macro propvalue name value type]
-[#if type.label == cmisconstants.DATATYPE_STRING]
+[#if type == cmisconstants.DATATYPE_STRING]
[@values value;v][@stringvalue v/][/@values]
-[#elseif type.label == cmisconstants.DATATYPE_INTEGER]
+[#elseif type == cmisconstants.DATATYPE_INTEGER]
[@values value;v][@integervalue v/][/@values]
-[#elseif type.label == cmisconstants.DATATYPE_DECIMAL]
+[#elseif type == cmisconstants.DATATYPE_DECIMAL]
[@values value;v][@decimalvalue v/][/@values]
-[#elseif type.label == cmisconstants.DATATYPE_BOOLEAN]
+[#elseif type == cmisconstants.DATATYPE_BOOLEAN]
[@values value;v][@booleanvalue v/][/@values]
-[#elseif type.label == cmisconstants.DATATYPE_DATETIME]
+[#elseif type == cmisconstants.DATATYPE_DATETIME]
[@values value;v][@datetimevalue v/][/@values]
-[#elseif type.label == cmisconstants.DATATYPE_URI]
+[#elseif type == cmisconstants.DATATYPE_URI]
[#-- TODO: check validity of abs url prefix --]
[@values value;v][@urivalue absurl(url.serviceContext) + v/][/@values]
-[#elseif type.label == cmisconstants.DATATYPE_ID]
+[#elseif type == cmisconstants.DATATYPE_ID]
[@values value;v][@idvalue v/][/@values]
[#-- TODO: remaining property types --]
[/#if]
[/#macro]
[#macro propnull name type]
-[#if type.label == cmisconstants.DATATYPE_STRING]
+[#if type == cmisconstants.DATATYPE_STRING]
-[#elseif type.label == cmisconstants.DATATYPE_INTEGER]
+[#elseif type == cmisconstants.DATATYPE_INTEGER]
-[#elseif type.label == cmisconstants.DATATYPE_DECIMAL]
+[#elseif type == cmisconstants.DATATYPE_DECIMAL]
-[#elseif type.label == cmisconstants.DATATYPE_BOOLEAN]
+[#elseif type == cmisconstants.DATATYPE_BOOLEAN]
-[#elseif type.label == cmisconstants.DATATYPE_DATETIME]
+[#elseif type == cmisconstants.DATATYPE_DATETIME]
-[#elseif type.label == cmisconstants.DATATYPE_URI]
+[#elseif type == cmisconstants.DATATYPE_URI]
-[#elseif type.label == cmisconstants.DATATYPE_ID]
+[#elseif type == cmisconstants.DATATYPE_ID]
[#-- TODO: remaining property types --]
[/#if]
@@ -380,7 +385,7 @@
${person.properties.userName}
${typedefn.typeId.id} [#-- TODO --]
urn:uuid:type-${typedefn.typeId.id}
-
+[@linksLib.linktypeself typedefn/]
[@typedefCMISLinks typedefn/]
[#if typedefn.description??]${typedefn.description?xml}[#else]${typedefn.displayName?xml}[/#if]
${typedefn.displayName}
@@ -391,7 +396,9 @@
[#assign nested = typedefn.getSubTypes(false)/]
[#if nested?size > 1]
-[@feedLib.typedef typedefn=typedefn kind="descendants" author="${person.properties.userName}"/]
+[@feedLib.generic "urn:uuid:type-${typedefn.typeId.id}-descendants" "Type ${typedefn.displayName} Descendants" "${person.properties.userName}"]
+ [@linksLib.linktypedescendants typedefn "self"/]
+[/@feedLib.generic]
[#list nested as child]
[@typedef child includeProperties includeInheritedProperties ns depth+1 maxdepth/]
[/#list]
@@ -402,13 +409,13 @@
[/#macro]
[#macro typedefCMISLinks typedef]
-[@linktype typedef/]
+[@linksLib.linktype typedef/]
[#if typedef.parentType??]
-[@linktypeparent typedef/]
+[@linksLib.linktypeparent typedef/]
[/#if]
-[@linktypechildren typedef/]
-[@linktypedescendants typedef/]
-[@linkservice/]
+[@linksLib.linktypechildren typedef/]
+[@linksLib.linktypedescendants typedef/]
+[@linksLib.linkservice/]
[/#macro]
[#macro typedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
@@ -424,30 +431,30 @@
[/#macro]
[#macro documenttypedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
-
+
[@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/]
${typedef.versionable?string}
${typedef.contentStreamAllowed.label}
-
+
[/#macro]
[#macro foldertypedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
-
+
[@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/]
-
+
[/#macro]
[#macro relationshiptypedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
-
+
[@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/]
[#-- TODO: source and target types --]
-
+
[/#macro]
[#macro policytypedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
-
+
[@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/]
-
+
[/#macro]
[#macro objecttypedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
@@ -576,7 +583,7 @@
${propdef.required?string}
${propdef.queryable?string}
${propdef.orderable?string}
- [@cmisChoices propdef.choices propdef.dataType/]
+ [@cmisChoices propdef.choices propdef.dataType.label/]
${propdef.openChoice?string}
[#if propdef.defaultValue??]
[#-- TODO: defaults for HTML and XML property types --]
@@ -587,37 +594,37 @@
[#macro cmisChoices choices type]
[#if choices?exists]
[#list choices as choice]
-[#if type.label == cmisconstants.DATATYPE_STRING]
+[#if type == cmisconstants.DATATYPE_STRING]
[@cmisChoices choice.children type/]
[@stringvalue choice.value/]
-[#elseif type.label == cmisconstants.DATATYPE_INTEGER]
+[#elseif type == cmisconstants.DATATYPE_INTEGER]
[@cmisChoices choice.children type/]
[@stringvalue choice.value/]
-[#elseif type.label == cmisconstants.DATATYPE_DECIMAL]
+[#elseif type == cmisconstants.DATATYPE_DECIMAL]
[@cmisChoices choice.children type/]
[@stringvalue choice.value/]
-[#elseif type.label == cmisconstants.DATATYPE_BOOLEAN]
+[#elseif type == cmisconstants.DATATYPE_BOOLEAN]
[@cmisChoices choice.children type/]
[@stringvalue choice.value/]
-[#elseif type.label == cmisconstants.DATATYPE_DATETIME]
+[#elseif type == cmisconstants.DATATYPE_DATETIME]
[@cmisChoices choice.children type/]
[@stringvalue choice.value/]
-[#elseif type.label == cmisconstants.DATATYPE_URI]
+[#elseif type == cmisconstants.DATATYPE_URI]
[@cmisChoices choice.children type/]
[@stringvalue choice.value/]
-[#elseif type.label == cmisconstants.DATATYPE_ID]
+[#elseif type == cmisconstants.DATATYPE_ID]
[@cmisChoices choice.children type/]
[@stringvalue choice.value/]
@@ -629,91 +636,6 @@
[/#macro]
-[#-- --]
-[#-- Link Relations --]
-[#-- --]
-
-[#-- Link to repository service document --]
-[#macro linkservice]
-
-[/#macro]
-
-[#-- Link to node allowable actions --]
-[#macro linkallowableactions node]
-
-[/#macro]
-
-[#-- Link to node relationships --]
-[#macro linkrelationships node]
-
-[/#macro]
-
-[#-- Link to node parents --]
-[#macro linkparents node]
-
-[/#macro]
-
-[#-- Link to folder parent --]
-[#macro linkparent node]
-
-[/#macro]
-
-[#-- Link to node children --]
-[#macro linkchildren node]
-
-[/#macro]
-
-[#-- Link to node descendants --]
-[#macro linkdescendants node]
-
-[/#macro]
-
-[#-- Link to node tree --]
-[#macro linktree node]
-
-[/#macro]
-
-[#-- Link to node versions --]
-[#macro linkversions node]
-
-[/#macro]
-
-[#-- Link to source node --]
-[#macro linktosource node]
-
-[/#macro]
-
-[#-- Link to target node --]
-[#macro linktotarget node]
-
-[/#macro]
-
-[#-- Link to content stream --]
-[#macro linkstream node rel=""]
-
-[/#macro]
-
-[#-- Link to node type --]
-[#macro linktype object]
-
-[/#macro]
-
-[#-- Link to type parent --]
-[#macro linktypeparent typedef]
-
-[/#macro]
-
-[#-- Link to type children --]
-[#macro linktypechildren typedef]
-
-[/#macro]
-
-[#-- Link to type descendants --]
-[#macro linktypedescendants typedef]
-
-[/#macro]
-
-
[#-- --]
[#-- General Utils --]
[#-- --]
@@ -725,22 +647,4 @@
[#macro contenttype type][#if type == "text/html"]text[#elseif type == "text/xhtml"]xhtml[#elseif type == "text/plain"]text<#else>${type}[/#if][/#macro]
[#-- Helper to render atom content element --]
-[#macro contentstream node][/#macro]
-
-[#-- Helper to render Alfresco content stream uri --]
-[#macro contenturi node]${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content[#if node.properties.name?? && node.properties.name?last_index_of(".") != -1]${encodeuri(node.properties.name?substring(node.properties.name?last_index_of(".")))}[/#if][/#macro]
-
-[#-- Helper to render Alfresco service document uri --]
-[#macro serviceuri]${absurl(url.serviceContext)}/api/repository[/#macro]
-
-[#-- Helper to render Node Ref --]
-[#macro noderef node]${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}[/#macro]
-
-[#-- Helper to render Alfresco Node uri --]
-[#macro nodeuri node]/api/node/[@noderef node/][/#macro]
-
-[#-- Helper to render Alfresco Assoc uri --]
-[#macro assocuri assoc]/api/rel/[@noderef assoc.source/]/type/${cmistype(assoc).typeId.id!"undefined"}/target/[@noderef assoc.target/][/#macro]
-
-[#-- Helper to render Alfresco Type uri --]
-[#macro typeuri typedef]/api/type/${typedef.typeId.id}[/#macro]
+[#macro contentstream node][/#macro]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/cmis/atomfeed.lib.atom.ftl b/config/alfresco/templates/webscripts/org/alfresco/cmis/atomfeed.lib.atom.ftl
index d9ba3095aa..29a5854c76 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/cmis/atomfeed.lib.atom.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/cmis/atomfeed.lib.atom.ftl
@@ -20,7 +20,6 @@
Alfresco (${server.edition})
${absurl(url.context)}/images/logo/AlfrescoLogo16.ico
${id}
-
[#nested] [#-- NOTE: Custom links --]
${title}
${xmldate(date)}
@@ -36,25 +35,7 @@
Alfresco (${server.edition})
${absurl(url.context)}/images/logo/AlfrescoLogo16.ico
urn:uuid:${node.id}[#if kind != ""]-${kind}[/#if]
-
-
[#nested] [#-- NOTE: Custom links --]
${node.name}[#if kind != ""] ${kind?capitalize}[/#if]
${xmldate(node.properties.modified)}
[/#macro]
-
-
-[#-- --]
-[#-- ATOM Feed for Type Container --]
-[#-- --]
-
-[#macro typedef typedefn kind="children" author="System"]
-${author}
-Alfresco (${server.edition})
-${absurl(url.context)}/images/logo/AlfrescoLogo16.ico
-urn:uuid:type-${typedefn.typeId.id}-${kind}
-
-[#nested] [#-- NOTE: Custom links --]
-${typedefn.displayName} ${kind?capitalize}
-${xmldate(date)}
-[/#macro]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/cmis/links.lib.atom.ftl b/config/alfresco/templates/webscripts/org/alfresco/cmis/links.lib.atom.ftl
new file mode 100644
index 0000000000..a30a85e1cc
--- /dev/null
+++ b/config/alfresco/templates/webscripts/org/alfresco/cmis/links.lib.atom.ftl
@@ -0,0 +1,143 @@
+[#ftl]
+
+[#-- --]
+[#-- Link Relations --]
+[#-- --]
+
+[#-- Link to repository service document --]
+[#macro linkservice]
+
+[/#macro]
+
+[#-- Link to node allowable actions --]
+[#macro linkallowableactions node]
+
+[/#macro]
+
+[#-- Link to node relationships --]
+[#macro linkrelationships node]
+
+[/#macro]
+
+[#-- Link to node parents --]
+[#macro linkparents node]
+
+[/#macro]
+
+[#-- Link to folder parent --]
+[#macro linkparent node]
+
+[/#macro]
+
+[#-- Link to node children --]
+[#macro linkchildren node rel=""]
+
+[/#macro]
+
+[#-- Link to node descendants --]
+[#macro linkdescendants node rel=""]
+
+[/#macro]
+
+[#-- Link to node tree --]
+[#macro linktree node rel=""]
+
+[/#macro]
+
+[#-- Link to node versions --]
+[#macro linkversions node]
+
+[/#macro]
+
+[#-- Link to source node --]
+[#macro linktosource node]
+
+[/#macro]
+
+[#-- Link to target node --]
+[#macro linktotarget node]
+
+[/#macro]
+
+[#-- Link to content stream --]
+[#macro linkstream node rel=""]
+
+[/#macro]
+
+[#-- Link to node type --]
+[#macro linktype object]
+
+[/#macro]
+
+[#-- Link to type parent --]
+[#macro linktypeparent typedef]
+
+[/#macro]
+
+[#-- Link to type children --]
+[#macro linktypechildren typedef]
+
+[/#macro]
+
+[#-- Link to type descendants --]
+[#macro linktypedescendants typedef rel=""]
+
+[/#macro]
+
+[#-- Link to self --]
+[#macro linkself href="" type=""]
+
+[/#macro]
+
+[#macro linknodeself node]
+
+[/#macro]
+
+[#macro linkassocself assoc]
+
+[/#macro]
+
+[#macro linktypeself typedef]
+
+[/#macro]
+
+[#-- Link to edit --]
+[#macro linkedit href="" type=""]
+
+[/#macro]
+
+[#macro linknodeedit node]
+
+[/#macro]
+
+[#macro linkassocedit assoc]
+
+[/#macro]
+
+[#-- Link to via --]
+[#macro linkvia href="" type=""]
+
+[/#macro]
+
+
+[#-- --]
+[#-- URLs --]
+[#-- --]
+
+[#-- Helper to render Alfresco service document uri --]
+[#macro serviceuri]${absurl(url.serviceContext)}/api/repository[/#macro]
+
+[#-- Helper to render Alfresco content stream uri --]
+[#macro contenturi node]${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content[#if node.properties.name?? && node.properties.name?last_index_of(".") != -1]${encodeuri(node.properties.name?substring(node.properties.name?last_index_of(".")))}[/#if][/#macro]
+
+[#-- Helper to render Node Ref --]
+[#macro noderef node]${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}[/#macro]
+
+[#-- Helper to render Alfresco Node uri --]
+[#macro nodeuri node]/api/node/[@noderef node/][/#macro]
+
+[#-- Helper to render Alfresco Assoc uri --]
+[#macro assocuri assoc]/api/rel/[@noderef assoc.source/]/type/${cmistype(assoc).typeId.id!"undefined"}/target/[@noderef assoc.target/][/#macro]
+
+[#-- Helper to render Alfresco Type uri --]
+[#macro typeuri typedef]/api/type/${typedef.typeId.id}[/#macro]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/paging.lib.atom.ftl b/config/alfresco/templates/webscripts/org/alfresco/paging.lib.atom.ftl
index 0aef2c7560..08e1f6dd0a 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/paging.lib.atom.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/paging.lib.atom.ftl
@@ -30,6 +30,36 @@
[/#if]
[/#macro]
+[#macro linksredirect cursor serviceUrl urlargs="" type="" pageNo="pageNo" pageSize="pageSize" skipCount="skipCount" maxItems="maxItems"]
+[#if cursor.pageType = "PAGE"]
+[#if cursor.hasFirstPage]
+
+[/#if]
+[#if cursor.hasLastPage]
+
+[/#if]
+[#if cursor.hasPrevPage]
+
+[/#if]
+[#if cursor.hasNextPage]
+
+[/#if]
+[#else]
+[#if cursor.hasFirstPage]
+
+[/#if]
+[#if cursor.hasLastPage]
+
+[/#if]
+[#if cursor.hasPrevPage]
+
+[/#if]
+[#if cursor.hasNextPage]
+
+[/#if]
+[/#if]
+[/#macro]
+
[#macro opensearch cursor]
[#-- NOTE: this macro requires the definition of xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" in --]
[#-- the enclosing document --]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.atom.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.atomsvc.ftl
similarity index 65%
rename from config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.atom.ftl
rename to config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.atomsvc.ftl
index 55d5e32285..cd75c048bf 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.atom.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.atomsvc.ftl
@@ -1,11 +1,12 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
${server.name}
-
+
root collection
@@ -13,20 +14,20 @@
checkedout collection
- application/atom+xml;type=entry
+ ${cmisconstants.MIMETYPE_ENTRY}
unfiled collection
- application/atom+xml;type=entry
+ ${cmisconstants.MIMETYPE_ENTRY}
-
+
query collection
- application/cmisquery+xml
+ ${cmisconstants.MIMETYPE_CMIS_QUERY}
-
-
-
+
+
+
${server.id}
@@ -36,7 +37,7 @@
Alfresco
Alfresco Repository (${server.edition})
${server.version}
- ${absurl(url.serviceContext)}/api/path/${encodeuri(defaultRootFolderPath)}
+ ${absurl(url.serviceContext)}[@linksLib.nodeuri defaultRootFolder/]
[#-- TODO: implement change log --]
@@ -64,7 +65,12 @@
${absurl(url.serviceContext)}/api/node/{id}?filter={filter}&includeAllowableActions={includeAllowableActions}&includeRelationships={includeRelationships}
entrybyid
- application/atom+xml;type=entry
+ ${cmisconstants.MIMETYPE_ENTRY}
+
+
+ ${absurl(url.serviceContext)}/api/query?q={q}&includeAllowableActions={includeAllowableActions?}&searchAllVersions={searchAllVersions?}&skipCount={skipCount?}&maxItems={maxItems?}
+ query
+ ${cmisconstants.MIMETYPE_FEED}
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.desc.xml
index 614d34312d..77a926685b 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.desc.xml
@@ -33,7 +33,7 @@ Enum capabilityFulltext: nofulltext, fulltextonly, fulltextandstructured
/api/repository
/api/cmis
-
+
user
CMIS
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/search/queries.post.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/search/queries.post.atomfeed.ftl
new file mode 100644
index 0000000000..521e9c6ba8
--- /dev/null
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/search/queries.post.atomfeed.ftl
@@ -0,0 +1,27 @@
+[#ftl]
+[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
+[#import "/org/alfresco/cmis/atomfeed.lib.atom.ftl" as feedLib/]
+[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
+[#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/]
+[#compress]
+
+
+
+
+[#-- TODO: uuid --]
+[@feedLib.generic "urn:uuid:resultset" "Result set for ${statement}" "${person.properties.userName}"]
+ [@linksLib.linkservice/]
+ [@linksLib.linkself/]
+ [@pagingLib.linksredirect cursor "${queryUri}" "${queryArgs}" "${cmisconstants.MIMETYPE_FEED}"/]
+[/@feedLib.generic]
+[@pagingLib.opensearch cursor/]
+
+[#assign rs = cmisresultset(resultset)]
+[#list rs.rows as row]
+[@entryLib.row row=row includeallowableactions=includeAllowableActions/]
+[/#list]
+
+
+
+[/#compress]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.cmisquery.js b/config/alfresco/templates/webscripts/org/alfresco/repository/search/queries.post.cmisquery.js
similarity index 51%
rename from config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.cmisquery.js
rename to config/alfresco/templates/webscripts/org/alfresco/repository/search/queries.post.cmisquery.js
index 470e73cb0e..e2d8e147b7 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.cmisquery.js
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/search/queries.post.cmisquery.js
@@ -1,14 +1,14 @@
script:
{
// process query statement
- //
- //
- // SELECT name FROM DOCUMENT_OBJECT_TYPE
- // false
- // 0
- // 0
- // false
- //
+ //
+ //
+ // SELECT * FROM Document
+ // true
+ // 50
+ // 0
+ //
+
// TODO: XML parsing need to be moved to Java
@@ -43,18 +43,35 @@ script:
break script;
}
- // TODO: CMIS-124
// include allowable actions
- var includeAllowableActions = cmisQuery.returnAllowableActions.toString();
+ var includeAllowableActions = cmisQuery.includeAllowableActions.toString();
model.includeAllowableActions = (includeAllowableActions == null || includeAllowableActions == "true" ? true : false);
// process paging
var skipCount = parseInt(cmisQuery.skipCount);
- var pageSize = parseInt(cmisQuery.pageSize);
- var page = paging.createPageOrWindow(null, null, isNaN(skipCount) ? null : skipCount, isNaN(pageSize) ? null : pageSize);
+ var maxItems = parseInt(cmisQuery.maxItems);
+ var page = paging.createPageOrWindow(null, null, isNaN(skipCount) ? null : skipCount, isNaN(maxItems) ? null : maxItems);
// perform query
var paged = cmis.query(model.statement, page);
model.resultset = paged.result;
model.cursor = paged.cursor;
-}
+
+ // check includeFlags are valid for query
+ var multiNodeResultSet = false; // todo: calculate from result set (for now, don't support joins)
+ if (multiNodeResultSet && (model.includeAllowableActions))
+ {
+ status.setCode(status.STATUS_BAD_REQUEST, "Can't includeAllowableActions for multi-selector column result sets");
+ break script;
+ }
+
+ // construct query uri
+ model.queryUri = "/api/query";
+ model.queryArgs = cmis.ARG_QUERY_STATEMENT + "=" + model.statement;
+ if (model.includeAllowableActions) model.queryArgs += "&" + cmis.ARG_INCLUDE_ALLOWABLE_ACTIONS + "=true";
+ model.queryArgs += "&" + cmis.ARG_SKIP_COUNT + "=" + page.number;
+ model.queryArgs += "&" + cmis.ARG_MAX_ITEMS + "=" + page.size;
+
+ // TODO: set Content-Location
+ status.location = url.server + url.serviceContext + model.queryUri + "?" + model.queryArgs;
+}
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/search/queries.post.desc.xml
similarity index 99%
rename from config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.desc.xml
rename to config/alfresco/templates/webscripts/org/alfresco/repository/search/queries.post.desc.xml
index 512c858832..5daab9e35e 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/search/queries.post.desc.xml
@@ -29,7 +29,7 @@ It is recommended that “includeAllowableActions” be used with query statemen
"IncludeRelationships" indicates whether relationships are also returned for each returned object. If it is set to "source" or "target", relationships for which the returned object is a source, or respectively a target, will also be returned. If it is set to "both", relationships for which the returned object is either a source or a target will be returned. If it is set to "none", relationships are not returned.
]]>
- /api/query
+ /api/queries
user
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.get.atomfeed.ftl
similarity index 86%
rename from config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.atomfeed.ftl
rename to config/alfresco/templates/webscripts/org/alfresco/repository/search/query.get.atomfeed.ftl
index e7e0917531..133ce388b5 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.atomfeed.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.get.atomfeed.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/]
@@ -10,6 +11,8 @@
[#-- TODO: uuid --]
[@feedLib.generic "urn:uuid:resultset" "Result set for ${statement}" "${person.properties.userName}"]
+ [@linksLib.linkservice/]
+ [@linksLib.linkself/]
[@pagingLib.links cursor/]
[/@feedLib.generic]
[@pagingLib.opensearch cursor/]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.get.desc.xml
new file mode 100644
index 0000000000..7c313f8e13
--- /dev/null
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.get.desc.xml
@@ -0,0 +1,37 @@
+
+ Issue ad-hoc query (query)
+
+
+
+Inputs:
+
+String statement: Query statement
+(Optional) Bool searchAllVersions: False (Default)
+(Optional) Boolean includeAllowableActions: False (default)
+(Optional) Enum includeRelationships: none (default), source, target, both
+(Optional) int maxItems: 0 = Repository-default number of items (Default)
+(Optional) int skipCount: 0 = Start at first position (Default)
+
+Outputs:
+
+Collection objectCollection - this collection represents a result table produced by the query statement. Typically each row of this table corresponds to an object, and each column corresponds to a property or a computed value as specified by the SELECT clause of the query statement. A CMIS SQL 1.0 query without JOIN always produces one object per row.
+Bool hasMoreItems
+
+Notes:
+
+If SearchAllVersions is True, and CONTAINS() is used in the query, OperationNotSupported will be thrown if full-text search is not supported or if the repository does not have previous versions in the full-text index.
+Returns set of objects from (skipCount, maxItems+skipCount)
+If no “maxItems” value is provided, then the Repository will determine an appropriate number of items to return. How the Repository determines this value is repository-specific and opaque to CMIS.
+If “includeAllowableActions” is TRUE, the repository will return the allowable actions for the current user for each result object in the output table as an additional multi-valued column containing computed values of type string, provided that each row in the output table indeed corresponds to one object (which is true for a CMIS SQL 1.0 query without JOIN).
+If each row in the output table does not correspond to a specific object and “includeAllowableActions” is TRUE, then InvalidArgumentException will be thrown.
+It is recommended that “includeAllowableActions” be used with query statements without JOIN, and that the Object ID property or “*” be included in the SELECT list.
+"IncludeRelationships" indicates whether relationships are also returned for each returned object. If it is set to "source" or "target", relationships for which the returned object is a source, or respectively a target, will also be returned. If it is set to "both", relationships for which the returned object is either a source or a target will be returned. If it is set to "none", relationships are not returned.
+]]>
+
+ /api/query?q={q}&includeAllowableActions={includeAllowableActions?}&searchAllVersions={searchAllVersions?}&skipCount={skipCount?}&maxItems={maxItems?}
+ user
+
+
+ CMIS
+
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.get.js
new file mode 100644
index 0000000000..5a4d9fdd2b
--- /dev/null
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.get.js
@@ -0,0 +1,46 @@
+script:
+{
+ // process query statement
+ //
+ //
+ // SELECT * FROM Document
+ // true
+ // 50
+ // 0
+ //
+
+
+ // extract query statement
+ model.statement = args.q;
+ if (model.statement == null || model.statement.length == 0)
+ {
+ status.setCode(status.STATUS_BAD_REQUEST, "Query statement must be provided");
+ break script;
+ }
+
+ // process search all versions (NOTE: not supported)
+ var searchAllVersions = args.searchAllVersions;
+ if (searchAllVersions != null && searchAllVersions === "true")
+ {
+ status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Search all versions not supported");
+ break script;
+ }
+
+ // include allowable actions
+ var includeAllowableActions = args[cmis.ARG_INCLUDE_ALLOWABLE_ACTIONS];
+ model.includeAllowableActions = (includeAllowableActions == "true" ? true : false);
+
+ // perform query
+ var page = paging.createPageOrWindow(args);
+ var paged = cmis.query(model.statement, page);
+ model.resultset = paged.result;
+ model.cursor = paged.cursor;
+
+ // check includeFlags are valid for query
+ var multiNodeResultSet = false; // TODO: calculate from result set (for now, don't support joins)
+ if (!multiNodeResultSet && (model.includeAllowableActions))
+ {
+ status.setCode(status.STATUS_BAD_REQUEST, "Can't includeAllowableActions for multi-selector column result sets");
+ break script;
+ }
+}
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/allowableactions.get.cmisallowableactions.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/allowableactions.get.cmisallowableactions.ftl
index 86117df503..ed57c5a4ea 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/allowableactions.get.cmisallowableactions.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/allowableactions.get.cmisallowableactions.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.atomfeed.ftl
index d357de3bfd..d95e4b14bf 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.atomfeed.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.atomfeed.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/]
@@ -9,6 +10,8 @@
[@feedLib.generic "urn:uuid:checkedout" "Checked out Documents" "${person.properties.userName}"]
+ [@linksLib.linkservice/]
+ [@linksLib.linkself/]
[@pagingLib.links cursor/]
[/@feedLib.generic]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.post.atomentry.201.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.post.atomentry.201.ftl
index 94b55b6441..fcd70054e9 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.post.atomentry.201.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.post.atomentry.201.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.get.atomfeed.ftl
index a6eca40067..71be7da261 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.get.atomfeed.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.get.atomfeed.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/]
@@ -9,6 +10,15 @@
[@feedLib.node node "children"]
+ [@linksLib.linkservice/]
+ [@linksLib.linkself/]
+ [#assign nodeuri][@linksLib.nodeuri node/][/#assign]
+ [@linksLib.linkvia href="${nodeuri}"/]
+ [#if cmisproperty(node, cmisconstants.PROP_PARENT_ID)?is_string]
+ [@linksLib.linkchildren node.parent "${cmisconstants.REL_UP}"/]
+ [/#if]
+ [@linksLib.linkdescendants node/]
+ [@linksLib.linktree node/]
[@pagingLib.links cursor/]
[/@feedLib.node]
[@pagingLib.opensearch cursor/]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.post.atomentry.201.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.post.atomentry.201.ftl
index 56cc6e5b0a..f58283fb34 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.post.atomentry.201.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.post.atomentry.201.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.get.atomfeed.ftl
index 0bcfaa64d0..33656f00e0 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.get.atomfeed.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.get.atomfeed.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
@@ -7,7 +8,17 @@
-[@feedLib.node node "descendants"/]
+[@feedLib.node node "descendants"]
+ [@linksLib.linkservice/]
+ [@linksLib.linkself/]
+ [#assign nodeuri][@linksLib.nodeuri node/][/#assign]
+ [@linksLib.linkvia href="${nodeuri}"/]
+ [#if cmisproperty(node, cmisconstants.PROP_PARENT_ID)?is_string]
+ [@linksLib.linkchildren node.parent "${cmisconstants.REL_UP}"/]
+ [/#if]
+ [@linksLib.linkchildren node/]
+ [@linksLib.linktree node/]
+[/@feedLib.node]
[#if depth > 0 || depth == -1]
[#list cmischildren(node, typesFilter) as child]
@@ -15,7 +26,7 @@
[@entryLib.document node=child propfilter=propFilter includeallowableactions=includeAllowableActions includerelationships=false/]
[#else]
[@entryLib.folder node=child propfilter=propFilter typesfilter=typeFilter includeallowableactions=includeAllowableActions includerelationships=false depth=1 maxdepth=depth/]
- [/#if]
+[/#if]
[/#list]
[/#if]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.get.atomentry.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.get.atomentry.ftl
index 1c0f892078..e515665d5d 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.get.atomentry.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.get.atomentry.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.patch.atomentry.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.patch.atomentry.ftl
index ba1a5032ef..9c991c2b2d 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.patch.atomentry.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.patch.atomentry.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.put.atomentry.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.put.atomentry.ftl
index ba1a5032ef..9c991c2b2d 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.put.atomentry.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.put.atomentry.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.atomentry.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.atomentry.ftl
index 206a9230c2..076440463c 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.atomentry.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.atomentry.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.atomfeed.ftl
index 8e855c7174..9eef0c8a44 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.atomfeed.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.atomfeed.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
@@ -8,7 +9,12 @@
-[@feedLib.node node "parents"/]
+[@feedLib.node node "parents"]
+ [@linksLib.linkservice/]
+ [@linksLib.linkself/]
+ [#assign nodeuri][@linksLib.nodeuri node/][/#assign]
+ [@linksLib.linkvia href="${nodeuri}"/]
+[/@feedLib.node]
[#if parent?? && parent.isContainer]
[@entryLib.folder node=parent propfilter=filter includeallowableactions=includeAllowableActions includerelationships="none"/]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.get.atomentry.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.get.atomentry.ftl
index 8836a1c42e..63dd456f94 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.get.atomentry.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.get.atomentry.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.patch.atomentry.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.patch.atomentry.ftl
index 7b7b1f35ae..f6b84f605c 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.patch.atomentry.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.patch.atomentry.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.put.atomentry.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.put.atomentry.ftl
index 7b7b1f35ae..f6b84f605c 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.put.atomentry.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.put.atomentry.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/relationship.get.atomentry.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/relationship.get.atomentry.ftl
index c63fc7ba2c..b18d5df53f 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/relationship.get.atomentry.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/relationship.get.atomentry.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/relationships.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/relationships.get.atomfeed.ftl
index 5974468a93..39d477de36 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/relationships.get.atomfeed.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/relationships.get.atomfeed.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/]
@@ -9,6 +10,10 @@
[@feedLib.node node "relationships"]
+ [@linksLib.linkservice/]
+ [@linksLib.linkself/]
+ [#assign nodeuri][@linksLib.nodeuri node/][/#assign]
+ [@linksLib.linkvia href="${nodeuri}"/]
[@pagingLib.links cursor/]
[/@feedLib.node]
[@pagingLib.opensearch cursor/]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/relationships.post.atomentry.201.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/relationships.post.atomentry.201.ftl
index c63fc7ba2c..b18d5df53f 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/relationships.post.atomentry.201.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/relationships.post.atomentry.201.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/tree.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/tree.get.atomfeed.ftl
index 8349964ee5..4f78a19aa9 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/tree.get.atomfeed.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/tree.get.atomfeed.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
@@ -7,7 +8,17 @@
-[@feedLib.node node "tree"/]
+[@feedLib.node node "tree"]
+ [@linksLib.linkservice/]
+ [@linksLib.linkself/]
+ [#assign nodeuri][@linksLib.nodeuri node/][/#assign]
+ [@linksLib.linkvia href="${nodeuri}"/]
+ [#if cmisproperty(node, cmisconstants.PROP_PARENT_ID)?is_string]
+ [@linksLib.linkchildren node.parent "${cmisconstants.REL_UP}"/]
+ [/#if]
+ [@linksLib.linkchildren node/]
+ [@linksLib.linkdescendants node/]
+[/@feedLib.node]
[#if depth > 0 || depth == -1]
[#list cmischildren(node, "folders") as child]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/type.get.atomentry.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/type.get.atomentry.ftl
index bc40d88453..ffd97bb651 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/type.get.atomentry.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/type.get.atomentry.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/typechildren.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/typechildren.get.atomfeed.ftl
index 3041430ba9..0f289a54b1 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/typechildren.get.atomfeed.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/typechildren.get.atomfeed.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/]
@@ -8,14 +9,23 @@
-[#assign title][#if type = "base"]Base Types[#else]Type ${type}[/#if][/#assign]
-[@feedLib.generic "urn:uuid:types-${type}" "${title}" "${person.properties.userName}"]
+[#assign title][#if typedef??]Type ${typedef.displayName}[#else]Base Types[/#if][/#assign]
+[#assign id][#if typedef??]urn:uuid:types-${typedef.typeId.id}[#else]urn:uuid:types-base[/#if][/#assign]
+
+[@feedLib.generic "${id}" "${title}" "${person.properties.userName}"]
+ [@linksLib.linkservice/]
+ [@linksLib.linkself/]
+ [#if typedef??]
+ [#assign typeuri][@linksLib.typeuri typedef/][/#assign]
+ [@linksLib.linkvia href="${typeuri}"/]
+ [@linksLib.linktypedescendants typedef/]
+ [/#if]
[@pagingLib.links cursor/]
[/@feedLib.generic]
[@pagingLib.opensearch cursor/]
[#list results as child]
-[@entryLib.typedef child returnPropertyDefinitions/]
+[@entryLib.typedef child includePropertyDefinitions/]
[/#list]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/typechildren.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/store/typechildren.get.js
index 7569eafdf6..050858c13f 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/typechildren.get.js
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/typechildren.get.js
@@ -12,7 +12,7 @@ script:
var paged = cmis.queryTypeChildren(null, page);
model.results = paged.results;
model.cursor = paged.cursor;
- model.type = "base";
+ model.typedef = null;
}
else
{
@@ -28,10 +28,10 @@ script:
var paged = cmis.queryTypeChildren(typedef, page);
model.results = paged.results;
model.cursor = paged.cursor;
- model.type = typeId;
+ model.typedef = typedef;
}
// handle property definitions
- var returnPropertyDefinitions = args[cmis.ARG_INCLUDE_PROPERTY_DEFINITIONS];
- model.returnPropertyDefinitions = returnPropertyDefinitions == "true" ? true : false;
+ var includePropertyDefinitions = args[cmis.ARG_INCLUDE_PROPERTY_DEFINITIONS];
+ model.includePropertyDefinitions = includePropertyDefinitions == "true" ? true : false;
}
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/typedescendants.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/typedescendants.get.atomfeed.ftl
index 9c2045b12a..3365353f7e 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/typedescendants.get.atomfeed.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/typedescendants.get.atomfeed.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
@@ -10,19 +11,31 @@
[#if depth > 0 || depth == -1]
[#if typedef??]
-[@feedLib.typedef typedefn=typedef kind="descendants" author="${person.properties.userName}"/]
+
+[@feedLib.generic "urn:uuid:type-${typedef.typeId.id}-descendants" "Type ${typedef.displayName} Descendants" "${person.properties.userName}"]
+ [@linksLib.linkservice/]
+ [@linksLib.linkself/]
+ [#assign typeuri][@linksLib.typeuri typedef/][/#assign]
+ [@linksLib.linkvia href="${typeuri}"/]
+ [@linksLib.linktypechildren typedef/]
+[/@feedLib.generic]
[#list typedef.getSubTypes(false) as child]
[@entryLib.typedef typedefn=child includeProperties=includePropertyDefinitions depth=1 maxdepth=depth/]
[/#list]
+
[#else]
-[@feedLib.generic "urn:uuid:types-all" "All Types" "${person.properties.userName}"/]
+
+[@feedLib.generic "urn:uuid:types-all" "All Types" "${person.properties.userName}"]
+ [@linksLib.linkservice/]
+ [@linksLib.linkself/]
+[/@feedLib.generic]
[#list basetypes as child]
[@entryLib.typedef typedefn=child includeProperties=includePropertyDefinitions depth=1 maxdepth=depth/]
[/#list]
-[/#if]
+[/#if]
[/#if]
-[/#compress]
+[/#compress]
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/unfiled.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/unfiled.get.atomfeed.ftl
index ad1e60fc37..23f4073620 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/unfiled.get.atomfeed.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/unfiled.get.atomfeed.ftl
@@ -1,12 +1,16 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomfeed.lib.atom.ftl" as feedLib/]
[#compress]
- [@feedLib.generic "urn:uuid:unfiled" "Unfiled Documents"/]
+[@feedLib.generic "urn:uuid:unfiled" "Unfiled Documents"]
+ [@linksLib.linkservice/]
+ [@linksLib.linkself/]
+[/@feedLib.generic]
[/#compress]
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/versions.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/versions.get.atomfeed.ftl
index 52ab1d556a..eca521d670 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/versions.get.atomfeed.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/versions.get.atomfeed.ftl
@@ -1,5 +1,6 @@
[#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
+[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
[#import "/org/alfresco/cmis/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress]
@@ -8,7 +9,12 @@
-[@feedLib.generic "urn:uuid:${node.id}-versions" "Versions of ${node.displayPath}"/]
+[@feedLib.generic "urn:uuid:${node.id}-versions" "Versions of ${node.displayPath}"]
+ [@linksLib.linkservice/]
+ [@linksLib.linkself/]
+ [#assign nodeuri][@linksLib.nodeuri node/][/#assign]
+ [@linksLib.linkvia href="${nodeuri}"/]
+[/@feedLib.generic]
[#list nodes as version]
[@entryLib.version version versions[version_index]/]
diff --git a/source/java/org/alfresco/repo/cmis/rest/CMISQueryReader.java b/source/java/org/alfresco/repo/cmis/rest/CMISQueryReader.java
index d8fef64df5..bdffd1c7ff 100644
--- a/source/java/org/alfresco/repo/cmis/rest/CMISQueryReader.java
+++ b/source/java/org/alfresco/repo/cmis/rest/CMISQueryReader.java
@@ -62,7 +62,7 @@ public class CMISQueryReader implements FormatReader
*/
public String getSourceMimetype()
{
- return CMISConstants.MIMETYPE_QUERY;
+ return CMISConstants.MIMETYPE_CMIS_QUERY;
}
/* (non-Javadoc)
diff --git a/source/java/org/alfresco/repo/cmis/rest/CMISScript.java b/source/java/org/alfresco/repo/cmis/rest/CMISScript.java
index dae6f1cfaf..28ff278626 100644
--- a/source/java/org/alfresco/repo/cmis/rest/CMISScript.java
+++ b/source/java/org/alfresco/repo/cmis/rest/CMISScript.java
@@ -40,6 +40,7 @@ import org.alfresco.cmis.CMISResultSet;
import org.alfresco.cmis.CMISServices;
import org.alfresco.cmis.CMISTypeDefinition;
import org.alfresco.cmis.CMISTypesFilterEnum;
+import org.alfresco.cmis.CMISQueryOptions.CMISQueryMode;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.jscript.Association;
import org.alfresco.repo.jscript.BaseScopableProcessorExtension;
@@ -84,6 +85,7 @@ public class CMISScript extends BaseScopableProcessorExtension
public static final String ARG_MAJOR_VERSION = "majorVersion";
public static final String ARG_MAX_ITEMS = "maxItems";
public static final String ARG_OFFSET = "offset";
+ public static final String ARG_QUERY_STATEMENT = "q";
public static final String ARG_REMOVE_FROM = "removeFrom";
public static final String ARG_RELATIONSHIP_TYPE = "relationshipType";
public static final String ARG_REPOSITORY_ID = "repositoryId";
@@ -554,6 +556,7 @@ public class CMISScript extends BaseScopableProcessorExtension
public PagedResults query(String statement, Page page)
{
CMISQueryOptions options = new CMISQueryOptions(statement, cmisService.getDefaultRootStoreRef());
+ options.setQueryMode(CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS);
options.setSkipCount(page.getNumber());
options.setMaxItems(page.getSize());
CMISResultSet resultSet = cmisQueryService.query(options);
diff --git a/source/java/org/alfresco/repo/cmis/rest/CMISTemplateResultSet.java b/source/java/org/alfresco/repo/cmis/rest/CMISTemplateResultSet.java
index 1e88412617..25814f6356 100644
--- a/source/java/org/alfresco/repo/cmis/rest/CMISTemplateResultSet.java
+++ b/source/java/org/alfresco/repo/cmis/rest/CMISTemplateResultSet.java
@@ -231,7 +231,7 @@ public class CMISTemplateResultSet implements Serializable
public String getColumnType(String colName)
{
CMISResultSetColumn col = resultSet.getMetaData().getColumn(colName);
- return col == null ? null : col.getCMISDataType().name();
+ return col == null ? null : col.getCMISDataType().getLabel();
}
/**
diff --git a/source/java/org/alfresco/repo/cmis/rest/test/CMISCustomTypeTest.java b/source/java/org/alfresco/repo/cmis/rest/test/CMISCustomTypeTest.java
index f28af386fe..230e43a726 100644
--- a/source/java/org/alfresco/repo/cmis/rest/test/CMISCustomTypeTest.java
+++ b/source/java/org/alfresco/repo/cmis/rest/test/CMISCustomTypeTest.java
@@ -273,7 +273,7 @@ public class CMISCustomTypeTest extends BaseCMISWebScriptTest
queryReq = queryReq.replace("${PAGESIZE}", "5");
// issue structured query
- Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_QUERY), 200);
+ Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_CMIS_QUERY), 200);
assertNotNull(queryRes);
Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed);
diff --git a/source/java/org/alfresco/repo/cmis/rest/test/CMISTest.java b/source/java/org/alfresco/repo/cmis/rest/test/CMISTest.java
index 3db840aad3..e6c3179a78 100644
--- a/source/java/org/alfresco/repo/cmis/rest/test/CMISTest.java
+++ b/source/java/org/alfresco/repo/cmis/rest/test/CMISTest.java
@@ -1274,13 +1274,13 @@ public class CMISTest extends BaseCMISWebScriptTest
{
{
// meta data only query against folder
- String query = "SELECT * FROM Folder " +
- "WHERE ObjectId = '" + testFolderObject.getObjectId().getStringValue() + "'";
+ String query = "SELECT * FROM cmis:folder " +
+ "WHERE cmis:ObjectId = '" + testFolderObject.getObjectId().getStringValue() + "'";
String queryReq = queryDoc.replace("${STATEMENT}", query);
queryReq = queryReq.replace("${SKIPCOUNT}", "0");
- queryReq = queryReq.replace("${PAGESIZE}", "5");
+ queryReq = queryReq.replace("${MAXITEMS}", "5");
- Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_QUERY), 200);
+ Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_CMIS_QUERY), 200);
assertNotNull(queryRes);
Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed);
@@ -1294,14 +1294,14 @@ public class CMISTest extends BaseCMISWebScriptTest
{
// meta data only query against document
- String query = "SELECT * FROM Document " +
+ String query = "SELECT * FROM cmis:document " +
"WHERE IN_FOLDER('" + testFolderObject.getObjectId().getStringValue() + "') " +
- "AND Name = 'apple1'";
+ "AND cmis:Name = 'apple1'";
String queryReq = queryDoc.replace("${STATEMENT}", query);
queryReq = queryReq.replace("${SKIPCOUNT}", "0");
- queryReq = queryReq.replace("${PAGESIZE}", "5");
+ queryReq = queryReq.replace("${MAXITEMS}", "5");
- Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_QUERY), 200);
+ Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_CMIS_QUERY), 200);
assertNotNull(queryRes);
Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed);
@@ -1317,13 +1317,13 @@ public class CMISTest extends BaseCMISWebScriptTest
if (queryCapability.equals("fulltextonly") || queryCapability.equals("bothseperate") || queryCapability.equals("bothcombined"))
{
// full text only query
- String query = "SELECT ObjectId, ObjectTypeId, Name FROM Document " +
+ String query = "SELECT cmis:ObjectId, cmis:ObjectTypeId, cmis:Name FROM cmis:document " +
"WHERE CONTAINS('" + doc2name + "')";
String queryReq = queryDoc.replace("${STATEMENT}", query);
queryReq = queryReq.replace("${SKIPCOUNT}", "0");
- queryReq = queryReq.replace("${PAGESIZE}", "5");
+ queryReq = queryReq.replace("${MAXITEMS}", "5");
- Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_QUERY), 200);
+ Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_CMIS_QUERY), 200);
assertNotNull(queryRes);
Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed);
@@ -1338,15 +1338,15 @@ public class CMISTest extends BaseCMISWebScriptTest
if (queryCapability.equals("bothcombined"))
{
// combined meta data and full text
- String query = "SELECT ObjectId, ObjectTypeId, Name FROM Document " +
+ String query = "SELECT cmis:ObjectId, cmis:ObjectTypeId, cmis:Name FROM cmis:document " +
"WHERE IN_FOLDER('" + testFolderObject.getObjectId().getStringValue() + "') " +
- "AND Name = 'apple1' " +
+ "AND cmis:Name = 'apple1' " +
"AND CONTAINS('apple1')";
String queryReq = queryDoc.replace("${STATEMENT}", query);
queryReq = queryReq.replace("${SKIPCOUNT}", "0");
- queryReq = queryReq.replace("${PAGESIZE}", "5");
+ queryReq = queryReq.replace("${MAXITEMS}", "5");
- Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_QUERY), 200);
+ Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_CMIS_QUERY), 200);
assertNotNull(queryRes);
Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed);
@@ -1386,26 +1386,52 @@ public class CMISTest extends BaseCMISWebScriptTest
// query children
String queryDoc = loadString("/org/alfresco/repo/cmis/rest/test/query.cmisquery.xml");
CMISObject testFolderObject = testFolder.getExtension(CMISConstants.OBJECT);
- String query = "SELECT ObjectId, ObjectTypeId, Name FROM Document " + "WHERE IN_FOLDER('" + testFolderObject.getObjectId().getStringValue() + "')";
+ String query = "SELECT cmis:ObjectId, cmis:ObjectTypeId, cmis:Name FROM cmis:document " + "WHERE IN_FOLDER('" + testFolderObject.getObjectId().getStringValue() + "')";
+ String queryReq = queryDoc.replace("${STATEMENT}", query);
+ queryReq = queryReq.replace("${SKIPCOUNT}", "0");
+ queryReq = queryReq.replace("${MAXITEMS}", "4");
+
+ // issue query
+ Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_CMIS_QUERY), 200);
+ assertNotNull(queryRes);
+
+ // retrieve entries for first page
+ Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
+ assertNotNull(queryFeed);
- for (int page = 0; page < 4; page++)
+ int page = 0;
+ Link nextLink = null;
+ do
{
- String queryReq = queryDoc.replace("${STATEMENT}", query);
- queryReq = queryReq.replace("${SKIPCOUNT}", new Integer(page * 4).toString());
- queryReq = queryReq.replace("${PAGESIZE}", "4");
- Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_QUERY), 200);
- assertNotNull(queryRes);
-
- Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
- assertNotNull(queryFeed);
- assertEquals(page < 3 ? 4 : 3, queryFeed.getEntries().size());
-
+ page++;
+ assertEquals(page < 4 ? 4 : 3, queryFeed.getEntries().size());
+
+ // mark entries as read
for (Entry entry : queryFeed.getEntries())
{
docIds.remove(entry.getId());
}
+
+ // next page
+ nextLink = queryFeed.getLink("next");
+ if (page == 4)
+ {
+ assertNull(nextLink);
+ }
+ else
+ {
+ assertNotNull(nextLink);
+ }
+
+ if (nextLink != null)
+ {
+ queryFeed = getFeed(nextLink.getHref());
+ assertNotNull(queryFeed);
+ }
}
+ while (nextLink != null);
+ assertEquals(4, page);
assertEquals(0, docIds.size());
}
@@ -1444,15 +1470,15 @@ public class CMISTest extends BaseCMISWebScriptTest
{
// construct structured query
- String query = "SELECT * FROM Document " +
+ String query = "SELECT * FROM cmis:document " +
"WHERE IN_FOLDER('" + testFolderObject.getObjectId().getStringValue() + "') ";
String queryReq = queryDoc.replace("${STATEMENT}", query);
queryReq = queryReq.replace("${INCLUDEALLOWABLEACTIONS}", "true");
queryReq = queryReq.replace("${SKIPCOUNT}", "0");
- queryReq = queryReq.replace("${PAGESIZE}", "5");
+ queryReq = queryReq.replace("${MAXITEMS}", "5");
// issue structured query
- Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_QUERY), 200);
+ Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_CMIS_QUERY), 200);
assertNotNull(queryRes);
Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed);
diff --git a/source/java/org/alfresco/repo/cmis/rest/test/query.cmisquery.xml b/source/java/org/alfresco/repo/cmis/rest/test/query.cmisquery.xml
index 4ac838b735..4c43c9a581 100644
--- a/source/java/org/alfresco/repo/cmis/rest/test/query.cmisquery.xml
+++ b/source/java/org/alfresco/repo/cmis/rest/test/query.cmisquery.xml
@@ -1,5 +1,5 @@
${SKIPCOUNT}
- ${PAGESIZE}
+ ${MAXITEMS}
diff --git a/source/java/org/alfresco/repo/cmis/rest/test/queryallowableactions.cmisquery.xml b/source/java/org/alfresco/repo/cmis/rest/test/queryallowableactions.cmisquery.xml
index 300b90bf61..08db1fef86 100644
--- a/source/java/org/alfresco/repo/cmis/rest/test/queryallowableactions.cmisquery.xml
+++ b/source/java/org/alfresco/repo/cmis/rest/test/queryallowableactions.cmisquery.xml
@@ -1,6 +1,6 @@
- ${INCLUDEALLOWABLEACTIONS}
+ ${INCLUDEALLOWABLEACTIONS}
${SKIPCOUNT}
- ${PAGESIZE}
+ ${MAXITEMS}
diff --git a/source/java/org/alfresco/repo/web/util/paging/Paging.java b/source/java/org/alfresco/repo/web/util/paging/Paging.java
index 01326340b4..dc1176b700 100644
--- a/source/java/org/alfresco/repo/web/util/paging/Paging.java
+++ b/source/java/org/alfresco/repo/web/util/paging/Paging.java
@@ -152,10 +152,6 @@ public class Paging
* skipCount => row number start index
* maxItems => size of page
*
- * - header values
- * CMIS-skipCount => row number start index
- * CMIS-maxItems => size of page
- *
* @param args request args
* @return page (if pageNumber driven) or window (if skipCount driven)
*/
@@ -253,7 +249,7 @@ public class Paging
*/
public Page createUnlimitedPage()
{
- return new Page(PageType.PAGE, zeroBasedPage, zeroBasedPage ? 0 : 1, 0);
+ return new Page(PageType.PAGE, zeroBasedPage, zeroBasedPage ? 0 : 1, -1);
}
/**