Merged CMIS063 to HEAD

15327: 0.62 final update: Add feed links as per spec
  15334: 0.62 final update: queries working again.
  15350: 0.62 final update: query via GET
  15362: 0.62 final update: query uri template and query result set feed as per 0.62
  15434: Fix decoding issue retrieving query string of request.
  15441: 0.62 final updates: fixes to allow CMIS Fileshare browsing

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17231 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2009-10-29 16:27:40 +00:00
parent c9facc3e78
commit e90b63f20b
44 changed files with 599 additions and 288 deletions

View File

@@ -15,7 +15,7 @@
[#assign typedef = cmistype(object)] [#assign typedef = cmistype(object)]
[#list typedef.propertyDefinitions?values as propdef] [#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] [/#list]
</cmis:properties> </cmis:properties>
[/#macro] [/#macro]
@@ -30,10 +30,10 @@
<author><name>${node.properties.creator!""}</name></author> <author><name>${node.properties.creator!""}</name></author>
[@contentstream node/] [@contentstream node/]
<id>urn:uuid:${node.id}</id> <id>urn:uuid:${node.id}</id>
<link rel="self" href="${absurl(url.serviceContext)}[@nodeuri node/]"/> [@linksLib.linknodeself node/]
[@linkstream node "enclosure"/] [@linksLib.linkstream node "enclosure"/]
<link rel="edit" href="${absurl(url.serviceContext)}[@nodeuri node/]"/> [@linksLib.linknodeedit node/]
[@linkstream node "edit-media"/] [@linksLib.linkstream node "edit-media"/]
[@documentCMISLinks node=node/] [@documentCMISLinks node=node/]
<published>${xmldate(node.properties.created)}</published> <published>${xmldate(node.properties.created)}</published>
<summary>[@contentsummary node/]</summary> <summary>[@contentsummary node/]</summary>
@@ -49,12 +49,12 @@
[/#macro] [/#macro]
[#macro documentCMISLinks node] [#macro documentCMISLinks node]
[@linkallowableactions node/] [@linksLib.linkallowableactions node/]
[@linkrelationships node/] [@linksLib.linkrelationships node/]
[@linkparents node/] [@linksLib.linkparents node/]
[@linkversions node/] [@linksLib.linkversions node/]
[@linktype node/] [@linksLib.linktype node/]
[@linkservice/] [@linksLib.linkservice/]
[/#macro] [/#macro]
@@ -67,8 +67,8 @@
<author><name>${node.properties.creator}</name></author> <author><name>${node.properties.creator}</name></author>
[@contentstream node/] [@contentstream node/]
<id>urn:uuid:${node.id}</id> <id>urn:uuid:${node.id}</id>
<link rel="self" href="${absurl(url.serviceContext)}[@nodeuri node/]"/> [@linksLib.linknodeself node/]
[@linkstream node "enclosure"/] [@linksLib.linkstream node "enclosure"/]
[@documentCMISLinks node=node/] [@documentCMISLinks node=node/]
<published>${xmldate(node.properties.created)}</published> <published>${xmldate(node.properties.created)}</published>
<summary>[@contentsummary node/]</summary> <summary>[@contentsummary node/]</summary>
@@ -92,17 +92,17 @@
<author><name>${node.properties.creator}</name></author> <author><name>${node.properties.creator}</name></author>
[@contentstream node/] [@contentstream node/]
<id>urn:uuid:${node.id}</id> <id>urn:uuid:${node.id}</id>
<link rel="self" href="${absurl(url.serviceContext)}/api/pwc/[@noderef node/]"/> [#assign pwcuri]/api/pwc/[@linksLib.noderef node/][/#assign]
[@linkstream node "enclosure"/] [@linksLib.linkself href="${pwcuri}"/]
<link rel="edit" href="${absurl(url.serviceContext)}[@nodeuri node/]"/> [@linksLib.linkstream node "enclosure"/]
[@linkstream node "edit-media"/] [@linksLib.linknodeedit node/]
[@linksLib.linkstream node "edit-media"/]
[@documentCMISLinks node=node/] [@documentCMISLinks node=node/]
<published>${xmldate(node.properties.created)}</published> <published>${xmldate(node.properties.created)}</published>
<summary>[@contentsummary node/]</summary> <summary>[@contentsummary node/]</summary>
<title>${node.name}</title> <title>${node.name}</title>
<updated>${xmldate(node.properties.modified)}</updated> <updated>${xmldate(node.properties.modified)}</updated>
<app:edited>${xmldate(node.properties.modified)}</app:edited> <app:edited>${xmldate(node.properties.modified)}</app:edited>
[#-- TODO: the edit link refers to the updatable node resource, allowing updates on PWCs without checkin --]
<alf:icon>${absurl(url.context)}${node.icon16}</alf:icon> <alf:icon>${absurl(url.context)}${node.icon16}</alf:icon>
<cmisra:object> <cmisra:object>
[@objectCMISProps node propfilter/] [@objectCMISProps node propfilter/]
@@ -125,8 +125,8 @@
<author><name>${node.properties.creator}</name></author> <author><name>${node.properties.creator}</name></author>
<content>${node.id}</content> [#-- TODO --] <content>${node.id}</content> [#-- TODO --]
<id>urn:uuid:${node.id}</id> <id>urn:uuid:${node.id}</id>
<link rel="self" href="${absurl(url.serviceContext)}[@nodeuri node/]"/> [@linksLib.linknodeself node/]
<link rel="edit" href="${absurl(url.serviceContext)}[@nodeuri node/]"/> [@linksLib.linknodeedit node/]
[@folderCMISLinks node/] [@folderCMISLinks node/]
<published>${xmldate(node.properties.created)}</published> <published>${xmldate(node.properties.created)}</published>
<summary>${node.properties.description!node.properties.title!""}</summary> [#-- TODO --] <summary>${node.properties.description!node.properties.title!""}</summary> [#-- TODO --]
@@ -143,7 +143,9 @@
[#assign nested = cmischildren(node, typesfilter)/] [#assign nested = cmischildren(node, typesfilter)/]
[#if nested?size > 0] [#if nested?size > 0]
<cmisra:children> <cmisra:children>
[@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] [#list nested as child]
[#if child.isDocument] [#if child.isDocument]
[@document child propfilter includeallowableactions includerelationships/] [@document child propfilter includeallowableactions includerelationships/]
@@ -158,16 +160,16 @@
[/#macro] [/#macro]
[#macro folderCMISLinks node] [#macro folderCMISLinks node]
[@linkallowableactions node/] [@linksLib.linkallowableactions node/]
[@linkrelationships node/] [@linksLib.linkrelationships node/]
[#if cmisproperty(node, cmisconstants.PROP_PARENT_ID)?is_string] [#if cmisproperty(node, cmisconstants.PROP_PARENT_ID)?is_string]
[@linkparent node/] [@linksLib.linkparent node/]
[/#if] [/#if]
[@linkchildren node/] [@linksLib.linkchildren node/]
[@linkdescendants node/] [@linksLib.linkdescendants node/]
[@linktree node/] [@linksLib.linktree node/]
[@linktype node/] [@linksLib.linktype node/]
[@linkservice/] [@linksLib.linkservice/]
[/#macro] [/#macro]
@@ -180,8 +182,8 @@
<author><name>${xmldate(date)}</name></author> [#-- TODO: [@namedvalue cmisconstants.PROP_CREATED_BY assoc cmisconstants.DATATYPE_STRING/] --] <author><name>${xmldate(date)}</name></author> [#-- TODO: [@namedvalue cmisconstants.PROP_CREATED_BY assoc cmisconstants.DATATYPE_STRING/] --]
<content>[@namedvalue cmisconstants.PROP_OBJECT_ID assoc cmisconstants.DATATYPE_ID/]</content> [#-- TODO: spec id, how to map? --] <content>[@namedvalue cmisconstants.PROP_OBJECT_ID assoc cmisconstants.DATATYPE_ID/]</content> [#-- TODO: spec id, how to map? --]
<id>[@namedvalue cmisconstants.PROP_OBJECT_ID assoc cmisconstants.DATATYPE_ID/]</id> [#-- TODO: id compliant --] <id>[@namedvalue cmisconstants.PROP_OBJECT_ID assoc cmisconstants.DATATYPE_ID/]</id> [#-- TODO: id compliant --]
<link rel="self" href="${absurl(url.serviceContext)}[@assocuri assoc/]"/> [@linksLib.linkassocself assoc/]
<link rel="edit" href="${absurl(url.serviceContext)}[@assocuri assoc/]"/> [@linksLib.linkassocedit assoc/]
[@assocCMISLinks assoc=assoc/] [@assocCMISLinks assoc=assoc/]
<published>${xmldate(date)}</published> [#-- TODO: [@namedvalue cmisconstants.PROP_CREATION_DATE assoc cmisconstants.DATATYPE_DATETIME/] --] <published>${xmldate(date)}</published> [#-- TODO: [@namedvalue cmisconstants.PROP_CREATION_DATE assoc cmisconstants.DATATYPE_DATETIME/] --]
<summary>[@namedvalue cmisconstants.PROP_OBJECT_ID assoc cmisconstants.DATATYPE_ID/]</summary> [#-- TODO: spec id, how to map? --] <summary>[@namedvalue cmisconstants.PROP_OBJECT_ID assoc cmisconstants.DATATYPE_ID/]</summary> [#-- TODO: spec id, how to map? --]
@@ -197,10 +199,10 @@
[#macro assocCMISLinks assoc] [#macro assocCMISLinks assoc]
[#-- TODO: <link rel="allowableactions" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/permissions"/> --] [#-- TODO: <link rel="allowableactions" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/permissions"/> --]
[@linktype assoc/] [@linksLib.linktype assoc/]
[@linktosource assoc.source/] [@linksLib.linktosource assoc.source/]
[@linktotarget assoc.target/] [@linksLib.linktotarget assoc.target/]
[@linkservice/] [@linksLib.linkservice/]
[/#macro] [/#macro]
@@ -211,23 +213,22 @@
[#-- TODO: spec issue 47 --] [#-- TODO: spec issue 47 --]
[#macro row row includeallowableactions=false] [#macro row row includeallowableactions=false]
[@entry] [@entry]
[#if row.nodes??] [#-- TODO: calculate multiNodeResultSet from result set --]
[#assign node = row.nodes?first] [#if row.nodes?? && row.nodes?size == 1][#assign node = row.nodes?first/][/#if]
[#if node??]
<author><name>${node.properties.creator!""}</name></author> <author><name>${node.properties.creator!""}</name></author>
[#-- TODO: review if consistent with ATOM --] [#-- TODO: review if consistent with ATOM --]
[#if node.isDocument] [#if node.isDocument]
[@contentstream node/] [@contentstream node/]
[#else] [#else]
<content>${node.id}</content> [#-- TODO --] <content>${node.id}</content> [#-- TODO --]
[/#if] [/#if]
<id>urn:uuid:${node.id}</id> <id>urn:uuid:${node.id}</id>
<link rel="self" href="${absurl(url.serviceContext)}[@nodeuri node/]"/> [@linksLib.linknodeself node/]
<link rel="edit" href="${absurl(url.serviceContext)}[@nodeuri node/]"/> [@linksLib.linknodeedit node/]
[#if node.isDocument] [#if node.isDocument]
[@linkstream node "enclosure"/] [@linksLib.linkstream node "enclosure"/]
[@linkstream node "edit-media"/] [@linksLib.linkstream node "edit-media"/]
[@documentCMISLinks node=node/] [@documentCMISLinks node=node/]
[#else] [#else]
[@folderCMISLinks node=node/] [@folderCMISLinks node=node/]
@@ -235,10 +236,14 @@
<title>${node.name}</title> <title>${node.name}</title>
<updated>${xmldate(node.properties.modified)}</updated> <updated>${xmldate(node.properties.modified)}</updated>
<alf:icon>${absurl(url.context)}${node.icon16}</alf:icon> <alf:icon>${absurl(url.context)}${node.icon16}</alf:icon>
[#else]
<author><name>${person.properties.userName}</name></author>
<id>urn:uuid:row-${row.index?c}</id>
<title>Row ${row.index?c}</title>
<updated>${xmldate(now)}</updated>
[/#if] [/#if]
<cmisra:object> <cmisra:object>
<cmis:properties> <cmis:properties>
[#assign rowvalues = row.values] [#assign rowvalues = row.values]
[#list rowvalues?keys as colname] [#list rowvalues?keys as colname]
[#assign coltype = row.getColumnType(colname)] [#assign coltype = row.getColumnType(colname)]
@@ -249,7 +254,7 @@
[/#if] [/#if]
[/#list] [/#list]
</cmis:properties> </cmis:properties>
[#if row.nodes?? && includeallowableactions][@allowableactions node/][/#if] [#if node?? && includeallowableactions][@allowableactions node/][/#if]
</cmisra:object> </cmisra:object>
[/@entry] [/@entry]
[/#macro] [/#macro]
@@ -273,39 +278,39 @@
[/#macro] [/#macro]
[#macro propvalue name value type] [#macro propvalue name value type]
[#if type.label == cmisconstants.DATATYPE_STRING] [#if type == cmisconstants.DATATYPE_STRING]
<cmis:propertyString pdid="${name}">[@values value;v]<cmis:value>[@stringvalue v/]</cmis:value>[/@values]</cmis:propertyString> <cmis:propertyString pdid="${name}">[@values value;v]<cmis:value>[@stringvalue v/]</cmis:value>[/@values]</cmis:propertyString>
[#elseif type.label == cmisconstants.DATATYPE_INTEGER] [#elseif type == cmisconstants.DATATYPE_INTEGER]
<cmis:propertyInteger pdid="${name}">[@values value;v]<cmis:value>[@integervalue v/]</cmis:value>[/@values]</cmis:propertyInteger> <cmis:propertyInteger pdid="${name}">[@values value;v]<cmis:value>[@integervalue v/]</cmis:value>[/@values]</cmis:propertyInteger>
[#elseif type.label == cmisconstants.DATATYPE_DECIMAL] [#elseif type == cmisconstants.DATATYPE_DECIMAL]
<cmis:propertyDecimal pdid="${name}">[@values value;v]<cmis:value>[@decimalvalue v/]</cmis:value>[/@values]</cmis:propertyDecimal> <cmis:propertyDecimal pdid="${name}">[@values value;v]<cmis:value>[@decimalvalue v/]</cmis:value>[/@values]</cmis:propertyDecimal>
[#elseif type.label == cmisconstants.DATATYPE_BOOLEAN] [#elseif type == cmisconstants.DATATYPE_BOOLEAN]
<cmis:propertyBoolean pdid="${name}">[@values value;v]<cmis:value>[@booleanvalue v/]</cmis:value>[/@values]</cmis:propertyBoolean> <cmis:propertyBoolean pdid="${name}">[@values value;v]<cmis:value>[@booleanvalue v/]</cmis:value>[/@values]</cmis:propertyBoolean>
[#elseif type.label == cmisconstants.DATATYPE_DATETIME] [#elseif type == cmisconstants.DATATYPE_DATETIME]
<cmis:propertyDateTime pdid="${name}">[@values value;v]<cmis:value>[@datetimevalue v/]</cmis:value>[/@values]</cmis:propertyDateTime> <cmis:propertyDateTime pdid="${name}">[@values value;v]<cmis:value>[@datetimevalue v/]</cmis:value>[/@values]</cmis:propertyDateTime>
[#elseif type.label == cmisconstants.DATATYPE_URI] [#elseif type == cmisconstants.DATATYPE_URI]
[#-- TODO: check validity of abs url prefix --] [#-- TODO: check validity of abs url prefix --]
<cmis:propertyUri pdid="${name}">[@values value;v]<cmis:value>[@urivalue absurl(url.serviceContext) + v/]</cmis:value>[/@values]</cmis:propertyUri> <cmis:propertyUri pdid="${name}">[@values value;v]<cmis:value>[@urivalue absurl(url.serviceContext) + v/]</cmis:value>[/@values]</cmis:propertyUri>
[#elseif type.label == cmisconstants.DATATYPE_ID] [#elseif type == cmisconstants.DATATYPE_ID]
<cmis:propertyId pdid="${name}">[@values value;v]<cmis:value>[@idvalue v/]</cmis:value>[/@values]</cmis:propertyId> <cmis:propertyId pdid="${name}">[@values value;v]<cmis:value>[@idvalue v/]</cmis:value>[/@values]</cmis:propertyId>
[#-- TODO: remaining property types --] [#-- TODO: remaining property types --]
[/#if] [/#if]
[/#macro] [/#macro]
[#macro propnull name type] [#macro propnull name type]
[#if type.label == cmisconstants.DATATYPE_STRING] [#if type == cmisconstants.DATATYPE_STRING]
<cmis:propertyString pdid="${name}"/> <cmis:propertyString pdid="${name}"/>
[#elseif type.label == cmisconstants.DATATYPE_INTEGER] [#elseif type == cmisconstants.DATATYPE_INTEGER]
<cmis:propertyInteger pdid="${name}"/> <cmis:propertyInteger pdid="${name}"/>
[#elseif type.label == cmisconstants.DATATYPE_DECIMAL] [#elseif type == cmisconstants.DATATYPE_DECIMAL]
<cmis:propertyDecimal pdid="${name}"/> <cmis:propertyDecimal pdid="${name}"/>
[#elseif type.label == cmisconstants.DATATYPE_BOOLEAN] [#elseif type == cmisconstants.DATATYPE_BOOLEAN]
<cmis:propertyBoolean pdid="${name}"/> <cmis:propertyBoolean pdid="${name}"/>
[#elseif type.label == cmisconstants.DATATYPE_DATETIME] [#elseif type == cmisconstants.DATATYPE_DATETIME]
<cmis:propertyDateTime pdid="${name}"/> <cmis:propertyDateTime pdid="${name}"/>
[#elseif type.label == cmisconstants.DATATYPE_URI] [#elseif type == cmisconstants.DATATYPE_URI]
<cmis:propertyUri pdid="${name}"/> <cmis:propertyUri pdid="${name}"/>
[#elseif type.label == cmisconstants.DATATYPE_ID] [#elseif type == cmisconstants.DATATYPE_ID]
<cmis:propertyId pdid="${name}"/> <cmis:propertyId pdid="${name}"/>
[#-- TODO: remaining property types --] [#-- TODO: remaining property types --]
[/#if] [/#if]
@@ -380,7 +385,7 @@
<author><name>${person.properties.userName}</name></author> <author><name>${person.properties.userName}</name></author>
<content>${typedefn.typeId.id}</content> [#-- TODO --] <content>${typedefn.typeId.id}</content> [#-- TODO --]
<id>urn:uuid:type-${typedefn.typeId.id}</id> <id>urn:uuid:type-${typedefn.typeId.id}</id>
<link rel="self" href="${absurl(url.serviceContext)}/api/type/${typedefn.typeId.id}"/> [@linksLib.linktypeself typedefn/]
[@typedefCMISLinks typedefn/] [@typedefCMISLinks typedefn/]
<summary>[#if typedefn.description??]${typedefn.description?xml}[#else]${typedefn.displayName?xml}[/#if]</summary> <summary>[#if typedefn.description??]${typedefn.description?xml}[#else]${typedefn.displayName?xml}[/#if]</summary>
<title>${typedefn.displayName}</title> <title>${typedefn.displayName}</title>
@@ -391,7 +396,9 @@
[#assign nested = typedefn.getSubTypes(false)/] [#assign nested = typedefn.getSubTypes(false)/]
[#if nested?size > 1] [#if nested?size > 1]
<cmisra:children> <cmisra:children>
[@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] [#list nested as child]
[@typedef child includeProperties includeInheritedProperties ns depth+1 maxdepth/] [@typedef child includeProperties includeInheritedProperties ns depth+1 maxdepth/]
[/#list] [/#list]
@@ -402,13 +409,13 @@
[/#macro] [/#macro]
[#macro typedefCMISLinks typedef] [#macro typedefCMISLinks typedef]
[@linktype typedef/] [@linksLib.linktype typedef/]
[#if typedef.parentType??] [#if typedef.parentType??]
[@linktypeparent typedef/] [@linksLib.linktypeparent typedef/]
[/#if] [/#if]
[@linktypechildren typedef/] [@linksLib.linktypechildren typedef/]
[@linktypedescendants typedef/] [@linksLib.linktypedescendants typedef/]
[@linkservice/] [@linksLib.linkservice/]
[/#macro] [/#macro]
[#macro typedefCMISProps typedef includeProperties=true includeInheritedProperties=true] [#macro typedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
@@ -424,30 +431,30 @@
[/#macro] [/#macro]
[#macro documenttypedefCMISProps typedef includeProperties=true includeInheritedProperties=true] [#macro documenttypedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
<cmisra:documentType> <cmisra:type xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="cmis:cmisTypeDocumentDefinitionType">
[@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/] [@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/]
<cmis:versionable>${typedef.versionable?string}</cmis:versionable> <cmis:versionable>${typedef.versionable?string}</cmis:versionable>
<cmis:contentStreamAllowed>${typedef.contentStreamAllowed.label}</cmis:contentStreamAllowed> <cmis:contentStreamAllowed>${typedef.contentStreamAllowed.label}</cmis:contentStreamAllowed>
</cmisra:documentType> </cmisra:type>
[/#macro] [/#macro]
[#macro foldertypedefCMISProps typedef includeProperties=true includeInheritedProperties=true] [#macro foldertypedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
<cmisra:folderType> <cmisra:type xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="cmis:cmisTypeFolderDefinitionType">
[@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/] [@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/]
</cmisra:folderType> </cmisra:type>
[/#macro] [/#macro]
[#macro relationshiptypedefCMISProps typedef includeProperties=true includeInheritedProperties=true] [#macro relationshiptypedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
<cmisra:relationshipType> <cmisra:type xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="cmis:cmisTypeRelationshipDefinitionType">
[@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/] [@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/]
[#-- TODO: source and target types --] [#-- TODO: source and target types --]
</cmisra:relationshipType> </cmisra:type>
[/#macro] [/#macro]
[#macro policytypedefCMISProps typedef includeProperties=true includeInheritedProperties=true] [#macro policytypedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
<cmisra:policyType> <cmisra:type xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="cmis:cmisTypePolicyDefinitionType">
[@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/] [@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/]
</cmisra:policyType> </cmisra:type>
[/#macro] [/#macro]
[#macro objecttypedefCMISProps typedef includeProperties=true includeInheritedProperties=true] [#macro objecttypedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
@@ -576,7 +583,7 @@
<cmis:required>${propdef.required?string}</cmis:required> <cmis:required>${propdef.required?string}</cmis:required>
<cmis:queryable>${propdef.queryable?string}</cmis:queryable> <cmis:queryable>${propdef.queryable?string}</cmis:queryable>
<cmis:orderable>${propdef.orderable?string}</cmis:orderable> <cmis:orderable>${propdef.orderable?string}</cmis:orderable>
[@cmisChoices propdef.choices propdef.dataType/] [@cmisChoices propdef.choices propdef.dataType.label/]
<cmis:openChoice>${propdef.openChoice?string}</cmis:openChoice> <cmis:openChoice>${propdef.openChoice?string}</cmis:openChoice>
[#if propdef.defaultValue??] [#if propdef.defaultValue??]
[#-- TODO: defaults for HTML and XML property types --] [#-- TODO: defaults for HTML and XML property types --]
@@ -587,37 +594,37 @@
[#macro cmisChoices choices type] [#macro cmisChoices choices type]
[#if choices?exists] [#if choices?exists]
[#list choices as choice] [#list choices as choice]
[#if type.label == cmisconstants.DATATYPE_STRING] [#if type == cmisconstants.DATATYPE_STRING]
<cmis:choiceString cmis:key="${choice.name}"> <cmis:choiceString cmis:key="${choice.name}">
[@cmisChoices choice.children type/] [@cmisChoices choice.children type/]
<cmis:value>[@stringvalue choice.value/]</cmis:value> <cmis:value>[@stringvalue choice.value/]</cmis:value>
</cmis:choiceString> </cmis:choiceString>
[#elseif type.label == cmisconstants.DATATYPE_INTEGER] [#elseif type == cmisconstants.DATATYPE_INTEGER]
<cmis:choiceInteger cmis:key="${choice.name}"> <cmis:choiceInteger cmis:key="${choice.name}">
[@cmisChoices choice.children type/] [@cmisChoices choice.children type/]
<cmis:value>[@stringvalue choice.value/]</cmis:value> <cmis:value>[@stringvalue choice.value/]</cmis:value>
</cmis:choiceInteger> </cmis:choiceInteger>
[#elseif type.label == cmisconstants.DATATYPE_DECIMAL] [#elseif type == cmisconstants.DATATYPE_DECIMAL]
<cmis:choiceDecimal cmis:key="${choice.name}"> <cmis:choiceDecimal cmis:key="${choice.name}">
[@cmisChoices choice.children type/] [@cmisChoices choice.children type/]
<cmis:value>[@stringvalue choice.value/]</cmis:value> <cmis:value>[@stringvalue choice.value/]</cmis:value>
</cmis:choiceDecimal> </cmis:choiceDecimal>
[#elseif type.label == cmisconstants.DATATYPE_BOOLEAN] [#elseif type == cmisconstants.DATATYPE_BOOLEAN]
<cmis:choiceBoolean cmis:key="${choice.name}"> <cmis:choiceBoolean cmis:key="${choice.name}">
[@cmisChoices choice.children type/] [@cmisChoices choice.children type/]
<cmis:value>[@stringvalue choice.value/]</cmis:value> <cmis:value>[@stringvalue choice.value/]</cmis:value>
</cmis:choiceBoolean> </cmis:choiceBoolean>
[#elseif type.label == cmisconstants.DATATYPE_DATETIME] [#elseif type == cmisconstants.DATATYPE_DATETIME]
<cmis:choiceDateTime cmis:key="${choice.name}"> <cmis:choiceDateTime cmis:key="${choice.name}">
[@cmisChoices choice.children type/] [@cmisChoices choice.children type/]
<cmis:value>[@stringvalue choice.value/]</cmis:value> <cmis:value>[@stringvalue choice.value/]</cmis:value>
</cmis:choiceDateTime> </cmis:choiceDateTime>
[#elseif type.label == cmisconstants.DATATYPE_URI] [#elseif type == cmisconstants.DATATYPE_URI]
<cmis:choiceUri cmis:key="${choice.name}"> <cmis:choiceUri cmis:key="${choice.name}">
[@cmisChoices choice.children type/] [@cmisChoices choice.children type/]
<cmis:value>[@stringvalue choice.value/]</cmis:value> <cmis:value>[@stringvalue choice.value/]</cmis:value>
</cmis:choiceUri> </cmis:choiceUri>
[#elseif type.label == cmisconstants.DATATYPE_ID] [#elseif type == cmisconstants.DATATYPE_ID]
<cmis:choiceId cmis:key="${choice.name}"> <cmis:choiceId cmis:key="${choice.name}">
[@cmisChoices choice.children type/] [@cmisChoices choice.children type/]
<cmis:value>[@stringvalue choice.value/]</cmis:value> <cmis:value>[@stringvalue choice.value/]</cmis:value>
@@ -629,91 +636,6 @@
[/#macro] [/#macro]
[#-- --]
[#-- Link Relations --]
[#-- --]
[#-- Link to repository service document --]
[#macro linkservice]
<link rel="${cmisconstants.REL_SERVICE}" href="${absurl(url.serviceContext)}/api/repository"/>
[/#macro]
[#-- Link to node allowable actions --]
[#macro linkallowableactions node]
<link rel="${cmisconstants.REL_ALLOWABLE_ACTIONS}" href="${absurl(url.serviceContext)}[@nodeuri node/]/allowableactions"/>
[/#macro]
[#-- Link to node relationships --]
[#macro linkrelationships node]
<link rel="${cmisconstants.REL_RELATIONSHIPS}" href="${absurl(url.serviceContext)}[@nodeuri node/]/rels"/>
[/#macro]
[#-- Link to node parents --]
[#macro linkparents node]
<link rel="${cmisconstants.REL_UP}" type="application/atom+xml;type=feed" href="${absurl(url.serviceContext)}[@nodeuri node/]/parents"/>
[/#macro]
[#-- Link to folder parent --]
[#macro linkparent node]
<link rel="${cmisconstants.REL_UP}" type="application/atom+xml;type=entry" href="${absurl(url.serviceContext)}[@nodeuri node.parent/]"/>
[/#macro]
[#-- Link to node children --]
[#macro linkchildren node]
<link rel="${cmisconstants.REL_DOWN}" type="application/atom+xml;type=feed" href="${absurl(url.serviceContext)}[@nodeuri node/]/children"/>
[/#macro]
[#-- Link to node descendants --]
[#macro linkdescendants node]
<link rel="${cmisconstants.REL_DOWN}" type="application/cmistree+xml" href="${absurl(url.serviceContext)}[@nodeuri node/]/descendants"/>
[/#macro]
[#-- Link to node tree --]
[#macro linktree node]
<link rel="${cmisconstants.REL_FOLDER_TREE}" type="application/cmistree+xml" href="${absurl(url.serviceContext)}[@nodeuri node/]/tree"/>
[/#macro]
[#-- Link to node versions --]
[#macro linkversions node]
<link rel="${cmisconstants.REL_VERSION_HISTORY}" href="${absurl(url.serviceContext)}[@nodeuri node/]/versions"/>
[/#macro]
[#-- Link to source node --]
[#macro linktosource node]
<link rel="${cmisconstants.REL_ASSOC_SOURCE}" href="${absurl(url.serviceContext)}[@nodeuri node/]"/>
[/#macro]
[#-- Link to target node --]
[#macro linktotarget node]
<link rel="${cmisconstants.REL_ASSOC_TARGET}" href="${absurl(url.serviceContext)}[@nodeuri node/]"/>
[/#macro]
[#-- Link to content stream --]
[#macro linkstream node rel=""]
<link[#if rel !=""] rel="${rel}"[/#if][#if node.mimetype??] type="${node.mimetype}"[/#if] href="[@contenturi node/]"/>
[/#macro]
[#-- Link to node type --]
[#macro linktype object]
<link rel="${cmisconstants.REL_DESCRIBED_BY}" href="${absurl(url.serviceContext)}[@typeuri cmistype(object)/]"/>
[/#macro]
[#-- Link to type parent --]
[#macro linktypeparent typedef]
<link rel="${cmisconstants.REL_UP}" type="application/atom+xml;type=entry" href="${absurl(url.serviceContext)}[@typeuri typedef.parentType/]"/>
[/#macro]
[#-- Link to type children --]
[#macro linktypechildren typedef]
<link rel="${cmisconstants.REL_DOWN}" type="application/atom+xml;type=feed" href="${absurl(url.serviceContext)}[@typeuri typedef/]/children"/>
[/#macro]
[#-- Link to type descendants --]
[#macro linktypedescendants typedef]
<link rel="${cmisconstants.REL_DOWN}" type="application/cmistree+xml" href="${absurl(url.serviceContext)}[@typeuri typedef/]/descendants"/>
[/#macro]
[#-- --] [#-- --]
[#-- General Utils --] [#-- 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] [#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 --] [#-- Helper to render atom content element --]
[#macro contentstream node]<content[#if node.mimetype??] type="${node.mimetype}"[/#if] src="[@contenturi node/]"/>[/#macro] [#macro contentstream node]<content[#if node.mimetype??] type="${node.mimetype}"[/#if] src="[@linksLib.contenturi 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]

View File

@@ -20,7 +20,6 @@
<generator version="${server.version}">Alfresco (${server.edition})</generator> <generator version="${server.version}">Alfresco (${server.edition})</generator>
<icon>${absurl(url.context)}/images/logo/AlfrescoLogo16.ico</icon> <icon>${absurl(url.context)}/images/logo/AlfrescoLogo16.ico</icon>
<id>${id}</id> <id>${id}</id>
<link rel="self" href="${absurl(encodeuri(url.full))?xml}"/>
[#nested] [#-- NOTE: Custom links --] [#nested] [#-- NOTE: Custom links --]
<title>${title}</title> <title>${title}</title>
<updated>${xmldate(date)}</updated> <updated>${xmldate(date)}</updated>
@@ -36,25 +35,7 @@
<generator version="${server.version}">Alfresco (${server.edition})</generator> <generator version="${server.version}">Alfresco (${server.edition})</generator>
<icon>${absurl(url.context)}/images/logo/AlfrescoLogo16.ico</icon> <icon>${absurl(url.context)}/images/logo/AlfrescoLogo16.ico</icon>
<id>urn:uuid:${node.id}[#if kind != ""]-${kind}[/#if]</id> <id>urn:uuid:${node.id}[#if kind != ""]-${kind}[/#if]</id>
<link rel="self" href="${absurl(encodeuri(url.full))?xml}"/>
<link rel="source" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}"/>
[#nested] [#-- NOTE: Custom links --] [#nested] [#-- NOTE: Custom links --]
<title>${node.name}[#if kind != ""] ${kind?capitalize}[/#if]</title> <title>${node.name}[#if kind != ""] ${kind?capitalize}[/#if]</title>
<updated>${xmldate(node.properties.modified)}</updated> <updated>${xmldate(node.properties.modified)}</updated>
[/#macro] [/#macro]
[#-- --]
[#-- ATOM Feed for Type Container --]
[#-- --]
[#macro typedef typedefn kind="children" author="System"]
<author><name>${author}</name></author>
<generator version="${server.version}">Alfresco (${server.edition})</generator>
<icon>${absurl(url.context)}/images/logo/AlfrescoLogo16.ico</icon>
<id>urn:uuid:type-${typedefn.typeId.id}-${kind}</id>
<link rel="self" href="${absurl(url.serviceContext)}/api/type/${typedefn.typeId.id}/${kind}"/>
[#nested] [#-- NOTE: Custom links --]
<title>${typedefn.displayName} ${kind?capitalize}</title>
<updated>${xmldate(date)}</updated>
[/#macro]

View File

@@ -0,0 +1,143 @@
[#ftl]
[#-- --]
[#-- Link Relations --]
[#-- --]
[#-- Link to repository service document --]
[#macro linkservice]
<link rel="${cmisconstants.REL_SERVICE}" href="${absurl(url.serviceContext)}/api/repository"/>
[/#macro]
[#-- Link to node allowable actions --]
[#macro linkallowableactions node]
<link rel="${cmisconstants.REL_ALLOWABLE_ACTIONS}" href="${absurl(url.serviceContext)}[@nodeuri node/]/allowableactions"/>
[/#macro]
[#-- Link to node relationships --]
[#macro linkrelationships node]
<link rel="${cmisconstants.REL_RELATIONSHIPS}" href="${absurl(url.serviceContext)}[@nodeuri node/]/rels"/>
[/#macro]
[#-- Link to node parents --]
[#macro linkparents node]
<link rel="${cmisconstants.REL_UP}" href="${absurl(url.serviceContext)}[@nodeuri node/]/parents" type="${cmisconstants.MIMETYPE_FEED}"/>
[/#macro]
[#-- Link to folder parent --]
[#macro linkparent node]
<link rel="${cmisconstants.REL_UP}" href="${absurl(url.serviceContext)}[@nodeuri node.parent/]" type="${cmisconstants.MIMETYPE_ENTRY}"/>
[/#macro]
[#-- Link to node children --]
[#macro linkchildren node rel=""]
<link rel="[#if rel == ""]${cmisconstants.REL_DOWN}[#else]${rel}[/#if]" href="${absurl(url.serviceContext)}[@nodeuri node/]/children" type="${cmisconstants.MIMETYPE_FEED}"/>
[/#macro]
[#-- Link to node descendants --]
[#macro linkdescendants node rel=""]
<link rel="[#if rel == ""]${cmisconstants.REL_DOWN}[#else]${rel}[/#if]" href="${absurl(url.serviceContext)}[@nodeuri node/]/descendants" type="${cmisconstants.MIMETYPE_CMISTREE}"/>
[/#macro]
[#-- Link to node tree --]
[#macro linktree node rel=""]
<link rel="[#if rel == ""]${cmisconstants.REL_FOLDER_TREE}[#else]${rel}[/#if]" href="${absurl(url.serviceContext)}[@nodeuri node/]/tree" type="${cmisconstants.MIMETYPE_CMISTREE}"/>
[/#macro]
[#-- Link to node versions --]
[#macro linkversions node]
<link rel="${cmisconstants.REL_VERSION_HISTORY}" href="${absurl(url.serviceContext)}[@nodeuri node/]/versions"/>
[/#macro]
[#-- Link to source node --]
[#macro linktosource node]
<link rel="${cmisconstants.REL_ASSOC_SOURCE}" href="${absurl(url.serviceContext)}[@nodeuri node/]"/>
[/#macro]
[#-- Link to target node --]
[#macro linktotarget node]
<link rel="${cmisconstants.REL_ASSOC_TARGET}" href="${absurl(url.serviceContext)}[@nodeuri node/]"/>
[/#macro]
[#-- Link to content stream --]
[#macro linkstream node rel=""]
<link[#if rel != ""] rel="${rel}"[/#if] href="[@contenturi node/]"[#if node.mimetype??] type="${node.mimetype}"[/#if]/>
[/#macro]
[#-- Link to node type --]
[#macro linktype object]
<link rel="${cmisconstants.REL_DESCRIBED_BY}" href="${absurl(url.serviceContext)}[@typeuri cmistype(object)/]"/>
[/#macro]
[#-- Link to type parent --]
[#macro linktypeparent typedef]
<link rel="${cmisconstants.REL_UP}" href="${absurl(url.serviceContext)}[@typeuri typedef.parentType/]" type="${cmisconstants.MIMETYPE_ENTRY}"/>
[/#macro]
[#-- Link to type children --]
[#macro linktypechildren typedef]
<link rel="${cmisconstants.REL_DOWN}" href="${absurl(url.serviceContext)}[@typeuri typedef/]/children" type="${cmisconstants.MIMETYPE_FEED}"/>
[/#macro]
[#-- Link to type descendants --]
[#macro linktypedescendants typedef rel=""]
<link rel="[#if rel == ""]${cmisconstants.REL_DOWN}[#else]${rel}[/#if]" href="${absurl(url.serviceContext)}[@typeuri typedef/]/descendants" type="${cmisconstants.MIMETYPE_CMISTREE}"/>
[/#macro]
[#-- Link to self --]
[#macro linkself href="" type=""]
<link rel="self" href="[#if href == ""]${absurl(encodeuri(url.full))?xml}[#else]${absurl(url.serviceContext)}${href}[/#if]"[#if type != ""] type="${type}"[/#if]/>
[/#macro]
[#macro linknodeself node]
<link rel="self" href="${absurl(url.serviceContext)}[@nodeuri node/]"/>
[/#macro]
[#macro linkassocself assoc]
<link rel="self" href="${absurl(url.serviceContext)}[@assocuri assoc/]"/>
[/#macro]
[#macro linktypeself typedef]
<link rel="self" href="${absurl(url.serviceContext)}[@typeuri typedef/]"/>
[/#macro]
[#-- Link to edit --]
[#macro linkedit href="" type=""]
<link rel="edit" href="[#if href == ""]${absurl(encodeuri(url.full))?xml}[#else]${absurl(url.serviceContext)}${href}[/#if]"[#if type != ""] type="${type}"[/#if]/>
[/#macro]
[#macro linknodeedit node]
<link rel="edit" href="${absurl(url.serviceContext)}[@nodeuri node/]"/>
[/#macro]
[#macro linkassocedit assoc]
<link rel="edit" href="${absurl(url.serviceContext)}[@nodeuri node/]"/>
[/#macro]
[#-- Link to via --]
[#macro linkvia href="" type=""]
<link rel="via" href="${absurl(url.serviceContext)}${href}"[#if type != ""] type="${type}"[/#if]/>
[/#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]

View File

@@ -30,6 +30,36 @@
[/#if] [/#if]
[/#macro] [/#macro]
[#macro linksredirect cursor serviceUrl urlargs="" type="" pageNo="pageNo" pageSize="pageSize" skipCount="skipCount" maxItems="maxItems"]
[#if cursor.pageType = "PAGE"]
[#if cursor.hasFirstPage]
<link rel="first" href="${absurl(encodeuri(url.serviceContext + serviceUrl + "?" + argreplace(urlargs, pageNo, cursor.firstPage, pageSize, cursor.pageSize)))?xml}"[#if type != ""] type="${type}"[/#if]/>
[/#if]
[#if cursor.hasLastPage]
<link rel="last" href="${absurl(encodeuri(url.serviceContext + serviceUrl + "?" + argreplace(urlargs, pageNo, cursor.lastPage, pageSize, cursor.pageSize)))?xml}"[#if type != ""] type="${type}"[/#if]/>
[/#if]
[#if cursor.hasPrevPage]
<link rel="prev" href="${absurl(encodeuri(url.serviceContext + serviceUrl + "?" + argreplace(urlargs, pageNo, cursor.prevPage, pageSize, cursor.pageSize)))?xml}"[#if type != ""] type="${type}"[/#if]/>
[/#if]
[#if cursor.hasNextPage]
<link rel="next" href="${absurl(encodeuri(url.serviceContext + serviceUrl + "?" + argreplace(urlargs, pageNo, cursor.nextPage, pageSize, cursor.pageSize)))?xml}"[#if type != ""] type="${type}"[/#if]/>
[/#if]
[#else]
[#if cursor.hasFirstPage]
<link rel="first" href="${absurl(encodeuri(url.serviceContext + serviceUrl + "?" + argreplace(urlargs, skipCount, cursor.firstPage, maxItems, cursor.pageSize)))?xml}"[#if type != ""] type="${type}"[/#if]/>
[/#if]
[#if cursor.hasLastPage]
<link rel="last" href="${absurl(encodeuri(url.serviceContext + serviceUrl + "?" + argreplace(urlargs, skipCount, cursor.lastPage, maxItems, cursor.pageSize)))?xml}"[#if type != ""] type="${type}"[/#if]/>
[/#if]
[#if cursor.hasPrevPage]
<link rel="prev" href="${absurl(encodeuri(url.serviceContext + serviceUrl + "?" + argreplace(urlargs, skipCount, cursor.prevPage, maxItems, cursor.pageSize)))?xml}"[#if type != ""] type="${type}"[/#if]/>
[/#if]
[#if cursor.hasNextPage]
<link rel="next" href="${absurl(encodeuri(url.serviceContext + serviceUrl + "?" + argreplace(urlargs, skipCount, cursor.nextPage, maxItems, cursor.pageSize)))?xml}"[#if type != ""] type="${type}"[/#if]/>
[/#if]
[/#if]
[/#macro]
[#macro opensearch cursor] [#macro opensearch cursor]
[#-- NOTE: this macro requires the definition of xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" in --] [#-- NOTE: this macro requires the definition of xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" in --]
[#-- the enclosing document --] [#-- the enclosing document --]

View File

@@ -1,11 +1,12 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/]
[#import "/org/alfresco/cmis/links.lib.atom.ftl" as linksLib/]
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<service [@nsLib.serviceNS/]> <service [@nsLib.serviceNS/]>
<workspace cmis:id="${server.id}" cmis:repositoryRelationship="self"> <workspace cmis:id="${server.id}" cmis:repositoryRelationship="self">
<atom:title>${server.name}</atom:title> <atom:title>${server.name}</atom:title>
<collection href="${absurl(url.serviceContext)}/api/path/${encodeuri(defaultRootFolderPath)}/children" cmisra:collectionType="root"> <collection href="${absurl(url.serviceContext)}[@linksLib.nodeuri defaultRootFolder/]/children" cmisra:collectionType="root">
<atom:title>root collection</atom:title> <atom:title>root collection</atom:title>
</collection> </collection>
<collection href="${absurl(url.serviceContext)}/api/types" cmisra:collectionType="types"> <collection href="${absurl(url.serviceContext)}/api/types" cmisra:collectionType="types">
@@ -13,20 +14,20 @@
</collection> </collection>
<collection href="${absurl(url.serviceContext)}/api/checkedout" cmisra:collectionType="checkedout"> <collection href="${absurl(url.serviceContext)}/api/checkedout" cmisra:collectionType="checkedout">
<atom:title>checkedout collection</atom:title> <atom:title>checkedout collection</atom:title>
<accept>application/atom+xml;type=entry</accept> <accept>${cmisconstants.MIMETYPE_ENTRY}</accept>
</collection> </collection>
<collection href="${absurl(url.serviceContext)}/api/unfiled" cmisra:collectionType="unfiled"> <collection href="${absurl(url.serviceContext)}/api/unfiled" cmisra:collectionType="unfiled">
<atom:title>unfiled collection</atom:title> <atom:title>unfiled collection</atom:title>
<accept>application/atom+xml;type=entry</accept> <accept>${cmisconstants.MIMETYPE_ENTRY}</accept>
</collection> </collection>
<collection href="${absurl(url.serviceContext)}/api/query" cmisra:collectionType="query"> <collection href="${absurl(url.serviceContext)}/api/queries" cmisra:collectionType="query">
<atom:title>query collection</atom:title> <atom:title>query collection</atom:title>
<accept>application/cmisquery+xml</accept> <accept>${cmisconstants.MIMETYPE_CMIS_QUERY}</accept>
</collection> </collection>
<atom:link title="root folder tree" type="application/atom+xml;type=feed" rel="http://docs.oasis-open.org/ns/cmis/link/200901/foldertree" href="${absurl(url.serviceContext)}/api/path/${encodeuri(defaultRootFolderPath)}/tree"/> <atom:link title="root folder tree" type="${cmisconstants.MIMETYPE_CMISTREE}" rel="http://docs.oasis-open.org/ns/cmis/link/200901/foldertree" href="${absurl(url.serviceContext)}[@linksLib.nodeuri defaultRootFolder/]/tree"/>
<atom:link title="root descendants" type="application/atom+xml;type=feed" rel="http://docs.oasis-open.org/ns/cmis/link/200901/rootdescendants" href="${absurl(url.serviceContext)}/api/path/${encodeuri(defaultRootFolderPath)}/descendants"/> <atom:link title="root descendants" type="${cmisconstants.MIMETYPE_CMISTREE}" rel="http://docs.oasis-open.org/ns/cmis/link/200901/rootdescendants" href="${absurl(url.serviceContext)}[@linksLib.nodeuri defaultRootFolder/]/descendants"/>
<atom:link title="type descendants" type="application/atom+xml;type=feed" rel="http://docs.oasis-open.org/ns/cmis/link/200901/typesdescendants" href="${absurl(url.serviceContext)}/api/types/descendants"/> <atom:link title="type descendants" type="${cmisconstants.MIMETYPE_CMISTREE}" rel="http://docs.oasis-open.org/ns/cmis/link/200901/typesdescendants" href="${absurl(url.serviceContext)}/api/types/descendants"/>
<cmisra:repositoryInfo> <cmisra:repositoryInfo>
<cmis:repositoryId>${server.id}</cmis:repositoryId> <cmis:repositoryId>${server.id}</cmis:repositoryId>
@@ -36,7 +37,7 @@
<cmis:vendorName>Alfresco</cmis:vendorName> <cmis:vendorName>Alfresco</cmis:vendorName>
<cmis:productName>Alfresco Repository (${server.edition})</cmis:productName> <cmis:productName>Alfresco Repository (${server.edition})</cmis:productName>
<cmis:productVersion>${server.version}</cmis:productVersion> <cmis:productVersion>${server.version}</cmis:productVersion>
<cmis:rootFolderId>${absurl(url.serviceContext)}/api/path/${encodeuri(defaultRootFolderPath)}</cmis:rootFolderId> <cmis:rootFolderId>${absurl(url.serviceContext)}[@linksLib.nodeuri defaultRootFolder/]</cmis:rootFolderId>
[#-- TODO: implement change log --] [#-- TODO: implement change log --]
<cmis:latestChangeToken></cmis:latestChangeToken> <cmis:latestChangeToken></cmis:latestChangeToken>
<cmis:capabilities> <cmis:capabilities>
@@ -64,7 +65,12 @@
<cmisra:uritemplate> <cmisra:uritemplate>
<cmisra:template>${absurl(url.serviceContext)}/api/node/{id}?filter={filter}&amp;includeAllowableActions={includeAllowableActions}&amp;includeRelationships={includeRelationships}</cmisra:template> <cmisra:template>${absurl(url.serviceContext)}/api/node/{id}?filter={filter}&amp;includeAllowableActions={includeAllowableActions}&amp;includeRelationships={includeRelationships}</cmisra:template>
<cmisra:type>entrybyid</cmisra:type> <cmisra:type>entrybyid</cmisra:type>
<cmisra:mediatype>application/atom+xml;type=entry</cmisra:mediatype> <cmisra:mediatype>${cmisconstants.MIMETYPE_ENTRY}</cmisra:mediatype>
</cmisra:uritemplate>
<cmisra:uritemplate>
<cmisra:template>${absurl(url.serviceContext)}/api/query?q={q}&amp;includeAllowableActions={includeAllowableActions?}&amp;searchAllVersions={searchAllVersions?}&amp;skipCount={skipCount?}&amp;maxItems={maxItems?}</cmisra:template>
<cmisra:type>query</cmisra:type>
<cmisra:mediatype>${cmisconstants.MIMETYPE_FEED}</cmisra:mediatype>
</cmisra:uritemplate> </cmisra:uritemplate>
</workspace> </workspace>

View File

@@ -33,7 +33,7 @@ Enum capabilityFulltext: nofulltext, fulltextonly, fulltextandstructured<br>
</description> </description>
<url>/api/repository</url> <url>/api/repository</url>
<url>/api/cmis</url> <url>/api/cmis</url>
<format default="atom"/> <format default="atomsvc"/>
<authentication>user</authentication> <authentication>user</authentication>
<family>CMIS</family> <family>CMIS</family>
</webscript> </webscript>

View File

@@ -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]
<?xml version="1.0" encoding="UTF-8"?>
<feed [@nsLib.feedNS/]>
[#-- 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]
</feed>
[/#compress]

View File

@@ -1,14 +1,14 @@
script: script:
{ {
// process query statement // process query statement
// <?xml version="1.0"?> // <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
// <query xmlns="http://docs.oasis-open.org/ns/cmis/core/200901"> // <cmis:query xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200901">
// <statement>SELECT name FROM DOCUMENT_OBJECT_TYPE</statement> // <cmis:statement>SELECT * FROM Document</cmis:statement>
// <searchAllVersions>false</searchAllVersions> // <cmis:searchAllVersions>true</cmis:searchAllVersions>
// <pageSize>0</pageSize> // <cmis:maxItems>50</cmis:maxItems>
// <skipCount>0</skipCount> // <cmis:skipCount>0</cmis:skipCount>
// <returnAllowableActions>false</returnAllowableActions> // </cmis:query>
// </query>
// TODO: XML parsing need to be moved to Java // TODO: XML parsing need to be moved to Java
@@ -43,18 +43,35 @@ script:
break script; break script;
} }
// TODO: CMIS-124
// include allowable actions // include allowable actions
var includeAllowableActions = cmisQuery.returnAllowableActions.toString(); var includeAllowableActions = cmisQuery.includeAllowableActions.toString();
model.includeAllowableActions = (includeAllowableActions == null || includeAllowableActions == "true" ? true : false); model.includeAllowableActions = (includeAllowableActions == null || includeAllowableActions == "true" ? true : false);
// process paging // process paging
var skipCount = parseInt(cmisQuery.skipCount); var skipCount = parseInt(cmisQuery.skipCount);
var pageSize = parseInt(cmisQuery.pageSize); var maxItems = parseInt(cmisQuery.maxItems);
var page = paging.createPageOrWindow(null, null, isNaN(skipCount) ? null : skipCount, isNaN(pageSize) ? null : pageSize); var page = paging.createPageOrWindow(null, null, isNaN(skipCount) ? null : skipCount, isNaN(maxItems) ? null : maxItems);
// perform query // perform query
var paged = cmis.query(model.statement, page); var paged = cmis.query(model.statement, page);
model.resultset = paged.result; model.resultset = paged.result;
model.cursor = paged.cursor; 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;
} }

View File

@@ -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.<br> "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.<br>
]]> ]]>
</description> </description>
<url>/api/query</url> <url>/api/queries</url>
<authentication>user</authentication> <authentication>user</authentication>
<transaction allow="readonly"/> <transaction allow="readonly"/>
<format default="atomfeed"/> <format default="atomfeed"/>

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/] [#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/]
@@ -10,6 +11,8 @@
[#-- TODO: uuid --] [#-- TODO: uuid --]
[@feedLib.generic "urn:uuid:resultset" "Result set for ${statement}" "${person.properties.userName}"] [@feedLib.generic "urn:uuid:resultset" "Result set for ${statement}" "${person.properties.userName}"]
[@linksLib.linkservice/]
[@linksLib.linkself/]
[@pagingLib.links cursor/] [@pagingLib.links cursor/]
[/@feedLib.generic] [/@feedLib.generic]
[@pagingLib.opensearch cursor/] [@pagingLib.opensearch cursor/]

View File

@@ -0,0 +1,37 @@
<webscript>
<shortname>Issue ad-hoc query (query)</shortname>
<description>
<![CDATA[
Queries the repository for queryable object based on properties or an optional full-text string. Relationship objects are not queryable. Content-streams are not returned as part of query.<br>
<br>
Inputs:<br>
<br>
String statement: Query statement<br>
(Optional) Bool searchAllVersions: False (Default)<br>
(Optional) Boolean includeAllowableActions: False (default)<br>
(Optional) Enum includeRelationships: none (default), source, target, both<br>
(Optional) int maxItems: 0 = Repository-default number of items (Default)<br>
(Optional) int skipCount: 0 = Start at first position (Default)<br>
<br>
Outputs:<br>
<br>
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.<br>
Bool hasMoreItems<br>
<br>
Notes:<br>
<br>
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.<br>
Returns set of objects from (skipCount, maxItems+skipCount)<br>
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.<br>
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).<br>
If each row in the output table does not correspond to a specific object and “includeAllowableActions” is TRUE, then InvalidArgumentException will be thrown.<br>
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.<br>
"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.<br>
]]>
</description>
<url>/api/query?q={q}&amp;includeAllowableActions={includeAllowableActions?}&amp;searchAllVersions={searchAllVersions?}&amp;skipCount={skipCount?}&amp;maxItems={maxItems?}</url>
<authentication>user</authentication>
<transaction allow="readonly"/>
<format default="atomfeed"/>
<family>CMIS</family>
</webscript>

View File

@@ -0,0 +1,46 @@
script:
{
// process query statement
// <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
// <cmis:query xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200901">
// <cmis:statement>SELECT * FROM Document</cmis:statement>
// <cmis:searchAllVersions>true</cmis:searchAllVersions>
// <cmis:maxItems>50</cmis:maxItems>
// <cmis:skipCount>0</cmis:skipCount>
// </cmis:query>
// 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;
}
}

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/] [#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/]
@@ -9,6 +10,8 @@
<feed [@nsLib.feedNS/]> <feed [@nsLib.feedNS/]>
[@feedLib.generic "urn:uuid:checkedout" "Checked out Documents" "${person.properties.userName}"] [@feedLib.generic "urn:uuid:checkedout" "Checked out Documents" "${person.properties.userName}"]
[@linksLib.linkservice/]
[@linksLib.linkself/]
[@pagingLib.links cursor/] [@pagingLib.links cursor/]
[/@feedLib.generic] [/@feedLib.generic]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/] [#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/]
@@ -9,6 +10,15 @@
<feed [@nsLib.feedNS/]> <feed [@nsLib.feedNS/]>
[@feedLib.node node "children"] [@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/] [@pagingLib.links cursor/]
[/@feedLib.node] [/@feedLib.node]
[@pagingLib.opensearch cursor/] [@pagingLib.opensearch cursor/]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]
@@ -7,7 +8,17 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<feed [@nsLib.feedNS/]> <feed [@nsLib.feedNS/]>
[@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 &gt; 0 || depth == -1] [#if depth &gt; 0 || depth == -1]
[#list cmischildren(node, typesFilter) as child] [#list cmischildren(node, typesFilter) as child]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]
@@ -8,7 +9,12 @@
<feed [@nsLib.feedNS/]> <feed [@nsLib.feedNS/]>
[@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] [#if parent?? && parent.isContainer]
[@entryLib.folder node=parent propfilter=filter includeallowableactions=includeAllowableActions includerelationships="none"/] [@entryLib.folder node=parent propfilter=filter includeallowableactions=includeAllowableActions includerelationships="none"/]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/] [#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/]
@@ -9,6 +10,10 @@
<feed [@nsLib.feedNS/]> <feed [@nsLib.feedNS/]>
[@feedLib.node node "relationships"] [@feedLib.node node "relationships"]
[@linksLib.linkservice/]
[@linksLib.linkself/]
[#assign nodeuri][@linksLib.nodeuri node/][/#assign]
[@linksLib.linkvia href="${nodeuri}"/]
[@pagingLib.links cursor/] [@pagingLib.links cursor/]
[/@feedLib.node] [/@feedLib.node]
[@pagingLib.opensearch cursor/] [@pagingLib.opensearch cursor/]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]
@@ -7,7 +8,17 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<feed [@nsLib.feedNS/]> <feed [@nsLib.feedNS/]>
[@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 &gt; 0 || depth == -1] [#if depth &gt; 0 || depth == -1]
[#list cmischildren(node, "folders") as child] [#list cmischildren(node, "folders") as child]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/] [#import "/org/alfresco/paging.lib.atom.ftl" as pagingLib/]
@@ -8,14 +9,23 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<feed [@nsLib.feedNS/]> <feed [@nsLib.feedNS/]>
[#assign title][#if type = "base"]Base Types[#else]Type ${type}[/#if][/#assign] [#assign title][#if typedef??]Type ${typedef.displayName}[#else]Base Types[/#if][/#assign]
[@feedLib.generic "urn:uuid:types-${type}" "${title}" "${person.properties.userName}"] [#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/] [@pagingLib.links cursor/]
[/@feedLib.generic] [/@feedLib.generic]
[@pagingLib.opensearch cursor/] [@pagingLib.opensearch cursor/]
[#list results as child] [#list results as child]
[@entryLib.typedef child returnPropertyDefinitions/] [@entryLib.typedef child includePropertyDefinitions/]
[/#list] [/#list]
</feed> </feed>

View File

@@ -12,7 +12,7 @@ script:
var paged = cmis.queryTypeChildren(null, page); var paged = cmis.queryTypeChildren(null, page);
model.results = paged.results; model.results = paged.results;
model.cursor = paged.cursor; model.cursor = paged.cursor;
model.type = "base"; model.typedef = null;
} }
else else
{ {
@@ -28,10 +28,10 @@ script:
var paged = cmis.queryTypeChildren(typedef, page); var paged = cmis.queryTypeChildren(typedef, page);
model.results = paged.results; model.results = paged.results;
model.cursor = paged.cursor; model.cursor = paged.cursor;
model.type = typeId; model.typedef = typedef;
} }
// handle property definitions // handle property definitions
var returnPropertyDefinitions = args[cmis.ARG_INCLUDE_PROPERTY_DEFINITIONS]; var includePropertyDefinitions = args[cmis.ARG_INCLUDE_PROPERTY_DEFINITIONS];
model.returnPropertyDefinitions = returnPropertyDefinitions == "true" ? true : false; model.includePropertyDefinitions = includePropertyDefinitions == "true" ? true : false;
} }

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]
@@ -10,17 +11,29 @@
[#if depth &gt; 0 || depth == -1] [#if depth &gt; 0 || depth == -1]
[#if typedef??] [#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] [#list typedef.getSubTypes(false) as child]
[@entryLib.typedef typedefn=child includeProperties=includePropertyDefinitions depth=1 maxdepth=depth/] [@entryLib.typedef typedefn=child includeProperties=includePropertyDefinitions depth=1 maxdepth=depth/]
[/#list] [/#list]
[#else] [#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] [#list basetypes as child]
[@entryLib.typedef typedefn=child includeProperties=includePropertyDefinitions depth=1 maxdepth=depth/] [@entryLib.typedef typedefn=child includeProperties=includePropertyDefinitions depth=1 maxdepth=depth/]
[/#list] [/#list]
[/#if]
[/#if]
[/#if] [/#if]
</feed> </feed>

View File

@@ -1,12 +1,16 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/atomfeed.lib.atom.ftl" as feedLib/]
[#compress] [#compress]
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<feed [@nsLib.feedNS/]> <feed [@nsLib.feedNS/]>
[@feedLib.generic "urn:uuid:unfiled" "Unfiled Documents"/] [@feedLib.generic "urn:uuid:unfiled" "Unfiled Documents"]
[@linksLib.linkservice/]
[@linksLib.linkself/]
[/@feedLib.generic]
</feed> </feed>
[/#compress] [/#compress]

View File

@@ -1,5 +1,6 @@
[#ftl] [#ftl]
[#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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/atomfeed.lib.atom.ftl" as feedLib/]
[#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/] [#import "/org/alfresco/cmis/atomentry.lib.atom.ftl" as entryLib/]
[#compress] [#compress]
@@ -8,7 +9,12 @@
<feed [@nsLib.feedNS/]> <feed [@nsLib.feedNS/]>
[@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] [#list nodes as version]
[@entryLib.version version versions[version_index]/] [@entryLib.version version versions[version_index]/]

View File

@@ -62,7 +62,7 @@ public class CMISQueryReader implements FormatReader<String>
*/ */
public String getSourceMimetype() public String getSourceMimetype()
{ {
return CMISConstants.MIMETYPE_QUERY; return CMISConstants.MIMETYPE_CMIS_QUERY;
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@@ -40,6 +40,7 @@ import org.alfresco.cmis.CMISResultSet;
import org.alfresco.cmis.CMISServices; import org.alfresco.cmis.CMISServices;
import org.alfresco.cmis.CMISTypeDefinition; import org.alfresco.cmis.CMISTypeDefinition;
import org.alfresco.cmis.CMISTypesFilterEnum; import org.alfresco.cmis.CMISTypesFilterEnum;
import org.alfresco.cmis.CMISQueryOptions.CMISQueryMode;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.jscript.Association; import org.alfresco.repo.jscript.Association;
import org.alfresco.repo.jscript.BaseScopableProcessorExtension; 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_MAJOR_VERSION = "majorVersion";
public static final String ARG_MAX_ITEMS = "maxItems"; public static final String ARG_MAX_ITEMS = "maxItems";
public static final String ARG_OFFSET = "offset"; 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_REMOVE_FROM = "removeFrom";
public static final String ARG_RELATIONSHIP_TYPE = "relationshipType"; public static final String ARG_RELATIONSHIP_TYPE = "relationshipType";
public static final String ARG_REPOSITORY_ID = "repositoryId"; public static final String ARG_REPOSITORY_ID = "repositoryId";
@@ -554,6 +556,7 @@ public class CMISScript extends BaseScopableProcessorExtension
public PagedResults query(String statement, Page page) public PagedResults query(String statement, Page page)
{ {
CMISQueryOptions options = new CMISQueryOptions(statement, cmisService.getDefaultRootStoreRef()); CMISQueryOptions options = new CMISQueryOptions(statement, cmisService.getDefaultRootStoreRef());
options.setQueryMode(CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS);
options.setSkipCount(page.getNumber()); options.setSkipCount(page.getNumber());
options.setMaxItems(page.getSize()); options.setMaxItems(page.getSize());
CMISResultSet resultSet = cmisQueryService.query(options); CMISResultSet resultSet = cmisQueryService.query(options);

View File

@@ -231,7 +231,7 @@ public class CMISTemplateResultSet implements Serializable
public String getColumnType(String colName) public String getColumnType(String colName)
{ {
CMISResultSetColumn col = resultSet.getMetaData().getColumn(colName); CMISResultSetColumn col = resultSet.getMetaData().getColumn(colName);
return col == null ? null : col.getCMISDataType().name(); return col == null ? null : col.getCMISDataType().getLabel();
} }
/** /**

View File

@@ -273,7 +273,7 @@ public class CMISCustomTypeTest extends BaseCMISWebScriptTest
queryReq = queryReq.replace("${PAGESIZE}", "5"); queryReq = queryReq.replace("${PAGESIZE}", "5");
// issue structured query // 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); assertNotNull(queryRes);
Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null); Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed); assertNotNull(queryFeed);

View File

@@ -1274,13 +1274,13 @@ public class CMISTest extends BaseCMISWebScriptTest
{ {
{ {
// meta data only query against folder // meta data only query against folder
String query = "SELECT * FROM Folder " + String query = "SELECT * FROM cmis:folder " +
"WHERE ObjectId = '" + testFolderObject.getObjectId().getStringValue() + "'"; "WHERE cmis:ObjectId = '" + testFolderObject.getObjectId().getStringValue() + "'";
String queryReq = queryDoc.replace("${STATEMENT}", query); String queryReq = queryDoc.replace("${STATEMENT}", query);
queryReq = queryReq.replace("${SKIPCOUNT}", "0"); 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); assertNotNull(queryRes);
Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null); Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed); assertNotNull(queryFeed);
@@ -1294,14 +1294,14 @@ public class CMISTest extends BaseCMISWebScriptTest
{ {
// meta data only query against document // meta data only query against document
String query = "SELECT * FROM Document " + String query = "SELECT * FROM cmis:document " +
"WHERE IN_FOLDER('" + testFolderObject.getObjectId().getStringValue() + "') " + "WHERE IN_FOLDER('" + testFolderObject.getObjectId().getStringValue() + "') " +
"AND Name = 'apple1'"; "AND cmis:Name = 'apple1'";
String queryReq = queryDoc.replace("${STATEMENT}", query); String queryReq = queryDoc.replace("${STATEMENT}", query);
queryReq = queryReq.replace("${SKIPCOUNT}", "0"); 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); assertNotNull(queryRes);
Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null); Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed); assertNotNull(queryFeed);
@@ -1317,13 +1317,13 @@ public class CMISTest extends BaseCMISWebScriptTest
if (queryCapability.equals("fulltextonly") || queryCapability.equals("bothseperate") || queryCapability.equals("bothcombined")) if (queryCapability.equals("fulltextonly") || queryCapability.equals("bothseperate") || queryCapability.equals("bothcombined"))
{ {
// full text only query // 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 + "')"; "WHERE CONTAINS('" + doc2name + "')";
String queryReq = queryDoc.replace("${STATEMENT}", query); String queryReq = queryDoc.replace("${STATEMENT}", query);
queryReq = queryReq.replace("${SKIPCOUNT}", "0"); 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); assertNotNull(queryRes);
Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null); Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed); assertNotNull(queryFeed);
@@ -1338,15 +1338,15 @@ public class CMISTest extends BaseCMISWebScriptTest
if (queryCapability.equals("bothcombined")) if (queryCapability.equals("bothcombined"))
{ {
// combined meta data and full text // 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() + "') " + "WHERE IN_FOLDER('" + testFolderObject.getObjectId().getStringValue() + "') " +
"AND Name = 'apple1' " + "AND cmis:Name = 'apple1' " +
"AND CONTAINS('apple1')"; "AND CONTAINS('apple1')";
String queryReq = queryDoc.replace("${STATEMENT}", query); String queryReq = queryDoc.replace("${STATEMENT}", query);
queryReq = queryReq.replace("${SKIPCOUNT}", "0"); 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); assertNotNull(queryRes);
Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null); Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed); assertNotNull(queryFeed);
@@ -1386,26 +1386,52 @@ public class CMISTest extends BaseCMISWebScriptTest
// query children // query children
String queryDoc = loadString("/org/alfresco/repo/cmis/rest/test/query.cmisquery.xml"); String queryDoc = loadString("/org/alfresco/repo/cmis/rest/test/query.cmisquery.xml");
CMISObject testFolderObject = testFolder.getExtension(CMISConstants.OBJECT); 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() + "')";
for (int page = 0; page < 4; page++)
{
String queryReq = queryDoc.replace("${STATEMENT}", query); String queryReq = queryDoc.replace("${STATEMENT}", query);
queryReq = queryReq.replace("${SKIPCOUNT}", new Integer(page * 4).toString()); queryReq = queryReq.replace("${SKIPCOUNT}", "0");
queryReq = queryReq.replace("${PAGESIZE}", "4"); queryReq = queryReq.replace("${MAXITEMS}", "4");
Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_QUERY), 200);
// issue query
Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq, CMISConstants.MIMETYPE_CMIS_QUERY), 200);
assertNotNull(queryRes); assertNotNull(queryRes);
// retrieve entries for first page
Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null); Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed); assertNotNull(queryFeed);
assertEquals(page < 3 ? 4 : 3, queryFeed.getEntries().size());
int page = 0;
Link nextLink = null;
do
{
page++;
assertEquals(page < 4 ? 4 : 3, queryFeed.getEntries().size());
// mark entries as read
for (Entry entry : queryFeed.getEntries()) for (Entry entry : queryFeed.getEntries())
{ {
docIds.remove(entry.getId()); 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()); assertEquals(0, docIds.size());
} }
@@ -1444,15 +1470,15 @@ public class CMISTest extends BaseCMISWebScriptTest
{ {
// construct structured query // construct structured query
String query = "SELECT * FROM Document " + String query = "SELECT * FROM cmis:document " +
"WHERE IN_FOLDER('" + testFolderObject.getObjectId().getStringValue() + "') "; "WHERE IN_FOLDER('" + testFolderObject.getObjectId().getStringValue() + "') ";
String queryReq = queryDoc.replace("${STATEMENT}", query); String queryReq = queryDoc.replace("${STATEMENT}", query);
queryReq = queryReq.replace("${INCLUDEALLOWABLEACTIONS}", "true"); queryReq = queryReq.replace("${INCLUDEALLOWABLEACTIONS}", "true");
queryReq = queryReq.replace("${SKIPCOUNT}", "0"); queryReq = queryReq.replace("${SKIPCOUNT}", "0");
queryReq = queryReq.replace("${PAGESIZE}", "5"); queryReq = queryReq.replace("${MAXITEMS}", "5");
// issue structured query // 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); assertNotNull(queryRes);
Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null); Feed queryFeed = getAbdera().parseFeed(new StringReader(queryRes.getContentAsString()), null);
assertNotNull(queryFeed); assertNotNull(queryFeed);

View File

@@ -1,5 +1,5 @@
<cmis:query xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200901" > <cmis:query xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200901" >
<cmis:statement><![CDATA[${STATEMENT}]]></cmis:statement> <cmis:statement><![CDATA[${STATEMENT}]]></cmis:statement>
<cmis:skipCount>${SKIPCOUNT}</cmis:skipCount> <cmis:skipCount>${SKIPCOUNT}</cmis:skipCount>
<cmis:pageSize>${PAGESIZE}</cmis:pageSize> <cmis:maxItems>${MAXITEMS}</cmis:maxItems>
</cmis:query> </cmis:query>

View File

@@ -1,6 +1,6 @@
<cmis:query xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200901" > <cmis:query xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200901" >
<cmis:statement><![CDATA[${STATEMENT}]]></cmis:statement> <cmis:statement><![CDATA[${STATEMENT}]]></cmis:statement>
<cmis:returnAllowableActions>${INCLUDEALLOWABLEACTIONS}</cmis:returnAllowableActions> <cmis:includeAllowableActions>${INCLUDEALLOWABLEACTIONS}</cmis:includeAllowableActions>
<cmis:skipCount>${SKIPCOUNT}</cmis:skipCount> <cmis:skipCount>${SKIPCOUNT}</cmis:skipCount>
<cmis:pageSize>${PAGESIZE}</cmis:pageSize> <cmis:maxItems>${MAXITEMS}</cmis:maxItems>
</cmis:query> </cmis:query>

View File

@@ -152,10 +152,6 @@ public class Paging
* skipCount => row number start index * skipCount => row number start index
* maxItems => size of page * maxItems => size of page
* *
* - header values
* CMIS-skipCount => row number start index
* CMIS-maxItems => size of page
*
* @param args request args * @param args request args
* @return page (if pageNumber driven) or window (if skipCount driven) * @return page (if pageNumber driven) or window (if skipCount driven)
*/ */
@@ -253,7 +249,7 @@ public class Paging
*/ */
public Page createUnlimitedPage() public Page createUnlimitedPage()
{ {
return new Page(PageType.PAGE, zeroBasedPage, zeroBasedPage ? 0 : 1, 0); return new Page(PageType.PAGE, zeroBasedPage, zeroBasedPage ? 0 : 1, -1);
} }
/** /**