mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
SAIL-173: Added processing of includeRelationships argument to CMIS REST and SOAP bindings
- Despite its name, this argument is not a Boolean! - TODO: Extend TCK to test relationships git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18897 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
[#list results as child]
|
||||
[#if child.isDocument]
|
||||
[@entryLib.document node=child renditionfilter=renditionFilter propfilter=filter includeallowableactions=includeAllowableActions includerelationships="none"/]
|
||||
[@entryLib.document node=child renditionfilter=renditionFilter propfilter=filter includeallowableactions=includeAllowableActions includerelationships=includeRelationships/]
|
||||
[/#if]
|
||||
[/#list]
|
||||
|
||||
|
@@ -28,7 +28,7 @@ If “includeAllowableActions” is TRUE, the repository will return the allowab
|
||||
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>
|
||||
]]>
|
||||
</description>
|
||||
<url>/cmis/checkedout?folderId={folderId?}&includeDescendants={includeDescendants?}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/checkedout?folderId={folderId?}&includeDescendants={includeDescendants?}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<authentication>user</authentication>
|
||||
<transaction allow="readonly"/>
|
||||
<format default="atomfeed"/>
|
||||
|
@@ -42,6 +42,13 @@ script:
|
||||
var includeAllowableActions = args[cmis.ARG_INCLUDE_ALLOWABLE_ACTIONS];
|
||||
model.includeAllowableActions = (includeAllowableActions == "true" ? true : false);
|
||||
|
||||
// include relationships
|
||||
model.includeRelationships = args[cmis.ARG_INCLUDE_RELATIONSHIPS];
|
||||
if (model.includeRelationships == null || model.includeRelationships.length == 0)
|
||||
{
|
||||
model.includeRelationships = "none";
|
||||
}
|
||||
|
||||
// retrieve checked-out
|
||||
var page = paging.createPageOrWindow(args);
|
||||
var paged = cmis.queryCheckedOut(person.properties.userName, model.folder, model.includeDescendants, page);
|
||||
|
@@ -26,9 +26,9 @@
|
||||
|
||||
[#list results as child]
|
||||
[#if child.isDocument]
|
||||
[@entryLib.document node=child renditionfilter=renditionFilter propfilter=filter includeallowableactions=includeAllowableActions/]
|
||||
[@entryLib.document node=child renditionfilter=renditionFilter propfilter=filter includeallowableactions=includeAllowableActions includerelationships=includeRelationships/]
|
||||
[#else]
|
||||
[@entryLib.folder node=child renditionfilter=renditionFilter propfilter=filter includeallowableactions=includeAllowableActions/]
|
||||
[@entryLib.folder node=child renditionfilter=renditionFilter propfilter=filter includeallowableactions=includeAllowableActions includerelationships=includeRelationships/]
|
||||
[/#if]
|
||||
[/#list]
|
||||
|
||||
|
@@ -36,14 +36,14 @@ If no “maxItems” value is provided, then the Repository will determine an ap
|
||||
</description>
|
||||
|
||||
<!-- by object id -->
|
||||
<url>/cmis/i/{id}/children?types={types}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}&orderBy={orderBy?}</url>
|
||||
<url>/cmis/s/{store}/i/{id}/children?types={types}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}&orderBy={orderBy?}</url>
|
||||
<url>/cmis/i/{id}/children?types={types}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}&orderBy={orderBy?}</url>
|
||||
<url>/cmis/s/{store}/i/{id}/children?types={types}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}&orderBy={orderBy?}</url>
|
||||
<!-- by path -->
|
||||
<url>/cmis/p{path}/children?types={types}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}&orderBy={orderBy?}</url>
|
||||
<url>/cmis/s/{store}/p{path}/children?types={types}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}&orderBy={orderBy?}</url>
|
||||
<url>/cmis/p{path}/children?types={types}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}&orderBy={orderBy?}</url>
|
||||
<url>/cmis/s/{store}/p{path}/children?types={types}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}&orderBy={orderBy?}</url>
|
||||
<!-- alfresco style -->
|
||||
<url>/api/node/{store_type}/{store_id}/{id}/children?types={types}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}&orderBy={orderBy?}</url>
|
||||
<url>/api/path/{store_type}/{store_id}/{path}/children?types={types}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}&orderBy={orderBy?}</url>
|
||||
<url>/api/node/{store_type}/{store_id}/{id}/children?types={types}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}&orderBy={orderBy?}</url>
|
||||
<url>/api/path/{store_type}/{store_id}/{path}/children?types={types}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}&orderBy={orderBy?}</url>
|
||||
|
||||
<authentication>guest</authentication>
|
||||
<transaction allow="readonly"/>
|
||||
|
@@ -41,6 +41,13 @@ script:
|
||||
var includeAllowableActions = args[cmis.ARG_INCLUDE_ALLOWABLE_ACTIONS];
|
||||
model.includeAllowableActions = (includeAllowableActions == "true" ? true : false);
|
||||
|
||||
// include relationships
|
||||
model.includeRelationships = args[cmis.ARG_INCLUDE_RELATIONSHIPS];
|
||||
if (model.includeRelationships == null || model.includeRelationships.length == 0)
|
||||
{
|
||||
model.includeRelationships = "none";
|
||||
}
|
||||
|
||||
// retrieve children
|
||||
var page = paging.createPageOrWindow(args);
|
||||
var paged = cmis.queryChildren(model.node, model.types, orderBy, page);
|
||||
|
@@ -8,9 +8,9 @@
|
||||
[#assign namespace][@nsLib.entryNS/][/#assign]
|
||||
|
||||
[#if node.isDocument]
|
||||
[@entryLib.document node=node propfilter="*" includeallowableactions=true includerelationships=true ns=namespace/]
|
||||
[@entryLib.document node=node propfilter="*" includeallowableactions=true ns=namespace/]
|
||||
[#else]
|
||||
[@entryLib.folder node=node propfilter="*" includeallowableactions=true includerelationships=true ns=namespace/]
|
||||
[@entryLib.folder node=node propfilter="*" includeallowableactions=true ns=namespace/]
|
||||
[/#if]
|
||||
|
||||
[/#compress]
|
@@ -23,9 +23,9 @@
|
||||
[#if depth > 0 || depth == -1]
|
||||
[#list cmischildren(node, typesFilter) as child]
|
||||
[#if child.isDocument]
|
||||
[@entryLib.document node=child renditionfilter=renditionFilter propfilter=propFilter includeallowableactions=includeAllowableActions includerelationships=false/]
|
||||
[@entryLib.document node=child renditionfilter=renditionFilter propfilter=propFilter includeallowableactions=includeAllowableActions includerelationships=includeRelationships/]
|
||||
[#else]
|
||||
[@entryLib.folder node=child renditionfilter=renditionFilter propfilter=propFilter typesfilter=types includeallowableactions=includeAllowableActions includerelationships=false depth=1 maxdepth=depth/]
|
||||
[@entryLib.folder node=child renditionfilter=renditionFilter propfilter=propFilter typesfilter=types includeallowableactions=includeAllowableActions includerelationships=includeRelationships depth=1 maxdepth=depth/]
|
||||
[/#if]
|
||||
[/#list]
|
||||
[/#if]
|
||||
|
@@ -34,14 +34,14 @@ If “includeAllowableActions” is TRUE, the repository will return the allowab
|
||||
</description>
|
||||
|
||||
<!-- by object id -->
|
||||
<url>/cmis/i/{id}/descendants?types={types}&filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/i/{id}/descendants?types={types}&filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/i/{id}/descendants?types={types}&filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/i/{id}/descendants?types={types}&filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<!-- by path -->
|
||||
<url>/cmis/p{path}/descendants?types={types}&filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/p{path}/descendants?types={types}&filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/p{path}/descendants?types={types}&filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/p{path}/descendants?types={types}&filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<!-- alfresco style -->
|
||||
<url>/api/node/{store_type}/{store_id}/{id}/descendants?types={types}&filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/api/path/{store_type}/{store_id}/{path}/descendants?types={types}&filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/api/node/{store_type}/{store_id}/{id}/descendants?types={types}&filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/api/path/{store_type}/{store_id}/{path}/descendants?types={types}&filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
|
||||
<authentication>guest</authentication>
|
||||
<transaction allow="readonly"/>
|
||||
|
@@ -40,4 +40,11 @@ script:
|
||||
// include allowable actions
|
||||
var includeAllowableActions = args[cmis.ARG_INCLUDE_ALLOWABLE_ACTIONS];
|
||||
model.includeAllowableActions = (includeAllowableActions == "true" ? true : false);
|
||||
|
||||
// include relationships
|
||||
model.includeRelationships = args[cmis.ARG_INCLUDE_RELATIONSHIPS];
|
||||
if (model.includeRelationships == null || model.includeRelationships.length == 0)
|
||||
{
|
||||
model.includeRelationships = "none";
|
||||
}
|
||||
}
|
||||
|
@@ -8,9 +8,9 @@
|
||||
[#assign namespace][@nsLib.entryNS/][/#assign]
|
||||
|
||||
[#if node.isDocument]
|
||||
[@entryLib.document node=node renditionfilter=renditionFilter propfilter=filter includeallowableactions=includeAllowableActions includerelationships="none" includeacl=includeACL ns=namespace/]
|
||||
[@entryLib.document node=node renditionfilter=renditionFilter propfilter=filter includeallowableactions=includeAllowableActions includerelationships=includeRelationships includeacl=includeACL ns=namespace/]
|
||||
[#else]
|
||||
[@entryLib.folder node=node renditionfilter=renditionFilter propfilter=filter includeallowableactions=includeAllowableActions includerelationships="none" includeacl=includeACL ns=namespace/]
|
||||
[@entryLib.folder node=node renditionfilter=renditionFilter propfilter=filter includeallowableactions=includeAllowableActions includerelationships=includeRelationships includeacl=includeACL ns=namespace/]
|
||||
[/#if]
|
||||
|
||||
[/#compress]
|
@@ -27,20 +27,20 @@ PropertyCollection includes changeToken (if applicable to repository)<br>
|
||||
</description>
|
||||
|
||||
<!-- by object id -->
|
||||
<url>/cmis/i/{id}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/i/{id}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/i/{id}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/i/{id}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<!-- by object path -->
|
||||
<url>/cmis/p{path}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/p{path}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/p{path}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/p{path}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
|
||||
<!-- for CMIS URI template generators -->
|
||||
<url>/cmis/s/{store}/arg/i?id={id}&filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/arg/p?path={path}&filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/arg/n?noderef={noderef}&filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/arg/i?id={id}&filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/arg/p?path={path}&filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/arg/n?noderef={noderef}&filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
|
||||
<!-- alfresco style -->
|
||||
<url>/api/node/{store_type}/{store_id}/{id}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/api/path/{store_type}/{store_id}/{path}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/api/node/{store_type}/{store_id}/{id}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/api/path/{store_type}/{store_id}/{path}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
|
||||
<authentication>guest</authentication>
|
||||
<transaction allow="readonly"/>
|
||||
|
@@ -36,4 +36,11 @@ script:
|
||||
|
||||
// include allowable actions
|
||||
model.includeAllowableActions = args[cmis.ARG_INCLUDE_ALLOWABLE_ACTIONS] == "true";
|
||||
|
||||
// include relationships
|
||||
model.includeRelationships = args[cmis.ARG_INCLUDE_RELATIONSHIPS];
|
||||
if (model.includeRelationships == null || model.includeRelationships.length == 0)
|
||||
{
|
||||
model.includeRelationships = "none";
|
||||
}
|
||||
}
|
||||
|
@@ -44,6 +44,7 @@
|
||||
<cmisra:object>
|
||||
[@objectCMISProps node propfilter/]
|
||||
[#if includeallowableactions][@allowableactions node/][/#if]
|
||||
[@relationships node includerelationships includeallowableactions propfilter/]
|
||||
[#if includeacl][@aclreport node/][/#if]
|
||||
</cmisra:object>
|
||||
<cmisra:pathSegment>${node.name?xml}</cmisra:pathSegment>
|
||||
@@ -71,31 +72,6 @@
|
||||
[/#list]
|
||||
[/#macro]
|
||||
|
||||
|
||||
[#-- --]
|
||||
[#-- ATOM Entry for Version --]
|
||||
[#-- --]
|
||||
|
||||
[#macro version node propfilter="*" ns=""]
|
||||
[@entry ns]
|
||||
<author><name>${node.properties.creator!""}</name></author>
|
||||
[@contentstream node/]
|
||||
<id>urn:uuid:${node.id}</id>
|
||||
[@linksLib.linknodeself node/]
|
||||
[@linksLib.linkstream node "enclosure"/]
|
||||
[@documentCMISLinks node=node/]
|
||||
<published>${xmldate(node.properties.created)}</published>
|
||||
<summary>[@contentsummary node/]</summary>
|
||||
<title>${node.name?xml}</title>
|
||||
<updated>${xmldate(node.properties.modified)}</updated>
|
||||
<app:edited>${xmldate(node.properties.modified)}</app:edited>
|
||||
<alf:icon>${absurl(url.context)}${node.icon16}</alf:icon>
|
||||
<cmisra:object>
|
||||
[@objectCMISProps node propfilter/]
|
||||
</cmisra:object>
|
||||
[/@entry]
|
||||
[/#macro]
|
||||
|
||||
[#-- --]
|
||||
[#-- ATOM Entry for Folder --]
|
||||
[#-- --]
|
||||
@@ -121,6 +97,7 @@
|
||||
<cmisra:object>
|
||||
[@objectCMISProps node propfilter/]
|
||||
[#if includeallowableactions][@allowableactions node/][/#if]
|
||||
[@relationships node includerelationships includeallowableactions propfilter/]
|
||||
[#if includeacl][@aclreport node/][/#if]
|
||||
</cmisra:object>
|
||||
<cmisra:pathSegment>${node.name?xml}</cmisra:pathSegment>
|
||||
@@ -171,26 +148,24 @@
|
||||
|
||||
[#macro assoc assoc propfilter="*" includeallowableactions=false ns=""]
|
||||
[@entry ns]
|
||||
<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? --]
|
||||
<author><name>${assoc.source.properties.creator!""}</name></author>
|
||||
<content>[@namedvalue cmisconstants.PROP_OBJECT_ID assoc cmisconstants.DATATYPE_ID/]</content>
|
||||
<id>[@namedvalue cmisconstants.PROP_OBJECT_ID assoc cmisconstants.DATATYPE_ID/]</id> [#-- TODO: id compliant --]
|
||||
[@linksLib.linkassocself assoc/]
|
||||
[@linksLib.linkassocedit assoc/]
|
||||
[@assocCMISLinks assoc=assoc/]
|
||||
<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? --]
|
||||
<title>[@namedvalue cmisconstants.PROP_OBJECT_ID assoc cmisconstants.DATATYPE_ID/]</title> [#-- TODO: spec id, how to map? --]
|
||||
<title>[@namedvalue cmisconstants.PROP_NAME assoc cmisconstants.DATATYPE_STRING/]</title>
|
||||
<updated>${xmldate(date)}</updated> [#-- TODO: [@namedvalue cmisconstants.PROP_LAST_MODIFICATION_DATE assoc cmisconstants.DATATYPE_DATETIME/] --]
|
||||
<app:edited>${xmldate(date)}</app:edited> [#-- TODO: [@namedvalue cmisconstants.PROP_LAST_MODIFICATION_DATE assoc cmisconstants.DATATYPE_DATETIME/] --]
|
||||
<cmisra:object>
|
||||
[@objectCMISProps assoc propfilter/]
|
||||
[#-- TODO: [#if includeallowableactions][@allowableactions node/][/#if] --]
|
||||
[#if includeallowableactions][@assocallowableactions assoc/][/#if]
|
||||
</cmisra:object>
|
||||
[/@entry]
|
||||
[/#macro]
|
||||
|
||||
[#macro assocCMISLinks assoc]
|
||||
[#-- TODO: <link rel="allowableactions" href="${absurl(url.serviceContext)}/cmis/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/permissions"/> --]
|
||||
[@linksLib.linkassocallowableactions assoc/]
|
||||
[@linksLib.linktype assoc/]
|
||||
[@linksLib.linktosource assoc.source/]
|
||||
[@linksLib.linktotarget assoc.target/]
|
||||
@@ -203,7 +178,7 @@
|
||||
[#-- --]
|
||||
|
||||
[#-- TODO: spec issue 47 --]
|
||||
[#macro row row renditionfilter="cmis:none" includeallowableactions=false]
|
||||
[#macro row row renditionfilter="cmis:none" includeallowableactions=false includerelationships="none"]
|
||||
[@entry]
|
||||
[#-- TODO: calculate multiNodeResultSet from result set --]
|
||||
[#if row.nodes?? && row.nodes?size == 1][#assign node = row.nodes?first/][/#if]
|
||||
@@ -255,7 +230,10 @@
|
||||
[/#if]
|
||||
[/#list]
|
||||
</cmis:properties>
|
||||
[#if node?? && includeallowableactions][@allowableactions node/][/#if]
|
||||
[#if node??]
|
||||
[#if includeallowableactions][@allowableactions node/][/#if]
|
||||
[@relationships node includerelationships includeallowableactions/]
|
||||
[/#if]
|
||||
</cmisra:object>
|
||||
[/@entry]
|
||||
[/#macro]
|
||||
@@ -391,6 +369,20 @@
|
||||
[#macro urivalue value]${value?xml}[/#macro]
|
||||
[#macro idvalue value]${value?xml}[/#macro]
|
||||
|
||||
[#-- --]
|
||||
[#-- CMIS Relationships --]
|
||||
[#-- --]
|
||||
|
||||
[#macro relationships node includerelationships="none" includeallowableactions=false propfilter="*"]
|
||||
[#if includerelationships != "none"]
|
||||
[#list cmisassocs(node, includerelationships) as assoc]
|
||||
<cmis:relationship>
|
||||
[@objectCMISProps assoc propfilter/]
|
||||
[#if includeallowableactions][@assocallowableactions assoc/][/#if]
|
||||
</cmis:relationship>
|
||||
[/#list]
|
||||
[/#if]
|
||||
[/#macro]
|
||||
|
||||
[#-- --]
|
||||
[#-- CMIS Allowable Actions --]
|
||||
@@ -410,6 +402,20 @@
|
||||
<cmis:${actionevaluator.action.label}>${actionevaluator.isAllowed(node.nodeRef)?string}</cmis:${actionevaluator.action.label}>
|
||||
[/#macro]
|
||||
|
||||
[#macro assocallowableactions assoc ns=""]
|
||||
<cmis:allowableActions[#if ns != ""] ${ns}[/#if]>
|
||||
[#nested]
|
||||
[#assign typedef = cmistype(assoc)]
|
||||
[#list typedef.actionEvaluators?values as actionevaluator]
|
||||
[@assocallowableaction assoc actionevaluator/]
|
||||
[/#list]
|
||||
</cmis:allowableActions>
|
||||
[/#macro]
|
||||
|
||||
[#macro assocallowableaction assoc actionevaluator]
|
||||
<cmis:${actionevaluator.action.label}>${actionevaluator.isAllowed(assoc.associationRef)?string}</cmis:${actionevaluator.action.label}>
|
||||
[/#macro]
|
||||
|
||||
[#-- --]
|
||||
[#-- CMIS Access Control Lists --]
|
||||
[#-- --]
|
||||
|
@@ -14,6 +14,11 @@
|
||||
<link rel="${cmisconstants.REL_ALLOWABLE_ACTIONS}" href="${absurl(url.serviceContext)}[@nodeuri node/]/allowableactions"/>
|
||||
[/#macro]
|
||||
|
||||
[#-- Link to node allowable actions --]
|
||||
[#macro linkassocallowableactions assoc]
|
||||
<link rel="${cmisconstants.REL_ALLOWABLE_ACTIONS}" href="${absurl(url.serviceContext)}[@assocuri assoc/]/allowableactions"/>
|
||||
[/#macro]
|
||||
|
||||
[#-- Link to node relationships --]
|
||||
[#macro linkrelationships node]
|
||||
<link rel="${cmisconstants.REL_RELATIONSHIPS}" href="${absurl(url.serviceContext)}[@nodeuri node/]/rels"/>
|
||||
|
@@ -30,4 +30,11 @@ script:
|
||||
// include allowable actions
|
||||
var includeAllowableActions = args[cmis.ARG_INCLUDE_ALLOWABLE_ACTIONS];
|
||||
model.includeAllowableActions = (includeAllowableActions == "true" ? true : false);
|
||||
|
||||
// include relationships
|
||||
model.includeRelationships = args[cmis.ARG_INCLUDE_RELATIONSHIPS];
|
||||
if (model.includeRelationships == null || model.includeRelationships.length == 0)
|
||||
{
|
||||
model.includeRelationships = "none";
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@
|
||||
[/@feedLib.node]
|
||||
|
||||
[#if parent?? && parent.isContainer]
|
||||
[@entryLib.folder node=parent renditionfilter=renditionFilter propfilter=filter includeallowableactions=includeAllowableActions includerelationships="none" relativePathSegment=node.name/]
|
||||
[@entryLib.folder node=parent renditionfilter=renditionFilter propfilter=filter includeallowableactions=includeAllowableActions includerelationships=includeRelationships relativePathSegment=node.name/]
|
||||
[/#if]
|
||||
|
||||
</feed>
|
||||
|
@@ -25,14 +25,14 @@ If “includeAllowableActions” is TRUE, the repository will return the allowab
|
||||
</description>
|
||||
|
||||
<!-- by object id -->
|
||||
<url>/cmis/i/{id}/parents?filter={filter?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/i/{id}/parents?filter={filter?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/i/{id}/parents?filter={filter?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/i/{id}/parents?filter={filter?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<!-- by path -->
|
||||
<url>/cmis/p{path}/parents?filter={filter?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/p{path}/parents?filter={filter?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/p{path}/parents?filter={filter?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/p{path}/parents?filter={filter?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<!-- alfresco style -->
|
||||
<url>/api/node/{store_type}/{store_id}/{id}/parents?filter={filter?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/api/path/{store_type}/{store_id}/{path}/parents?filter={filter?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/api/node/{store_type}/{store_id}/{id}/parents?filter={filter?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/api/path/{store_type}/{store_id}/{path}/parents?filter={filter?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
|
||||
<authentication>guest</authentication>
|
||||
<transaction allow="readonly"/>
|
||||
|
@@ -7,6 +7,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
[#assign namespace][@nsLib.entryNS/][/#assign]
|
||||
|
||||
[@entryLib.document node=node renditionfilter=renditionFilter propfilter=filter includeallowableactions=includeAllowableActions includerelationships="none" includeacl=includeACL ns=namespace/]
|
||||
[@entryLib.document node=node renditionfilter=renditionFilter propfilter=filter includeallowableactions=includeAllowableActions includerelationships=includeRelationships includeacl=includeACL ns=namespace/]
|
||||
|
||||
[/#compress]
|
@@ -26,8 +26,8 @@ PropertyCollection includes changeToken (if applicable to repository)<br>
|
||||
]]>
|
||||
</description>
|
||||
|
||||
<url>/cmis/pwc/i/{id}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/pwc/s/{store}/i/{id}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/pwc/i/{id}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/pwc/s/{store}/i/{id}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}</url>
|
||||
|
||||
<authentication>user</authentication>
|
||||
<transaction allow="readonly"/>
|
||||
|
@@ -36,4 +36,11 @@ script:
|
||||
|
||||
// include allowable actions
|
||||
model.includeAllowableActions = args[cmis.ARG_INCLUDE_ALLOWABLE_ACTIONS] == "true";
|
||||
|
||||
// include relationships
|
||||
model.includeRelationships = args[cmis.ARG_INCLUDE_RELATIONSHIPS];
|
||||
if (model.includeRelationships == null || model.includeRelationships.length == 0)
|
||||
{
|
||||
model.includeRelationships = "none";
|
||||
}
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
[#assign rs = cmisresultset(resultset)]
|
||||
[#list rs.rows as row]
|
||||
[@entryLib.row row=row renditionfilter=renditionFilter includeallowableactions=includeAllowableActions/]
|
||||
[@entryLib.row row=row renditionfilter=renditionFilter includeallowableactions=includeAllowableActions includerelationships=includeRelationships/]
|
||||
[/#list]
|
||||
|
||||
</feed>
|
||||
|
@@ -47,6 +47,13 @@ script:
|
||||
var includeAllowableActions = cmisQuery.includeAllowableActions.toString();
|
||||
model.includeAllowableActions = (includeAllowableActions == null || includeAllowableActions == "true" ? true : false);
|
||||
|
||||
// include relationships
|
||||
model.includeRelationships = cmisQuery.includeRelationships.toString();
|
||||
if (model.includeRelationships == null || model.includeRelationships.length == 0)
|
||||
{
|
||||
model.includeRelationships = "none";
|
||||
}
|
||||
|
||||
// rendition filter
|
||||
var renditionFilter = cmisQuery.renditionFilter.toString();
|
||||
model.renditionFilter = renditionFilter != null && renditionFilter.length > 0 ? renditionFilter : "cmis:none";
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
[#assign rs = cmisresultset(resultset)]
|
||||
[#list rs.rows as row]
|
||||
[@entryLib.row row=row includeallowableactions=includeAllowableActions/]
|
||||
[@entryLib.row row=row includeallowableactions=includeAllowableActions includerelationships=includeRelationships/]
|
||||
[/#list]
|
||||
|
||||
</feed>
|
||||
|
@@ -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>
|
||||
]]>
|
||||
</description>
|
||||
<url>/cmis/query?q={q}&includeAllowableActions={includeAllowableActions?}&searchAllVersions={searchAllVersions?}&skipCount={skipCount?}&maxItems={maxItems?}</url>
|
||||
<url>/cmis/query?q={q}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&searchAllVersions={searchAllVersions?}&skipCount={skipCount?}&maxItems={maxItems?}</url>
|
||||
<authentication>user</authentication>
|
||||
<transaction allow="readonly"/>
|
||||
<format default="atomfeed"/>
|
||||
|
@@ -30,6 +30,13 @@ script:
|
||||
var includeAllowableActions = args[cmis.ARG_INCLUDE_ALLOWABLE_ACTIONS];
|
||||
model.includeAllowableActions = (includeAllowableActions == "true" ? true : false);
|
||||
|
||||
// include relationships
|
||||
model.includeRelationships = args[cmis.ARG_INCLUDE_RELATIONSHIPS];
|
||||
if (model.includeRelationships == null || model.includeRelationships.length == 0)
|
||||
{
|
||||
model.includeRelationships = "none";
|
||||
}
|
||||
|
||||
// perform query
|
||||
var page = paging.createPageOrWindow(args);
|
||||
var paged = cmis.query(model.statement, page);
|
||||
|
@@ -0,0 +1,11 @@
|
||||
[#ftl]
|
||||
[#import "/org/alfresco/cmis/lib/ns.lib.atom.ftl" as nsLib/]
|
||||
[#import "/org/alfresco/cmis/lib/links.lib.atom.ftl" as linksLib/]
|
||||
[#import "/org/alfresco/cmis/lib/atomentry.lib.atom.ftl" as entryLib/]
|
||||
[#compress]
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
[#assign namespace][@nsLib.allowableactionsNS/][/#assign]
|
||||
[@entryLib.assocallowableactions assoc=assoc ns=namespace/]
|
||||
|
||||
[/#compress]
|
@@ -0,0 +1,9 @@
|
||||
<webscript>
|
||||
<shortname>Retrieve Allowable Actions</shortname>
|
||||
<description>Retrieve Allowable Actions</description>
|
||||
<url>/cmis/rel/{assoc_id}/allowableactions</url>
|
||||
<authentication>guest</authentication>
|
||||
<transaction allow="readonly"/>
|
||||
<format default="cmisallowableactions">argument</format>
|
||||
<family>CMIS</family>
|
||||
</webscript>
|
@@ -0,0 +1,13 @@
|
||||
<import resource="classpath:alfresco/templates/webscripts/org/alfresco/cmis/lib/read.lib.js">
|
||||
|
||||
script:
|
||||
{
|
||||
// locate association
|
||||
var rel = getAssocFromUrl();
|
||||
if (rel.assoc == null)
|
||||
{
|
||||
break script;
|
||||
}
|
||||
model.assoc = rel.assoc;
|
||||
|
||||
}
|
@@ -32,7 +32,7 @@ script:
|
||||
model.assoc = assoc;
|
||||
// TODO: set Content-Location
|
||||
status.code = 201;
|
||||
// TODO: complete url mapping
|
||||
status.location = url.server + url.serviceContext + "/cmis/rel/" + model.source.nodeRef.storeRef.protocol + "/" + model.source.nodeRef.storeRef.identifier + "/" + model.source.nodeRef.id;
|
||||
|
||||
status.location = url.server + url.serviceContext + "/cmis/rel/" + assoc.associationRef.id;
|
||||
status.redirect = true;
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
[#if depth > 0 || depth == -1]
|
||||
[#list cmischildren(node, "folders") as child]
|
||||
[@entryLib.foldertree node=child renditionfilter=renditionFilter propfilter=propFilter includeallowableactions=includeAllowableActions includerelationships=false maxdepth=depth/]
|
||||
[@entryLib.foldertree node=child renditionfilter=renditionFilter propfilter=propFilter includeallowableactions=includeAllowableActions includerelationships=includeRelationships maxdepth=depth/]
|
||||
[/#list]
|
||||
[/#if]
|
||||
|
||||
|
@@ -4,14 +4,14 @@
|
||||
</description>
|
||||
|
||||
<!-- by object id -->
|
||||
<url>/cmis/i/{id}/tree?filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/i/{id}/tree?filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/i/{id}/tree?filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/i/{id}/tree?filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<!-- by path -->
|
||||
<url>/cmis/p{path}/tree?filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/p{path}/tree?filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/p{path}/tree?filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/cmis/s/{store}/p{path}/tree?filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<!-- alfresco style -->
|
||||
<url>/api/node/{store_type}/{store_id}/{id}/tree?filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/api/path/{store_type}/{store_id}/{path}/tree?filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/api/node/{store_type}/{store_id}/{id}/tree?filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
<url>/api/path/{store_type}/{store_id}/{path}/tree?filter={filter?}&depth={depth?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}</url>
|
||||
|
||||
<authentication>guest</authentication>
|
||||
<transaction allow="readonly"/>
|
||||
|
@@ -39,4 +39,11 @@ script:
|
||||
// include allowable actions
|
||||
var includeAllowableActions = args[cmis.ARG_INCLUDE_ALLOWABLE_ACTIONS];
|
||||
model.includeAllowableActions = (includeAllowableActions == "true" ? true : false);
|
||||
|
||||
// include relationships
|
||||
model.includeRelationships = args[cmis.ARG_INCLUDE_RELATIONSHIPS];
|
||||
if (model.includeRelationships == null || model.includeRelationships.length == 0)
|
||||
{
|
||||
model.includeRelationships = "none";
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,9 @@
|
||||
[/@feedLib.generic]
|
||||
|
||||
[#list nodes as version]
|
||||
[@entryLib.version version/]
|
||||
[#if node.isDocument]
|
||||
[@entryLib.document node=version propfilter=filter includeallowableactions=includeAllowableActions/]
|
||||
[/#if]
|
||||
[/#list]
|
||||
|
||||
</feed>
|
||||
|
@@ -167,6 +167,13 @@
|
||||
<constructor-arg><ref bean="webscripts.repo.imageresolver"/></constructor-arg>
|
||||
</bean>
|
||||
</entry>
|
||||
<entry key="cmisassocs">
|
||||
<bean class="org.alfresco.repo.cmis.rest.CMISAssocsMethod">
|
||||
<constructor-arg><ref bean="CMISService"/></constructor-arg>
|
||||
<constructor-arg><ref bean="webscripts.repo.templateprocessor"/></constructor-arg>
|
||||
<constructor-arg><ref bean="webscripts.repo.imageresolver"/></constructor-arg>
|
||||
</bean>
|
||||
</entry>
|
||||
</map>
|
||||
</property>
|
||||
<property name="registryFactory">
|
||||
|
122
source/java/org/alfresco/repo/cmis/rest/CMISAssocsMethod.java
Normal file
122
source/java/org/alfresco/repo/cmis/rest/CMISAssocsMethod.java
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have received a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.cmis.rest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.cmis.CMISRelationshipDirectionEnum;
|
||||
import org.alfresco.cmis.CMISServiceException;
|
||||
import org.alfresco.cmis.CMISServices;
|
||||
import org.alfresco.repo.template.TemplateNode;
|
||||
import org.alfresco.repo.web.scripts.RepositoryImageResolver;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
||||
import org.alfresco.service.cmr.repository.TemplateValueConverter;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
|
||||
import freemarker.ext.beans.BeanModel;
|
||||
import freemarker.template.TemplateMethodModelEx;
|
||||
import freemarker.template.TemplateModelException;
|
||||
import freemarker.template.TemplateScalarModel;
|
||||
|
||||
/**
|
||||
* Custom FreeMarker Template language method.
|
||||
* <p>
|
||||
* Gets the associations of a TemplateNode
|
||||
* <p>
|
||||
* Usage: cmisassocs(TemplateNode node, String direction)
|
||||
*
|
||||
* @author dward
|
||||
*/
|
||||
public class CMISAssocsMethod implements TemplateMethodModelEx
|
||||
{
|
||||
private CMISServices cmisService;
|
||||
private TemplateImageResolver imageResolver;
|
||||
private TemplateValueConverter templateValueConverter;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public CMISAssocsMethod(CMISServices cmisService, RepositoryImageResolver imageResolver,
|
||||
TemplateValueConverter templateValueConverter)
|
||||
{
|
||||
this.cmisService = cmisService;
|
||||
this.imageResolver = imageResolver.getImageResolver();
|
||||
this.templateValueConverter = templateValueConverter;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object exec(List args) throws TemplateModelException
|
||||
{
|
||||
NodeRef nodeRef = null;
|
||||
CMISRelationshipDirectionEnum direction = CMISRelationshipDirectionEnum.SOURCE;
|
||||
try
|
||||
{
|
||||
int i = 0;
|
||||
// extract node ref
|
||||
Object arg = args.get(i++);
|
||||
if (arg instanceof BeanModel)
|
||||
{
|
||||
Object wrapped = ((BeanModel) arg).getWrappedObject();
|
||||
if (wrapped != null)
|
||||
{
|
||||
if (wrapped instanceof TemplateNode)
|
||||
{
|
||||
nodeRef = ((TemplateNode) wrapped).getNodeRef();
|
||||
}
|
||||
}
|
||||
}
|
||||
// extract direction, if specified
|
||||
arg = args.get(i++);
|
||||
if (arg instanceof TemplateScalarModel)
|
||||
{
|
||||
direction = CMISRelationshipDirectionEnum.valueOf(((TemplateScalarModel) arg).getAsString());
|
||||
}
|
||||
}
|
||||
catch (IndexOutOfBoundsException e)
|
||||
{
|
||||
// Ignore optional arguments
|
||||
}
|
||||
|
||||
// query relationships
|
||||
if (nodeRef != null)
|
||||
{
|
||||
AssociationRef[] assocs;
|
||||
try
|
||||
{
|
||||
assocs = cmisService.getRelationships(nodeRef, null, true, direction);
|
||||
}
|
||||
catch (CMISServiceException e)
|
||||
{
|
||||
throw new WebScriptException(e.getStatusCode(), e.getMessage(), e);
|
||||
}
|
||||
return templateValueConverter.convertValue(assocs, imageResolver);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@@ -50,6 +50,7 @@ import org.alfresco.cmis.CMISConstraintException;
|
||||
import org.alfresco.cmis.CMISFilterNotValidException;
|
||||
import org.alfresco.cmis.CMISInvalidArgumentException;
|
||||
import org.alfresco.cmis.CMISQueryService;
|
||||
import org.alfresco.cmis.CMISRelationshipDirectionEnum;
|
||||
import org.alfresco.cmis.CMISRendition;
|
||||
import org.alfresco.cmis.CMISRenditionService;
|
||||
import org.alfresco.cmis.CMISServices;
|
||||
@@ -87,14 +88,20 @@ public class DMAbstractServicePort
|
||||
private static final String INVALID_REPOSITORY_ID_MESSAGE = "Invalid repository id";
|
||||
|
||||
private static final Map<EnumACLPropagation, CMISAclPropagationEnum> ACL_PROPAGATION_ENUM_MAPPGIN;
|
||||
private static final Map<EnumIncludeRelationships, CMISRelationshipDirectionEnum> INCLUDE_RELATIONSHIPS_ENUM_MAPPING;
|
||||
private static final Map<CMISAllowedActionEnum, PropertyDescriptor> ALLOWED_ACTION_ENUM_MAPPING;
|
||||
static
|
||||
{
|
||||
ACL_PROPAGATION_ENUM_MAPPGIN = new HashMap<EnumACLPropagation, CMISAclPropagationEnum>();
|
||||
ACL_PROPAGATION_ENUM_MAPPGIN = new HashMap<EnumACLPropagation, CMISAclPropagationEnum>(5);
|
||||
ACL_PROPAGATION_ENUM_MAPPGIN.put(EnumACLPropagation.OBJECTONLY, CMISAclPropagationEnum.OBJECT_ONLY);
|
||||
ACL_PROPAGATION_ENUM_MAPPGIN.put(EnumACLPropagation.PROPAGATE, CMISAclPropagationEnum.PROPAGATE);
|
||||
ACL_PROPAGATION_ENUM_MAPPGIN.put(EnumACLPropagation.REPOSITORYDETERMINED, CMISAclPropagationEnum.REPOSITORY_DETERMINED);
|
||||
|
||||
INCLUDE_RELATIONSHIPS_ENUM_MAPPING = new HashMap<EnumIncludeRelationships, CMISRelationshipDirectionEnum>(5);
|
||||
INCLUDE_RELATIONSHIPS_ENUM_MAPPING.put(EnumIncludeRelationships.SOURCE, CMISRelationshipDirectionEnum.SOURCE);
|
||||
INCLUDE_RELATIONSHIPS_ENUM_MAPPING.put(EnumIncludeRelationships.TARGET, CMISRelationshipDirectionEnum.TARGET);
|
||||
INCLUDE_RELATIONSHIPS_ENUM_MAPPING.put(EnumIncludeRelationships.BOTH, CMISRelationshipDirectionEnum.BOTH);
|
||||
|
||||
try
|
||||
{
|
||||
ALLOWED_ACTION_ENUM_MAPPING = new HashMap<CMISAllowedActionEnum, PropertyDescriptor>(97);
|
||||
@@ -210,37 +217,99 @@ public class DMAbstractServicePort
|
||||
* This method converts Alfresco's <b>NodeRef</b>'s to CMIS objects those will be stored in <b>resultList</b>-parameter. Properties for returning filtering also performs
|
||||
*
|
||||
* @param filter properties filter value for filtering objects returning properties
|
||||
* @param includeRelationships
|
||||
* what relationships to include
|
||||
* @param sourceList the list that contains all returning Node References
|
||||
* @param resultList the list of <b>CmisObjectType</b> values for end response result collecting
|
||||
* @throws CmisException
|
||||
*/
|
||||
protected void createCmisObjectList(PropertyFilter filter, boolean includeAllowableActions, String renditionFilter, List<NodeRef> sourceList, List<CmisObjectType> resultList)
|
||||
throws CmisException
|
||||
protected void createCmisObjectList(PropertyFilter filter, CMISRelationshipDirectionEnum includeRelationships,
|
||||
boolean includeAllowableActions, String renditionFilter, List<NodeRef> sourceList,
|
||||
List<CmisObjectType> resultList) throws CmisException
|
||||
{
|
||||
for (NodeRef objectNodeRef : sourceList)
|
||||
{
|
||||
resultList.add(createCmisObject(objectNodeRef, filter, includeAllowableActions, renditionFilter));
|
||||
resultList.add(createCmisObject(objectNodeRef, filter, includeRelationships, includeAllowableActions,
|
||||
renditionFilter));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method creates and configures CMIS object against appropriate Alfresco object (NodeRef or AssociationRef)
|
||||
* This method creates and configures CMIS object against appropriate Alfresco object (NodeRef or AssociationRef).
|
||||
*
|
||||
* @param objectNodeRef the Alfresco object against those conversion must to be done
|
||||
* @param filter accepted properties filter
|
||||
* @return converted to CMIS object Alfresco object
|
||||
* @param object
|
||||
* the Alfresco object
|
||||
* @param filter
|
||||
* accepted properties filter
|
||||
* @param includeRelationships
|
||||
* what relationships to include
|
||||
* @param includeAllowableActions
|
||||
* should we include allowable actions?
|
||||
* @param renditionFilter
|
||||
* the rendition filter
|
||||
* @return the converted CMIS object
|
||||
* @throws CmisException
|
||||
* on error
|
||||
*/
|
||||
protected CmisObjectType createCmisObject(Object identifier, PropertyFilter filter, boolean includeAllowableActions, String renditionFilter) throws CmisException
|
||||
protected CmisObjectType createCmisObject(Object object, PropertyFilter filter,
|
||||
EnumIncludeRelationships includeRelationships, Boolean includeAllowableActions, String renditionFilter)
|
||||
throws CmisException
|
||||
{
|
||||
return createCmisObject(object, filter, includeRelationships == null ? null
|
||||
: INCLUDE_RELATIONSHIPS_ENUM_MAPPING.get(includeRelationships), includeAllowableActions != null
|
||||
&& includeAllowableActions, renditionFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method creates and configures CMIS object against appropriate Alfresco object (NodeRef or AssociationRef).
|
||||
*
|
||||
* @param object
|
||||
* the Alfresco object
|
||||
* @param filter
|
||||
* accepted properties filter
|
||||
* @param includeRelationships
|
||||
* what relationships to include
|
||||
* @param includeAllowableActions
|
||||
* should we include allowable actions?
|
||||
* @param renditionFilter
|
||||
* the rendition filter
|
||||
* @return the converted CMIS object
|
||||
* @throws CmisException
|
||||
* on error
|
||||
*/
|
||||
protected CmisObjectType createCmisObject(Object object, PropertyFilter filter,
|
||||
CMISRelationshipDirectionEnum includeRelationships, boolean includeAllowableActions, String renditionFilter)
|
||||
throws CmisException
|
||||
{
|
||||
// Get a NodeRef if we can
|
||||
if (object instanceof Version)
|
||||
{
|
||||
object = ((Version) object).getFrozenStateNodeRef();
|
||||
}
|
||||
CmisObjectType result = new CmisObjectType();
|
||||
result.setProperties(propertiesUtil.getProperties(identifier, filter));
|
||||
result.setProperties(propertiesUtil.getProperties(object, filter));
|
||||
if (object instanceof NodeRef && includeRelationships != null)
|
||||
{
|
||||
List<CmisObjectType> relationships = result.getRelationship();
|
||||
try
|
||||
{
|
||||
for (AssociationRef assoc : cmisService.getRelationships((NodeRef)object, null, true, includeRelationships))
|
||||
{
|
||||
relationships.add(createCmisObject(assoc, filter, includeRelationships, includeAllowableActions, renditionFilter));
|
||||
}
|
||||
}
|
||||
catch (CMISInvalidArgumentException e)
|
||||
{
|
||||
throw ExceptionUtil.createCmisException(e);
|
||||
}
|
||||
}
|
||||
if (includeAllowableActions)
|
||||
{
|
||||
result.setAllowableActions(determineObjectAllowableActions(identifier));
|
||||
result.setAllowableActions(determineObjectAllowableActions(object));
|
||||
}
|
||||
if (renditionFilter != null)
|
||||
{
|
||||
List<CmisRenditionType> renditions = getRenditions(identifier, renditionFilter);
|
||||
List<CmisRenditionType> renditions = getRenditions(object, renditionFilter);
|
||||
if (renditions != null && !renditions.isEmpty())
|
||||
{
|
||||
result.getRendition().addAll(renditions);
|
||||
|
@@ -84,13 +84,10 @@ public class DMNavigationServicePort extends DMAbstractServicePort implements Na
|
||||
|
||||
for (int index = cursor.getStartRow(); index <= cursor.getEndRow(); index++)
|
||||
{
|
||||
resultListing.add(createCmisObject(nodeRefs[index], propertyFilter, includeAllowableActions,
|
||||
renditionFilter));
|
||||
resultListing.add(createCmisObject(nodeRefs[index], propertyFilter, includeRelationships,
|
||||
includeAllowableActions, renditionFilter));
|
||||
}
|
||||
result.setHasMoreItems(new Boolean(cursor.getEndRow() < (nodeRefs.length - 1)));
|
||||
|
||||
// TODO: includeAllowableActions, includeRelationships, renditions
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (CMISServiceException e)
|
||||
@@ -128,8 +125,8 @@ public class DMNavigationServicePort extends DMAbstractServicePort implements Na
|
||||
|
||||
for (int index = cursor.getStartRow(); index <= cursor.getEndRow(); index++)
|
||||
{
|
||||
CmisObjectType cmisObject = createCmisObject(listing[index], propertyFilter, includeAllowableActions,
|
||||
renditionFilter);
|
||||
CmisObjectType cmisObject = createCmisObject(listing[index], propertyFilter, includeRelationships,
|
||||
includeAllowableActions, renditionFilter);
|
||||
CmisObjectInFolderType cmisObjectInFolder = new CmisObjectInFolderType();
|
||||
cmisObjectInFolder.setObject(cmisObject);
|
||||
if (includePathSegments != null && includePathSegments)
|
||||
@@ -220,7 +217,7 @@ public class DMNavigationServicePort extends DMAbstractServicePort implements Na
|
||||
throw ExceptionUtil.createCmisException(e);
|
||||
}
|
||||
|
||||
CmisObjectType result = createCmisObject(parentRef, propertyFilter, false, null);
|
||||
CmisObjectType result = createCmisObject(parentRef, propertyFilter, null, false, null);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -253,8 +250,8 @@ public class DMNavigationServicePort extends DMAbstractServicePort implements Na
|
||||
String relativePathSegment = propertiesUtil.getProperty(childNode, CMISDictionaryModel.PROP_NAME, "");
|
||||
for (NodeRef objectNodeRef : parents)
|
||||
{
|
||||
CmisObjectType cmisObject = createCmisObject(objectNodeRef, propertyFilter, includeAllowableActions, renditionFilter);
|
||||
// TODO: includeRelationship, renditions
|
||||
CmisObjectType cmisObject = createCmisObject(objectNodeRef, propertyFilter, includeRelationships,
|
||||
includeAllowableActions, renditionFilter);
|
||||
CmisObjectParentsType cmisObjectParentsType = new CmisObjectParentsType();
|
||||
cmisObjectParentsType.setObject(cmisObject);
|
||||
if (includeRelativePathSegment != null && includeRelativePathSegment)
|
||||
@@ -262,7 +259,6 @@ public class DMNavigationServicePort extends DMAbstractServicePort implements Na
|
||||
cmisObjectParentsType.setRelativePathSegment(relativePathSegment);
|
||||
}
|
||||
result.add(cmisObjectParentsType);
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -319,9 +315,8 @@ public class DMNavigationServicePort extends DMAbstractServicePort implements Na
|
||||
private CmisObjectInFolderContainerType createObjectInFolderContainer(NodeRef nodeRef, PropertyFilter filter, Boolean includeAllowableActions,
|
||||
EnumIncludeRelationships includeRelationships, String renditionFilter, Boolean includePathSegments) throws CmisException
|
||||
{
|
||||
includeAllowableActions = includeAllowableActions == null ? Boolean.FALSE : includeAllowableActions;
|
||||
CmisObjectType cmisObject = createCmisObject(nodeRef, filter, includeAllowableActions, renditionFilter);
|
||||
// TODO: add relationships and renditions
|
||||
CmisObjectType cmisObject = createCmisObject(nodeRef, filter, includeRelationships, includeAllowableActions,
|
||||
renditionFilter);
|
||||
|
||||
CmisObjectInFolderType objectInFolderType = new CmisObjectInFolderType();
|
||||
objectInFolderType.setObject(cmisObject);
|
||||
|
@@ -431,8 +431,8 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
||||
{
|
||||
NodeRef object = cmisService.getReadableObject(objectId, NodeRef.class);
|
||||
PropertyFilter propertyFilter = createPropertyFilter(filter);
|
||||
boolean includeActions = (null != includeAllowableActions) ? (includeAllowableActions.booleanValue()) : (false);
|
||||
CmisObjectType cmisObject = createCmisObject(object, propertyFilter, includeActions, renditionFilter);
|
||||
CmisObjectType cmisObject = createCmisObject(object, propertyFilter, includeRelationships,
|
||||
includeAllowableActions, renditionFilter);
|
||||
|
||||
// TODO: process relationships
|
||||
// TODO: process policyIds
|
||||
@@ -471,7 +471,8 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
||||
throw ExceptionUtil.createCmisException("Path to Folder was not specified or Folder Path is invalid", EnumServiceException.INVALID_ARGUMENT);
|
||||
}
|
||||
PropertyFilter propertyFilter = createPropertyFilter(filter);
|
||||
CmisObjectType object = createCmisObject(objectNodeRef, propertyFilter, includeAllowableActions, renditionFilter);
|
||||
CmisObjectType object = createCmisObject(objectNodeRef, propertyFilter, includeRelationships,
|
||||
includeAllowableActions, renditionFilter);
|
||||
boolean includeAcl = (null != includeACL) ? (includeACL.booleanValue()) : (false);
|
||||
if (includeAcl)
|
||||
{
|
||||
|
@@ -88,14 +88,14 @@ public class DMRelationshipServicePort extends DMAbstractServicePort implements
|
||||
}
|
||||
}
|
||||
|
||||
private CmisObjectListType createResult(PropertyFilter filter, boolean includeAllowableActions, Object[] sourceArray, BigInteger skipCount, BigInteger maxItems)
|
||||
private CmisObjectListType createResult(PropertyFilter filter, Boolean includeAllowableActions, Object[] sourceArray, BigInteger skipCount, BigInteger maxItems)
|
||||
throws CmisException
|
||||
{
|
||||
Cursor cursor = createCursor(sourceArray.length, skipCount, maxItems);
|
||||
CmisObjectListType result = new CmisObjectListType();
|
||||
for (int i = cursor.getStartRow(); i <= cursor.getEndRow(); i++)
|
||||
{
|
||||
result.getObjects().add(createCmisObject(sourceArray[i], filter, includeAllowableActions, null));
|
||||
result.getObjects().add(createCmisObject(sourceArray[i], filter, null, includeAllowableActions, null));
|
||||
}
|
||||
result.setHasMoreItems(cursor.getEndRow() < sourceArray.length);
|
||||
result.setNumItems(BigInteger.valueOf(cursor.getPageSize()));
|
||||
|
@@ -162,15 +162,11 @@ public class DMVersioningServicePort extends DMAbstractServicePort implements Ve
|
||||
checkRepositoryId(repositoryId);
|
||||
PropertyFilter propertyFilter = createPropertyFilter(filter);
|
||||
List<CmisObjectType> objects = new LinkedList<CmisObjectType>();
|
||||
if (includeAllowableActions == null)
|
||||
{
|
||||
includeAllowableActions = false;
|
||||
}
|
||||
try
|
||||
{
|
||||
for (NodeRef nodeRef : cmisService.getAllVersions(objectId))
|
||||
{
|
||||
objects.add(createCmisObject(nodeRef, propertyFilter, includeAllowableActions, null));
|
||||
objects.add(createCmisObject(nodeRef, propertyFilter, null, includeAllowableActions, null));
|
||||
}
|
||||
}
|
||||
catch (CMISServiceException e)
|
||||
@@ -215,10 +211,10 @@ public class DMVersioningServicePort extends DMAbstractServicePort implements Ve
|
||||
try
|
||||
{
|
||||
NodeRef latestVersionNodeRef = cmisService.getLatestVersion(objectId, major != null && major);
|
||||
// TODO: includeRelationships
|
||||
// TODO: includePolicyIds
|
||||
PropertyFilter propertyFilter = createPropertyFilter(filter);
|
||||
CmisObjectType result = createCmisObject(latestVersionNodeRef, propertyFilter, includeAllowableActions, renditionFilter);
|
||||
CmisObjectType result = createCmisObject(latestVersionNodeRef, propertyFilter, includeRelationships,
|
||||
includeAllowableActions, renditionFilter);
|
||||
if (includeACL)
|
||||
{
|
||||
appendWithAce(cmisService.getVersionSeries(objectId, NodeRef.class, false), result);
|
||||
|
Reference in New Issue
Block a user