From 40bb33b90ed14e45216ae0e2fe5c2758f1fd1c3c Mon Sep 17 00:00:00 2001 From: David Caruana Date: Thu, 4 Sep 2008 11:25:34 +0000 Subject: [PATCH] Merge from SEAMIST3 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10735 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/cmis/atomentry.lib.atom.ftl | 579 +++++--- .../org/alfresco/cmis/atomfeed.lib.atom.ftl | 21 +- .../org/alfresco/cmis/ns.lib.atom.ftl | 6 +- .../org/alfresco/cmis/test.post.desc.xml | 8 + .../org/alfresco/paging.lib.atom.ftl | 6 +- .../repository/repository.get.atom.ftl | 31 +- .../repository/repository.get.desc.xml | 2 +- .../repository/repository.get.html.ftl | 47 +- .../org/alfresco/repository/repository.get.js | 9 +- .../repository/search/query.post.atomfeed.ftl | 10 +- ...missqlquery.js => query.post.cmisquery.js} | 2 +- .../store/checkedout.get.atomfeed.ftl | 8 +- .../repository/store/checkedout.get.desc.xml | 2 +- .../repository/store/checkedout.get.js | 11 +- .../store/checkedout.post.atomentry.201.ftl | 5 +- .../store/checkedout.post.atomentry.js | 4 +- .../store/children.get.atomfeed.ftl | 14 +- .../alfresco/repository/store/children.get.js | 8 +- .../repository/store/children.post.atom.js | 12 +- .../store/children.post.atomentry.201.ftl | 13 +- .../store/descendants.get.atomfeed.ftl | 20 +- .../repository/store/descendants.get.js | 10 +- .../repository/store/descendants.post.atom.js | 10 +- .../store/descendants.post.atomentry.201.ftl | 12 +- .../repository/store/item.get.atomentry.ftl | 13 +- .../org/alfresco/repository/store/item.get.js | 9 +- .../repository/store/item.put.atomentry.ftl | 13 +- .../repository/store/parent.get.atomfeed.ftl | 12 +- .../repository/store/parent.get.desc.xml | 4 +- .../alfresco/repository/store/parent.get.js | 7 +- .../repository/store/parents.get.atomfeed.ftl | 12 +- .../repository/store/parents.get.desc.xml | 4 +- .../alfresco/repository/store/parents.get.js | 7 +- .../repository/store/pwc.get.atomentry.ftl | 5 +- .../repository/store/pwc.put.atomentry.ftl | 13 +- .../repository/store/type.get.atomentry.ftl | 5 +- .../store/typechildren.get.atomfeed.ftl | 10 +- .../store/typedescendants.get.atomfeed.ftl | 10 +- .../repository/store/types.get.atomfeed.ftl | 10 +- .../repository/store/unfiled.get.atomfeed.ftl | 2 +- .../store/versions.get.atomfeed.ftl | 8 +- .../alfresco/repository/store/versions.get.js | 7 +- .../web-scripts-application-context.xml | 18 +- .../repo/cmis/rest/CMISChildrenMethod.java | 115 ++ .../repo/cmis/rest/CMISQueryReader.java | 3 +- .../alfresco/repo/cmis/rest/CMISScript.java | 66 +- .../org/alfresco/repo/cmis/rest/CMISTest.java | 193 ++- .../repo/cmis/rest/CMISTypeIdMethod.java | 2 +- .../repo/cmis/rest/TestRemoteCMIS.java | 91 -- .../{ => test}/BaseCMISWebScriptTest.java | 2 +- .../repo/cmis/rest/test/CMISTest.java | 1289 +++++++++++++++++ .../repo/cmis/rest/test/CMISTestRunner.java | 259 ++++ .../rest/test/CMISTestRunnerWebScript.java | 91 ++ .../rest/{ => test}/CMISWithHeadersTest.java | 2 +- .../checkinandupdatedocument.atomentry.xml | 0 .../rest/test}/checkindocument.atomentry.xml | 3 +- .../rest/test/createdocument.atomentry.xml | 11 + .../rest/test/createdocument2.atomentry.xml | 10 + .../test}/createdocumentBase64.atomentry.xml | 10 +- .../cmis/rest/test}/createdocumentBase64.txt | 0 .../rest/test}/createfolder.atomentry.xml | 8 +- .../repo/cmis/rest/test/query.cmisquery.xml} | 0 .../cmis/rest/test/query.cmissqlquery.xml | 4 + .../rest/test}/updatedocument.atomentry.xml | 0 .../org/alfresco/repo/cmis/rest/xsd/APP.xsd | 27 +- .../alfresco/repo/cmis/rest/xsd/ATOM4CMIS.xsd | 168 +-- .../alfresco/repo/cmis/rest/xsd/CMIS-REST.xsd | 455 ------ .../org/alfresco/repo/cmis/rest/xsd/CMIS.xsd | 1077 ++++++++++++++ .../rest/xsd/Example-AllowableActions.xml | 2 +- .../cmis/rest/xsd/Example-DocumentEntry.xml | 120 +- .../rest/xsd/Example-DocumentPWCEntry.xml | 120 +- .../xsd/Example-FolderChildren-Alfresco.xml | 174 +-- .../cmis/rest/xsd/Example-FolderChildren.xml | 189 +-- .../rest/xsd/Example-FolderDescendants.xml | 461 +++--- .../cmis/rest/xsd/Example-FolderEntry.xml | 78 +- .../cmis/rest/xsd/Example-PolicyEntry.xml | 73 +- .../repo/cmis/rest/xsd/Example-Query.xml | 4 +- .../rest/xsd/Example-RelationshipEntry.xml | 75 +- .../repo/cmis/rest/xsd/Example-Service.xml | 25 +- .../repo/cmis/rest/xsd/Example-Type.xml | 103 +- .../repo/cmis/rest/xsd/xhtml1-strict.xsd | 13 +- .../org/alfresco/repo/cmis/rest/xsd/xml.xsd | 181 +-- .../repo/cmis/ws/DMAbstractServicePort.java | 17 +- .../repo/cmis/ws/DMNavigationServicePort.java | 8 +- .../repo/cmis/ws/DMRepositoryServicePort.java | 83 +- .../repo/web/scripts/BaseWebScriptTest.java | 159 +- .../apache/abdera/ext/cmis/CMISConstants.java | 81 +- .../abdera/ext/cmis/CMISExtensionFactory.java | 19 + .../apache/abdera/ext/cmis/CMISObject.java | 217 +++ .../abdera/ext/cmis/CMISProperties.java | 150 +- .../apache/abdera/ext/cmis/CMISProperty.java | 387 +++++ .../cmis/rest/createdocument.atomentry.xml | 2 +- .../cmis/rest/createdocument2.atomentry.xml | 8 - .../repo/cmis/ws/BaseServicePortTest.java | 10 +- .../repo/cmis/ws/DMObjectServicePortTest.java | 6 +- 95 files changed, 5392 insertions(+), 2278 deletions(-) create mode 100644 config/alfresco/templates/webscripts/org/alfresco/cmis/test.post.desc.xml rename config/alfresco/templates/webscripts/org/alfresco/repository/search/{query.post.cmissqlquery.js => query.post.cmisquery.js} (97%) create mode 100644 source/java/org/alfresco/repo/cmis/rest/CMISChildrenMethod.java delete mode 100644 source/java/org/alfresco/repo/cmis/rest/TestRemoteCMIS.java rename source/java/org/alfresco/repo/cmis/rest/{ => test}/BaseCMISWebScriptTest.java (99%) create mode 100644 source/java/org/alfresco/repo/cmis/rest/test/CMISTest.java create mode 100644 source/java/org/alfresco/repo/cmis/rest/test/CMISTestRunner.java create mode 100644 source/java/org/alfresco/repo/cmis/rest/test/CMISTestRunnerWebScript.java rename source/java/org/alfresco/repo/cmis/rest/{ => test}/CMISWithHeadersTest.java (97%) rename source/{test-resources/cmis/rest => java/org/alfresco/repo/cmis/rest/test}/checkinandupdatedocument.atomentry.xml (100%) rename source/{test-resources/cmis/rest => java/org/alfresco/repo/cmis/rest/test}/checkindocument.atomentry.xml (77%) create mode 100644 source/java/org/alfresco/repo/cmis/rest/test/createdocument.atomentry.xml create mode 100644 source/java/org/alfresco/repo/cmis/rest/test/createdocument2.atomentry.xml rename source/{test-resources/cmis/rest => java/org/alfresco/repo/cmis/rest/test}/createdocumentBase64.atomentry.xml (81%) rename source/{test-resources/cmis/rest => java/org/alfresco/repo/cmis/rest/test}/createdocumentBase64.txt (100%) rename source/{test-resources/cmis/rest => java/org/alfresco/repo/cmis/rest/test}/createfolder.atomentry.xml (51%) rename source/{test-resources/cmis/rest/query.cmissqlquery.xml => java/org/alfresco/repo/cmis/rest/test/query.cmisquery.xml} (100%) create mode 100644 source/java/org/alfresco/repo/cmis/rest/test/query.cmissqlquery.xml rename source/{test-resources/cmis/rest => java/org/alfresco/repo/cmis/rest/test}/updatedocument.atomentry.xml (100%) delete mode 100644 source/java/org/alfresco/repo/cmis/rest/xsd/CMIS-REST.xsd create mode 100644 source/java/org/alfresco/repo/cmis/rest/xsd/CMIS.xsd create mode 100644 source/java/org/apache/abdera/ext/cmis/CMISObject.java create mode 100644 source/java/org/apache/abdera/ext/cmis/CMISProperty.java delete mode 100644 source/test-resources/cmis/rest/createdocument2.atomentry.xml diff --git a/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.atom.ftl b/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.atom.ftl index 48c62ee1c4..99460514be 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.atom.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.atom.ftl @@ -1,32 +1,41 @@ [#ftl] +[#-- --] +[#-- ATOM Entry --] +[#-- --] + +[#macro entry ns=""] + +[#nested] + +[/#macro] + + [#-- --] [#-- ATOM Entry for Document --] [#-- --] - -[#macro contentLink node] - -${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content.${node.properties.name} - -[/#macro] - -[#macro document node propfilter="*"] +[#macro document node propfilter="*" ns=""] +[@entry ns] ${node.properties.creator!""} - + urn:uuid:${node.id} - + - + [@documentCMISLinks node=node/] ${xmldate(node.properties.created)} ${node.properties.description!node.properties.title!cropContent(node, 50)} ${node.name} ${xmldate(node.properties.modified)} + [@documentCMISProps node propfilter/] -[#-- TODO: custom ns ${xmldate(node.properties.modified)} --] -[#-- TODO: custom ns ${absurl(url.context)}${node.icon16} --] + + +${xmldate(node.properties.modified)} +${absurl(url.context)}${node.icon16} +[/@entry] [/#macro] [#macro documentCMISLinks node] @@ -34,34 +43,38 @@ ${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node. - + + [/#macro] [#macro documentCMISProps node propfilter] - [@filter propfilter "IS_IMMUTABLE"][@prop "isImmutable" cmisproperty(node, "IS_IMMUTABLE") "Boolean"/][/@filter] - [@filter propfilter "IS_LATEST_VERSION"][@prop "isLatestVersion" cmisproperty(node, "IS_LATEST_VERSION") "Boolean"/][/@filter] - [@filter propfilter "IS_MAJOR_VERSION"][@prop "isMajorVersion" cmisproperty(node, "IS_MAJOR_VERSION") "Boolean"/][/@filter] - [@filter propfilter "IS_LATEST_MAJOR_VERSION"][@prop "isLatestMajorVersion" cmisproperty(node, "IS_LATEST_MAJOR_VERSION") "Boolean"/][/@filter] - [@filter propfilter "VERSION_SERIES_IS_CHECKED_OUT"][@prop "isVersionSeriesCheckedOut" cmisproperty(node, "VERSION_SERIES_IS_CHECKED_OUT") "Boolean"/][/@filter] - [@filter propfilter "CREATION_DATE"][@prop "creationDate" node.properties.created "DateTime"/][/@filter] - [@filter propfilter "LAST_MODIFICATION_DATE"][@prop "lastModificationDate" node.properties.modified "DateTime"/][/@filter] - [@filter propfilter "OBJECT_ID"][@prop "objectId" node.nodeRef "ID"/][/@filter] - [@filter propfilter "VERSION_SERIES_ID"][@prop "versionSeriesID" cmisproperty(node, "VERSION_SERIES_ID") "ID"/][/@filter] - [@filter propfilter "VERSION_SERIES_CHECKED_OUT_ID"][@prop "versionSeriesCheckedOutID" cmisproperty(node, "VERSION_SERIES_CHECKED_OUT_ID")!"" "ID"/][/@filter] - [@filter propfilter "CONTENT_STREAM_LENGTH"][@prop "contentStreamLength" node.properties.content.size "Integer"/][/@filter] - [@filter propfilter "NAME"][@prop "name" node.name "String"/][/@filter] - [@filter propfilter "ROOT_TYPE_QUERY_NAME"][@prop "baseType" "document" "String"/][/@filter] [#-- TODO: spec issue 41 --] - [@filter propfilter "OBJECT_TYPE_ID"][@prop "objectType" cmistypeid(node) "String"/][/@filter] - [@filter propfilter "CREATED_BY"][@prop "createdBy" node.properties.creator "String"/][/@filter] - [@filter propfilter "LAST_MODIFIED_BY"][@prop "lastModifiedBy" node.properties.modifier "String"/][/@filter] - [@filter propfilter "CONTENT_STREAM_MIME_TYPE"][@prop "contentStreamMimetype" node.properties.content.mimetype "String"/][/@filter] - [@filter propfilter "CONTENT_STREAM_FILENAME"][@prop "contentStreamName" node.name "String"/][/@filter] - [@filter propfilter "VERSION_LABEL"][@prop "versionLabel" cmisproperty(node, "VERSION_LABEL")!"" "String"/][/@filter] - [@filter propfilter "VERSION_SERIES_CHECKED_OUT_BY"][@prop "versionSeriesCheckedOutBy" cmisproperty(node, "VERSION_SERIES_CHECKED_OUT_BY")!"" "String"/][/@filter] - [@filter propfilter "CHECKIN_COMMENT"][@prop "checkinComment" cmisproperty(node, "CHECKIN_COMMENT")!"" "String"/][/@filter] - [@filter propfilter "CONTENT_STREAM_URI"][@prop "contentStreamURI" absurl(url.serviceContext) + "/api/node/" + node.nodeRef.storeRef.protocol + "/" + node.nodeRef.storeRef.identifier + "/" + node.nodeRef.id + "/content." + node.properties.name "String"/][/@filter] + [@filter propfilter "ObjectId"][@prop "ObjectId" node "ID"/][/@filter] + [#-- TODO: Spec issue - add root type id to meta-model --] + [@filter propfilter "BaseType"][@propvalue "BaseType" "document" "STRING"/][/@filter] + [@filter propfilter "ObjectTypeId"][@prop "ObjectTypeId" node "STRING"/][/@filter] + [@filter propfilter "CreatedBy"][@prop "CreatedBy" node "STRING"/][/@filter] + [@filter propfilter "CreationDate"][@prop "CreationDate" node "DATETIME"/][/@filter] + [@filter propfilter "LastModifiedBy"][@prop "LastModifiedBy" node "STRING"/][/@filter] + [@filter propfilter "LastModificationDate"][@prop "LastModificationDate" node "DATETIME"/][/@filter] + [#-- TODO: ChangeToken --] + [@filter propfilter "Name"][@prop "Name" node "STRING"/][/@filter] + [@filter propfilter "IsImmutable"][@prop "IsImmutable" node "BOOLEAN"/][/@filter] + [@filter propfilter "isLatestVersion"][@prop "IsLatestVersion" node "BOOLEAN"/][/@filter] + [@filter propfilter "IsMajorVersion"][@prop "IsMajorVersion" node "BOOLEAN"/][/@filter] + [@filter propfilter "isLatestMajorVersion"][@prop "IsLatestMajorVersion" node "BOOLEAN"/][/@filter] + [@filter propfilter "VersionLabel"][@prop "VersionLabel" node "STRING"/][/@filter] + [@filter propfilter "VersionSeriesId"][@prop "VersionSeriesId" node "ID"/][/@filter] + [@filter propfilter "IsVersionSeriesCheckedOut"][@prop "IsVersionSeriesCheckedOut" node "BOOLEAN"/][/@filter] + [@filter propfilter "VersionSeriesCheckedOutBy"][@prop "VersionSeriesCheckedOutBy" node "STRING"/][/@filter] + [@filter propfilter "VersionSeriesCheckedOutId"][@prop "VersionSeriesCheckedOutId" node "ID"/][/@filter] + [@filter propfilter "CheckinComment"][@prop "CheckinComment" node "STRING"/][/@filter] + [#-- TODO: ContentStreamAllowed --] + [@filter propfilter "ContentStreamLength"][@prop "ContentStreamLength" node "INTEGER"/][/@filter] + [@filter propfilter "ContentStreamMimeType"][@prop "ContentStreamMimeType" node "STRING"/][/@filter] + [@filter propfilter "ContentStreamFilename"][@prop "ContentStreamFilename" node "STRING"/][/@filter] + [@filter propfilter "ContentStreamURI"][@propvalue "ContentStreamURI" absurl(url.serviceContext) + "/api/node/" + node.nodeRef.storeRef.protocol + "/" + node.nodeRef.storeRef.identifier + "/" + node.nodeRef.id + "/content." + node.properties.name "STRING"/][/@filter] [/#macro] @@ -70,20 +83,25 @@ ${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node. [#-- ATOM Entry for Version --] [#-- --] -[#macro version node version propfilter="*"] +[#macro version node version propfilter="*" ns=""] +[@entry ns] ${node.properties.creator} - + urn:uuid:${node.id} - + [@documentCMISLinks node=node/] ${xmldate(node.properties.created)} ${node.properties.description!node.properties.title!cropContent(node.properties.content, 50)} ${node.name} ${xmldate(node.properties.modified)} + [@documentCMISProps node propfilter/] -[#-- TODO: custom ns ${xmldate(node.properties.modified)} --] -[#-- TODO: custom ns ${absurl(url.context)}${node.icon16} --] + + +${xmldate(node.properties.modified)} +${absurl(url.context)}${node.icon16} +[/@entry] [/#macro] @@ -91,23 +109,28 @@ ${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node. [#-- ATOM Entry for Private Working Copy --] [#-- --] -[#macro pwc node propfilter="*"] +[#macro pwc node propfilter="*" ns=""] +[@entry ns] ${node.properties.creator} - + urn:uuid:${node.id} - + - + [@documentCMISLinks node=node/] ${xmldate(node.properties.created)} ${node.properties.description!node.properties.title!cropContent(node.properties.content, 50)} ${node.name} ${xmldate(node.properties.modified)} + [@documentCMISProps node propfilter/] -[#-- TODO: custom ns ${xmldate(node.properties.modified)} --] + + +${xmldate(node.properties.modified)} [#-- TODO: the edit link refers to the updatable node resource, allowing updates on PWCs without checkin --] -[#-- TODO: custom ns ${absurl(url.context)}${node.icon16} --] +${absurl(url.context)}${node.icon16} +[/@entry] [/#macro] @@ -115,7 +138,8 @@ ${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node. [#-- ATOM Entry for Folder --] [#-- --] -[#macro folder node propfilter="*"] +[#macro folder node propfilter="*" typesfilter="any" ns="" depth=1 maxdepth=1] +[@entry ns] ${node.properties.creator} ${node.id} [#-- TODO --] urn:uuid:${node.id} @@ -126,34 +150,51 @@ ${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node. ${node.properties.description!node.properties.title!""} [#-- TODO --] ${node.name} ${xmldate(node.properties.modified)} + +[#-- recurse for depth greater than 1 --] [@folderCMISProps node propfilter/] -[#-- TODO: custom ns ${xmldate(node.properties.modified)} --] -[#-- TODO: custom ns ${absurl(url.context)}${node.icon16} --] + +[#if depth < maxdepth || depth == -1] +[#list cmischildren(node, typesfilter) as child] + [#if child.isDocument] + [@entryLib.document child propfilter/] + [#else] + [@entryLib.folder child propfilter/] + [@folder child propfilter typesfilter ns depth+1 maxdepth/] + [/#if] +[/#list] +[/#if] + +${xmldate(node.properties.modified)} +${absurl(url.context)}${node.icon16} +[/@entry] [/#macro] [#macro folderCMISLinks node] -[#if cmisproperty(node, "PARENT")??] +[#if cmisproperty(node, "ParentId")??] [/#if] + [/#macro] [#macro folderCMISProps node propfilter] - [@filter propfilter "CREATION_DATE"][@prop "creationDate" node.properties.created "DateTime"/][/@filter] - [@filter propfilter "LAST_MODIFICATION_DATE"][@prop "lastModificationDate" node.properties.modified "DateTime"/][/@filter] - [@filter propfilter "OBJECT_ID"][@prop "objectId" node.nodeRef "ID"/][/@filter] - [@filter propfilter "PARENT"][@prop "parent" cmisproperty(node, "PARENT")!"" "ID"/][/@filter] - [@filter propfilter "NAME"][@prop "name" node.name "String"/][/@filter] - [@filter propfilter "ROOT_TYPE_QUERY_NAME"][@prop "baseType" "folder" "String"/][/@filter] [#-- TODO: spec issue 41 --] - [@filter propfilter "OBJECT_TYPE_ID"][@prop "objectType" cmistypeid(node) "String"/][/@filter] - [@filter propfilter "CREATED_BY"][@prop "createdBy" node.properties.creator "String"/][/@filter] - [@filter propfilter "LAST_MODIFIED_BY"][@prop "lastModifiedBy" node.properties.modifier "String"/][/@filter] + [@filter propfilter "ObjectId"][@prop "ObjectId" node "ID"/][/@filter] + [#-- TODO: Spec issue - add root type id to meta-model --] + [@filter propfilter "BaseType"][@propvalue "BaseType" "folder" "STRING"/][/@filter] + [@filter propfilter "ObjectTypeId"][@prop "ObjectTypeId" node "STRING"/][/@filter] + [@filter propfilter "CreatedBy"][@prop "CreatedBy" node "STRING"/][/@filter] + [@filter propfilter "CreationDate"][@prop "CreationDate" node "DATETIME"/][/@filter] + [@filter propfilter "LastModifiedBy"][@prop "LastModifiedBy" node "STRING"/][/@filter] + [@filter propfilter "LastModificationDate"][@prop "LastModificationDate" node "DATETIME"/][/@filter] + [@filter propfilter "Name"][@prop "Name" node "STRING"/][/@filter] + [@filter propfilter "ParentId"][@prop "ParentId" node "ID"/][/@filter] [/#macro] @@ -164,23 +205,25 @@ ${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node. [#-- TODO: spec issue 47 --] [#macro row row] +[@entry] [#if row.nodes??] [#assign node = row.nodes?first] ${node.properties.creator!""} - + urn:uuid:${node.id} ${node.name} ${xmldate(node.properties.modified)} [/#if] + [#-- TODO: spec issue: baseType to become formal property --] [#if node??] [#if node.isDocument] - [@prop "baseType" "document" "String"/] + [@propvalue "BaseType" "document" "STRING"/] [#else] - [@prop "baseType" "folder" "String"/] + [@propvalue "BaseType" "folder" "STRING"/] [/#if] [/#if] @@ -188,90 +231,16 @@ ${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node. [#list values?keys as colname] [#assign coltype = row.getColumnType(colname)] [#if values[colname]??] - [@prop colname values[colname] coltype/] + [@propvalue colname values[colname] coltype/] [#else] [@propnull colname coltype/] [/#if] [/#list] -[#-- TODO: custom ns ${absurl(url.context)}${node.icon16} --] -[/#macro] - - -[#-- --] -[#-- ATOM Entry for Type Definition --] -[#-- --] - -[#macro typedef typedef includeProperties=true includeInheritedProperties=true] -[#if true] [#-- TODO: spec issue 40 --] -[@typedefCMISProps typedef includeProperties includeInheritedProperties/] -[#else] -${person.properties.userName} -${typedef.objectTypeId} [#-- TODO --] -urn:uuid:type-${typedef.objectTypeId} - -[@typedefCMISLinks typedef/] -${typedef.description!typedef.objectTypeDisplayName} -${typedef.objectTypeDisplayName} -${xmldate(date)} [#-- TODO --] -[@typedefCMISProps typedef includeProperties/] -[/#if] -[/#macro] - -[#macro typedefCMISLinks typedef] - - - - -[/#macro] - -[#macro typedefCMISProps typedef includeProperties=true includeInheritedProperties=true] - [#-- TODO: spec issue 40, remove ns decl --] - ${typedef.objectTypeId} - [@cmisBaseType typedef.rootTypeQueryName/] [#-- TODO: remove spec issue 36 --] - ${xmldate(date)} [#-- TODO: remove spec issue 36 --] - ${xmldate(date)} [#-- TODO: remove spec issue 36 --] - ${typedef.objectTypeQueryName} - [#if typedef.objectTypeDisplayName??]${typedef.objectTypeDisplayName?xml}[/#if] - ${typedef.rootTypeQueryName} - ${typedef.parentTypeId!""} - [#if typedef.description??]${typedef.description?xml}[/#if] - ${typedef.creatable?string} - ${typedef.fileable?string} - ${typedef.queryable?string} - ${typedef.controllable?string} - ${typedef.versionable?string} - [@cmisContentStreamAllowed typedef.contentStreamAllowed/] [#-- TODO: spec issue 37 --] - [#if includeProperties] - [#list typedef.propertyDefinitions?values as propdef] - [#if includeInheritedProperties || !propdef.inherited] - [@propdefCMISProps propdef/] - [/#if] - [/#list] - [/#if] - -[/#macro] - -[#macro propdefCMISProps propdef] - - ${propdef.propertyNameREST} - ${propdef.propertyId} - [#if propdef.displayName??]${propdef.displayName?xml}[/#if] - [#if propdef.description??]${propdef.description?xml}[/#if] - ${propdef.inherited?string} - ${propdef.propertyType} - [@cmisCardinality propdef.cardinality/] - [#if propdef.maximumLength != -1] - ${propdef.maximumLength} - [/#if] - [@cmisChoices propdef.choices/] - ${propdef.openChoice?string} - ${propdef.required?string} - ${propdef.defaultValue!""} - [@cmisUpdatability propdef.updatability/] [#-- TODO spec issue 38 --] - ${propdef.queryable?string} - ${propdef.orderable?string} - + + +${absurl(url.context)}${node.icon16} +[/@entry] [/#macro] @@ -283,67 +252,303 @@ ${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node. [#if filter == "*" || filter?index_of(value) != -1 || filter?matches(value,'i')][#nested][/#if] [/#macro] -[#macro prop name value type] -[#if type == "String"] -${value} -[#elseif type == "Integer"] -${value?c} -[#elseif type == "Decimal"] -${value?c} -[#elseif type == "Boolean"] -${value?string} -[#elseif type == "DateTime"] -${xmldate(value)} +[#macro prop name node type] +[#-- TODO: Freemarker doesn't support NULL - better workaround required --] +[#assign value=cmisproperty(node, name)!"__N_U_L_L__"/] +[#if value?is_string && value == "__N_U_L_L__"] +[@propnull name type/] +[#else] +[@propvalue name value type/] +[/#if] +[/#macro] + +[#macro propvalue name value type] +[#if type == "STRING"] +[@stringvalue value/] +[#elseif type == "INTEGER"] +[@integervalue value/] +[#elseif type == "DECIMAL"] +[@decimalvalue value/] +[#elseif type == "BOOLEAN"] +[@booleanvalue value/] +[#elseif type == "DATETIME"] +[@datetimevalue value/] [#elseif type == "URI"] -${value} +[@urivalue value/] [#elseif type == "ID"] -${value} +[@idvalue value/] [#-- TODO: remaining property types --] [/#if] [/#macro] [#macro propnull name type] -[#if type == "String"] - -[#elseif type == "Integer"] - -[#elseif type == "Decimal"] - -[#elseif type == "Boolean"] - -[#elseif type == "DateTime"] - +[#if type == "STRING"] + +[#elseif type == "INTEGER"] + +[#elseif type == "DECIMAL"] + +[#elseif type == "BOOLEAN"] + +[#elseif type == "DATETIME"] + [#elseif type == "URI"] - + [#elseif type == "ID"] - + [#-- TODO: remaining property types --] [/#if] [/#macro] -[#-- TODO: spec issue 40 --] -[#macro cmisBaseType rootType] -[#if rootType = "DOCUMENT_OBJECT_TYPE"]document[#elseif rootType = "FOLDER_OBJECT_TYPE"]folder[#elseif rootType = "RELATIONSHIP_OBJECT_TYPE"]relationship[#elseif rootType = "POLICY_OBJECT_TYPE"]policy[#else][/#if][/#macro] -[#-- TODO: spec issue 37 --] -[#macro cmisContentStreamAllowed allowed] -[#if allowed = "NOT_ALLOWED"]notallowed[#elseif allowed = "ALLOWED"]allowed[#elseif allowed = "REQUIRED"]required[#else][/#if][/#macro] +[#-- --] +[#-- CMIS Values --] +[#-- --] -[#-- TODO: spec issue 37 --] -[#macro cmisCardinality cardinality] -[#if cardinality = "SINGLE_VALUED"]Single[#elseif cardinality = "MULTI_VALUED"]Multi[#else][/#if][/#macro] +[#macro stringvalue value]${value}[/#macro] +[#macro integervalue value]${value?c}[/#macro] +[#macro decimalvalue value]${value?c}[/#macro] +[#macro booleanvalue value]${value?string}[/#macro] +[#macro datetimevalue value]${xmldate(value)}[/#macro] +[#macro urivalue value]${value}[/#macro] +[#macro idvalue value]${value}[/#macro] -[#-- TODO: spec issue 37/38 --] -[#macro cmisUpdatability updatability] -[#if updatability = "READ_ONLY"]ro[#elseif updatability = "READ_AND_WRITE"]rw[#elseif updatability = "READ_AND_WRITE_WHEN_CHECKED_OUT"]checkedout[/#if][/#macro] -[#-- TODO: spec issue 39 --] -[#macro cmisChoices choices] +[#-- --] +[#-- ATOM Entry for Type Definition --] +[#-- --] + +[#macro typedef typedef includeProperties=true includeInheritedProperties=true ns=""] +[@entry ns=ns] +${person.properties.userName} +${typedef.objectTypeId} [#-- TODO --] +urn:uuid:type-${typedef.objectTypeId} + +[@typedefCMISLinks typedef/] +[#if typedef.description??]${typedef.description?xml}[#else]${typedef.objectTypeDisplayName?xml}[/#if] +${typedef.objectTypeDisplayName} +${xmldate(date)} [#-- TODO --] +[@typedefCMISProps typedef includeProperties/] + +[/@entry] +[/#macro] + +[#macro typedefCMISLinks typedef] + +[#if typedef.parentTypeId??] + +[/#if] + + + +[/#macro] + +[#macro typedefCMISProps typedef includeProperties=true includeInheritedProperties=true] +[#if typedef.rootTypeId.toString() = "document"] +[@documenttypedefCMISProps typedef includeProperties includeInheritedProperties/] +[#elseif typedef.rootTypeId.toString() = "folder"] +[@foldertypedefCMISProps typedef includeProperties includeInheritedProperties/] +[#elseif typedef.rootTypeId.toString() = "relationship"] +[@relationshiptypedefCMISProps typedef includeProperties includeInheritedProperties/] +[#elseif typedef.rootTypeId.toString() = "policy"] +[@policytypedefCMISProps typedef includeProperties includeInheritedProperties/] +[/#if] +[/#macro] + +[#macro documenttypedefCMISProps typedef includeProperties=true includeInheritedProperties=true] + + [@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/] + ${typedef.versionable?string} + ${typedef.contentStreamAllowed.label} + +[/#macro] + +[#macro foldertypedefCMISProps typedef includeProperties=true includeInheritedProperties=true] + + [@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/] + +[/#macro] + +[#macro relationshiptypedefCMISProps typedef includeProperties=true includeInheritedProperties=true] + + [@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/] + [#-- TODO: source and target types --] + +[/#macro] + +[#macro policytypedefCMISProps typedef includeProperties=true includeInheritedProperties=true] + + [@objecttypedefCMISProps typedef includeProperties includeInheritedProperties/] + +[/#macro] + +[#macro objecttypedefCMISProps typedef includeProperties=true includeInheritedProperties=true] + ${typedef.objectTypeId} + ${typedef.objectTypeQueryName} + [#if typedef.objectTypeDisplayName??]${typedef.objectTypeDisplayName?xml}[/#if] + ${typedef.rootTypeId} [#-- TODO: remove spec issue 36 --] + ${typedef.rootTypeQueryName} +[#if typedef.parentTypeId??] + ${typedef.parentTypeId} +[/#if] + [#if typedef.description??]${typedef.description?xml}[/#if] + ${typedef.creatable?string} + ${typedef.fileable?string} + ${typedef.queryable?string} + ${typedef.controllable?string} + ${typedef.includedInSupertypeQuery?string} + [#if includeProperties] + [#list typedef.propertyDefinitions?values as propdef] + [#if includeInheritedProperties || !propdef.inherited] + [@propdefCMISProps propdef/] + [/#if] + [/#list] + [/#if] +[/#macro] + +[#macro propdefCMISProps propdef] +[#if propdef.propertyType == "BOOLEAN"] +[@booleanpropdefCMISProps propdef/] +[#elseif propdef.propertyType == "ID"] +[@idpropdefCMISProps propdef/] +[#elseif propdef.propertyType == "INTEGER"] +[@integerpropdefCMISProps propdef/] +[#elseif propdef.propertyType == "DATETIME"] +[@datetimepropdefCMISProps propdef/] +[#elseif propdef.propertyType == "DECIMAL"] +[@decimalpropdefCMISProps propdef/] +[#elseif propdef.propertyType == "HTML"] +[@htmlpropdefCMISProps propdef/] +[#elseif propdef.propertyType == "STRING"] +[@stringpropdefCMISProps propdef/] +[#elseif propdef.propertyType == "URI"] +[@uripropdefCMISProps propdef/] +[#elseif propdef.propertyType == "XML"] +[@xmlpropdefCMISProps propdef/] +[/#if] +[/#macro] + +[#macro booleanpropdefCMISProps propdef] + +[@abstractpropdefCMISProps propdef/] + +[/#macro] + +[#macro idpropdefCMISProps propdef] + +[@abstractpropdefCMISProps propdef/] + +[/#macro] + +[#macro integerpropdefCMISProps propdef] + +[@abstractpropdefCMISProps propdef/] +[#-- TODO: minValue, maxValue --] + +[/#macro] + +[#macro datetimepropdefCMISProps propdef] + +[@abstractpropdefCMISProps propdef/] + +[/#macro] + +[#macro decimalpropdefCMISProps propdef] + +[@abstractpropdefCMISProps propdef/] + +[/#macro] + +[#macro htmlpropdefCMISProps propdef] + +[@abstractpropdefCMISProps propdef/] + +[/#macro] + +[#macro stringpropdefCMISProps propdef] + +[@abstractpropdefCMISProps propdef/] +[#if propdef.maximumLength != -1] +${propdef.maximumLength} +[/#if] + +[/#macro] + +[#macro uripropdefCMISProps propdef] + +[@abstractpropdefCMISProps propdef/] + +[/#macro] + +[#macro xmlpropdefCMISProps propdef] + +[@abstractpropdefCMISProps propdef/] +[#-- TODO: scheme, uri --] + +[/#macro] + +[#macro abstractpropdefCMISProps propdef] + ${propdef.propertyName} + ${propdef.propertyId} + [#if propdef.displayName??]${propdef.displayName?xml}[/#if] +[#if propdef.description??] + ${propdef.description?xml} +[/#if] + ${propdef.propertyType.label} + ${propdef.cardinality.label} + ${propdef.updatability.label} + ${propdef.inherited?string} + ${propdef.required?string} + ${propdef.queryable?string} + ${propdef.orderable?string} + [@cmisChoices propdef.choices propdef.propertyType/] + ${propdef.openChoice?string} +[#if propdef.defaultValue??] + [#-- TODO: defaults for HTML and XML property types --] + ${propdef.defaultValue} +[/#if] +[/#macro] + +[#macro cmisChoices choices type] [#if choices?exists] [#list choices as choice] -${choice.value} -[@cmisChoices choice.children/] - +[#if type == "STRING"] + +[@cmisChoices choice.children type/] +[@stringvalue choice.value/] + +[#elseif type == "INTEGER"] + +[@cmisChoices choice.children type/] +[@stringvalue choice.value/] + +[#elseif type == "DECIMAL"] + +[@cmisChoices choice.children type/] +[@stringvalue choice.value/] + +[#elseif type == "BOOLEAN"] + +[@cmisChoices choice.children type/] +[@stringvalue choice.value/] + +[#elseif type == "DATETIME"] + +[@cmisChoices choice.children type/] +[@stringvalue choice.value/] + +[#elseif type == "URI"] + +[@cmisChoices choice.children type/] +[@stringvalue choice.value/] + +[#elseif type == "ID"] + +[@cmisChoices choice.children type/] +[@stringvalue choice.value/] + +[#-- TODO: remaining property types --] +[/#if] [/#list] [/#if] [/#macro] @@ -351,3 +556,9 @@ ${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node. [#-- Helper to render Alfresco content type to Atom content type --] [#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 Alfresco content stream link --] +[#macro contentlink node]${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/content[#if node.properties.name??].${encodeuri(node.properties.name)}[/#if][/#macro] + +[#-- Helper to render Alfresco service document link --] +[#macro servicelink]${absurl(url.serviceContext)}/api/repository[/#macro] \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/cmis/atomfeed.lib.atom.ftl b/config/alfresco/templates/webscripts/org/alfresco/cmis/atomfeed.lib.atom.ftl index bc4b807812..9f37bbec8f 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/cmis/atomfeed.lib.atom.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/cmis/atomfeed.lib.atom.ftl @@ -1,5 +1,16 @@ [#ftl] +[#-- --] +[#-- ATOM Feed --] +[#-- --] + +[#macro feed ns=""] + +[#nested] + +[/#macro] + + [#-- --] [#-- ATOM Feed (generic) --] [#-- --] @@ -20,15 +31,15 @@ [#-- ATOM Feed for Node --] [#-- --] -[#macro node node] +[#macro node node title=""] ${node.properties.creator!""} Alfresco (${server.edition}) ${absurl(url.context)}/images/logo/AlfrescoLogo16.ico -urn:uuid:${node.id} +urn:uuid:${node.id}[#if title != ""]-${title}[/#if] [#nested] [#-- NOTE: Custom links --] -${node.name} +${node.name}[#if title != ""] ${title?capitalize}[/#if] ${xmldate(node.properties.modified)} [/#macro] @@ -38,9 +49,9 @@ [#-- --] [#macro hasMore more] -[#if more?is_string && more = "true"] +[#if more?is_boolean && more] true -[#elseif more?is_string && more = "false"] +[#elseif more?is_boolean && !more] false [#else] ${more.hasNextPage?string} diff --git a/config/alfresco/templates/webscripts/org/alfresco/cmis/ns.lib.atom.ftl b/config/alfresco/templates/webscripts/org/alfresco/cmis/ns.lib.atom.ftl index 7d3a5e8e4d..435d4bc84a 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/cmis/ns.lib.atom.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/cmis/ns.lib.atom.ftl @@ -4,6 +4,6 @@ [#macro cmisNS]http://www.cmis.org/2008/05[/#macro] [#macro alfNS]http://www.alfresco.org[/#macro] [#macro opensearchNS]http://a9.com/-/spec/opensearch/1.1/[/#macro] -[#macro serviceNS]xmlns="[@appNS/]" xmlns:atom="[@atomNS/]" xmlns:cmis="[@cmisNS/]" [#-- TODO: custom ns xmlns:alf="[@alfNS/]" --][/#macro] -[#macro feedNS]xmlns="[@atomNS/]" xmlns:app="[@appNS/]" xmlns:cmis="[@cmisNS/]" [#-- xmlns:alf="[@alfNS/]" xmlns:opensearch="[@opensearchNS/]" --][/#macro] -[#macro entryNS]xmlns="[@atomNS/]" xmlns:app="[@appNS/]" xmlns:cmis="[@cmisNS/]" [#-- xmlns:alf="[@alfNS/]" --][/#macro] \ No newline at end of file +[#macro serviceNS]xmlns="[@appNS/]" xmlns:atom="[@atomNS/]" xmlns:cmis="[@cmisNS/]" xmlns:alf="[@alfNS/]"[/#macro] +[#macro feedNS]xmlns="[@atomNS/]" xmlns:app="[@appNS/]" xmlns:cmis="[@cmisNS/]" xmlns:alf="[@alfNS/]" xmlns:opensearch="[@opensearchNS/]"[/#macro] +[#macro entryNS]xmlns="[@atomNS/]" xmlns:app="[@appNS/]" xmlns:cmis="[@cmisNS/]" xmlns:alf="[@alfNS/]"[/#macro] \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/cmis/test.post.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/cmis/test.post.desc.xml new file mode 100644 index 0000000000..7a81394977 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/cmis/test.post.desc.xml @@ -0,0 +1,8 @@ + + CMIS Test Harness + Execute a series of tests against a CMIS server + /api/cmis/test?url={serviceUrl}&user={user?}&args={args?}&validate={validate?}&trace={trace?}&tests={tests?} + none + + CMIS + \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/paging.lib.atom.ftl b/config/alfresco/templates/webscripts/org/alfresco/paging.lib.atom.ftl index e16383b870..0aef2c7560 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/paging.lib.atom.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/paging.lib.atom.ftl @@ -33,7 +33,7 @@ [#macro opensearch cursor] [#-- NOTE: this macro requires the definition of xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" in --] [#-- the enclosing document --] -[#-- TODO: custom ns ${cursor.totalRows} --] -[#-- TODO: custom ns ${cursor.startRow} --] -[#-- TODO: custom ns ${cursor.pageSize} --] +${cursor.totalRows} +${cursor.startRow} +${cursor.pageSize} [/#macro] diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.atom.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.atom.ftl index 790aacc6b0..26e6a79334 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.atom.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.atom.ftl @@ -2,30 +2,37 @@ [#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] - + ${server.name} ${server.id} ${server.name} + self [#-- TODO --] Alfresco Alfresco Repository (${server.edition}) - ${server.version} + ${server.version} + ${absurl(url.serviceContext)}/api/path/${encodeuri(defaultRootFolderPath)}/children true false false true + ${pwcSearchable?string} ${allVersionsSearchable?string} - [@capabilityJoin joinSupport/] - [@capabilityFullText fullTextSupport/] + ${querySupport} + ${joinSupport} + ${fullTextSupport} ${cmisVersion} - + + root collection + + root collection @@ -34,19 +41,17 @@ unfiled collection - + + type collection + + [#-- TODO: wait for 0.5 spec --] + type collection + [#-- TODO: --] query collection - - -[#macro capabilityJoin join] -[#if join = "NO_JOIN_SUPPORT"]noJoin[#elseif join = "INNER_JOIN_SUPPORT"]innerOnly[#elseif join = "INNER_AND_OUTER_JOIN_SUPPORT"]innerAndOuter[/#if][/#macro] - -[#macro capabilityFullText fulltext] -[#if fulltext = "NO_FULL_TEXT"]none[#elseif fulltext = "FULL_TEXT_ONLY"]fulltextonly[#elseif fulltext = "FULL_TEXT_AND_STRUCTURED"]fulltextandstructured[/#if][/#macro] diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.desc.xml index 189cd08383..274d660cd4 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.desc.xml +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.desc.xml @@ -4,6 +4,6 @@ /api/repository /api/cmis - none + user CMIS \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.html.ftl index 117428057e..b5658ba287 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.html.ftl @@ -2,13 +2,13 @@ Alfresco CMIS v${cmisVersion} - + - +
AlfrescoAlfresco CMIS v${cmisVersion} (REST Binding)Alfresco CMIS v${cmisVersion}

@@ -27,35 +27,58 @@
REST Binding - + +
Alfresco's Content Repository provides the CMIS REST binding, an extension of the Atom Publishing Protocol. - All CMIS services are implemented as Web Scripts, - therefore support all Web Script capabilities such as authentication, content negotiation, tunelling etc.
Alfresco's Content Repository provides the CMIS REST v${cmisVersion} binding, an extension of the Atom Publishing Protocol. + All CMIS services are implemented as Web Scripts, + therefore support all Web Script capabilities such as authentication, content negotiation, tunelling etc.

- CMIS Services + REST TEST - + + + + + + + + + + + + +
A description of each CMIS service is available in the reference documentation.
The following test harness exercises the CMIS REST binding. By default, its parameters are setup to this + repository, although any CMIS REST provider may be tested.
Service URI:
Username/Password:
Validate Responses:
Trace Request/Responses:
Argument Style:
Tests (use * for wildcard in name):
(<#list tests as test>${test}<#if test_has_next>, )
+
+ Web Services Binding + +
Alfresco's Content Repository provides the CMIS Web Services v${cmisVersion} binding as defined by the following + WSDL.

- CMIS Repository Information + Alfresco Repository Information - +
(also available as an APP Service Document)
(also available as an CMIS/APP Service Document)

+ + - - - + + + + +
Repository Id:${server.id}
Repository Name:${server.name}
Repository Relationship:Self
Repository Description:[none]
Vendor Name:Alfresco
Product Name:Alfresco Repository (${server.edition})
Product Version:${server.version}
Root Folder Id:${absurl(url.serviceContext)}/api/path/${encodeuri(defaultRootFolderPath)}/children
Multifiling:true
Unfiling:false
VersionSpecificFiling:false
PWCUpdateable:true
AllVersionsSearchable:false
Join:noJoin
FullText:fulltextandstructured
PWCSearchable:${pwcSearchable?string}
AllVersionsSearchable:${allVersionsSearchable?string}
Query:${querySupport}
Join:${joinSupport}
FullText:${fullTextSupport}
VersionsSupported:${cmisVersion}
repositorySpecificInformation:[none]
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.js index 75f542dd78..588be8af13 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.js @@ -1,5 +1,10 @@ +var testRunner = Packages.org.alfresco.repo.cmis.rest.test.CMISTestRunner(); +model.tests = testRunner.getTestNames("*"); model.cmisVersion = cmis.version; +model.defaultRootFolder = cmis.defaultRootFolder; model.defaultRootFolderPath = cmis.defaultRootFolderPath; +model.querySupport = cmis.querySupport.label; +model.joinSupport = cmis.joinSupport.label; +model.fullTextSupport = cmis.fullTextSearchSupport.label; +model.pwcSearchable = cmis.pwcSearchable; model.allVersionsSearchable = cmis.allVersionsSearchable; -model.joinSupport = cmis.joinSupport; -model.fullTextSupport = cmis.fullTextSearchSupport; \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.atomfeed.ftl index ce6ef61329..787ccc36c2 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.atomfeed.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.atomfeed.ftl @@ -10,18 +10,16 @@ [#-- TODO: uuid --] [@feedLib.generic "urn:uuid:resultset" "Result set for ${statement}" "${person.properties.userName}"] - [@pagingLib.links cursor=cursor/] + [@pagingLib.links cursor/] [/@feedLib.generic] [#assign rs = cmisresultset(resultset)] [#list rs.rows as row] - - [@entryLib.row row/] - +[@entryLib.row row/] [/#list] -[@feedLib.hasMore more=cursor/] -[@pagingLib.opensearch cursor=cursor/] +[@feedLib.hasMore cursor/] +[@pagingLib.opensearch cursor/] diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.cmissqlquery.js b/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.cmisquery.js similarity index 97% rename from config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.cmissqlquery.js rename to config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.cmisquery.js index 3c0bc8717e..dd9b7f714d 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.cmissqlquery.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/search/query.post.cmisquery.js @@ -10,7 +10,7 @@ script: // false // - // XML parsing need to be moved to Java + // TODO: XML parsing need to be moved to Java function ltrim(str){ return str.replace(/^\s+/, ''); diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.atomfeed.ftl index e8dc4a612b..dceb8f4622 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.atomfeed.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.atomfeed.ftl @@ -9,18 +9,16 @@ [@feedLib.generic "urn:uuid:checkedout" "Checked out Documents" "${person.properties.userName}"] - [@pagingLib.links cursor=cursor/] + [@pagingLib.links cursor/] [/@feedLib.generic] [#list results as child] - [#if child.isDocument] - [@entryLib.pwc node=child/] + [@entryLib.pwc child filter/] [/#if] - [/#list] -[@feedLib.hasMore more=cursor/] +[@feedLib.hasMore cursor/] diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.desc.xml index eb8dc04b34..5e81b387ef 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.desc.xml +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.desc.xml @@ -1,7 +1,7 @@ Checked-out Documents Retrieve list of documents that are checked-out - /api/checkedout + /api/checkedout?folderId={folderId?}&includeDescendants={includeDescendants?}&filter={filter?}&skipCount={skipCount?}&maxItems={maxItems?} user CMIS diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.js index 71aa2b6965..1fa30db4d7 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.get.js @@ -22,10 +22,15 @@ script: } } // NOTE: includeDescendants is an extension of CMIS - model.includeDescendants = (args.includeDescendants == "true") ? true : false;; + model.includeDescendants = (args.includeDescendants == "true") ? true : false; - // TODO: property filters - + // property filter + model.filter = cmis.findArg(args.filter, headers["CMIS-filter"]); + if (model.filter === null) + { + model.filter = "*"; + } + // TODO: includeAllowableActions // retrieve checked-out diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.post.atomentry.201.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.post.atomentry.201.ftl index c31c53337c..c271febd25 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.post.atomentry.201.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.post.atomentry.201.ftl @@ -4,8 +4,7 @@ [#compress] - - [@entryLib.pwc node=pwc/] - +[#assign namespace][@nsLib.entryNS/][/#assign] +[@entryLib.pwc node=pwc ns=namespace/] [/#compress] \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.post.atomentry.js b/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.post.atomentry.js index f42bc69216..a9460f3865 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.post.atomentry.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.post.atomentry.js @@ -10,8 +10,8 @@ script: } // extract object id from atom entry - var cmisProperties = entry.getExtension(atom.names.cmis_properties); - var objectId = (cmisProperties !== null) ? cmisProperties.objectId : null; + var object = entry.getExtension(atom.names.cmis_object); + var objectId = (object !== null) ? object.objectId.value : null; if (objectId === null) { status.code = 400; diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.get.atomfeed.ftl index c66965b7ae..d36de0d4c1 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.get.atomfeed.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.get.atomfeed.ftl @@ -8,22 +8,20 @@ -[@feedLib.node node=node] - [@pagingLib.links cursor=cursor/] +[@feedLib.node node "children"] + [@pagingLib.links cursor/] [/@feedLib.node] [#list results as child] - [#if child.isDocument] - [@entryLib.document node=child/] + [@entryLib.document child filter/] [#else] - [@entryLib.folder node=child/] + [@entryLib.folder child filter/] [/#if] - [/#list] -[@feedLib.hasMore more=cursor/] -[@pagingLib.opensearch cursor=cursor/] +[@feedLib.hasMore cursor/] +[@pagingLib.opensearch cursor/] diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.get.js index c1e38fa576..c429108376 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.get.js @@ -21,7 +21,13 @@ script: status.redirect = true; break script; } - // TODO: property filters + + // property filter + model.filter = cmis.findArg(args.filter, headers["CMIS-filter"]); + if (model.filter === null) + { + model.filter = "*"; + } // retrieve children var page = paging.createPageOrWindow(args, headers); diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.post.atom.js b/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.post.atom.js index b336cafc2d..40381355f0 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.post.atom.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.post.atom.js @@ -31,13 +31,13 @@ script: var description = entry.summary; var updated = entry.updated; var author = (entry.author !== null) ? entry.author.name : null; - var cmisProperties = entry.getExtension(atom.names.cmis_properties); - var objectType = (cmisProperties !== null) ? cmisProperties.objectType : null; + var object = entry.getExtension(atom.names.cmis_object); + var typeId = (object !== null) ? object.objectTypeId.value : null; // create the item // TODO: author/updated/id - if (objectType === null || objectType.toLowerCase() == "document") + if (typeId === null || typeId.toLowerCase() == "document") { // TODO: objectTypeId to Alfresco content type var node = model.parent.createFile(name); @@ -47,7 +47,7 @@ script: // write entry content if (entry.content != null) { - if (entry.contentType !== null && entry.contentType == "MEDIA") + if (entry.contentType != null && entry.contentType == "MEDIA") { node.properties.content.write(entry.contentStream); } @@ -64,7 +64,7 @@ script: // TODO: versioningState argument (CheckedOut/CheckedInMinor/CheckedInMajor) } - else if (objectType.toLowerCase() == "folder") + else if (typeId.toLowerCase() == "folder") { // TODO: objectTypeId to Alfresco content type var node = model.parent.createFolder(name); @@ -76,7 +76,7 @@ script: else { status.code = 400; - status.message = "CMIS object type " + objectType + " not understood"; + status.message = "CMIS object type " + typeId + " not understood"; status.redirect = true; break script; } diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.post.atomentry.201.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.post.atomentry.201.ftl index 84a13506f1..0245ef2720 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.post.atomentry.201.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/children.post.atomentry.201.ftl @@ -4,13 +4,12 @@ [#compress] +[#assign namespace][@nsLib.entryNS/][/#assign] - - [#if node.isDocument] - [@entryLib.document node=node/] - [#else] - [@entryLib.folder node=node/] - [/#if] - +[#if node.isDocument] + [@entryLib.document node=node ns=namespace/] +[#else] + [@entryLib.folder node=node ns=namespace/] +[/#if] [/#compress] \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.get.atomfeed.ftl index 61e8df147c..b3ec1c03fd 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.get.atomfeed.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.get.atomfeed.ftl @@ -2,29 +2,25 @@ [#import "/org/alfresco/cmis/ns.lib.atom.ftl" as nsLib/] [#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] -[@feedLib.node node] - [@pagingLib.links cursor/] -[/@feedLib.node] +[@feedLib.node node "descendants"/] -[#list results as child] - +[#if depth > 0 || depth == -1] +[#list cmischildren(node, typesFilter) as child] [#if child.isDocument] - [@entryLib.document child filter/] + [@entryLib.document node=child propfilter=propFilter/] [#else] - [@entryLib.folder child filter/] + [@entryLib.folder node=child propfilter=propFilter typesfilter=typeFilter depth=1 maxdepth=depth/] [/#if] - [/#list] +[/#if] -[@feedLib.hasMore cursor/] -[@pagingLib.opensearch cursor/] +[@feedLib.hasMore false/] -[/#compress] \ No newline at end of file +[/#compress] diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.get.js index b1f34af635..bdcabb9c89 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.get.js @@ -21,6 +21,7 @@ script: status.redirect = true; break script; } + // property filter model.filter = cmis.findArg(args.filter, headers["CMIS-filter"]); if (model.filter === null) @@ -28,10 +29,7 @@ script: model.filter = "*"; } - // TODO: retrieve descendants instead - // retrieve children - var page = paging.createPageOrWindow(args, headers); - var paged = cmis.queryChildren(model.node, model.types, page); - model.results = paged.results; - model.cursor = paged.cursor; + // depth + var depth = cmis.findArg(args.depth, headers["CMIS-depth"]); + model.depth = (depth === null) ? 1 : parseInt(depth); } diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.post.atom.js b/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.post.atom.js index f745b7d27d..770a967192 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.post.atom.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.post.atom.js @@ -33,13 +33,13 @@ script: var description = entry.summary; var updated = entry.updated; var author = (entry.author !== null) ? entry.author.name : null; - var cmisProperties = entry.getExtension(atom.names.cmis_properties); - var objectType = (cmisProperties !== null) ? cmisProperties.objectType : null; + var object = entry.getExtension(atom.names.cmis_object); + var typeId = (object !== null) ? object.objectTypeId.value : null; // create the item // TODO: author/updated/id - if (objectType === null || objectType.toLowerCase() == "document") + if (typeId === null || typeId.toLowerCase() == "document") { // TODO: objectTypeId to Alfresco content type var node = model.parent.createFile(name); @@ -66,7 +66,7 @@ script: // TODO: versioningState argument (CheckedOut/CheckedInMinor/CheckedInMajor) } - else if (objectType.toLowerCase() == "folder") + else if (typeId.toLowerCase() == "folder") { // TODO: objectTypeId to Alfresco content type var node = model.parent.createFolder(name); @@ -78,7 +78,7 @@ script: else { status.code = 400; - status.message = "CMIS object type " + objectType + " not understood"; + status.message = "CMIS object type " + typeId + " not understood"; status.redirect = true; break script; } diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.post.atomentry.201.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.post.atomentry.201.ftl index 84a13506f1..a9225b7edd 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.post.atomentry.201.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/descendants.post.atomentry.201.ftl @@ -5,12 +5,10 @@ - - [#if node.isDocument] - [@entryLib.document node=node/] - [#else] - [@entryLib.folder node=node/] - [/#if] - +[#if node.isDocument] + [@entryLib.document node ns=[@nsLib.entryNS/]/] +[#else] + [@entryLib.folder node ns=[@nsLib.entryNS/]/] +[/#if] [/#compress] \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.get.atomentry.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.get.atomentry.ftl index 84a13506f1..6f28e3557c 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.get.atomentry.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.get.atomentry.ftl @@ -4,13 +4,12 @@ [#compress] +[#assign namespace][@nsLib.entryNS/][/#assign] - - [#if node.isDocument] - [@entryLib.document node=node/] - [#else] - [@entryLib.folder node=node/] - [/#if] - +[#if node.isDocument] + [@entryLib.document node=node propfilter=filter ns=namespace/] +[#else] + [@entryLib.folder node=node propfilter=filter ns=namespace/] +[/#if] [/#compress] \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.get.js index 4be2d998a6..bfbe035886 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.get.js @@ -13,5 +13,12 @@ script: } // TODO: handle version?? - // TODO: property filters + + // property filter + model.filter = cmis.findArg(args.filter, headers["CMIS-filter"]); + if (model.filter === null) + { + model.filter = "*"; + } + } diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.put.atomentry.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.put.atomentry.ftl index 7aa5ead762..0245ef2720 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.put.atomentry.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/item.put.atomentry.ftl @@ -4,13 +4,12 @@ [#compress] +[#assign namespace][@nsLib.entryNS/][/#assign] - - [#if node.isDocument] - [@entryLib.document node=node/] - [#else] - [@entryLib.folder node=node/] - [/#if] - +[#if node.isDocument] + [@entryLib.document node=node ns=namespace/] +[#else] + [@entryLib.folder node=node ns=namespace/] +[/#if] [/#compress] \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.atomfeed.ftl index 237dae3b5b..6abb45b382 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.atomfeed.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.atomfeed.ftl @@ -8,9 +8,9 @@ -[@feedLib.node node=node/] -[@parent node=node.parent recurse=returnToRoot/] -[@feedLib.hasMore more="false"/] +[@feedLib.node node "parent"/] +[@parent node.parent returnToRoot/] +[@feedLib.hasMore false/] @@ -18,11 +18,9 @@ [#macro parent node recurse=false] [#if node?exists && node.isContainer] - - [@entryLib.folder node=node/] - + [@entryLib.folder node filter/] [#if recurse && node.id != rootNode.id] - [@parent node=node.parent recurse=true/] + [@parent node.parent true/] [/#if] [/#if] [/#macro] diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.desc.xml index f0421a4d9a..9399944bb4 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.desc.xml +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.desc.xml @@ -1,8 +1,8 @@ Retrieve Parent Folder Retrieve parent folder - /api/node/{store_type}/{store_id}/{id}/parent?returnToRoot={returnToRoot} - /api/path/{store_type}/{store_id}/{id}/parent?returnToRoot={returnToRoot} + /api/node/{store_type}/{store_id}/{id}/parent?returnToRoot={returnToRoot}&filter={filter?} + /api/path/{store_type}/{store_id}/{id}/parent?returnToRoot={returnToRoot}&filter={filter?} guest argument CMIS diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.js index 0e9a92b2b8..7d292b61b6 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parent.get.js @@ -12,7 +12,12 @@ script: break script; } - // TODO: property filters + // property filter + model.filter = cmis.findArg(args.filter, headers["CMIS-filter"]); + if (model.filter === null) + { + model.filter = "*"; + } // retrieve parent var returnToRoot = cmis.findArg(args.returnToRoot, headers["CMIS-returnToRoot"]); diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.atomfeed.ftl index 237dae3b5b..d209f9e422 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.atomfeed.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.atomfeed.ftl @@ -8,9 +8,9 @@ -[@feedLib.node node=node/] -[@parent node=node.parent recurse=returnToRoot/] -[@feedLib.hasMore more="false"/] +[@feedLib.node node "parents"/] +[@parent node.parent returnToRoot/] +[@feedLib.hasMore false/] @@ -18,11 +18,9 @@ [#macro parent node recurse=false] [#if node?exists && node.isContainer] - - [@entryLib.folder node=node/] - + [@entryLib.folder node filter/] [#if recurse && node.id != rootNode.id] - [@parent node=node.parent recurse=true/] + [@parent node.parent true/] [/#if] [/#if] [/#macro] diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.desc.xml index c3acecb9b5..0af39ab785 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.desc.xml +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.desc.xml @@ -2,8 +2,8 @@ Retrieve Parent Folders Retrieve parent folders (primary and secondary) - /api/node/{store_type}/{store_id}/{id}/parents - /api/path/{store_type}/{store_id}/{id}/parents + /api/node/{store_type}/{store_id}/{id}/parents?filter={filter?} + /api/path/{store_type}/{store_id}/{id}/parents?filter={filter?} guest argument CMIS diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.js index 4c104b86f8..06fcd31064 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/parents.get.js @@ -12,7 +12,12 @@ script: break script; } - // TODO: property filters + // property filter + model.filter = cmis.findArg(args.filter, headers["CMIS-filter"]); + if (model.filter === null) + { + model.filter = "*"; + } // TODO: check returnToRoot is required for getDocumentParents // retrieve parent diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.get.atomentry.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.get.atomentry.ftl index 9962c284a6..9c71e25db3 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.get.atomentry.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.get.atomentry.ftl @@ -4,9 +4,6 @@ [#compress] - - - [@entryLib.pwc node=node/] - +[@entryLib.pwc node ns=[@nsLib.entryNS/]/] [/#compress] \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.put.atomentry.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.put.atomentry.ftl index e9c9369725..5eba4bd8c2 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.put.atomentry.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/pwc.put.atomentry.ftl @@ -4,13 +4,12 @@ [#compress] +[#assign namespace][@nsLib.entryNS/][/#assign] - - [#if checkin] - [@entryLib.document node/] - [#else] - [@entryLib.pwc node/] - [/#if] - +[#if checkin] + [@entryLib.document node=node ns=namespace/] +[#else] + [@entryLib.pwc node=node ns=namespace/] +[/#if] [/#compress] \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/type.get.atomentry.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/type.get.atomentry.ftl index d4a5041209..346575b2fd 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/type.get.atomentry.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/type.get.atomentry.ftl @@ -4,8 +4,7 @@ [#compress] -[#-- TODO: spec issue 40 --] - [@entryLib.typedef typedef true includeInheritedProperties/] -[#-- TODO: spec issue 40 --] +[#assign namespace][@nsLib.entryNS/][/#assign] +[@entryLib.typedef typedef=typedef includeProperties=true includeInheritedProperties=includeInheritedProperties ns=namespace/] [/#compress] diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/typechildren.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/typechildren.get.atomfeed.ftl index 6f3decc280..26b0412154 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/typechildren.get.atomfeed.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/typechildren.get.atomfeed.ftl @@ -9,17 +9,15 @@ [@feedLib.generic "urn:uuid:type-${typedef.objectTypeId}-children" "Child types of ${typedef.objectTypeId}" "${person.properties.userName}"] - [@pagingLib.links cursor=cursor/] + [@pagingLib.links cursor/] [/@feedLib.generic] [#list results as child] - - [@entryLib.typedef typedef=child includeProperties=returnPropertyDefinitions/] - +[@entryLib.typedef child returnPropertyDefinitions/] [/#list] -[@feedLib.hasMore more=cursor/] -[@pagingLib.opensearch cursor=cursor/] +[@feedLib.hasMore cursor/] +[@pagingLib.opensearch cursor/] diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/typedescendants.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/typedescendants.get.atomfeed.ftl index 0745bfc1a7..52f77fd2a5 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/typedescendants.get.atomfeed.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/typedescendants.get.atomfeed.ftl @@ -9,17 +9,15 @@ [@feedLib.generic "urn:uuid:type-${typedef.objectTypeId}-descendants" "Descendant types of ${typedef.objectTypeId}" "${person.properties.userName}"] - [@pagingLib.links cursor=cursor/] + [@pagingLib.links cursor/] [/@feedLib.generic] [#list results as child] - - [@entryLib.typedef typedef=child includeProperties=returnPropertyDefinitions/] - +[@entryLib.typedef child returnPropertyDefinitions/] [/#list] -[@feedLib.hasMore more=cursor/] -[@pagingLib.opensearch cursor=cursor/] +[@feedLib.hasMore cursor/] +[@pagingLib.opensearch cursor/] diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/types.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/types.get.atomfeed.ftl index 79d05adde5..5e374ef703 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/types.get.atomfeed.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/types.get.atomfeed.ftl @@ -10,17 +10,15 @@ [#assign title][#if type = "all"]All Types[#else]Type ${type}[/#if][/#assign] [@feedLib.generic "urn:uuid:types-${type}" "${title}" "${person.properties.userName}"] - [@pagingLib.links cursor=cursor/] + [@pagingLib.links cursor/] [/@feedLib.generic] [#list results as child] -[#-- TODO: spec issue 40 --] - [@entryLib.typedef typedef=child includeProperties=returnPropertyDefinitions/] -[#-- TODO: spec issue 40 --] +[@entryLib.typedef child returnPropertyDefinitions/] [/#list] -[@feedLib.hasMore more=cursor/] -[@pagingLib.opensearch cursor=cursor/] +[@feedLib.hasMore cursor/] +[@pagingLib.opensearch cursor/] diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/unfiled.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/unfiled.get.atomfeed.ftl index 923b912f59..ad1e60fc37 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/unfiled.get.atomfeed.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/unfiled.get.atomfeed.ftl @@ -6,7 +6,7 @@ - [@feedLib.generic id="urn:uuid:unfiled" title="Unfiled Documents"/] + [@feedLib.generic "urn:uuid:unfiled" "Unfiled Documents"/] [/#compress] \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/versions.get.atomfeed.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/store/versions.get.atomfeed.ftl index 29f79a5f64..3ef83430a6 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/versions.get.atomfeed.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/versions.get.atomfeed.ftl @@ -8,15 +8,13 @@ -[@feedLib.generic id="urn:uuid:${node.id}-versions" title="Versions of ${node.displayPath}"/] +[@feedLib.generic "urn:uuid:${node.id}-versions" "Versions of ${node.displayPath}"/] [#list nodes as version] - - [@entryLib.version node=version version=versions[version_index]/] - + [@entryLib.version version versions[version_index]/] [/#list] -[@feedLib.hasMore more="false"/] +[@feedLib.hasMore false/] diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/store/versions.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/store/versions.get.js index 879f3f064c..300d6ff363 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/store/versions.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/store/versions.get.js @@ -13,7 +13,12 @@ script: break script; } - // TODO: property filters + // property filter + model.filter = cmis.findArg(args.filter, headers["CMIS-filter"]); + if (model.filter === null) + { + model.filter = "*"; + } // retrieve versions model.versions = model.node.versionHistory; diff --git a/config/alfresco/web-scripts-application-context.xml b/config/alfresco/web-scripts-application-context.xml index 1fe43b5bff..3e98c14093 100644 --- a/config/alfresco/web-scripts-application-context.xml +++ b/config/alfresco/web-scripts-application-context.xml @@ -118,6 +118,13 @@ + + + + + + + @@ -422,17 +429,18 @@ - application/cmisrequest+xml;type=query + application/cmisquery+xml + application/cmisallowableactions+xml - cmissqlquery + cmisquery + application/cmisallowableactions+xml - cmis @@ -446,12 +454,14 @@ + + http://www.cmis.org/2008/05 - properties + object diff --git a/source/java/org/alfresco/repo/cmis/rest/CMISChildrenMethod.java b/source/java/org/alfresco/repo/cmis/rest/CMISChildrenMethod.java new file mode 100644 index 0000000000..da77a3447b --- /dev/null +++ b/source/java/org/alfresco/repo/cmis/rest/CMISChildrenMethod.java @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2005-2007 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 recieved 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.CMISService; +import org.alfresco.cmis.CMISTypesFilterEnum; +import org.alfresco.repo.template.TemplateNode; +import org.alfresco.repo.web.scripts.RepositoryImageResolver; +import org.alfresco.service.ServiceRegistry; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.TemplateImageResolver; + +import freemarker.ext.beans.BeanModel; +import freemarker.template.TemplateMethodModelEx; +import freemarker.template.TemplateModelException; +import freemarker.template.TemplateScalarModel; + +/** + * Custom FreeMarker Template language method. + *

+ * Lists the (CMIS) children of a TemplateNode + *

+ * Usage: cmischildren(TemplateNode node) + * cmischildren(TemplateNode node, String typesFilter) + * + * @author davidc + */ +public class CMISChildrenMethod implements TemplateMethodModelEx +{ + private CMISService cmisService; + private ServiceRegistry serviceRegistry; + private TemplateImageResolver imageResolver; + + /** + * Construct + */ + public CMISChildrenMethod(CMISService cmisService, ServiceRegistry serviceRegistry, RepositoryImageResolver imageResolver) + { + this.cmisService = cmisService; + this.serviceRegistry = serviceRegistry; + this.imageResolver = imageResolver.getImageResolver(); + } + + @SuppressWarnings("unchecked") + public Object exec(List args) throws TemplateModelException + { + TemplateNode[] children = null; + + if (args.size() > 0) + { + Object arg0 = args.get(0); + if (arg0 instanceof BeanModel) + { + // extract node ref + Object wrapped = ((BeanModel)arg0).getWrappedObject(); + if (wrapped != null) + { + if (wrapped instanceof TemplateNode) + { + NodeRef nodeRef = ((TemplateNode)wrapped).getNodeRef(); + CMISTypesFilterEnum typesFilter = CMISTypesFilterEnum.ANY; + if (args.size() > 1) + { + // extract types filter, if specified + Object arg1 = args.get(1); + if (arg1 instanceof TemplateScalarModel) + { + String typesFilterStr = ((TemplateScalarModel)arg1).getAsString(); + if (typesFilterStr != null && typesFilterStr.length() > 0) + { + typesFilter = (CMISTypesFilterEnum)CMISTypesFilterEnum.FACTORY.toEnum(typesFilterStr); + } + } + } + + // query children + NodeRef[] childNodeRefs = cmisService.getChildren(nodeRef, typesFilter); + children = new TemplateNode[childNodeRefs.length]; + for (int i = 0; i < childNodeRefs.length; i++) + { + children[i] = new TemplateNode(childNodeRefs[i], serviceRegistry, imageResolver); + } + } + } + } + } + + return children; + } + +} diff --git a/source/java/org/alfresco/repo/cmis/rest/CMISQueryReader.java b/source/java/org/alfresco/repo/cmis/rest/CMISQueryReader.java index cd24caefd7..c33e863b06 100644 --- a/source/java/org/alfresco/repo/cmis/rest/CMISQueryReader.java +++ b/source/java/org/alfresco/repo/cmis/rest/CMISQueryReader.java @@ -38,6 +38,7 @@ import org.alfresco.web.scripts.FormatReader; import org.alfresco.web.scripts.WebScriptException; import org.alfresco.web.scripts.WebScriptRequest; import org.alfresco.web.scripts.WebScriptResponse; +import org.apache.abdera.ext.cmis.CMISConstants; /** @@ -61,7 +62,7 @@ public class CMISQueryReader implements FormatReader */ public String getSourceMimetype() { - return "application/cmisrequest+xml;type=query"; + return CMISConstants.MIMETYPE_QUERY; } /* (non-Javadoc) diff --git a/source/java/org/alfresco/repo/cmis/rest/CMISScript.java b/source/java/org/alfresco/repo/cmis/rest/CMISScript.java index 252ac23763..a7293c78f1 100644 --- a/source/java/org/alfresco/repo/cmis/rest/CMISScript.java +++ b/source/java/org/alfresco/repo/cmis/rest/CMISScript.java @@ -27,16 +27,17 @@ package org.alfresco.repo.cmis.rest; import java.util.Collection; import java.util.Iterator; +import org.alfresco.cmis.CMISFullTextSearchEnum; +import org.alfresco.cmis.CMISJoinEnum; +import org.alfresco.cmis.CMISQueryEnum; import org.alfresco.cmis.CMISService; -import org.alfresco.cmis.CMISService.TypesFilter; +import org.alfresco.cmis.CMISTypesFilterEnum; import org.alfresco.cmis.dictionary.CMISDictionaryService; import org.alfresco.cmis.dictionary.CMISTypeDefinition; import org.alfresco.cmis.dictionary.CMISTypeId; import org.alfresco.cmis.search.CMISQueryOptions; import org.alfresco.cmis.search.CMISQueryService; import org.alfresco.cmis.search.CMISResultSet; -import org.alfresco.cmis.search.FullTextSearchSupport; -import org.alfresco.cmis.search.JoinSupport; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.repo.jscript.BaseScopableProcessorExtension; import org.alfresco.repo.jscript.ScriptNode; @@ -56,8 +57,6 @@ import org.alfresco.service.cmr.repository.NodeRef; */ public class CMISScript extends BaseScopableProcessorExtension { - private static final TypesFilter defaultTypesFilter = TypesFilter.Any; - private ServiceRegistry services; private Repository repository; private CMISService cmisService; @@ -191,7 +190,7 @@ public class CMISScript extends BaseScopableProcessorExtension */ public String getDefaultTypesFilter() { - return defaultTypesFilter.toString(); + return CMISTypesFilterEnum.FACTORY.defaultLabel(); } /** @@ -202,19 +201,7 @@ public class CMISScript extends BaseScopableProcessorExtension */ public boolean isValidTypesFilter(String typesFilter) { - try - { - TypesFilter.valueOf(typesFilter); - return true; - } - catch(IllegalArgumentException e) - { - return false; - } - catch(NullPointerException e) - { - return false; - } + return CMISTypesFilterEnum.FACTORY.validLabel(typesFilter); } /** @@ -226,16 +213,9 @@ public class CMISScript extends BaseScopableProcessorExtension * @param typesFilter types filter * @return resolved types filter */ - private TypesFilter resolveTypesFilter(String typesFilter) + private CMISTypesFilterEnum resolveTypesFilter(String typesFilter) { - if (isValidTypesFilter(typesFilter)) - { - return TypesFilter.valueOf(typesFilter); - } - else - { - return defaultTypesFilter; - } + return (CMISTypesFilterEnum)CMISTypesFilterEnum.FACTORY.toEnum(typesFilter); } /** @@ -266,7 +246,7 @@ public class CMISScript extends BaseScopableProcessorExtension */ public PagedResults queryChildren(ScriptNode parent, String typesFilter, Page page) { - TypesFilter filter = resolveTypesFilter(typesFilter); + CMISTypesFilterEnum filter = resolveTypesFilter(typesFilter); NodeRef[] children = cmisService.getChildren(parent.getNodeRef(), filter); Cursor cursor = paging.createCursor(children.length, page); @@ -408,7 +388,17 @@ public class CMISScript extends BaseScopableProcessorExtension // // SQL Query // - + + /** + * Can you query the private working copy of a document. + * + * @return + */ + public boolean getPwcSearchable() + { + return cmisQueryService.getPwcSearchable(); + } + /** * Can you query non-latest versions of a document. * @@ -420,13 +410,23 @@ public class CMISScript extends BaseScopableProcessorExtension { return cmisQueryService.getAllVersionsSearchable(); } - + + /** + * Get the query support level. + * + * @return + */ + public CMISQueryEnum getQuerySupport() + { + return cmisQueryService.getQuerySupport(); + } + /** * Get the join support level in queries. * * @return */ - public JoinSupport getJoinSupport() + public CMISJoinEnum getJoinSupport() { return cmisQueryService.getJoinSupport(); } @@ -436,7 +436,7 @@ public class CMISScript extends BaseScopableProcessorExtension * * @return */ - public FullTextSearchSupport getFullTextSearchSupport() + public CMISFullTextSearchEnum getFullTextSearchSupport() { return cmisQueryService.getFullTextSearchSupport(); } diff --git a/source/java/org/alfresco/repo/cmis/rest/CMISTest.java b/source/java/org/alfresco/repo/cmis/rest/CMISTest.java index 1d3d682e68..6f8cbf4867 100644 --- a/source/java/org/alfresco/repo/cmis/rest/CMISTest.java +++ b/source/java/org/alfresco/repo/cmis/rest/CMISTest.java @@ -31,6 +31,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.alfresco.util.Base64; import org.alfresco.util.GUID; import org.alfresco.web.scripts.Format; import org.alfresco.web.scripts.TestWebScriptServer.DeleteRequest; @@ -53,6 +54,7 @@ import org.apache.abdera.model.Feed; import org.apache.abdera.model.Link; import org.apache.abdera.model.Service; import org.apache.abdera.model.Workspace; +import org.apache.abdera.util.Constants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -73,6 +75,7 @@ public class CMISTest extends BaseCMISWebScriptTest protected static String username = "admin"; protected static String password = "admin"; protected static boolean argsAsHeaders = false; + // Logger private static final Log logger = LogFactory.getLog(CMISTest.class); @@ -84,8 +87,7 @@ public class CMISTest extends BaseCMISWebScriptTest private static Entry testsFolder = null; private static Entry testRunFolder = null; - - + @Override protected void setUp() throws Exception @@ -213,7 +215,7 @@ public class CMISTest extends BaseCMISWebScriptTest Entry entry = abdera.parseEntry(new StringReader(xml), null); assertNotNull(entry); assertEquals(name, entry.getTitle()); - assertEquals(name + " (summary)", entry.getSummary()); + //assertEquals(name + " (summary)", entry.getSummary()); CMISProperties props = entry.getExtension(CMISConstants.PROPERTIES); assertEquals("folder", props.getBaseType()); String testFolderHREF = (String)res.getHeader("Location"); @@ -232,13 +234,14 @@ public class CMISTest extends BaseCMISWebScriptTest { String createFile = loadString(atomEntryFile); createFile = createFile.replace("${NAME}", name); + createFile = createFile.replace("${CONTENT}", Base64.encodeBytes(name.getBytes())); Response res = sendRequest(new PostRequest(parent.toString(), createFile, Format.ATOMENTRY.mimetype()), 201, getAtomValidator()); assertNotNull(res); String xml = res.getContentAsString(); Entry entry = abdera.parseEntry(new StringReader(xml), null); assertNotNull(entry); assertEquals(name, entry.getTitle()); - assertEquals(name + " (summary)", entry.getSummary()); + //assertEquals(name + " (summary)", entry.getSummary()); assertNotNull(entry.getContentSrc()); CMISProperties props = entry.getExtension(CMISConstants.PROPERTIES); assertEquals("document", props.getBaseType()); @@ -338,7 +341,7 @@ public class CMISTest extends BaseCMISWebScriptTest Entry document = createDocument(children.getSelfLink().getHref(), "testCreateDocument"); Response documentContentRes = sendRequest(new GetRequest(document.getContentSrc().toString()), 200); String resContent = documentContentRes.getContentAsString(); - assertEquals("test content " + document.getTitle(), resContent); + assertEquals(document.getTitle(), resContent); Feed feedFolderAfter = getFeed(childrenLink.getHref()); int entriesAfter = feedFolderAfter.getEntries().size(); assertEquals(entriesBefore +1, entriesAfter); @@ -361,26 +364,27 @@ public class CMISTest extends BaseCMISWebScriptTest assertEquals("1", resContent); } - public void testCreateDocumentBase64() - throws Exception - { - Entry testFolder = createTestFolder("testCreateDocumentBase64"); - Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); - assertNotNull(childrenLink); - Feed children = getFeed(childrenLink.getHref()); - assertNotNull(children); - int entriesBefore = children.getEntries().size(); - Entry document = createDocument(children.getSelfLink().getHref(), "testCreateDocument", "/cmis/rest/createdocumentBase64.atomentry.xml"); - Response documentContentRes = sendRequest(new GetRequest(document.getContentSrc().toString()), 200); - String testContent = loadString("/cmis/rest/createdocumentBase64.txt"); - String resContent = documentContentRes.getContentAsString(); - assertEquals(testContent, resContent); - Feed feedFolderAfter = getFeed(childrenLink.getHref()); - int entriesAfter = feedFolderAfter.getEntries().size(); - assertEquals(entriesBefore +1, entriesAfter); - Entry entry = feedFolderAfter.getEntry(document.getId().toString()); - assertNotNull(entry); - } + // TODO: Test creation of document via Atom Entry containing plain text (non Base64 encoded) +// public void testCreateDocumentBase64() +// throws Exception +// { +// Entry testFolder = createTestFolder("testCreateDocumentBase64"); +// Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); +// assertNotNull(childrenLink); +// Feed children = getFeed(childrenLink.getHref()); +// assertNotNull(children); +// int entriesBefore = children.getEntries().size(); +// Entry document = createDocument(children.getSelfLink().getHref(), "testCreateDocument", "/cmis/rest/createdocumentBase64.atomentry.xml"); +// Response documentContentRes = sendRequest(new GetRequest(document.getContentSrc().toString()), 200); +// String testContent = loadString("/cmis/rest/createdocumentBase64.txt"); +// String resContent = documentContentRes.getContentAsString(); +// assertEquals(testContent, resContent); +// Feed feedFolderAfter = getFeed(childrenLink.getHref()); +// int entriesAfter = feedFolderAfter.getEntries().size(); +// assertEquals(entriesBefore +1, entriesAfter); +// Entry entry = feedFolderAfter.getEntry(document.getId().toString()); +// assertNotNull(entry); +// } public void testCreateFolder() throws Exception @@ -418,25 +422,25 @@ public class CMISTest extends BaseCMISWebScriptTest Entry testDocumentFromGet = getEntry(testDocument.getSelfLink().getHref()); assertEquals(testDocument.getId(), testDocumentFromGet.getId()); assertEquals(testDocument.getTitle(), testDocumentFromGet.getTitle()); - assertEquals(testDocument.getSummary(), testDocumentFromGet.getSummary()); + //assertEquals(testDocument.getSummary(), testDocumentFromGet.getSummary()); // get something that doesn't exist Response res = sendRequest(new GetRequest(testDocument.getSelfLink().getHref().toString() + GUID.generate()), 404); assertNotNull(res); } - public void testChildren() + public void testGetChildren() throws Exception { // create multiple children - Entry testFolder = createTestFolder("testChildren"); + Entry testFolder = createTestFolder("testGetChildren"); Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); assertNotNull(childrenLink); - Entry document1 = createDocument(childrenLink.getHref(), "testChildren1"); + Entry document1 = createDocument(childrenLink.getHref(), "testGetChildren1"); assertNotNull(document1); - Entry document2 = createDocument(childrenLink.getHref(), "testChildren2"); + Entry document2 = createDocument(childrenLink.getHref(), "testGetChildren2"); assertNotNull(document2); - Entry document3 = createDocument(childrenLink.getHref(), "testChildren3"); + Entry document3 = createDocument(childrenLink.getHref(), "testGetChildren3"); assertNotNull(document3); // checkout one of the children to ensure private working copy isn't included @@ -459,17 +463,17 @@ public class CMISTest extends BaseCMISWebScriptTest assertNull(children.getEntry(pwc.getId().toString())); } - public void testChildrenPaging() + public void testGetChildrenPaging() throws Exception { // create multiple children Set docIds = new HashSet(); - Entry testFolder = createTestFolder("testChildrenPaging"); + Entry testFolder = createTestFolder("testGetChildrenPaging"); Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); assertNotNull(childrenLink); for (int i = 0; i < 15; i++) { - Entry document = createDocument(childrenLink.getHref(), "testChildrenPaging" + i); + Entry document = createDocument(childrenLink.getHref(), "testGetChildrenPaging" + i); assertNotNull(document); docIds.add(document.getId()); } @@ -493,6 +497,10 @@ public class CMISTest extends BaseCMISWebScriptTest // next page Link nextLink = types.getLink("next"); + if (nextCount < 4) + { + assertNotNull(nextLink); + } childrenHREF = (nextLink != null) ? nextLink.getHref() : null; args = null; }; @@ -515,8 +523,9 @@ public class CMISTest extends BaseCMISWebScriptTest // invalid type filter Map args = new HashMap(); args.put("types", "Invalid"); - Response invalidRes = sendRequest(new GetRequest(childrenLink.getHref().toString()).setArgs(args), 400); - assertNotNull(invalidRes); + // TODO: potential spec issue +// Response invalidRes = sendRequest(new GetRequest(childrenLink.getHref().toString()).setArgs(args), 400); +// assertNotNull(invalidRes); // no filter Feed noFilters = getFeed(childrenLink.getHref()); @@ -544,6 +553,92 @@ public class CMISTest extends BaseCMISWebScriptTest assertNotNull(documents.getEntry(document.getId().toString())); } + public void testGetChildrenPropertyFilter() + throws Exception + { + // create children + Entry testFolder = createTestFolder("testGetChildrenPropertyFilter"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink); + Entry document1 = createDocument(childrenLink.getHref(), "testGetChildrenPropertyFilter1"); + assertNotNull(document1); + + { + // get children with all properties + Feed children = getFeed(childrenLink.getHref()); + for (Entry entry : children.getEntries()) + { + CMISProperties props = entry.getExtension(CMISConstants.PROPERTIES); + assertNotNull(props.getObjectId()); + assertNotNull(props.getObjectType()); + } + } + + { + // get children with object_id only + Map args = new HashMap(); + args.put("filter", "OBJECT_ID"); + Feed children = getFeed(childrenLink.getHref(), args); + for (Entry entry : children.getEntries()) + { + CMISProperties props = entry.getExtension(CMISConstants.PROPERTIES); + assertNotNull(props.getObjectId()); + assertNull(props.getObjectType()); + } + } + } + + public void testGetDescendants() + throws Exception + { + // create multiple nested children + Entry testFolder = createTestFolder("testGetDescendants"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink); + Entry document1 = createDocument(childrenLink.getHref(), "testGetDescendants1"); + assertNotNull(document1); + Entry folder2 = createFolder(childrenLink.getHref(), "testGetDescendants2"); + assertNotNull(folder2); + Link childrenLink2 = folder2.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink2); + Entry document3 = createDocument(childrenLink2.getHref(), "testGetDescendants3"); + assertNotNull(document3); + + { + // get descendants (depth = 1, equivalent to getChildren) + Map args = new HashMap(); + args.put("depth", "1"); + Link descendantsLink = testFolder.getLink(CMISConstants.REL_DESCENDANTS); + Feed descendants = getFeed(descendantsLink.getHref(), args); + assertNotNull(descendants); + assertEquals(2, descendants.getEntries().size()); + assertNotNull(descendants.getEntry(document1.getId().toString())); + assertNotNull(descendants.getEntry(folder2.getId().toString())); + + Entry getFolder2 = descendants.getEntry(folder2.getId().toString()); + Entry getFolder2Child = getFolder2.getFirstChild(CMISConstants.NESTED_ENTRY); + assertNull(getFolder2Child); + } + + { + // get nested children + Map args = new HashMap(); + args.put("depth", "2"); + Link descendantsLink = testFolder.getLink(CMISConstants.REL_DESCENDANTS); + Feed descendants = getFeed(descendantsLink.getHref(), args); + assertNotNull(descendants); + assertEquals(2, descendants.getEntries().size()); + assertNotNull(descendants.getEntry(document1.getId().toString())); + assertNotNull(descendants.getEntry(folder2.getId().toString())); + + Entry getFolder2 = descendants.getEntry(folder2.getId().toString()); + List getFolder2Children = getFolder2.getExtensions(CMISConstants.NESTED_ENTRY); + assertNotNull(getFolder2Children); + assertEquals(1, getFolder2Children.size()); + assertEquals(document3.getId(), getFolder2Children.get(0).getId()); + } + } + public void testGetParent() throws Exception { @@ -561,6 +656,8 @@ public class CMISTest extends BaseCMISWebScriptTest assertEquals(1, parent.getEntries().size()); assertEquals(testFolder.getId(), parent.getEntries().get(0).getId()); + // TODO: compare identity using OBJECT_ID property, not atom:id + // ensure there are ancestors 'testParent', "test run folder", "tests folder" and "root folder" Map args = new HashMap(); args.put("returnToRoot", "true"); @@ -574,7 +671,8 @@ public class CMISTest extends BaseCMISWebScriptTest assertEquals(testsFolder.getId(), parentsToRoot.getEntries().get(2).getId()); assertNotNull(parentsToRoot.getEntries().get(2).getLink(CMISConstants.REL_PARENT)); Feed root = getFeed(getRootCollection(getWorkspace(getRepository()))); - assertEquals(root.getId(), parentsToRoot.getEntries().get(3).getId()); + Entry rootEntry = getEntry(root.getLink(CMISConstants.REL_SOURCE).getHref()); + assertEquals(rootEntry.getId(), parentsToRoot.getEntries().get(3).getId()); assertNull(parentsToRoot.getEntries().get(3).getLink(CMISConstants.REL_PARENT)); } @@ -602,13 +700,14 @@ public class CMISTest extends BaseCMISWebScriptTest assertNotNull(parentsToRoot); assertEquals(4, parentsToRoot.getEntries().size()); assertEquals(testFolder.getId(), parentsToRoot.getEntries().get(0).getId()); - assertNotNull(parentsToRoot.getEntries().get(0).getLink(CMISConstants.REL_PARENT)); + //assertNotNull(parentsToRoot.getEntries().get(0).getLink(CMISConstants.REL_PARENT)); assertEquals(testRunFolder.getId(), parentsToRoot.getEntries().get(1).getId()); - assertNotNull(parentsToRoot.getEntries().get(1).getLink(CMISConstants.REL_PARENT)); + //assertNotNull(parentsToRoot.getEntries().get(1).getLink(CMISConstants.REL_PARENT)); assertEquals(testsFolder.getId(), parentsToRoot.getEntries().get(2).getId()); - assertNotNull(parentsToRoot.getEntries().get(2).getLink(CMISConstants.REL_PARENT)); + //assertNotNull(parentsToRoot.getEntries().get(2).getLink(CMISConstants.REL_PARENT)); Feed root = getFeed(getRootCollection(getWorkspace(getRepository()))); - assertEquals(root.getId(), parentsToRoot.getEntries().get(3).getId()); + Entry rootEntry = getEntry(root.getLink(CMISConstants.REL_SOURCE).getHref()); + assertEquals(rootEntry.getId(), parentsToRoot.getEntries().get(3).getId()); assertNull(parentsToRoot.getEntries().get(3).getLink(CMISConstants.REL_PARENT)); } @@ -653,8 +752,15 @@ public class CMISTest extends BaseCMISWebScriptTest // create document for update Entry document = createDocument(childrenLink.getHref(), "testUpdate"); assertNotNull(document); - assertEquals("text/html", document.getContentMimeType().toString()); + String mimetype = (document.getContentMimeType() != null) ? document.getContentMimeType().toString() : null; + if (mimetype != null) + { + assertEquals("text/html", mimetype); + } + // TODO: check for content update allowable action + // if update allowed, perform update, else update and check for appropriate error + // update String updateFile = loadString("/cmis/rest/updatedocument.atomentry.xml"); String guid = GUID.generate(); @@ -667,6 +773,7 @@ public class CMISTest extends BaseCMISWebScriptTest assertEquals(document.getId(), updated.getId()); assertEquals(document.getPublished(), updated.getPublished()); assertEquals("Updated Title " + guid, updated.getTitle()); + // TODO: why is this testing for text/plain? it should be test/html assertEquals("text/plain", updated.getContentMimeType().toString()); Response contentRes = sendRequest(new GetRequest(updated.getContentSrc().toString()), 200); assertEquals("updated content " + guid, contentRes.getContentAsString()); @@ -1144,7 +1251,7 @@ public class CMISTest extends BaseCMISWebScriptTest String query = "SELECT OBJECT_ID, OBJECT_TYPE_ID, NAME FROM DOCUMENT_OBJECT_TYPE " + "WHERE IN_FOLDER('" + testFolderProps.getObjectId() + "') " + "AND NAME = 'apple1' " + - "AND CONTAINS('test content')"; + "AND CONTAINS('apple1')"; String queryReq = queryDoc.replace("${STATEMENT}", query); queryReq = queryReq.replace("${PAGESIZE}", "5"); diff --git a/source/java/org/alfresco/repo/cmis/rest/CMISTypeIdMethod.java b/source/java/org/alfresco/repo/cmis/rest/CMISTypeIdMethod.java index a9f660c33f..39ef522bec 100644 --- a/source/java/org/alfresco/repo/cmis/rest/CMISTypeIdMethod.java +++ b/source/java/org/alfresco/repo/cmis/rest/CMISTypeIdMethod.java @@ -40,7 +40,7 @@ import freemarker.template.TemplateModelException; *

* Retrieve the CMIS Type Id for an Alfresco node *

- * Usage: cmistypeid(TemplaateNode node) + * Usage: cmistypeid(TemplateNode node) * cmistypeid(QName nodeType) * * @author davidc diff --git a/source/java/org/alfresco/repo/cmis/rest/TestRemoteCMIS.java b/source/java/org/alfresco/repo/cmis/rest/TestRemoteCMIS.java deleted file mode 100644 index 2a6a2c8273..0000000000 --- a/source/java/org/alfresco/repo/cmis/rest/TestRemoteCMIS.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2005-2008 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 recieved 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 junit.framework.TestSuite; -import junit.textui.TestRunner; - - -/** - * CMIS API Test Harness - * - * @author davidc - */ -public class TestRemoteCMIS extends CMISTest -{ - - /** - * Execute Unit Tests as client to remote CMIS Server - * - * args[0] = serverUrl - * args[1] = username/password - * args[2] = [params=url|headers] - * - * @param args args - */ - public static void main(String[] args) - { - remote = true; - - if (args.length > 0) - { - repositoryUrl = args[0]; - } - - if (args.length > 1) - { - String[] credentials = args[1].split("/"); - username = credentials[0]; - if (credentials.length > 1) - { - password = credentials[1]; - } - } - - String params = "both"; - if (args.length > 2) - { - String[] paramSegment = args[2].split("="); - if (paramSegment[0].equalsIgnoreCase("params")) - { - params = paramSegment[1].toLowerCase(); - } - } - - // execute cmis tests with url arguments - if (params.equals("both") || params.equals("url")) - { - TestRunner.run(new TestSuite(TestRemoteCMIS.class)); - } - - // execute cmis tests with headers - if (params.equals("both") || params.equals("headers")) - { - argsAsHeaders = true; - TestRunner.run(new TestSuite(TestRemoteCMIS.class)); - } - } - -} diff --git a/source/java/org/alfresco/repo/cmis/rest/BaseCMISWebScriptTest.java b/source/java/org/alfresco/repo/cmis/rest/test/BaseCMISWebScriptTest.java similarity index 99% rename from source/java/org/alfresco/repo/cmis/rest/BaseCMISWebScriptTest.java rename to source/java/org/alfresco/repo/cmis/rest/test/BaseCMISWebScriptTest.java index 3edecf2866..9e634e3770 100644 --- a/source/java/org/alfresco/repo/cmis/rest/BaseCMISWebScriptTest.java +++ b/source/java/org/alfresco/repo/cmis/rest/test/BaseCMISWebScriptTest.java @@ -22,7 +22,7 @@ * the FLOSS exception, and it is also available here: * http://www.alfresco.com/legal/licensing" */ -package org.alfresco.repo.cmis.rest; +package org.alfresco.repo.cmis.rest.test; import java.io.IOException; import java.io.InputStream; diff --git a/source/java/org/alfresco/repo/cmis/rest/test/CMISTest.java b/source/java/org/alfresco/repo/cmis/rest/test/CMISTest.java new file mode 100644 index 0000000000..1fea12d97d --- /dev/null +++ b/source/java/org/alfresco/repo/cmis/rest/test/CMISTest.java @@ -0,0 +1,1289 @@ +/* + * + * 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. + + * Copyright (C) 2005-2008 Alfresco Software Limited. + * 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 recieved 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.test; + +import java.io.PrintStream; +import java.io.StringReader; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import junit.framework.Test; + +import org.alfresco.util.Base64; +import org.alfresco.util.GUID; +import org.alfresco.web.scripts.Format; +import org.alfresco.web.scripts.TestWebScriptServer.DeleteRequest; +import org.alfresco.web.scripts.TestWebScriptServer.GetRequest; +import org.alfresco.web.scripts.TestWebScriptServer.PostRequest; +import org.alfresco.web.scripts.TestWebScriptServer.PutRequest; +import org.alfresco.web.scripts.TestWebScriptServer.Request; +import org.alfresco.web.scripts.TestWebScriptServer.Response; +import org.alfresco.web.scripts.atom.AbderaService; +import org.alfresco.web.scripts.atom.AbderaServiceImpl; +import org.apache.abdera.ext.cmis.CMISCapabilities; +import org.apache.abdera.ext.cmis.CMISConstants; +import org.apache.abdera.ext.cmis.CMISExtensionFactory; +import org.apache.abdera.ext.cmis.CMISObject; +import org.apache.abdera.ext.cmis.CMISRepositoryInfo; +import org.apache.abdera.i18n.iri.IRI; +import org.apache.abdera.model.Collection; +import org.apache.abdera.model.Entry; +import org.apache.abdera.model.Feed; +import org.apache.abdera.model.Link; +import org.apache.abdera.model.Service; +import org.apache.abdera.model.Workspace; + + +/** + * CMIS API Test Harness + * + * @author davidc + */ +public class CMISTest extends BaseCMISWebScriptTest +{ + // Repository Access + private String serviceUrl = "http://localhost:8080/alfresco/service/api/repository"; + + // cached responses + private AbderaService abdera; + private Service service = null; + private String fulltextCapability = null; + private Entry testsFolder = null; + private Entry testRunFolder = null; + + /** + * Sets the Repository Service URL + * + * @param serviceUrl serviceURL + */ + public void setServiceUrl(String serviceUrl) + { + this.serviceUrl = serviceUrl; + } + + @Override + protected void setUp() + throws Exception + { + // setup client atom support + AbderaServiceImpl abderaImpl = new AbderaServiceImpl(); + abderaImpl.afterPropertiesSet(); + abderaImpl.registerExtensionFactory(new CMISExtensionFactory()); + abdera = abderaImpl; + + // Uncomment to change default behaviour of tests + setDefaultRunAs("admin"); +// RemoteServer server = new RemoteServer(); +// server.username = "admin"; +// server.password = "admin"; +// setRemoteServer(server); +// setArgsAsHeaders(false); +// setValidateResponse(false); +// setListener(new CMISTestListener(System.out)); +// setTraceReqRes(true); + + super.setUp(); + } + + /** + * Default Test Listener + */ + public static class CMISTestListener extends BaseWebScriptTestListener implements WebScriptTestListener + { + /** + * Construct + * + * @param writer + */ + public CMISTestListener(PrintStream writer) + { + super(writer); + } + + /* (non-Javadoc) + * @see junit.textui.ResultPrinter#startTest(junit.framework.Test) + */ + @Override + public void startTest(Test test) + { + CMISTest cmisTest = (CMISTest)test; + getWriter().println(); + getWriter().println("*** Test started: " + cmisTest.getName() + " (remote: " + (cmisTest.getRemoteServer() != null) + ", headers: " + cmisTest.getArgsAsHeaders() + ")"); + } + } + + private Service getRepository() + throws Exception + { + if (service == null) + { + Response res = sendRequest(new GetRequest(serviceUrl), 200, getAppValidator()); + String xml = res.getContentAsString(); + assertNotNull(xml); + assertTrue(xml.length() > 0); + + service = abdera.parseService(new StringReader(xml), null); + assertNotNull(service); + Workspace workspace = getWorkspace(service); + CMISRepositoryInfo repoInfo = workspace.getExtension(CMISConstants.REPOSITORY_INFO); + assertNotNull(repoInfo); + CMISCapabilities capabilities = repoInfo.getCapabilities(); + assertNotNull(repoInfo); + fulltextCapability = capabilities.getFullText(); + assertNotNull(fulltextCapability); + } + return service; + } + + private Workspace getWorkspace(Service service) + { + return service.getWorkspaces().get(0); + } + + private Collection getCMISCollection(Workspace workspace, String collectionId) + { + List collections = workspace.getCollections(); + for (Collection collection : collections) + { + String id = collection.getAttributeValue(CMISConstants.COLLECTION_TYPE); + if (id != null && id.equals(collectionId)) + { + return collection; + } + } + return null; + } + + private IRI getRootChildrenCollection(Workspace workspace) + { + Collection root = getCMISCollection(workspace, CMISConstants.COLLECTION_ROOT_CHILDREN); + assertNotNull(root); + IRI rootHREF = root.getHref(); + assertNotNull(rootHREF); + return rootHREF; + } + + private IRI getCheckedOutCollection(Workspace workspace) + { + Collection root = getCMISCollection(workspace, CMISConstants.COLLECTION_CHECKEDOUT); + assertNotNull(root); + IRI rootHREF = root.getHref(); + assertNotNull(rootHREF); + return rootHREF; + } + + private IRI getTypesChildrenCollection(Workspace workspace) + { + Collection root = getCMISCollection(workspace, CMISConstants.COLLECTION_TYPES_CHILDREN); + assertNotNull(root); + IRI rootHREF = root.getHref(); + assertNotNull(rootHREF); + return rootHREF; + } + + private IRI getQueryCollection(Workspace workspace) + { + Collection root = getCMISCollection(workspace, CMISConstants.COLLECTION_QUERY); + assertNotNull(root); + IRI rootHREF = root.getHref(); + assertNotNull(rootHREF); + return rootHREF; + } + + private Entry createFolder(IRI parent, String name) + throws Exception + { + return createFolder(parent, name, "/org/alfresco/repo/cmis/rest/test/createfolder.atomentry.xml"); + } + + private Entry createFolder(IRI parent, String name, String atomEntryFile) + throws Exception + { + String createFolder = loadString(atomEntryFile); + createFolder = createFolder.replace("${NAME}", name); + Response res = sendRequest(new PostRequest(parent.toString(), createFolder, Format.ATOMENTRY.mimetype()), 201, getAtomValidator()); + assertNotNull(res); + String xml = res.getContentAsString(); + Entry entry = abdera.parseEntry(new StringReader(xml), null); + assertNotNull(entry); + assertEquals(name, entry.getTitle()); + //assertEquals(name + " (summary)", entry.getSummary()); + CMISObject object = entry.getExtension(CMISConstants.OBJECT); + assertEquals("folder", object.getBaseType().getValue()); + String testFolderHREF = (String)res.getHeader("Location"); + assertNotNull(testFolderHREF); + return entry; + } + + private Entry createDocument(IRI parent, String name) + throws Exception + { + return createDocument(parent, name, "/org/alfresco/repo/cmis/rest/test/createdocument.atomentry.xml"); + } + + private Entry createDocument(IRI parent, String name, String atomEntryFile) + throws Exception + { + String createFile = loadString(atomEntryFile); + createFile = createFile.replace("${NAME}", name); + createFile = createFile.replace("${CONTENT}", Base64.encodeBytes(name.getBytes())); + Response res = sendRequest(new PostRequest(parent.toString(), createFile, Format.ATOMENTRY.mimetype()), 201, getAtomValidator()); + assertNotNull(res); + String xml = res.getContentAsString(); + Entry entry = abdera.parseEntry(new StringReader(xml), null); + assertNotNull(entry); + assertEquals(name, entry.getTitle()); + //assertEquals(name + " (summary)", entry.getSummary()); + assertNotNull(entry.getContentSrc()); + CMISObject object = entry.getExtension(CMISConstants.OBJECT); + assertEquals("document", object.getBaseType().getValue()); + String testFileHREF = (String)res.getHeader("Location"); + assertNotNull(testFileHREF); + return entry; + } + + private Entry createTestsFolder(IRI rootFolder) + throws Exception + { + // TODO: Convert to query + Feed children = getFeed(rootFolder); + for (Entry child : children.getEntries()) + { + if (child.getTitle().equals("CMIS Tests")) + { + return child; + } + } + + // not found, create it + return createFolder(rootFolder, "CMIS Tests"); + } + + private Entry createTestFolder(String name) + throws Exception + { + if (testRunFolder == null) + { + Service service = getRepository(); + IRI rootFolderHREF = getRootChildrenCollection(getWorkspace(service)); + testsFolder = createTestsFolder(rootFolderHREF); + Link testsChildrenLink = testsFolder.getLink(CMISConstants.REL_CHILDREN); + testRunFolder = createFolder(testsChildrenLink.getHref(), "Test Run " + System.currentTimeMillis()); + } + Link childrenLink = testRunFolder.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink); + Entry testFolder = createFolder(childrenLink.getHref(), name + " " + System.currentTimeMillis()); + return testFolder; + } + + private Entry getEntry(IRI href) + throws Exception + { + return getEntry(href, null); + } + + private Entry getEntry(IRI href, Map args) + throws Exception + { + Request get = new GetRequest(href.toString()).setArgs(args); + Response res = sendRequest(get, 200, getAtomValidator()); + assertNotNull(res); + String xml = res.getContentAsString(); + Entry entry = abdera.parseEntry(new StringReader(xml), null); + assertNotNull(entry); + assertEquals(getArgsAsHeaders() ? get.getUri() : get.getFullUri(), entry.getSelfLink().getHref().toString()); + return entry; + } + + private Feed getFeed(IRI href) + throws Exception + { + return getFeed(href, null); + } + + private Feed getFeed(IRI href, Map args) + throws Exception + { + Request get = new GetRequest(href.toString()).setArgs(args); + Response res = sendRequest(get, 200, getAtomValidator()); + assertNotNull(res); + String xml = res.getContentAsString(); + Feed feed = abdera.parseFeed(new StringReader(xml), null); + assertNotNull(feed); + assertEquals(getArgsAsHeaders() ? get.getUri() : get.getFullUri(), feed.getSelfLink().getHref().toString()); + return feed; + } + + public void testRepository() + throws Exception + { + IRI rootHREF = getRootChildrenCollection(getWorkspace(getRepository())); + sendRequest(new GetRequest(rootHREF.toString()), 200, getAtomValidator()); + } + + public void testCreateDocument() + throws Exception + { + Entry testFolder = createTestFolder("testCreateDocument"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink); + Feed children = getFeed(childrenLink.getHref()); + assertNotNull(children); + int entriesBefore = children.getEntries().size(); + Entry document = createDocument(children.getSelfLink().getHref(), "testCreateDocument"); + Response documentContentRes = sendRequest(new GetRequest(document.getContentSrc().toString()), 200); + String resContent = documentContentRes.getContentAsString(); + assertEquals(document.getTitle(), resContent); + Feed feedFolderAfter = getFeed(childrenLink.getHref()); + int entriesAfter = feedFolderAfter.getEntries().size(); + assertEquals(entriesBefore +1, entriesAfter); + Entry entry = feedFolderAfter.getEntry(document.getId().toString()); + assertNotNull(entry); + } + + public void testCreateDocument2() + throws Exception + { + Entry testFolder = createTestFolder("testCreateDocument2"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink); + String createFile = loadString("/org/alfresco/repo/cmis/rest/test/createdocument2.atomentry.xml"); + Response res = sendRequest(new PostRequest(childrenLink.getHref().toString(), createFile, Format.ATOM.mimetype()), 201, getAtomValidator()); + String xml = res.getContentAsString(); + Entry entry = abdera.parseEntry(new StringReader(xml), null); + Response documentContentRes = sendRequest(new GetRequest(entry.getContentSrc().toString()), 200); + String resContent = documentContentRes.getContentAsString(); + assertEquals("1", resContent); + } + + // TODO: Test creation of document via Atom Entry containing plain text (non Base64 encoded) +// public void testCreateDocumentBase64() +// throws Exception +// { +// Entry testFolder = createTestFolder("testCreateDocumentBase64"); +// Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); +// assertNotNull(childrenLink); +// Feed children = getFeed(childrenLink.getHref()); +// assertNotNull(children); +// int entriesBefore = children.getEntries().size(); +// Entry document = createDocument(children.getSelfLink().getHref(), "testCreateDocument", "/org/alfresco/repo/cmis/rest/test/createdocumentBase64.atomentry.xml"); +// Response documentContentRes = sendRequest(new GetRequest(document.getContentSrc().toString()), 200); +// String testContent = loadString("/org/alfresco/repo/cmis/rest/test/createdocumentBase64.txt"); +// String resContent = documentContentRes.getContentAsString(); +// assertEquals(testContent, resContent); +// Feed feedFolderAfter = getFeed(childrenLink.getHref()); +// int entriesAfter = feedFolderAfter.getEntries().size(); +// assertEquals(entriesBefore +1, entriesAfter); +// Entry entry = feedFolderAfter.getEntry(document.getId().toString()); +// assertNotNull(entry); +// } + + public void testCreateFolder() + throws Exception + { + Entry testFolder = createTestFolder("testCreateFolder"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink); + Feed children = getFeed(childrenLink.getHref()); + assertNotNull(children); + int entriesBefore = children.getEntries().size(); + Entry folder = createFolder(children.getSelfLink().getHref(), "testCreateFolder"); + Feed feedFolderAfter = getFeed(childrenLink.getHref()); + int entriesAfter = feedFolderAfter.getEntries().size(); + assertEquals(entriesBefore +1, entriesAfter); + Entry entry = feedFolderAfter.getEntry(folder.getId().toString()); + assertNotNull(entry); + } + + public void testGet() + throws Exception + { + // get folder + Entry testFolder = createTestFolder("testGet"); + assertNotNull(testFolder); + Entry testFolderFromGet = getEntry(testFolder.getSelfLink().getHref()); + assertEquals(testFolder.getId(), testFolderFromGet.getId()); + assertEquals(testFolder.getTitle(), testFolderFromGet.getTitle()); + assertEquals(testFolder.getSummary(), testFolderFromGet.getSummary()); + + // get document + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink); + Entry testDocument = createDocument(childrenLink.getHref(), "testGet"); + assertNotNull(testDocument); + Entry testDocumentFromGet = getEntry(testDocument.getSelfLink().getHref()); + assertEquals(testDocument.getId(), testDocumentFromGet.getId()); + assertEquals(testDocument.getTitle(), testDocumentFromGet.getTitle()); + //assertEquals(testDocument.getSummary(), testDocumentFromGet.getSummary()); + + // get something that doesn't exist + Response res = sendRequest(new GetRequest(testDocument.getSelfLink().getHref().toString() + GUID.generate()), 404); + assertNotNull(res); + } + + public void testGetChildren() + throws Exception + { + // create multiple children + Entry testFolder = createTestFolder("testGetChildren"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink); + Entry document1 = createDocument(childrenLink.getHref(), "testGetChildren1"); + assertNotNull(document1); + Entry document2 = createDocument(childrenLink.getHref(), "testGetChildren2"); + assertNotNull(document2); + Entry document3 = createDocument(childrenLink.getHref(), "testGetChildren3"); + assertNotNull(document3); + + // checkout one of the children to ensure private working copy isn't included + Response documentRes = sendRequest(new GetRequest(document2.getSelfLink().getHref().toString()), 200, getAtomValidator()); + assertNotNull(documentRes); + String documentXML = documentRes.getContentAsString(); + assertNotNull(documentXML); + IRI checkedoutHREF = getCheckedOutCollection(getWorkspace(getRepository())); + Response pwcRes = sendRequest(new PostRequest(checkedoutHREF.toString(), documentXML, Format.ATOMENTRY.mimetype()), 201, getAtomValidator()); + assertNotNull(pwcRes); + Entry pwc = abdera.parseEntry(new StringReader(pwcRes.getContentAsString()), null); + + // get children, ensure they exist (but not private working copy) + Feed children = getFeed(childrenLink.getHref()); + assertNotNull(children); + assertEquals(3, children.getEntries().size()); + assertNotNull(children.getEntry(document1.getId().toString())); + assertNotNull(children.getEntry(document2.getId().toString())); + assertNotNull(children.getEntry(document3.getId().toString())); + assertNull(children.getEntry(pwc.getId().toString())); + } + + public void testGetChildrenPaging() + throws Exception + { + // create multiple children + Set docIds = new HashSet(); + Entry testFolder = createTestFolder("testGetChildrenPaging"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink); + for (int i = 0; i < 15; i++) + { + Entry document = createDocument(childrenLink.getHref(), "testGetChildrenPaging" + i); + assertNotNull(document); + docIds.add(document.getId()); + } + assertEquals(15, docIds.size()); + + // get children, ensure they exist (but not private working copy) + int nextCount = 0; + Map args = new HashMap(); + args.put("maxItems", "4"); + IRI childrenHREF = childrenLink.getHref(); + while (childrenHREF != null) + { + nextCount++; + Feed types = getFeed(childrenHREF, args); + assertNotNull(types); + assertEquals(nextCount < 4 ? 4 : 3, types.getEntries().size()); + for (Entry entry : types.getEntries()) + { + docIds.remove(entry.getId()); + } + + // next page + Link nextLink = types.getLink("next"); + if (nextCount < 4) + { + assertNotNull(nextLink); + } + childrenHREF = (nextLink != null) ? nextLink.getHref() : null; + args = null; + }; + assertEquals(4, nextCount); + assertEquals(0, docIds.size()); + } + + public void testGetChildrenTypeFilter() + throws Exception + { + // create multiple children + Entry testFolder = createTestFolder("testChildrenTypeFilter"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink); + Entry document = createDocument(childrenLink.getHref(), "testChildren1"); + assertNotNull(document); + Entry folder = createFolder(childrenLink.getHref(), "testChildren2"); + assertNotNull(folder); + + // invalid type filter + Map args = new HashMap(); + args.put("types", "Invalid"); + // TODO: potential spec issue +// Response invalidRes = sendRequest(new GetRequest(childrenLink.getHref().toString()).setArgs(args), 400); +// assertNotNull(invalidRes); + + // no filter + Feed noFilters = getFeed(childrenLink.getHref()); + assertNotNull(noFilters); + assertEquals(2, noFilters.getEntries().size()); + + // any filter + args.put("types", "Any"); + Feed any = getFeed(childrenLink.getHref(), args); + assertNotNull(any); + assertEquals(2, any.getEntries().size()); + + // folders filter + args.put("types", "Folders"); + Feed folders = getFeed(childrenLink.getHref(), args); + assertNotNull(folders); + assertEquals(1, folders.getEntries().size()); + assertNotNull(folders.getEntry(folder.getId().toString())); + + // documents filter + args.put("types", "Documents"); + Feed documents = getFeed(childrenLink.getHref(), args); + assertNotNull(documents); + assertEquals(1, documents.getEntries().size()); + assertNotNull(documents.getEntry(document.getId().toString())); + } + + public void testGetChildrenPropertyFilter() + throws Exception + { + // create children + Entry testFolder = createTestFolder("testGetChildrenPropertyFilter"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink); + Entry document1 = createDocument(childrenLink.getHref(), "testGetChildrenPropertyFilter1"); + assertNotNull(document1); + + { + // get children with all properties + Feed children = getFeed(childrenLink.getHref()); + for (Entry entry : children.getEntries()) + { + CMISObject object = entry.getExtension(CMISConstants.OBJECT); + assertNotNull(object.getObjectId().getValue()); + assertNotNull(object.getObjectTypeId().getValue()); + } + } + + { + // get children with object_id only + Map args = new HashMap(); + args.put("filter", "ObjectId"); + Feed children = getFeed(childrenLink.getHref(), args); + for (Entry entry : children.getEntries()) + { + CMISObject object = entry.getExtension(CMISConstants.OBJECT); + assertNotNull(object.getObjectId().getValue()); + assertNull(object.getObjectTypeId()); + } + } + } + + public void testGetDescendants() + throws Exception + { + // create multiple nested children + Entry testFolder = createTestFolder("testGetDescendants"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink); + Entry document1 = createDocument(childrenLink.getHref(), "testGetDescendants1"); + assertNotNull(document1); + Entry folder2 = createFolder(childrenLink.getHref(), "testGetDescendants2"); + assertNotNull(folder2); + Link childrenLink2 = folder2.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink2); + Entry document3 = createDocument(childrenLink2.getHref(), "testGetDescendants3"); + assertNotNull(document3); + + { + // get descendants (depth = 1, equivalent to getChildren) + Map args = new HashMap(); + args.put("depth", "1"); + Link descendantsLink = testFolder.getLink(CMISConstants.REL_DESCENDANTS); + Feed descendants = getFeed(descendantsLink.getHref(), args); + assertNotNull(descendants); + assertEquals(2, descendants.getEntries().size()); + assertNotNull(descendants.getEntry(document1.getId().toString())); + assertNotNull(descendants.getEntry(folder2.getId().toString())); + + Entry getFolder2 = descendants.getEntry(folder2.getId().toString()); + Entry getFolder2Child = getFolder2.getFirstChild(CMISConstants.NESTED_ENTRY); + assertNull(getFolder2Child); + } + + { + // get nested children + Map args = new HashMap(); + args.put("depth", "2"); + Link descendantsLink = testFolder.getLink(CMISConstants.REL_DESCENDANTS); + Feed descendants = getFeed(descendantsLink.getHref(), args); + assertNotNull(descendants); + assertEquals(2, descendants.getEntries().size()); + assertNotNull(descendants.getEntry(document1.getId().toString())); + assertNotNull(descendants.getEntry(folder2.getId().toString())); + + Entry getFolder2 = descendants.getEntry(folder2.getId().toString()); + List getFolder2Children = getFolder2.getExtensions(CMISConstants.NESTED_ENTRY); + assertNotNull(getFolder2Children); + assertEquals(1, getFolder2Children.size()); + Entry getFolder2Child = getFolder2Children.get(0); + assertEquals(document3.getId(), getFolder2Child.getId()); + assertEquals(document3.getEditLink().getHref().toString(), getFolder2Child.getEditLink().getHref().toString()); + } + } + + public void testGetParent() + throws Exception + { + Entry testFolder = createTestFolder("testParent"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink); + Entry childFolder = createFolder(childrenLink.getHref(), "testParentChild"); + assertNotNull(childFolder); + Link parentLink = childFolder.getLink(CMISConstants.REL_FOLDERPARENT); + assertNotNull(parentLink); + + // ensure there is parent 'testParent' + Feed parent = getFeed(parentLink.getHref()); + assertNotNull(parent); + assertEquals(1, parent.getEntries().size()); + assertEquals(testFolder.getId(), parent.getEntries().get(0).getId()); + + // TODO: compare identity using OBJECT_ID property, not atom:id + + // ensure there are ancestors 'testParent', "test run folder", "tests folder" and "root folder" + Map args = new HashMap(); + args.put("returnToRoot", "true"); + Feed parentsToRoot = getFeed(new IRI(parentLink.getHref().toString()), args); + assertNotNull(parentsToRoot); + assertEquals(4, parentsToRoot.getEntries().size()); + assertEquals(testFolder.getId(), parentsToRoot.getEntries().get(0).getId()); + assertNotNull(parentsToRoot.getEntries().get(0).getLink(CMISConstants.REL_PARENT)); + assertEquals(testRunFolder.getId(), parentsToRoot.getEntries().get(1).getId()); + assertNotNull(parentsToRoot.getEntries().get(1).getLink(CMISConstants.REL_PARENT)); + assertEquals(testsFolder.getId(), parentsToRoot.getEntries().get(2).getId()); + assertNotNull(parentsToRoot.getEntries().get(2).getLink(CMISConstants.REL_PARENT)); + Feed root = getFeed(getRootChildrenCollection(getWorkspace(getRepository()))); + Entry rootEntry = getEntry(root.getLink(CMISConstants.REL_SOURCE).getHref()); + assertEquals(rootEntry.getId(), parentsToRoot.getEntries().get(3).getId()); + assertNull(parentsToRoot.getEntries().get(3).getLink(CMISConstants.REL_PARENT)); + } + + public void testGetParents() + throws Exception + { + Entry testFolder = createTestFolder("testParents"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + assertNotNull(childrenLink); + Entry childDocs = createDocument(childrenLink.getHref(), "testParentsChild"); + assertNotNull(childDocs); + Link parentLink = childDocs.getLink(CMISConstants.REL_PARENTS); + assertNotNull(parentLink); + + // ensure there is parent 'testParent' + Feed parent = getFeed(parentLink.getHref()); + assertNotNull(parent); + assertEquals(1, parent.getEntries().size()); + assertEquals(testFolder.getId(), parent.getEntries().get(0).getId()); + + // ensure there are ancestors 'testParent', "test run folder" and "root folder" + Map args = new HashMap(); + args.put("returnToRoot", "true"); + Feed parentsToRoot = getFeed(new IRI(parentLink.getHref().toString()), args); + assertNotNull(parentsToRoot); + assertEquals(4, parentsToRoot.getEntries().size()); + assertEquals(testFolder.getId(), parentsToRoot.getEntries().get(0).getId()); + //assertNotNull(parentsToRoot.getEntries().get(0).getLink(CMISConstants.REL_PARENT)); + assertEquals(testRunFolder.getId(), parentsToRoot.getEntries().get(1).getId()); + //assertNotNull(parentsToRoot.getEntries().get(1).getLink(CMISConstants.REL_PARENT)); + assertEquals(testsFolder.getId(), parentsToRoot.getEntries().get(2).getId()); + //assertNotNull(parentsToRoot.getEntries().get(2).getLink(CMISConstants.REL_PARENT)); + Feed root = getFeed(getRootChildrenCollection(getWorkspace(getRepository()))); + Entry rootEntry = getEntry(root.getLink(CMISConstants.REL_SOURCE).getHref()); + assertEquals(rootEntry.getId(), parentsToRoot.getEntries().get(3).getId()); + assertNull(parentsToRoot.getEntries().get(3).getLink(CMISConstants.REL_PARENT)); + } + + public void testDelete() + throws Exception + { + // retrieve test folder for deletes + Entry testFolder = createTestFolder("testDelete"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + Feed children = getFeed(childrenLink.getHref()); + int entriesBefore = children.getEntries().size(); + + // create document for delete + Entry document = createDocument(childrenLink.getHref(), "testDelete"); + Response documentRes = sendRequest(new GetRequest(document.getSelfLink().getHref().toString()), 200, getAtomValidator()); + assertNotNull(documentRes); + + // ensure document has been created + Feed children2 = getFeed(childrenLink.getHref()); + assertNotNull(children2); + int entriesAfterCreate = children2.getEntries().size(); + assertEquals(entriesAfterCreate, entriesBefore +1); + + // delete + Response deleteRes = sendRequest(new DeleteRequest(document.getSelfLink().getHref().toString()), 204); + assertNotNull(deleteRes); + + // ensure document has been deleted + Feed children3 = getFeed(childrenLink.getHref()); + assertNotNull(children3); + int entriesAfterDelete = children3.getEntries().size(); + assertEquals(entriesBefore, entriesAfterDelete); + } + + public void testUpdate() + throws Exception + { + // retrieve test folder for update + Entry testFolder = createTestFolder("testUpdate"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + + // create document for update + Entry document = createDocument(childrenLink.getHref(), "testUpdate"); + assertNotNull(document); + String mimetype = (document.getContentMimeType() != null) ? document.getContentMimeType().toString() : null; + if (mimetype != null) + { + assertEquals("text/html", mimetype); + } + + // TODO: check for content update allowable action + // if update allowed, perform update, else update and check for appropriate error + + // update + String updateFile = loadString("/org/alfresco/repo/cmis/rest/test/updatedocument.atomentry.xml"); + String guid = GUID.generate(); + updateFile = updateFile.replace("${NAME}", guid); + Response res = sendRequest(new PutRequest(document.getSelfLink().getHref().toString(), updateFile, Format.ATOMENTRY.mimetype()), 200, getAtomValidator()); + assertNotNull(res); + Entry updated = abdera.parseEntry(new StringReader(res.getContentAsString()), null); + + // ensure update occurred + assertEquals(document.getId(), updated.getId()); + assertEquals(document.getPublished(), updated.getPublished()); + assertEquals("Updated Title " + guid, updated.getTitle()); + // TODO: why is this testing for text/plain? it should be test/html + assertEquals("text/plain", updated.getContentMimeType().toString()); + Response contentRes = sendRequest(new GetRequest(updated.getContentSrc().toString()), 200); + assertEquals("updated content " + guid, contentRes.getContentAsString()); + } + + public void testGetCheckedOut() + throws Exception + { + // retrieve test folder for checkouts + Entry testFolder = createTestFolder("testGetCheckedOut"); + CMISObject object = testFolder.getExtension(CMISConstants.OBJECT); + String scopeId = object.getObjectId().getValue(); + assertNotNull(scopeId); + + // retrieve checkouts within scope of test checkout folder + Service repository = getRepository(); + assertNotNull(repository); + IRI checkedoutHREF = getCheckedOutCollection(getWorkspace(getRepository())); + Map args = new HashMap(); + args.put("folderId", scopeId); + Feed checkedout = getFeed(new IRI(checkedoutHREF.toString()), args); + assertNotNull(checkedout); + assertEquals(0, checkedout.getEntries().size()); + } + + public void testCheckout() + throws Exception + { + // retrieve test folder for checkouts + Entry testFolder = createTestFolder("testCheckout"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + + // create document for checkout + Entry document = createDocument(childrenLink.getHref(), "testCheckout"); + CMISObject docObject = document.getExtension(CMISConstants.OBJECT); + Response documentRes = sendRequest(new GetRequest(document.getSelfLink().getHref().toString()), 200, getAtomValidator()); + assertNotNull(documentRes); + String documentXML = documentRes.getContentAsString(); + assertNotNull(documentXML); + + // checkout + IRI checkedoutHREF = getCheckedOutCollection(getWorkspace(getRepository())); + Response pwcRes = sendRequest(new PostRequest(checkedoutHREF.toString(), documentXML, Format.ATOMENTRY.mimetype()), 201, getAtomValidator()); + assertNotNull(pwcRes); + String pwcXml = pwcRes.getContentAsString(); + assertNotNull(pwcXml); + Entry pwc = abdera.parseEntry(new StringReader(pwcXml), null); + assertNotNull(pwc); + CMISObject pwcObject = pwc.getExtension(CMISConstants.OBJECT); + assertNotNull(pwcObject); + assertTrue(pwcObject.isVersionSeriesCheckedOut().getBooleanValue()); + assertEquals(docObject.getObjectId().getValue(), pwcObject.getVersionSeriesId().getValue()); + assertEquals(pwcObject.getObjectId().getValue(), pwcObject.getVersionSeriesCheckedOutId().getValue()); + assertNotNull(pwcObject.getVersionSeriesCheckedOutBy().getValue()); + + // test getCheckedOut is updated + CMISObject object = testFolder.getExtension(CMISConstants.OBJECT); + String scopeId = object.getObjectId().getValue(); + Map args = new HashMap(); + args.put("folderId", scopeId); + Feed checkedout = getFeed(new IRI(checkedoutHREF.toString()), args); + assertNotNull(checkedout); + assertEquals(1, checkedout.getEntries().size()); + } + + public void testCancelCheckout() + throws Exception + { + // retrieve test folder for checkouts + Entry testFolder = createTestFolder("testCancelCheckout"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + + // create document for checkout + Entry document = createDocument(childrenLink.getHref(), "testCancelCheckout"); + Response documentRes = sendRequest(new GetRequest(document.getSelfLink().getHref().toString()), 200, getAtomValidator()); + assertNotNull(documentRes); + String xml = documentRes.getContentAsString(); + assertNotNull(xml); + + // checkout + IRI checkedoutHREF = getCheckedOutCollection(getWorkspace(getRepository())); + Response pwcRes = sendRequest(new PostRequest(checkedoutHREF.toString(), xml, Format.ATOMENTRY.mimetype()), 201, getAtomValidator()); + assertNotNull(pwcRes); + String pwcXml = pwcRes.getContentAsString(); + + // test getCheckedOut is updated + CMISObject object = testFolder.getExtension(CMISConstants.OBJECT); + String scopeId = object.getObjectId().getValue(); + Map args = new HashMap(); + args.put("folderId", scopeId); + Feed checkedout = getFeed(new IRI(checkedoutHREF.toString()), args); + assertNotNull(checkedout); + assertEquals(1, checkedout.getEntries().size()); + + // cancel checkout + Entry pwc = abdera.parseEntry(new StringReader(pwcXml), null); + assertNotNull(pwc); + Response cancelRes = sendRequest(new DeleteRequest(pwc.getSelfLink().getHref().toString()), 204); + assertNotNull(cancelRes); + + // test getCheckedOut is updated + CMISObject object2 = testFolder.getExtension(CMISConstants.OBJECT); + String scopeId2 = object2.getObjectId().getValue(); + Map args2 = new HashMap(); + args2.put("folderId", scopeId2); + Feed checkedout2 = getFeed(new IRI(checkedoutHREF.toString()), args2); + assertNotNull(checkedout2); + assertEquals(0, checkedout2.getEntries().size()); + } + + public void testCheckIn() + throws Exception + { + // retrieve test folder for checkins + Entry testFolder = createTestFolder("testCheckIn"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + + // create document for checkout + Entry document = createDocument(childrenLink.getHref(), "testCheckin"); + Response documentRes = sendRequest(new GetRequest(document.getSelfLink().getHref().toString()), 200, getAtomValidator()); + assertNotNull(documentRes); + String xml = documentRes.getContentAsString(); + assertNotNull(xml); + + // checkout + IRI checkedoutHREF = getCheckedOutCollection(getWorkspace(getRepository())); + Response pwcRes = sendRequest(new PostRequest(checkedoutHREF.toString(), xml, Format.ATOMENTRY.mimetype()), 201, getAtomValidator()); + assertNotNull(pwcRes); + Entry pwc = abdera.parseEntry(new StringReader(pwcRes.getContentAsString()), null); + assertNotNull(pwc); + + // test getCheckedOut is updated + CMISObject object = testFolder.getExtension(CMISConstants.OBJECT); + String scopeId = object.getObjectId().getValue(); + Map args = new HashMap(); + args.put("folderId", scopeId); + Feed checkedout = getFeed(new IRI(checkedoutHREF.toString()), args); + assertNotNull(checkedout); + assertEquals(1, checkedout.getEntries().size()); + + // test version properties of checked-out item + // test checked-in version properties + Entry checkedoutdoc = getEntry(document.getSelfLink().getHref()); + CMISObject checkedoutdocObject = checkedoutdoc.getExtension(CMISConstants.OBJECT); + assertNotNull(checkedoutdocObject); + assertTrue(checkedoutdocObject.isVersionSeriesCheckedOut().getBooleanValue()); + //assertEquals(checkedoutdocObject.getObjectId().getValue(), checkedoutdocObject.getVersionSeriesId().getValue()); + assertNotNull(checkedoutdocObject.getVersionSeriesCheckedOutId().getValue()); + assertNotNull(checkedoutdocObject.getVersionSeriesCheckedOutBy().getValue()); + + // test update of private working copy + String updateFile = loadString("/org/alfresco/repo/cmis/rest/test/updatedocument.atomentry.xml"); + String guid = GUID.generate(); + updateFile = updateFile.replace("${NAME}", guid); + Response pwcUpdatedres = sendRequest(new PutRequest(pwc.getEditLink().getHref().toString(), updateFile, Format.ATOMENTRY.mimetype()), 200, getAtomValidator()); + assertNotNull(pwcUpdatedres); + Entry updated = abdera.parseEntry(new StringReader(pwcUpdatedres.getContentAsString()), null); + // ensure update occurred + assertEquals(pwc.getId(), updated.getId()); + assertEquals(pwc.getPublished(), updated.getPublished()); + assertEquals("Updated Title " + guid, updated.getTitle()); + assertEquals("text/plain", updated.getContentMimeType().toString()); + Response pwcContentRes = sendRequest(new GetRequest(pwc.getContentSrc().toString()), 200); + assertEquals("updated content " + guid, pwcContentRes.getContentAsString()); + + // checkin + String checkinFile = loadString("/org/alfresco/repo/cmis/rest/test/checkindocument.atomentry.xml"); + String checkinUrl = pwc.getSelfLink().getHref().toString(); + Map args2 = new HashMap(); + args2.put("checkinComment", guid); + args2.put("checkin", "true"); + Response checkinRes = sendRequest(new PutRequest(checkinUrl, checkinFile, Format.ATOMENTRY.mimetype()).setArgs(args2), 200, getAtomValidator()); + assertNotNull(checkinRes); + String checkinResXML = checkinRes.getContentAsString(); + + // test getCheckedOut is updated + CMISObject object2 = testFolder.getExtension(CMISConstants.OBJECT); + String scopeId2 = object2.getObjectId().getValue(); + Map args3 = new HashMap(); + args3.put("folderId", scopeId2); + Feed checkedout2 = getFeed(new IRI(checkedoutHREF.toString()), args3); + assertNotNull(checkedout2); + assertEquals(0, checkedout2.getEntries().size()); + + // test checked-in doc has new updates + Entry checkedIn = abdera.parseEntry(new StringReader(checkinResXML), null); + Entry updatedDoc = getEntry(checkedIn.getSelfLink().getHref()); + // TODO: issue with updating name on PWC and it not reflecting on checked-in document + //assertEquals("Updated Title " + guid, updatedDoc.getTitle()); + assertEquals("text/plain", updatedDoc.getContentMimeType().toString()); + Response updatedContentRes = sendRequest(new GetRequest(updatedDoc.getContentSrc().toString()), 200); + assertEquals("updated content " + guid, updatedContentRes.getContentAsString()); + + // test checked-in version properties + CMISObject updatedObject = updatedDoc.getExtension(CMISConstants.OBJECT); + assertNotNull(updatedObject); + assertFalse(updatedObject.isVersionSeriesCheckedOut().getBooleanValue()); + //assertEquals(updatedObject.getObjectId().getValue(), updatedObject.getVersionSeriesId().getValue()); + assertNull(updatedObject.getVersionSeriesCheckedOutId().getValue()); + assertNull(updatedObject.getVersionSeriesCheckedOutBy().getValue()); + assertEquals(guid, updatedObject.getCheckinComment().getValue()); + } + + public void testUpdateOnCheckIn() + throws Exception + { + // retrieve test folder for checkins + Entry testFolder = createTestFolder("testUpdateOnCheckIn"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + + // create document for checkout + Entry document = createDocument(childrenLink.getHref(), "testUpdateOnCheckIn"); + Response documentRes = sendRequest(new GetRequest(document.getSelfLink().getHref().toString()), 200, getAtomValidator()); + assertNotNull(documentRes); + String xml = documentRes.getContentAsString(); + assertNotNull(xml); + + // checkout + IRI checkedoutHREF = getCheckedOutCollection(getWorkspace(getRepository())); + Response pwcRes = sendRequest(new PostRequest(checkedoutHREF.toString(), xml, Format.ATOMENTRY.mimetype()), 201, getAtomValidator()); + assertNotNull(pwcRes); + Entry pwc = abdera.parseEntry(new StringReader(pwcRes.getContentAsString()), null); + assertNotNull(pwc); + + // test getCheckedOut is updated + CMISObject object = testFolder.getExtension(CMISConstants.OBJECT); + String scopeId = object.getObjectId().getValue(); + Map args = new HashMap(); + args.put("folderId", scopeId); + Feed checkedout = getFeed(new IRI(checkedoutHREF.toString()), args); + assertNotNull(checkedout); + assertEquals(1, checkedout.getEntries().size()); + + // checkin (with update) + String checkinFile = loadString("/org/alfresco/repo/cmis/rest/test/checkinandupdatedocument.atomentry.xml"); + String guid = GUID.generate(); + checkinFile = checkinFile.replace("${NAME}", guid); + String checkinUrl = pwc.getSelfLink().getHref().toString(); + Map args2 = new HashMap(); + args2.put("checkinComment", guid); + args2.put("checkin", "true"); + Response checkinRes = sendRequest(new PutRequest(checkinUrl, checkinFile, Format.ATOMENTRY.mimetype()).setArgs(args2), 200, getAtomValidator()); + assertNotNull(checkinRes); + String checkinResXML = checkinRes.getContentAsString(); + + // test getCheckedOut is updated + CMISObject object2 = testFolder.getExtension(CMISConstants.OBJECT); + String scopeId2 = object2.getObjectId().getValue(); + Map args3 = new HashMap(); + args3.put("folderId", scopeId2); + Feed checkedout2 = getFeed(new IRI(checkedoutHREF.toString()), args3); + assertNotNull(checkedout2); + assertEquals(0, checkedout2.getEntries().size()); + + // test checked-in doc has new updates + Entry checkedIn = abdera.parseEntry(new StringReader(checkinResXML), null); + Entry updatedDoc = getEntry(checkedIn.getSelfLink().getHref()); + // TODO: issue with updating name on PWC and it not reflecting on checked-in document + //assertEquals("Updated Title " + guid, updatedDoc.getTitle()); + assertEquals("text/plain", updatedDoc.getContentMimeType().toString()); + Response updatedContentRes = sendRequest(new GetRequest(updatedDoc.getContentSrc().toString()), 200); + assertEquals("updated content " + guid, updatedContentRes.getContentAsString()); + } + + public void testGetAllVersions() + throws Exception + { + int NUMBER_OF_VERSIONS = 3; + + // retrieve test folder for checkins + Entry testFolder = createTestFolder("testGetAllVersions"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + + // create document for checkout + Entry document = createDocument(childrenLink.getHref(), "testGetAllVersions"); + Response documentRes = sendRequest(new GetRequest(document.getSelfLink().getHref().toString()), 200, getAtomValidator()); + assertNotNull(documentRes); + String xml = documentRes.getContentAsString(); + assertNotNull(xml); + + IRI checkedoutHREF = getCheckedOutCollection(getWorkspace(getRepository())); + for (int i = 0; i < NUMBER_OF_VERSIONS; i++) + { + // checkout + Response pwcRes = sendRequest(new PostRequest(checkedoutHREF.toString(), xml, Format.ATOMENTRY.mimetype()), 201, getAtomValidator()); + assertNotNull(pwcRes); + Entry pwc = abdera.parseEntry(new StringReader(pwcRes.getContentAsString()), null); + assertNotNull(pwc); + + // checkin + String checkinFile = loadString("/org/alfresco/repo/cmis/rest/test/checkinandupdatedocument.atomentry.xml"); + checkinFile = checkinFile.replace("${NAME}", "checkin " + i); + String checkinUrl = pwc.getSelfLink().getHref().toString(); + Map args2 = new HashMap(); + args2.put("checkinComment", "checkin" + i); + args2.put("checkin", "true"); + Response checkinRes = sendRequest(new PutRequest(checkinUrl, checkinFile, Format.ATOMENTRY.mimetype()).setArgs(args2), 200, getAtomValidator()); + assertNotNull(checkinRes); + } + + // get all versions + Link allVersionsLink = document.getLink(CMISConstants.REL_ALLVERSIONS); + assertNotNull(allVersionsLink); + Feed allVersions = getFeed(allVersionsLink.getHref()); + assertNotNull(allVersions); + assertEquals(NUMBER_OF_VERSIONS + 1 /** initial version */, allVersions.getEntries().size()); + for (int i = 0; i < NUMBER_OF_VERSIONS; i++) + { + Link versionLink = allVersions.getEntries().get(i).getSelfLink(); + assertNotNull(versionLink); + Entry version = getEntry(versionLink.getHref()); + assertNotNull(version); + // TODO: issue with updating name on PWC and it not reflecting on checked-in document + //assertEquals("Update Title checkin " + i, version.getTitle()); + Response versionContentRes = sendRequest(new GetRequest(version.getContentSrc().toString()), 200); + assertEquals("updated content checkin " + (NUMBER_OF_VERSIONS -1 - i), versionContentRes.getContentAsString()); + CMISObject versionObject = version.getExtension(CMISConstants.OBJECT); + assertNotNull(versionObject); + assertEquals("checkin" + + (NUMBER_OF_VERSIONS -1 - i), versionObject.getCheckinComment().getValue()); + } + } + + public void testGetAllTypeDefinitions() + throws Exception + { + IRI typesHREF = getTypesChildrenCollection(getWorkspace(getRepository())); + Feed types = getFeed(typesHREF); + assertNotNull(types); + Feed typesWithProps = getFeed(typesHREF); + assertNotNull(typesWithProps); + for (Entry type : types.getEntries()) + { + Entry retrievedType = getEntry(type.getSelfLink().getHref()); + assertEquals(type.getId(), retrievedType.getId()); + assertEquals(type.getTitle(), retrievedType.getTitle()); + // TODO: type specific properties - extension to Abdera + } + } + + public void testGetHierarchyTypeDefinitions() + throws Exception + { + IRI typesHREF = getTypesChildrenCollection(getWorkspace(getRepository())); + Map args = new HashMap(); + args.put("type", "folder"); + args.put("includePropertyDefinitions", "true"); + args.put("maxItems", "5"); + while (typesHREF != null) + { + Feed types = getFeed(typesHREF, args); + + for (Entry type : types.getEntries()) + { + Entry retrievedType = getEntry(type.getSelfLink().getHref()); + assertEquals(type.getId(), retrievedType.getId()); + assertEquals(type.getTitle(), retrievedType.getTitle()); + // TODO: type specific properties - extension to Abdera + } + + // next page + Link nextLink = types.getLink("next"); + typesHREF = (nextLink != null) ? nextLink.getHref() : null; + args.remove("maxItems"); + }; + } + + public void testGetTypeDefinition() + throws Exception + { + // retrieve test folder for type definitions + Entry testFolder = createTestFolder("testGetEntryTypeDefinition"); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + + // create document + Entry document = createDocument(childrenLink.getHref(), "testGetEntryTypeDefinitionDoc"); + Response documentRes = sendRequest(new GetRequest(document.getSelfLink().getHref().toString()), 200, getAtomValidator()); + assertNotNull(documentRes); + + // create folder + Entry folder = createFolder(childrenLink.getHref(), "testGetEntryTypeDefinitionFolder"); + Response folderRes = sendRequest(new GetRequest(folder.getSelfLink().getHref().toString()), 200, getAtomValidator()); + assertNotNull(folderRes); + + // retrieve children + Feed children = getFeed(childrenLink.getHref()); + for (Entry entry : children.getEntries()) + { + // get type definition + Link typeLink = entry.getLink(CMISConstants.REL_TYPE); + assertNotNull(typeLink); + Entry type = getEntry(typeLink.getHref()); + assertNotNull(type); + // TODO: test correct type for entry & properties of type + } + } + + public void testQuery() + throws Exception + { + // retrieve query collection + IRI queryHREF = getQueryCollection(getWorkspace(getRepository())); + + // retrieve test folder for query + Entry testFolder = createTestFolder("testQuery"); + CMISObject testFolderObject = testFolder.getExtension(CMISConstants.OBJECT); + Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN); + + // create documents to query + Entry document1 = createDocument(childrenLink.getHref(), "apple1"); + assertNotNull(document1); + CMISObject document1Object = document1.getExtension(CMISConstants.OBJECT); + assertNotNull(document1Object); + String doc2name = "name" + System.currentTimeMillis(); + Entry document2 = createDocument(childrenLink.getHref(), doc2name); + assertNotNull(document2); + CMISObject document2Object = document2.getExtension(CMISConstants.OBJECT); + assertNotNull(document2Object); + Entry document3 = createDocument(childrenLink.getHref(), "banana1"); + assertNotNull(document3); + + // retrieve query request document + String queryDoc = loadString("/org/alfresco/repo/cmis/rest/test/query.cmisquery.xml"); + + { + // construct structured query + String query = "SELECT * FROM Document " + + "WHERE IN_FOLDER('" + testFolderObject.getObjectId().getValue() + "') " + + "AND Name = 'apple1'"; + String queryReq = queryDoc.replace("${STATEMENT}", query); + queryReq = queryReq.replace("${PAGESIZE}", "5"); + + // issue structured query + Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq.getBytes(), CMISConstants.MIMETYPE_QUERY), 200); + assertNotNull(queryRes); + Feed queryFeed = abdera.parseFeed(new StringReader(queryRes.getContentAsString()), null); + assertNotNull(queryFeed); + assertEquals(1, queryFeed.getEntries().size()); + assertNotNull(queryFeed.getEntry(document1.getId().toString())); + CMISObject result1 = queryFeed.getEntry(document1.getId().toString()).getExtension(CMISConstants.OBJECT); + assertEquals(document1Object.getName().getValue(), result1.getName().getValue()); + assertEquals(document1Object.getObjectId().getValue(), result1.getObjectId().getValue()); + assertEquals(document1Object.getObjectTypeId().getValue(), result1.getObjectTypeId().getValue()); + } + + if (fulltextCapability.equals("fulltextonly") || fulltextCapability.equals("fulltextandstructured")) + { + // construct fulltext query + String query = "SELECT ObjectId, ObjectTypeId, Name FROM Document " + + "WHERE CONTAINS('" + doc2name + "')"; + String queryReq = queryDoc.replace("${STATEMENT}", query); + queryReq = queryReq.replace("${PAGESIZE}", "5"); + + // issue fulltext query + Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq.getBytes(), CMISConstants.MIMETYPE_QUERY), 200); + assertNotNull(queryRes); + Feed queryFeed = abdera.parseFeed(new StringReader(queryRes.getContentAsString()), null); + assertNotNull(queryFeed); + assertEquals(1, queryFeed.getEntries().size()); + assertNotNull(queryFeed.getEntry(document2.getId().toString())); + CMISObject result1 = queryFeed.getEntry(document2.getId().toString()).getExtension(CMISConstants.OBJECT); + assertEquals(document2Object.getName().getValue(), result1.getName().getValue()); + assertEquals(document2Object.getObjectId().getValue(), result1.getObjectId().getValue()); + assertEquals(document2Object.getObjectTypeId().getValue(), result1.getObjectTypeId().getValue()); + } + + if (fulltextCapability.equals("fulltextandstructured")) + { + // construct fulltext and structured query + String query = "SELECT ObjectId, ObjectTypeId, Name FROM Document " + + "WHERE IN_FOLDER('" + testFolderObject.getObjectId().getValue() + "') " + + "AND Name = 'apple1' " + + "AND CONTAINS('apple1')"; + String queryReq = queryDoc.replace("${STATEMENT}", query); + queryReq = queryReq.replace("${PAGESIZE}", "5"); + + // issue structured query + Response queryRes = sendRequest(new PostRequest(queryHREF.toString(), queryReq.getBytes(), CMISConstants.MIMETYPE_QUERY), 200); + assertNotNull(queryRes); + Feed queryFeed = abdera.parseFeed(new StringReader(queryRes.getContentAsString()), null); + assertNotNull(queryFeed); + assertEquals(1, queryFeed.getEntries().size()); + assertNotNull(queryFeed.getEntry(document1.getId().toString())); + CMISObject result1 = queryFeed.getEntry(document1.getId().toString()).getExtension(CMISConstants.OBJECT); + assertEquals(document1Object.getName().getValue(), result1.getName().getValue()); + assertEquals(document1Object.getObjectId().getValue(), result1.getObjectId().getValue()); + assertEquals(document1Object.getObjectTypeId().getValue(), result1.getObjectTypeId().getValue()); + } + } + +// public void testUnfiled() +// { +// } + +} diff --git a/source/java/org/alfresco/repo/cmis/rest/test/CMISTestRunner.java b/source/java/org/alfresco/repo/cmis/rest/test/CMISTestRunner.java new file mode 100644 index 0000000000..2466f060c8 --- /dev/null +++ b/source/java/org/alfresco/repo/cmis/rest/test/CMISTestRunner.java @@ -0,0 +1,259 @@ +/* + * Copyright (C) 2005-2008 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 recieved 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.test; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import junit.framework.TestResult; +import junit.framework.TestSuite; + +import org.alfresco.repo.cmis.rest.test.CMISTest.CMISTestListener; +import org.alfresco.repo.web.scripts.BaseWebScriptTest.RemoteServer; +import org.alfresco.repo.web.scripts.BaseWebScriptTest.WebScriptTestListener; +import org.alfresco.util.CachingDateFormat; + + +/** + * CMIS Test Runner + * + * @author davidc + */ +public class CMISTestRunner +{ + private String match = null; + private WebScriptTestListener listener = new CMISTestListener(System.out); + private boolean traceReqRes = false; + private String serviceUrl = null; + private String userpass = null; + private String arguments = "url"; + private boolean validateResponse = true; + + + /** + * @param match test name to execute (* for wildcards) + */ + public void setMatch(String match) + { + this.match = match; + } + + /** + * @param listener test listener + */ + public void setListener(WebScriptTestListener listener) + { + this.listener = listener; + } + + /** + * @param traceReqRes true => trace requests / responses + */ + public void setTraceReqRes(boolean traceReqRes) + { + this.traceReqRes = traceReqRes; + } + + /** + * @param serviceUrl cmis service document url + */ + public void setServiceUrl(String serviceUrl) + { + this.serviceUrl = serviceUrl; + } + + /** + * @param userpass user name / password + */ + public void setUserPass(String userpass) + { + this.userpass = userpass; + } + + /** + * @param arguments "url" => url arguments, "headers" => request headers, "both" => url & headers + */ + public void setArguments(String arguments) + { + this.arguments = arguments; + } + + /** + * @param validateResponse true => test response against CMIS XSDs + */ + public void setValidateResponse(boolean validateResponse) + { + this.validateResponse = validateResponse; + } + + /** + * Gets the names of CMIS tests + * + * @param match * for wildcard + * @return array of test names + */ + public String[] getTestNames(String match) + { + List namesList = new ArrayList(); + TestSuite allSuite = new TestSuite(CMISTest.class); + for (int i = 0; i < allSuite.countTestCases(); i++) + { + CMISTest test = (CMISTest)allSuite.testAt(i); + if (match == null || match.equals("*") || test.getName().matches(match.replace("*", "[A-Za-z0-9]*"))) + { + namesList.add(test.getName()); + } + } + String[] names = new String[namesList.size()]; + namesList.toArray(names); + return names; + } + + /** + * Execute CMIS Tests + */ + public void execute() + { + RemoteServer server = null; + if (serviceUrl != null) + { + server = new RemoteServer(); + if (userpass != null) + { + String[] credentials = userpass.split("/"); + server.username = credentials[0]; + if (credentials.length > 1) + { + server.password = credentials[1]; + } + } + } + + // dump test parameters + if (listener != null) + { + Calendar today = Calendar.getInstance(); + SimpleDateFormat df = CachingDateFormat.getDateFormat("yyyy-MM-dd HH:mm:ss.SSS", true); + listener.addLog(null, "Test Started at " + df.format(today.getTime())); + listener.addLog(null, "Service URL: " + (serviceUrl == null ? "[not set]" : serviceUrl)); + listener.addLog(null, "User: " + (userpass == null ? "[not set]" : userpass)); + listener.addLog(null, "Args: " + (arguments == null ? "[not set]" : arguments)); + listener.addLog(null, "Validate Responses: " + validateResponse); + listener.addLog(null, "Trace Requests/Responses: " + traceReqRes); + listener.addLog(null, "Tests: " + (match == null ? "*" : match)); + listener.addLog(null, ""); + } + + // execute cmis tests with url arguments + if (arguments.equals("both") || arguments.equals("url")) + { + executeSuite(match, server, false); + } + + // execute cmis tests with headers + if (arguments.equals("both") || arguments.equals("headers")) + { + executeSuite(match, server, true); + } + } + + /** + * Execute suite of CMIS Tests + * + * @param match tests to execute (* for wildcard) + * @param server remote server + * @param argsAsHeaders arguments passed in Headers + */ + private void executeSuite(String match, RemoteServer server, boolean argsAsHeaders) + { + TestSuite allSuite = new TestSuite(CMISTest.class); + TestSuite suite = new TestSuite(); + for (int i = 0; i < allSuite.countTestCases(); i++) + { + CMISTest test = (CMISTest)allSuite.testAt(i); + if (match == null || match.equals("*") || test.getName().matches(match.replace("*", "[A-Za-z0-9]*"))) + { + if (listener != null) + { + test.setListener(listener); + test.setTraceReqRes(traceReqRes); + } + if (server != null) + { + test.setServiceUrl(serviceUrl); + if (server != null) + { + test.setRemoteServer(server); + } + } + test.setArgsAsHeaders(argsAsHeaders); + test.setValidateResponse(validateResponse); + suite.addTest(test); + } + } + TestResult result = new TestResult(); + if (listener != null) + { + result.addListener(listener); + } + suite.run(result); + } + + /** + * Execute CMIS Tests from command-line + * + * url={serviceUrl} + * user={userpass} + * args={"url"|"headers"|"both"} + */ + public static void main(String[] args) + { + CMISTestRunner runner = new CMISTestRunner(); + + for (String arg : args) + { + String[] argSegment = arg.split("="); + if (argSegment[0].equals("url")) + { + runner.setServiceUrl(argSegment[1]); + } + else if (argSegment[0].equals("user")) + { + runner.setUserPass(argSegment[1]); + } + else if (argSegment[0].equalsIgnoreCase("args")) + { + runner.setArguments(argSegment[1].toLowerCase()); + } + } + + // execute + runner.execute(); + System.exit(0); + } + +} diff --git a/source/java/org/alfresco/repo/cmis/rest/test/CMISTestRunnerWebScript.java b/source/java/org/alfresco/repo/cmis/rest/test/CMISTestRunnerWebScript.java new file mode 100644 index 0000000000..9cf3152055 --- /dev/null +++ b/source/java/org/alfresco/repo/cmis/rest/test/CMISTestRunnerWebScript.java @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2005-2007 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 recieved 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.test; + +import java.io.IOException; +import java.io.PrintStream; + +import org.alfresco.repo.cmis.rest.test.CMISTest.CMISTestListener; +import org.alfresco.repo.web.scripts.BaseWebScriptTest.WebScriptTestListener; +import org.alfresco.web.scripts.AbstractWebScript; +import org.alfresco.web.scripts.WebScriptRequest; +import org.alfresco.web.scripts.WebScriptResponse; + +/** + * Execute CMIS Tests + * + * @author davidc + */ +public class CMISTestRunnerWebScript extends AbstractWebScript +{ + /* (non-Javadoc) + * @see org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse) + */ + public void execute(WebScriptRequest req, WebScriptResponse res) + throws IOException + { + // setup CMIS tests + PrintStream printStream = new PrintStream(res.getOutputStream()); + WebScriptTestListener testListener = new CMISTestListener(printStream); + CMISTestRunner runner = new CMISTestRunner(); + runner.setListener(testListener); + + // process test parameters + String serviceUrl = req.getParameter("url"); + if (serviceUrl != null && serviceUrl.length() > 0) + { + runner.setServiceUrl(serviceUrl); + } + String userpass = req.getParameter("user"); + if (userpass != null && userpass.length() > 0) + { + runner.setUserPass(userpass); + } + String args = req.getParameter("args"); + if (args != null && args.length() > 0) + { + runner.setArguments(args); + } + String validate = req.getParameter("validate"); + if (validate != null && validate.length() > 0) + { + runner.setValidateResponse(Boolean.valueOf(validate)); + } + String trace = req.getParameter("trace"); + if (trace != null && trace.length() > 0) + { + runner.setTraceReqRes(Boolean.valueOf(trace)); + } + String match = req.getParameter("tests"); + if (match != null && match.length() > 0) + { + runner.setMatch(match); + } + + // execute tests + runner.execute(); + } + +} diff --git a/source/java/org/alfresco/repo/cmis/rest/CMISWithHeadersTest.java b/source/java/org/alfresco/repo/cmis/rest/test/CMISWithHeadersTest.java similarity index 97% rename from source/java/org/alfresco/repo/cmis/rest/CMISWithHeadersTest.java rename to source/java/org/alfresco/repo/cmis/rest/test/CMISWithHeadersTest.java index cfc154c048..beb855ffe7 100644 --- a/source/java/org/alfresco/repo/cmis/rest/CMISWithHeadersTest.java +++ b/source/java/org/alfresco/repo/cmis/rest/test/CMISWithHeadersTest.java @@ -22,7 +22,7 @@ * the FLOSS exception, and it is also available here: * http://www.alfresco.com/legal/licensing" */ -package org.alfresco.repo.cmis.rest; +package org.alfresco.repo.cmis.rest.test; diff --git a/source/test-resources/cmis/rest/checkinandupdatedocument.atomentry.xml b/source/java/org/alfresco/repo/cmis/rest/test/checkinandupdatedocument.atomentry.xml similarity index 100% rename from source/test-resources/cmis/rest/checkinandupdatedocument.atomentry.xml rename to source/java/org/alfresco/repo/cmis/rest/test/checkinandupdatedocument.atomentry.xml diff --git a/source/test-resources/cmis/rest/checkindocument.atomentry.xml b/source/java/org/alfresco/repo/cmis/rest/test/checkindocument.atomentry.xml similarity index 77% rename from source/test-resources/cmis/rest/checkindocument.atomentry.xml rename to source/java/org/alfresco/repo/cmis/rest/test/checkindocument.atomentry.xml index b3f81a8d61..a3ddc440ce 100644 --- a/source/test-resources/cmis/rest/checkindocument.atomentry.xml +++ b/source/java/org/alfresco/repo/cmis/rest/test/checkindocument.atomentry.xml @@ -1,3 +1,2 @@ - - + diff --git a/source/java/org/alfresco/repo/cmis/rest/test/createdocument.atomentry.xml b/source/java/org/alfresco/repo/cmis/rest/test/createdocument.atomentry.xml new file mode 100644 index 0000000000..da9c906e91 --- /dev/null +++ b/source/java/org/alfresco/repo/cmis/rest/test/createdocument.atomentry.xml @@ -0,0 +1,11 @@ + + + ${NAME} +

${NAME} (summary) + ${CONTENT} + + + document + + + diff --git a/source/java/org/alfresco/repo/cmis/rest/test/createdocument2.atomentry.xml b/source/java/org/alfresco/repo/cmis/rest/test/createdocument2.atomentry.xml new file mode 100644 index 0000000000..4871aea91d --- /dev/null +++ b/source/java/org/alfresco/repo/cmis/rest/test/createdocument2.atomentry.xml @@ -0,0 +1,10 @@ + + onesentence.txt + MQ== + + + document + onesentence.txt + + + \ No newline at end of file diff --git a/source/test-resources/cmis/rest/createdocumentBase64.atomentry.xml b/source/java/org/alfresco/repo/cmis/rest/test/createdocumentBase64.atomentry.xml similarity index 81% rename from source/test-resources/cmis/rest/createdocumentBase64.atomentry.xml rename to source/java/org/alfresco/repo/cmis/rest/test/createdocumentBase64.atomentry.xml index b2d3120053..3f76b65cb5 100644 --- a/source/test-resources/cmis/rest/createdocumentBase64.atomentry.xml +++ b/source/java/org/alfresco/repo/cmis/rest/test/createdocumentBase64.atomentry.xml @@ -12,8 +12,10 @@ biB0aGUgcmVwb3NpdG9yeSB3aWxsIGNyZWF0ZSB0aGUgZG9jdW1lbnQgaW4gdGhlIHNwZWNpZmll ZCBmb2xkZXIuICBJZiB0aGUgY29udGVudCBzdHJlYW0gaXMgc3BlY2lmaWVkIG9uIGNyZWF0ZSwg aXQgc2hvdWxkIGJlIGJhc2U2NCBlbmNvZGVkIGluIHRoZSBhdG9tIGVudHJ5Lg== -
- - document - +
+ + + document + + diff --git a/source/test-resources/cmis/rest/createdocumentBase64.txt b/source/java/org/alfresco/repo/cmis/rest/test/createdocumentBase64.txt similarity index 100% rename from source/test-resources/cmis/rest/createdocumentBase64.txt rename to source/java/org/alfresco/repo/cmis/rest/test/createdocumentBase64.txt diff --git a/source/test-resources/cmis/rest/createfolder.atomentry.xml b/source/java/org/alfresco/repo/cmis/rest/test/createfolder.atomentry.xml similarity index 51% rename from source/test-resources/cmis/rest/createfolder.atomentry.xml rename to source/java/org/alfresco/repo/cmis/rest/test/createfolder.atomentry.xml index e0384743da..d01f6b0cf0 100644 --- a/source/test-resources/cmis/rest/createfolder.atomentry.xml +++ b/source/java/org/alfresco/repo/cmis/rest/test/createfolder.atomentry.xml @@ -2,7 +2,9 @@ ${NAME} ${NAME} (summary) - - folder - + + + folder + + diff --git a/source/test-resources/cmis/rest/query.cmissqlquery.xml b/source/java/org/alfresco/repo/cmis/rest/test/query.cmisquery.xml similarity index 100% rename from source/test-resources/cmis/rest/query.cmissqlquery.xml rename to source/java/org/alfresco/repo/cmis/rest/test/query.cmisquery.xml diff --git a/source/java/org/alfresco/repo/cmis/rest/test/query.cmissqlquery.xml b/source/java/org/alfresco/repo/cmis/rest/test/query.cmissqlquery.xml new file mode 100644 index 0000000000..e4c46c2a42 --- /dev/null +++ b/source/java/org/alfresco/repo/cmis/rest/test/query.cmissqlquery.xml @@ -0,0 +1,4 @@ + + + ${PAGESIZE} + diff --git a/source/test-resources/cmis/rest/updatedocument.atomentry.xml b/source/java/org/alfresco/repo/cmis/rest/test/updatedocument.atomentry.xml similarity index 100% rename from source/test-resources/cmis/rest/updatedocument.atomentry.xml rename to source/java/org/alfresco/repo/cmis/rest/test/updatedocument.atomentry.xml diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/APP.xsd b/source/java/org/alfresco/repo/cmis/rest/xsd/APP.xsd index 0f762b6ee7..76da25bf40 100644 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/APP.xsd +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/APP.xsd @@ -6,11 +6,12 @@ + xmlns:cmis="http://www.cmis.org/2008/05" + version="0.5"> + schemaLocation="CMIS.xsd" /> @@ -35,11 +36,29 @@ + + + - + + + + + + + + + + + + + - \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/ATOM4CMIS.xsd b/source/java/org/alfresco/repo/cmis/rest/xsd/ATOM4CMIS.xsd index 8dfdf747f5..9110bad98e 100644 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/ATOM4CMIS.xsd +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/ATOM4CMIS.xsd @@ -1,24 +1,18 @@ - + - + elementFormDefault="qualified" targetNamespace="http://www.w3.org/2005/Atom" + xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xhtml="http://www.w3.org/1999/xhtml" + xmlns:cmis="http://www.cmis.org/2008/05" xmlns:xml="http://www.w3.org/XML/1998/namespace" + xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" + jaxb:extensionBindingPrefixes="xjc" jaxb:version="2.1" version="0.5"> + schemaLocation="xml.xsd" /> + schemaLocation="CMIS.xsd" /> @@ -41,8 +35,7 @@ - - + @@ -71,10 +64,11 @@ - - - - + + + + @@ -91,38 +85,27 @@ - - - + + - - + + - + - - + - - - + @@ -130,55 +113,54 @@ - - - - - - + + + - - - - - - + + + + + + + - - + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + - - - @@ -197,8 +179,7 @@ - + @@ -233,8 +214,7 @@ - + @@ -302,6 +282,7 @@ element. + @@ -309,10 +290,10 @@ - + + @@ -397,8 +378,8 @@ @@ -409,16 +390,16 @@ - + - + @@ -427,13 +408,11 @@ - - + @@ -453,6 +432,5 @@ processContents="lax" /> - - + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/CMIS-REST.xsd b/source/java/org/alfresco/repo/cmis/rest/xsd/CMIS-REST.xsd deleted file mode 100644 index 6b38e0b1b2..0000000000 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/CMIS-REST.xsd +++ /dev/null @@ -1,455 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/CMIS.xsd b/source/java/org/alfresco/repo/cmis/rest/xsd/CMIS.xsd new file mode 100644 index 0000000000..824ba10b55 --- /dev/null +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/CMIS.xsd @@ -0,0 +1,1077 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-AllowableActions.xml b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-AllowableActions.xml index 181d4d07db..46ee1a5ad7 100755 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-AllowableActions.xml +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-AllowableActions.xml @@ -3,7 +3,7 @@ xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.w3.org/2005/Atom ATOM4CMIS.xsd http://www.cmis.org/2008/05 CMIS-REST.xsd "> + xsi:schemaLocation="http://www.w3.org/2005/Atom ATOM4CMIS.xsd http://www.cmis.org/2008/05 CMIS.xsd "> cmis:parentId diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-DocumentEntry.xml b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-DocumentEntry.xml index 46d32c6d99..62d7f7a723 100755 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-DocumentEntry.xml +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-DocumentEntry.xml @@ -1,13 +1,9 @@ - - + xsi:schemaLocation="http://www.w3.org/2005/Atom ATOM4CMIS.xsd http://www.cmis.org/2008/05 CMIS.xsd "> Al Brown @@ -20,10 +16,8 @@ http://www.cmis.org/rep1/document-entry - - + + - + 2001-12-31T12:00:00 - - Document Entry example 2001-12-31T12:00:00 - - true - true - true - true - true - true - true - true - true - true - true - true - true - true - true - true - true - - - - false - true - true - true - false - false - - 2001-12-31T12:00:00 - 2001-12-31T12:00:00 - - docid1 - - - 70 - - email - document - - This is the initial checkin comment - 1.0 - text/plain - foo.txt - - - http://www.cmis.org/rep1/media/document-entry - - - - - - + + + false + + http://www.cmis.org/rep1/media/document-entry + true + true + true + false + false + abrown + 2001-12-31T12:00:00 + docid1 + + 70 + + email + document + + This is the + initial comment + 1.0 + text/plain + name + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-DocumentPWCEntry.xml b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-DocumentPWCEntry.xml index 92c2f6a71e..75889c7ed8 100755 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-DocumentPWCEntry.xml +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-DocumentPWCEntry.xml @@ -1,13 +1,9 @@ - - + xsi:schemaLocation="http://www.w3.org/2005/Atom ATOM4CMIS.xsd http://www.cmis.org/2008/05 CMIS.xsd "> Al Brown @@ -20,10 +16,8 @@ http://www.cmis.org/rep1/document-entry - - + + - + 2001-12-31T12:00:00 - - Document Entry example 2001-12-31T12:00:00 - - true - true - true - true - true - true - true - true - true - true - true - true - true - true - true - true - true - - - + + - true + docid1pwc + email + - true - false - false - false + true + + true + false + false + false - true + true + 2007-12-31T12:00:00 + 2007-12-31T12:00:00 - 2007-12-31T12:00:00 - 2007-12-31T12:00:00 - - - docid1pwc - docidpwc + docidpwc + 70 - 70 - - email - document + document - Al Brown - This is the initial checkin comment + Al Brown + This is the + initial checkin comment - 1.1 - text/plain - foo.txt - - - http://www.cmis.org/rep1/media/document-entry - - - + 1.1 + text/plain + foo.txt + + http://www.cmis.org/rep1/media/document-entry + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + - - + + + + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderChildren-Alfresco.xml b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderChildren-Alfresco.xml index e5c51e6b65..5f17281a27 100644 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderChildren-Alfresco.xml +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderChildren-Alfresco.xml @@ -7,11 +7,6 @@ - - - - - Company Home 2008-07-11T16:51:03.508+01:00 @@ -29,170 +24,23 @@ Site Collaboration Spaces Sites 2008-07-11T16:51:03.854+01:00 + -2008-07-11T16:51:03.086+01:00 -2008-07-11T16:51:03.854+01:00 -workspace://SpacesStore/b09bc7f5-19c3-4ad1-9c5d-8f3a95a3417d -workspace://SpacesStore/ffddcc48-0c6a-4aa3-b9e2-1121c35f6504 -document -System -System -Sites +2008-07-11T16:51:03.086+01:00 +2008-07-11T16:51:03.854+01:00 +workspace://SpacesStore/b09bc7f5-19c3-4ad1-9c5d-8f3a95a3417d +workspace://SpacesStore/ffddcc48-0c6a-4aa3-b9e2-1121c35f6504 +document +System +System +Sites + + 2008-07-11T16:51:03.854+01:00 http://localhost:80/alfresco/images/icons/space-icon-default-16.gif - -System -dd4f66e4-df9a-4910-94dd-4bc2a5e59443 -urn:uuid:dd4f66e4-df9a-4910-94dd-4bc2a5e59443 - - - - - - - -2008-07-11T16:50:25.286+01:00 -User managed definitions -Data Dictionary -2008-07-11T16:51:03.509+01:00 - -2008-07-11T16:50:25.286+01:00 -2008-07-11T16:51:03.509+01:00 -workspace://SpacesStore/dd4f66e4-df9a-4910-94dd-4bc2a5e59443 -workspace://SpacesStore/ffddcc48-0c6a-4aa3-b9e2-1121c35f6504 -document -System -System -Data Dictionary - -2008-07-11T16:51:03.509+01:00 -http://localhost:80/alfresco/images/icons/space-icon-default-16.gif - - -System -6dc1e4b5-d959-4ca8-b20c-21ce05fe8889 -urn:uuid:6dc1e4b5-d959-4ca8-b20c-21ce05fe8889 - - - - - - - -2008-07-11T16:50:25.698+01:00 -The guest root space -Guest Home -2008-07-11T16:51:03.515+01:00 - -2008-07-11T16:50:25.698+01:00 -2008-07-11T16:51:03.515+01:00 -workspace://SpacesStore/6dc1e4b5-d959-4ca8-b20c-21ce05fe8889 -workspace://SpacesStore/ffddcc48-0c6a-4aa3-b9e2-1121c35f6504 -document -System -System -Guest Home - -2008-07-11T16:51:03.515+01:00 -http://localhost:80/alfresco/images/icons/space-icon-default-16.gif - - -System -7d35ea01-5bfd-4785-92c3-3dc19623b162 -urn:uuid:7d35ea01-5bfd-4785-92c3-3dc19623b162 - - - - - - - -2008-07-11T16:50:25.822+01:00 -User Homes -User Homes -2008-07-11T16:51:03.516+01:00 - -2008-07-11T16:50:25.822+01:00 -2008-07-11T16:51:03.516+01:00 -workspace://SpacesStore/7d35ea01-5bfd-4785-92c3-3dc19623b162 -workspace://SpacesStore/ffddcc48-0c6a-4aa3-b9e2-1121c35f6504 -document -System -System -User Homes - -2008-07-11T16:51:03.516+01:00 -http://localhost:80/alfresco/images/icons/space-icon-default-16.gif - - -admin -605a7b77-c3b7-4583-85e6-04183ba69e44 -urn:uuid:605a7b77-c3b7-4583-85e6-04183ba69e44 - - - - - - - -2008-07-11T16:51:20.786+01:00 -CMIS Tests (summary) -CMIS Tests -2008-07-11T16:51:20.830+01:00 - -2008-07-11T16:51:20.786+01:00 -2008-07-11T16:51:20.830+01:00 -workspace://SpacesStore/605a7b77-c3b7-4583-85e6-04183ba69e44 -workspace://SpacesStore/ffddcc48-0c6a-4aa3-b9e2-1121c35f6504 -document -admin -admin -CMIS Tests - -2008-07-11T16:51:20.830+01:00 -http://localhost:80/alfresco/images/icons/space-icon-default-16.gif - - -System -79f2bb8b-a0ff-4e96-908c-85e794684104 -urn:uuid:79f2bb8b-a0ff-4e96-908c-85e794684104 - - - - - - - -2008-07-11T22:08:33.603+01:00 -Web Content Management Spaces -Web Projects -2008-07-11T22:08:33.676+01:00 - -2008-07-11T22:08:33.603+01:00 -2008-07-11T22:08:33.676+01:00 -workspace://SpacesStore/79f2bb8b-a0ff-4e96-908c-85e794684104 -workspace://SpacesStore/ffddcc48-0c6a-4aa3-b9e2-1121c35f6504 -document -System -System -Web Projects - -2008-07-11T22:08:33.676+01:00 -http://localhost:80/alfresco/images/icons/space-icon-default-16.gif - false - -2008-07-11T16:50:25.179+01:00 -2008-07-11T16:51:03.508+01:00 -workspace://SpacesStore/ffddcc48-0c6a-4aa3-b9e2-1121c35f6504 -workspace://SpacesStore/b9a00044-9a14-4733-a745-2bfb83915da8 -document -System -System -Company Home - 6 0 0 diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderChildren.xml b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderChildren.xml index 6831ea988f..c41960d719 100755 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderChildren.xml +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderChildren.xml @@ -5,7 +5,7 @@ xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.w3.org/2005/Atom ATOM4CMIS.xsd http://www.cmis.org/2008/05 CMIS-REST.xsd "> + xsi:schemaLocation="http://www.w3.org/2005/Atom ATOM4CMIS.xsd http://www.cmis.org/2008/05 CMIS.xsd "> 2001-12-31T12:00:00 - + + + + + 2001-12-31T12:00:00 + + + 2001-12-31T12:00:00 + + + + folderid1 + + + parentFolderId1 + + + + emailfolder + + + folder + + + true true @@ -88,29 +112,9 @@ true true - - - - 2001-12-31T12:00:00 - - - 2001-12-31T12:00:00 - - - - folderid1 - - - parentFolderId1 - - - - emailfolder - - - folder - - + + + @@ -167,7 +171,71 @@ 2001-12-31T12:00:00 - + + + + docid1 + + + + false + + + true + + + true + + + true + + + false + + + false + + + + 2001-12-31T12:00:00 + + + 2001-12-31T12:00:00 + + + + + + 70 + + + + email + + + document + + + + This is the initial checkin comment + + + 1.0 + + + text/plain + + + foo.txt + + + + http://www.cmis.org/rep1/media/document-entry + + + true true @@ -187,72 +255,11 @@ true true - - - - false - - - true - - - true - - - true - - - false - - - false - - - - 2001-12-31T12:00:00 - - - 2001-12-31T12:00:00 - - - - docid1 - - - - - 70 - - - - email - - - document - - - - - This is the initial checkin comment - - - 1.0 - - - text/plain - - - foo.txt - - - - http://www.cmis.org/rep1/media/document-entry - - + + + true - + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderDescendants.xml b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderDescendants.xml index 9737a1f9b1..82babcd694 100755 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderDescendants.xml +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderDescendants.xml @@ -1,41 +1,28 @@ - - Al Brown - http://www.cmis.org/rep1/folder1/children/3 - - + - - + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderEntry.xml b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderEntry.xml index 4626c44ca5..efeef5f5ae 100755 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderEntry.xml +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-FolderEntry.xml @@ -1,13 +1,9 @@ - - + xsi:schemaLocation="http://www.w3.org/2005/Atom ATOM4CMIS.xsd http://www.cmis.org/2008/05 CMIS.xsd "> Al Brown @@ -24,50 +20,52 @@ - + - + - + 2001-12-31T12:00:00 - Folder Entry example 2001-12-31T12:00:00 - - - - true - true - true - true - true - true - true - true - true - + + + + 2001-12-31T12:00:00 + + + 2001-12-31T12:00:00 + + folderid1 + parentFolderId1 + + emailfolder + + + folder + + + + + true + true + true + true + true + true + true + true + true + + - - 2001-12-31T12:00:00 - 2001-12-31T12:00:00 - - folderid1 - parentFolderId1 - - emailfolder - folder - - - - + + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-PolicyEntry.xml b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-PolicyEntry.xml index 0666031cfa..66c0f032c5 100755 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-PolicyEntry.xml +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-PolicyEntry.xml @@ -1,12 +1,9 @@ - + xsi:schemaLocation="http://www.w3.org/2005/Atom ATOM4CMIS.xsd http://www.cmis.org/2008/05 CMIS.xsd "> Al Brown @@ -21,46 +18,48 @@ http://www.cmis.org/rep1/policy-entry - - + + - - - + + + 2001-12-31T12:00:00 - Policy Entry example 2001-12-31T12:00:00 - + + + + 2001-12-31T12:00:00 + + + 2001-12-31T12:00:00 + + + policyid1 + + + security policy + + + policy + + - - true - true - true - true - true - - - - 2001-12-31T12:00:00 - 2001-12-31T12:00:00 - - policyid1 - - security policy - policy - - - + + true + true + true + true + true + + + + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-Query.xml b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-Query.xml index e5aec64976..3e93208fe6 100755 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-Query.xml +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-Query.xml @@ -2,10 +2,10 @@ + xsi:schemaLocation="http://www.cmis.org/2008/05 CMIS.xsd "> SELECT * FROM document true 0 0 false - + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-RelationshipEntry.xml b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-RelationshipEntry.xml index ad93a1d0b7..b5308e9794 100755 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-RelationshipEntry.xml +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-RelationshipEntry.xml @@ -1,12 +1,9 @@ - + xsi:schemaLocation="http://www.w3.org/2005/Atom ATOM4CMIS.xsd http://www.cmis.org/2008/05 CMIS.xsd "> Al Brown @@ -21,16 +18,13 @@ http://www.cmis.org/rep1/relationship-entry - - + + - + 2001-12-31T12:00:00 - Relationship Entry example 2001-12-31T12:00:00 - - - - true - true - true - true - true - + + + + 2001-12-31T12:00:00 + + + 2001-12-31T12:00:00 + + + relid1 + + + docid1 + + + docid2 + + + emaillink + + + relationship + + + + + true + true + true + true + true + + - - 2001-12-31T12:00:00 - 2001-12-31T12:00:00 - - relid1 - docid1 - docid2 - - emaillink - relationship - - + + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-Service.xml b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-Service.xml index b8343ba592..faf722b305 100755 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-Service.xml +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-Service.xml @@ -1,45 +1,56 @@ + xsi:schemaLocation="http://www.w3.org/2007/app APP.xsd http://www.w3.org/2005/Atom ATOM4CMIS.xsd http://www.cmis.org/2008/05 CMIS.xsd "> Repository 1 repid1 repository1 + Self Repository Description ACME Vendor ACME Repository ACME Version 99.01 + rootFolderId true true true true + true true - innerAndOuter + fulltextonly + innerandouter fulltextandstructured 0.43 - Welcome to ACME 99 + Local Message in vendor specific schema unfiled collection - + + root collection + + root collection checkedout collection - + + type collection + + type collection type collection - + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-Type.xml b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-Type.xml index f1e2d4453a..786ceb0362 100755 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/Example-Type.xml +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/Example-Type.xml @@ -1,43 +1,68 @@ - - documentTypeId - document - 2001-12-31T12:00:00 - 2001-12-31T12:00:00 - document - document - document - - The document type - true - true - true - true - true - allowed + + + System + Document Type + + http://www.cmis.org/id1 + document + 2001-12-31T12:00:00 + + + documentTypeId + document + document + + document + document + + + The document type + true + true + true + true + true - - - foo1 - propIdForFoo1 - foo1 - Description of foo1 - false - String - Single - 64 - cmis:choices - true - true - cmis:defaultValue - ro - true - true - + + + foo1 + + propIdForFoo1 + + foo1 + Description of foo1 + string + single + readonly + + false + true + true + true + + foo1 + foo2 - \ No newline at end of file + + true + + + default value + + + 1024 + + + + true + allowed + + + + + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/xhtml1-strict.xsd b/source/java/org/alfresco/repo/cmis/rest/xsd/xhtml1-strict.xsd index dfd54f8bbc..eaced8ed93 100644 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/xhtml1-strict.xsd +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/xhtml1-strict.xsd @@ -1,5 +1,10 @@ - + @@ -211,7 +216,7 @@ - + @@ -222,7 +227,7 @@ - + @@ -257,7 +262,7 @@ - + diff --git a/source/java/org/alfresco/repo/cmis/rest/xsd/xml.xsd b/source/java/org/alfresco/repo/cmis/rest/xsd/xml.xsd index 9cfd945778..6ec0d476f4 100644 --- a/source/java/org/alfresco/repo/cmis/rest/xsd/xml.xsd +++ b/source/java/org/alfresco/repo/cmis/rest/xsd/xml.xsd @@ -1,145 +1,48 @@ - + + + + + + + + + + + + - - - See http://www.w3.org/XML/1998/namespace.html and - http://www.w3.org/TR/REC-xml for information about this namespace. + + + + + + + + - This schema document describes the XML namespace, in a form - suitable for import by other schema documents. - - Note that local names in this namespace are intended to be defined - only by the World Wide Web Consortium or its subgroups. The - following names are currently defined in this namespace and should - not be used with conflicting semantics by any Working Group, - specification, or document instance: - - base (as an attribute name): denotes an attribute whose value - provides a URI to be used as the base for interpreting any - relative URIs in the scope of the element on which it - appears; its value is inherited. This name is reserved - by virtue of its definition in the XML Base specification. - - id (as an attribute name): denotes an attribute whose value - should be interpreted as if declared to be of type ID. - This name is reserved by virtue of its definition in the - xml:id specification. - - lang (as an attribute name): denotes an attribute whose value - is a language code for the natural language of the content of - any element; its value is inherited. This name is reserved - by virtue of its definition in the XML specification. - - space (as an attribute name): denotes an attribute whose - value is a keyword indicating what whitespace processing - discipline is intended for the content of the element; its - value is inherited. This name is reserved by virtue of its - definition in the XML specification. - - Father (in any context at all): denotes Jon Bosak, the chair of - the original XML Working Group. This name is reserved by - the following decision of the W3C XML Plenary and - XML Coordination groups: - - In appreciation for his vision, leadership and dedication - the W3C XML Plenary on this 10th day of February, 2000 - reserves for Jon Bosak in perpetuity the XML name - xml:Father - - - - - This schema defines attributes and an attribute group - suitable for use by - schemas wishing to allow xml:base, xml:lang, xml:space or xml:id - attributes on elements they define. - - To enable this, such a schema must import this schema - for the XML namespace, e.g. as follows: - <schema . . .> - . . . - <import namespace="http://www.w3.org/XML/1998/namespace" - schemaLocation="http://www.w3.org/2001/xml.xsd"/> - - Subsequently, qualified reference to any of the attributes - or the group defined below will have the desired effect, e.g. - - <type . . .> - . . . - <attributeGroup ref="xml:specialAttrs"/> + + + See http://www.w3.org/TR/xmlbase/ for + information about this attribute. + + - will define a type which will schema-validate an instance - element with any of those attributes - + + + See http://www.w3.org/TR/xml-id/ for + information about this attribute. + + - - In keeping with the XML Schema WG's standard versioning - policy, this schema document will persist at - http://www.w3.org/2007/08/xml.xsd. - At the date of issue it can also be found at - http://www.w3.org/2001/xml.xsd. - The schema document at that URI may however change in the future, - in order to remain compatible with the latest version of XML Schema - itself, or with the XML namespace itself. In other words, if the XML - Schema or XML namespaces change, the version of this document at - http://www.w3.org/2001/xml.xsd will change - accordingly; the version at - http://www.w3.org/2007/08/xml.xsd will not change. - - + + + + + + - - - Attempting to install the relevant ISO 2- and 3-letter - codes as the enumerated possible values is probably never - going to be a realistic possibility. See - RFC 3066 at http://www.ietf.org/rfc/rfc3066.txt and the IANA registry - at http://www.iana.org/assignments/lang-tag-apps.htm for - further information. - - The union allows for the 'un-declaration' of xml:lang with - the empty string. - - - - - - - - - - - - - - - - - - - - - - - - See http://www.w3.org/TR/xmlbase/ for - information about this attribute. - - - - - - See http://www.w3.org/TR/xml-id/ for - information about this attribute. - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java index 8c652624e4..12b5ab41ab 100644 --- a/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java +++ b/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java @@ -36,7 +36,6 @@ import javax.xml.datatype.XMLGregorianCalendar; import org.alfresco.cmis.CMISService; import org.alfresco.cmis.dictionary.CMISDictionaryService; import org.alfresco.cmis.dictionary.CMISMapping; -import org.alfresco.cmis.property.CMISPropertyNameMapping; import org.alfresco.cmis.property.CMISPropertyService; import org.alfresco.cmis.search.CMISQueryService; import org.alfresco.error.AlfrescoRuntimeException; @@ -108,7 +107,7 @@ public class DMAbstractServicePort if (filter.allow(name) && value != null) { PropertyBooleanType propBoolean = new PropertyBooleanType(); - propBoolean.setName(CMISPropertyNameMapping.getWebServiceName(name)); + propBoolean.setName(name); propBoolean.setValue((Boolean) value); properties.getPropertyBoolean().add(propBoolean); } @@ -120,7 +119,7 @@ public class DMAbstractServicePort if (filter.allow(name) && value != null) { PropertyDateTimeType propDateTime = new PropertyDateTimeType(); - propDateTime.setName(CMISPropertyNameMapping.getWebServiceName(name)); + propDateTime.setName(name); propDateTime.setValue(convert((Date) value)); properties.getPropertyDateTime().add(propDateTime); } @@ -132,7 +131,7 @@ public class DMAbstractServicePort if (filter.allow(name) && value != null) { PropertyIDType propID = new PropertyIDType(); - propID.setName(CMISPropertyNameMapping.getWebServiceName(name)); + propID.setName(name); propID.setValue(value.toString()); properties.getPropertyID().add(propID); } @@ -144,7 +143,7 @@ public class DMAbstractServicePort if (filter.allow(name) && value != null) { PropertyIntegerType propInteger = new PropertyIntegerType(); - propInteger.setName(CMISPropertyNameMapping.getWebServiceName(name)); + propInteger.setName(name); propInteger.setValue(BigInteger.valueOf((Long) value)); properties.getPropertyInteger().add(propInteger); } @@ -156,7 +155,7 @@ public class DMAbstractServicePort if (filter.allow(name) && value != null) { PropertyStringType propString = new PropertyStringType(); - propString.setName(CMISPropertyNameMapping.getWebServiceName(name)); + propString.setName(name); propString.setValue(value.toString()); properties.getPropertyString().add(propString); } @@ -179,7 +178,7 @@ public class DMAbstractServicePort if (filter.allow(name) && value != null) { PropertyURIType propString = new PropertyURIType(); - propString.setName(CMISPropertyNameMapping.getWebServiceName(name)); + propString.setName(name); propString.setValue(value.toString()); properties.getPropertyURI().add(propString); } @@ -205,7 +204,7 @@ public class DMAbstractServicePort addBooleanProperty(properties, filter, CMISMapping.PROP_IS_LATEST_VERSION, nodeRef); addBooleanProperty(properties, filter, CMISMapping.PROP_IS_MAJOR_VERSION, nodeRef); addBooleanProperty(properties, filter, CMISMapping.PROP_IS_LATEST_MAJOR_VERSION, nodeRef); - addBooleanProperty(properties, filter, CMISMapping.PROP_VERSION_SERIES_IS_CHECKED_OUT, nodeRef); + addBooleanProperty(properties, filter, CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT, nodeRef); addDateTimeProperty(properties, filter, CMISMapping.PROP_CREATION_DATE, nodeRef); addDateTimeProperty(properties, filter, CMISMapping.PROP_LAST_MODIFICATION_DATE, nodeRef); addIDProperty(properties, filter, CMISMapping.PROP_OBJECT_ID, nodeRef); @@ -229,7 +228,7 @@ public class DMAbstractServicePort addDateTimeProperty(properties, filter, CMISMapping.PROP_CREATION_DATE, nodeRef); addDateTimeProperty(properties, filter, CMISMapping.PROP_LAST_MODIFICATION_DATE, nodeRef); addIDProperty(properties, filter, CMISMapping.PROP_OBJECT_ID, nodeRef); - addIDProperty(properties, filter, CMISMapping.PROP_PARENT, nodeRef); + addIDProperty(properties, filter, CMISMapping.PROP_PARENT_ID, nodeRef); addStringProperty(properties, filter, CMISMapping.PROP_NAME, nodeRef); addStringProperty(properties, filter, "baseType", "folder"); addIDProperty(properties, filter, CMISMapping.PROP_OBJECT_TYPE_ID, nodeRef); diff --git a/source/java/org/alfresco/repo/cmis/ws/DMNavigationServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMNavigationServicePort.java index 625e58d3d6..1219ff1c7f 100644 --- a/source/java/org/alfresco/repo/cmis/ws/DMNavigationServicePort.java +++ b/source/java/org/alfresco/repo/cmis/ws/DMNavigationServicePort.java @@ -27,7 +27,7 @@ package org.alfresco.repo.cmis.ws; import java.math.BigInteger; import java.util.List; -import org.alfresco.cmis.CMISService.TypesFilter; +import org.alfresco.cmis.CMISTypesFilterEnum; import org.alfresco.cmis.dictionary.CMISMapping; import org.alfresco.service.cmr.repository.NodeRef; @@ -75,15 +75,15 @@ public class DMNavigationServicePort extends DMAbstractServicePort implements Na switch (parameters.getType()) { case DOCUMENTS: - listing = cmisService.getChildren(folderNodeRef, TypesFilter.Documents); + listing = cmisService.getChildren(folderNodeRef, CMISTypesFilterEnum.DOCUMENTS); break; case FOLDERS: - listing = cmisService.getChildren(folderNodeRef, TypesFilter.Folders); + listing = cmisService.getChildren(folderNodeRef, CMISTypesFilterEnum.FOLDERS); break; case POLICIES: throw new OperationNotSupportedException("Policies listing isn't supported", ExceptionUtils.createBasicFault(null, "Policies listing isn't supported")); case ANY: - listing = cmisService.getChildren(folderNodeRef, TypesFilter.Any); + listing = cmisService.getChildren(folderNodeRef, CMISTypesFilterEnum.ANY); break; } diff --git a/source/java/org/alfresco/repo/cmis/ws/DMRepositoryServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMRepositoryServicePort.java index e49f3a213a..6279488304 100644 --- a/source/java/org/alfresco/repo/cmis/ws/DMRepositoryServicePort.java +++ b/source/java/org/alfresco/repo/cmis/ws/DMRepositoryServicePort.java @@ -31,15 +31,15 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.alfresco.cmis.dictionary.CMISCardinality; +import org.alfresco.cmis.CMISCardinalityEnum; +import org.alfresco.cmis.CMISContentStreamAllowedEnum; +import org.alfresco.cmis.CMISFullTextSearchEnum; +import org.alfresco.cmis.CMISJoinEnum; +import org.alfresco.cmis.CMISPropertyTypeEnum; +import org.alfresco.cmis.CMISUpdatabilityEnum; import org.alfresco.cmis.dictionary.CMISPropertyDefinition; -import org.alfresco.cmis.dictionary.CMISPropertyType; import org.alfresco.cmis.dictionary.CMISTypeDefinition; import org.alfresco.cmis.dictionary.CMISTypeId; -import org.alfresco.cmis.dictionary.CMISUpdatability; -import org.alfresco.cmis.dictionary.ContentStreamAllowed; -import org.alfresco.cmis.search.FullTextSearchSupport; -import org.alfresco.cmis.search.JoinSupport; import org.alfresco.service.descriptor.Descriptor; /** @@ -51,49 +51,49 @@ import org.alfresco.service.descriptor.Descriptor; @javax.jws.WebService(name = "RepositoryServicePort", serviceName = "RepositoryService", portName = "RepositoryServicePort", targetNamespace = "http://www.cmis.org/ns/1.0", endpointInterface = "org.alfresco.repo.cmis.ws.RepositoryServicePort") public class DMRepositoryServicePort extends DMAbstractServicePort implements RepositoryServicePort { - private static Map fulltextEnumMapping; - private static Map joinEnumMapping; - private static Map contentStreamAllowedEnumMapping; - private static Map updatabilityEnumMapping; - private static Map cardinalityEnumMapping; - private static Map propertyTypeEnumMapping; + private static Map fulltextEnumMapping; + private static Map joinEnumMapping; + private static Map contentStreamAllowedEnumMapping; + private static Map updatabilityEnumMapping; + private static Map cardinalityEnumMapping; + private static Map propertyTypeEnumMapping; static { - fulltextEnumMapping = new HashMap(); - fulltextEnumMapping.put(FullTextSearchSupport.NO_FULL_TEXT, FulltextEnum.NO_FULLTEXT); - fulltextEnumMapping.put(FullTextSearchSupport.FULL_TEXT_ONLY, FulltextEnum.FULLTEXT_ONLY); - fulltextEnumMapping.put(FullTextSearchSupport.FULL_TEXT_AND_STRUCTURED, FulltextEnum.FULLTEXT_AND_STRUCTURED); + fulltextEnumMapping = new HashMap(); + fulltextEnumMapping.put(CMISFullTextSearchEnum.NO_FULL_TEXT, FulltextEnum.NO_FULLTEXT); + fulltextEnumMapping.put(CMISFullTextSearchEnum.FULL_TEXT_ONLY, FulltextEnum.FULLTEXT_ONLY); + fulltextEnumMapping.put(CMISFullTextSearchEnum.FULL_TEXT_AND_STRUCTURED, FulltextEnum.FULLTEXT_AND_STRUCTURED); - joinEnumMapping = new HashMap(); - joinEnumMapping.put(JoinSupport.INNER_AND_OUTER_JOIN_SUPPORT, JoinEnum.INNER_AND_OUTER); - joinEnumMapping.put(JoinSupport.INNER_JOIN_SUPPORT, JoinEnum.INNER_ONLY); - joinEnumMapping.put(JoinSupport.NO_JOIN_SUPPORT, JoinEnum.NO_JOIN); + joinEnumMapping = new HashMap(); + joinEnumMapping.put(CMISJoinEnum.INNER_AND_OUTER_JOIN_SUPPORT, JoinEnum.INNER_AND_OUTER); + joinEnumMapping.put(CMISJoinEnum.INNER_JOIN_SUPPORT, JoinEnum.INNER_ONLY); + joinEnumMapping.put(CMISJoinEnum.NO_JOIN_SUPPORT, JoinEnum.NO_JOIN); - contentStreamAllowedEnumMapping = new HashMap(); - contentStreamAllowedEnumMapping.put(ContentStreamAllowed.ALLOWED, ContentStreamAllowedEnum.ALLOWED); - contentStreamAllowedEnumMapping.put(ContentStreamAllowed.NOT_ALLOWED, ContentStreamAllowedEnum.NOT_ALLOWED); - contentStreamAllowedEnumMapping.put(ContentStreamAllowed.REQUIRED, ContentStreamAllowedEnum.REQUIRED); + contentStreamAllowedEnumMapping = new HashMap(); + contentStreamAllowedEnumMapping.put(CMISContentStreamAllowedEnum.ALLOWED, ContentStreamAllowedEnum.ALLOWED); + contentStreamAllowedEnumMapping.put(CMISContentStreamAllowedEnum.NOT_ALLOWED, ContentStreamAllowedEnum.NOT_ALLOWED); + contentStreamAllowedEnumMapping.put(CMISContentStreamAllowedEnum.REQUIRED, ContentStreamAllowedEnum.REQUIRED); - updatabilityEnumMapping = new HashMap(); - updatabilityEnumMapping.put(CMISUpdatability.READ_AND_WRITE, UpdatabilityEnum.READ_WRITE); - updatabilityEnumMapping.put(CMISUpdatability.READ_AND_WRITE_WHEN_CHECKED_OUT, UpdatabilityEnum.READ_WRITE_WHEN_CHECKED_OUT); - updatabilityEnumMapping.put(CMISUpdatability.READ_ONLY, UpdatabilityEnum.READ_ONLY); + updatabilityEnumMapping = new HashMap(); + updatabilityEnumMapping.put(CMISUpdatabilityEnum.READ_AND_WRITE, UpdatabilityEnum.READ_WRITE); + updatabilityEnumMapping.put(CMISUpdatabilityEnum.READ_AND_WRITE_WHEN_CHECKED_OUT, UpdatabilityEnum.READ_WRITE_WHEN_CHECKED_OUT); + updatabilityEnumMapping.put(CMISUpdatabilityEnum.READ_ONLY, UpdatabilityEnum.READ_ONLY); - cardinalityEnumMapping = new HashMap(); - cardinalityEnumMapping.put(CMISCardinality.MULTI_VALUED, CardinalityEnum.MULTI_VALUED); - cardinalityEnumMapping.put(CMISCardinality.SINGLE_VALUED, CardinalityEnum.SINGLE_VALUED); + cardinalityEnumMapping = new HashMap(); + cardinalityEnumMapping.put(CMISCardinalityEnum.MULTI_VALUED, CardinalityEnum.MULTI_VALUED); + cardinalityEnumMapping.put(CMISCardinalityEnum.SINGLE_VALUED, CardinalityEnum.SINGLE_VALUED); - propertyTypeEnumMapping = new HashMap(); - propertyTypeEnumMapping.put(CMISPropertyType.Boolean, PropertyTypeEnum.BOOLEAN); - propertyTypeEnumMapping.put(CMISPropertyType.DateTime, PropertyTypeEnum.DATE_TIME); - propertyTypeEnumMapping.put(CMISPropertyType.Decimal, PropertyTypeEnum.DECIMAL); - propertyTypeEnumMapping.put(CMISPropertyType.HTML, PropertyTypeEnum.HTML); - propertyTypeEnumMapping.put(CMISPropertyType.ID, PropertyTypeEnum.ID); - propertyTypeEnumMapping.put(CMISPropertyType.Integer, PropertyTypeEnum.INTEGER); - propertyTypeEnumMapping.put(CMISPropertyType.String, PropertyTypeEnum.STRING); - propertyTypeEnumMapping.put(CMISPropertyType.URI, PropertyTypeEnum.URI); - propertyTypeEnumMapping.put(CMISPropertyType.XML, PropertyTypeEnum.XML); + propertyTypeEnumMapping = new HashMap(); + propertyTypeEnumMapping.put(CMISPropertyTypeEnum.BOOLEAN, PropertyTypeEnum.BOOLEAN); + propertyTypeEnumMapping.put(CMISPropertyTypeEnum.DATETIME, PropertyTypeEnum.DATE_TIME); + propertyTypeEnumMapping.put(CMISPropertyTypeEnum.DECIMAL, PropertyTypeEnum.DECIMAL); + propertyTypeEnumMapping.put(CMISPropertyTypeEnum.HTML, PropertyTypeEnum.HTML); + propertyTypeEnumMapping.put(CMISPropertyTypeEnum.ID, PropertyTypeEnum.ID); + propertyTypeEnumMapping.put(CMISPropertyTypeEnum.INTEGER, PropertyTypeEnum.INTEGER); + propertyTypeEnumMapping.put(CMISPropertyTypeEnum.STRING, PropertyTypeEnum.STRING); + propertyTypeEnumMapping.put(CMISPropertyTypeEnum.URI, PropertyTypeEnum.URI); + propertyTypeEnumMapping.put(CMISPropertyTypeEnum.XML, PropertyTypeEnum.XML); } public List getRepositories() throws RuntimeException, InvalidArgumentException, OperationNotSupportedException, UpdateConflictException, @@ -102,7 +102,6 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re RepositoryType repositoryType = new RepositoryType(); Descriptor serverDescriptor = descriptorService.getCurrentRepositoryDescriptor(); repositoryType.setRepositoryID(serverDescriptor.getId()); - System.out.println("**** ID: " + serverDescriptor.getId()); repositoryType.setRepositoryName(serverDescriptor.getName()); return Collections.singletonList(repositoryType); } diff --git a/source/java/org/alfresco/repo/web/scripts/BaseWebScriptTest.java b/source/java/org/alfresco/repo/web/scripts/BaseWebScriptTest.java index 2aeb9e49a1..b0c938e0fb 100644 --- a/source/java/org/alfresco/repo/web/scripts/BaseWebScriptTest.java +++ b/source/java/org/alfresco/repo/web/scripts/BaseWebScriptTest.java @@ -25,10 +25,15 @@ package org.alfresco.repo.web.scripts; import java.io.IOException; +import java.io.PrintStream; import java.io.UnsupportedEncodingException; import java.util.Map; +import junit.framework.AssertionFailedError; +import junit.framework.Test; import junit.framework.TestCase; +import junit.framework.TestListener; +import junit.textui.ResultPrinter; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.repo.security.authentication.AuthenticationUtil; @@ -47,8 +52,6 @@ import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.params.HttpClientParams; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * Base unit test class for web scripts. @@ -57,14 +60,111 @@ import org.apache.commons.logging.LogFactory; */ public abstract class BaseWebScriptTest extends TestCase { - // Logger - private static final Log logger = LogFactory.getLog(BaseWebScriptTest.class); + // Test Listener + private WebScriptTestListener listener = null; + private boolean traceReqRes = false; /** Local / Remote Server access */ private String defaultRunAs = null; private RemoteServer remoteServer = null; private HttpClient httpClient = null; + + /** + * Web Script Test Listener + */ + public static interface WebScriptTestListener extends TestListener + { + public void addLog(Test test, String log); + } + + /** + * Default Test Listener + */ + public static class BaseWebScriptTestListener extends ResultPrinter implements WebScriptTestListener + { + /** + * Construct + * + * @param writer + */ + public BaseWebScriptTestListener(PrintStream writer) + { + super(writer); + } + + /* (non-Javadoc) + * @see junit.textui.ResultPrinter#addError(junit.framework.Test, java.lang.Throwable) + */ + @Override + public void addError(Test test, Throwable t) + { + getWriter().println("*** Error: " + ((BaseWebScriptTest)test).getName()); + t.printStackTrace(getWriter()); + } + + /* (non-Javadoc) + * @see junit.textui.ResultPrinter#addFailure(junit.framework.Test, junit.framework.AssertionFailedError) + */ + @Override + public void addFailure(Test test, AssertionFailedError t) + { + getWriter().println("*** Failed: " + ((BaseWebScriptTest)test).getName()); + t.printStackTrace(getWriter()); + } + + /* (non-Javadoc) + * @see junit.textui.ResultPrinter#endTest(junit.framework.Test) + */ + @Override + public void endTest(Test test) + { + getWriter().println(); + getWriter().println("*** Test completed: " + ((BaseWebScriptTest)test).getName()); + } + + /* (non-Javadoc) + * @see junit.textui.ResultPrinter#startTest(junit.framework.Test) + */ + @Override + public void startTest(Test test) + { + getWriter().println(); + getWriter().println("*** Test started: " + ((BaseWebScriptTest)test).getName() + " (remote: " + (((BaseWebScriptTest)test).getRemoteServer() != null)); + } + + /** + * Add an arbitrary log statement + * + * @param test + * @param log + */ + public void addLog(Test test, String log) + { + this.getWriter().println(log); + } + } + + /** + * Sets Test Listener + * + * @param resultPrinter + */ + public void setListener(WebScriptTestListener listener) + { + this.listener = listener; + } + + /** + * Sets whether to trace request / response bodies + * + * @param traceReqRes + */ + public void setTraceReqRes(boolean traceReqRes) + { + this.traceReqRes = traceReqRes; + } + /** * Set Remote Server context * @@ -74,6 +174,16 @@ public abstract class BaseWebScriptTest extends TestCase { remoteServer = server; } + + /** + * Gets Remote Server + * + * @return + */ + public RemoteServer getRemoteServer() + { + return remoteServer; + } /** * Set Local Run As User @@ -97,7 +207,6 @@ public abstract class BaseWebScriptTest extends TestCase httpClient.getState().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials(remoteServer.username, remoteServer.password)); } } - /** Test web script server */ private static TestWebScriptServer server = null; @@ -111,6 +220,28 @@ public abstract class BaseWebScriptTest extends TestCase return BaseWebScriptTest.server; } + /** + * Is Log Enabled? + * + * @return true => enabled + */ + protected boolean isLogEnabled() + { + return listener != null; + } + + /** + * Log Message to Test Listener + * + * @param log + */ + protected void log(String log) + { + if (listener != null) + { + listener.addLog(this, log); + } + } /** * Send Request to Test Web Script Server (as admin) @@ -138,8 +269,11 @@ public abstract class BaseWebScriptTest extends TestCase protected Response sendRequest(Request req, int expectedStatus, String asUser) throws IOException { - if (logger.isInfoEnabled()) - logger.info("Request: " + req.getMethod() + " " + req.getFullUri() + (req.getBody() == null ? "" : "\n" + new String(req.getBody()))); + if (traceReqRes && isLogEnabled()) + { + log(""); + log("* Request: " + req.getMethod() + " " + req.getFullUri() + (req.getBody() == null ? "" : "\n" + new String(req.getBody()))); + } Response res = null; if (remoteServer == null) @@ -151,15 +285,14 @@ public abstract class BaseWebScriptTest extends TestCase res = sendRemoteRequest(req, expectedStatus); } - if (logger.isInfoEnabled()) - logger.info("Response: " + res.getStatus() + " " + req.getMethod() + " " + req.getFullUri() + "\n" + res.getContentAsString()); + if (traceReqRes && isLogEnabled()) + { + log(""); + log("* Response: " + res.getStatus() + " " + req.getMethod() + " " + req.getFullUri() + "\n" + res.getContentAsString()); + } if (expectedStatus > 0 && expectedStatus != res.getStatus()) { -// if (res.getStatus() == 500) -// { -// System.out.println(res.getContentAsString()); -// } fail("Status code " + res.getStatus() + " returned, but expected " + expectedStatus + " for " + req.getFullUri() + " (" + req.getMethod() + ")\n" + res.getContentAsString()); } diff --git a/source/java/org/apache/abdera/ext/cmis/CMISConstants.java b/source/java/org/apache/abdera/ext/cmis/CMISConstants.java index 88c9189d63..c7b828f40a 100644 --- a/source/java/org/apache/abdera/ext/cmis/CMISConstants.java +++ b/source/java/org/apache/abdera/ext/cmis/CMISConstants.java @@ -26,6 +26,8 @@ package org.apache.abdera.ext.cmis; import javax.xml.namespace.QName; +import org.apache.abdera.util.Constants; + /** * CMIS Namespace definitions for the Abdera ATOM library. @@ -41,10 +43,22 @@ import javax.xml.namespace.QName; */ public interface CMISConstants { + // Namespace public static final String CMIS_200805_NS = "http://www.cmis.org/2008/05"; + + // Mimetypes + public static final String MIMETYPE_QUERY = "application/cmisquery+xml"; + public static final String MIMETYPE_ALLOWABLEACTIONS = "application/cmisallowableactions+xml"; // CMIS Service Document public static final QName COLLECTION_TYPE = new QName(CMIS_200805_NS, "collectionType"); + public static final String COLLECTION_ROOT_CHILDREN = "root-children"; + public static final String COLLECTION_ROOT_DESCENDANTS = "root-descendants"; + public static final String COLLECTION_CHECKEDOUT = "checkedout"; + public static final String COLLECTION_UNFILED = "unfiled"; + public static final String COLLECTION_TYPES_CHILDREN = "types-children"; + public static final String COLLECTION_TYPES_DESCENDANTS = "types-descendants"; + public static final String COLLECTION_QUERY = "query"; // CMIS Repository Info public static final QName REPOSITORY_INFO = new QName(CMIS_200805_NS, "repositoryInfo"); @@ -67,35 +81,60 @@ public interface CMISConstants public static final QName CAPABILITY_JOIN = new QName(CMIS_200805_NS, "capabilityJoin"); public static final QName CAPABILITY_FULLTEXT = new QName(CMIS_200805_NS, "capabilityFullText"); - // CMIS Schema + // CMIS Object + public static final QName OBJECT = new QName(CMIS_200805_NS, "object"); public static final QName PROPERTIES = new QName(CMIS_200805_NS, "properties"); - public static final QName PROPERTY_STRING = new QName(CMIS_200805_NS, "propertyString"); - public static final QName PROPERTY_ID = new QName(CMIS_200805_NS, "propertyID"); - public static final QName PROPERTY_BOOLEAN = new QName(CMIS_200805_NS, "propertyBoolean"); public static final QName PROPERTY_NAME = new QName(CMIS_200805_NS, "name"); - - // CMIS Properties - public static final String PROP_NAME = "name"; - public static final String PROP_OBJECT_ID = "objectId"; - public static final String PROP_BASETYPE = "baseType"; - public static final String PROP_OBJECT_TYPE = "objectType"; - public static final String PROP_IS_IMMUTABLE = "isImmutable"; - public static final String PROP_IS_LATEST_VERSION = "isLatestVersion"; - public static final String PROP_IS_MAJOR_VERSION = "isMajorVersion"; - public static final String PROP_IS_LATEST_MAJOR_VERSION = "isLatestMajorVersion"; - public static final String PROP_VERSION_LABEL = "versionLabel"; - public static final String PROP_VERSION_SERIES_ID = "versionSeriesID"; - public static final String PROP_VERSION_SERIES_IS_CHECKED_OUT = "isVersionSeriesCheckedOut"; - public static final String PROP_VERSION_SERIES_CHECKED_OUT_BY = "versionSeriesCheckedOutBy"; - public static final String PROP_VERSION_SERIES_CHECKED_OUT_ID = "versionSeriesCheckedOutID"; - public static final String PROP_CHECKIN_COMMENT = "checkinComment"; - + public static final QName PROPERTY_VALUE = new QName(CMIS_200805_NS, "value"); + public static final QName PROPERTY_STRING = new QName(CMIS_200805_NS, "propertyString"); + public static final QName PROPERTY_DECIMAL = new QName(CMIS_200805_NS, "propertyDecimal"); + public static final QName PROPERTY_INTEGER = new QName(CMIS_200805_NS, "propertyInteger"); + public static final QName PROPERTY_BOOLEAN = new QName(CMIS_200805_NS, "propertyBoolean"); + public static final QName PROPERTY_DATETIME = new QName(CMIS_200805_NS, "propertyDateTime"); + public static final QName PROPERTY_URI = new QName(CMIS_200805_NS, "propertyUri"); + public static final QName PROPERTY_ID = new QName(CMIS_200805_NS, "propertyId"); + public static final QName PROPERTY_XML = new QName(CMIS_200805_NS, "propertyXml"); + public static final QName PROPERTY_HTML = new QName(CMIS_200805_NS, "propertyHtml"); + // CMIS Relationships public static final String REL_CHILDREN = "cmis-children"; + public static final String REL_DESCENDANTS = "cmis-descendants"; public static final String REL_PARENT = "cmis-parent"; public static final String REL_FOLDERPARENT = "cmis-folderparent"; public static final String REL_PARENTS = "cmis-parents"; public static final String REL_ALLVERSIONS = "cmis-allversions"; public static final String REL_TYPE = "cmis-type"; + public static final String REL_SOURCE = "cmis-source"; + + // CMIS Nested Entry + public static final QName NESTED_ENTRY = Constants.ENTRY; + + + // CMIS Properties Names + public static final String PROP_NAME = "Name"; + public static final String PROP_OBJECT_ID = "ObjectId"; + public static final String PROP_BASETYPE = "BaseType"; + public static final String PROP_OBJECT_TYPE_ID = "ObjectTypeId"; + public static final String PROP_IS_IMMUTABLE = "IsImmutable"; + public static final String PROP_IS_LATEST_VERSION = "IsLatestVersion"; + public static final String PROP_IS_MAJOR_VERSION = "IsMajorVersion"; + public static final String PROP_IS_LATEST_MAJOR_VERSION = "IsLatestMajorVersion"; + public static final String PROP_VERSION_LABEL = "VersionLabel"; + public static final String PROP_VERSION_SERIES_ID = "VersionSeriesId"; + public static final String PROP_IS_VERSION_SERIES_CHECKED_OUT = "IsVersionSeriesCheckedOut"; + public static final String PROP_VERSION_SERIES_CHECKED_OUT_BY = "VersionSeriesCheckedOutBy"; + public static final String PROP_VERSION_SERIES_CHECKED_OUT_ID = "VersionSeriesCheckedOutId"; + public static final String PROP_CHECKIN_COMMENT = "CheckinComment"; + + // CMIS Property Types + public static final String PROP_TYPE_STRING = "string"; + public static final String PROP_TYPE_DECIMAL = "decimal"; + public static final String PROP_TYPE_INTEGER = "integer"; + public static final String PROP_TYPE_BOOLEAN = "boolean"; + public static final String PROP_TYPE_DATETIME = "datetime"; + public static final String PROP_TYPE_URI = "uri"; + public static final String PROP_TYPE_ID = "id"; + public static final String PROP_TYPE_XML = "xml"; + public static final String PROP_TYPE_HTML = "html"; } diff --git a/source/java/org/apache/abdera/ext/cmis/CMISExtensionFactory.java b/source/java/org/apache/abdera/ext/cmis/CMISExtensionFactory.java index 554438e7d3..df5fdb00bf 100644 --- a/source/java/org/apache/abdera/ext/cmis/CMISExtensionFactory.java +++ b/source/java/org/apache/abdera/ext/cmis/CMISExtensionFactory.java @@ -24,6 +24,15 @@ */ package org.apache.abdera.ext.cmis; +import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyBoolean; +import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyDateTime; +import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyDecimal; +import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyHtml; +import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyId; +import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyInteger; +import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyString; +import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyUri; +import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyXml; import org.apache.abdera.util.AbstractExtensionFactory; @@ -48,7 +57,17 @@ public class CMISExtensionFactory extends AbstractExtensionFactory super(CMIS_200805_NS); addImpl(REPOSITORY_INFO, CMISRepositoryInfo.class); addImpl(CAPABILITIES, CMISCapabilities.class); + addImpl(OBJECT, CMISObject.class); addImpl(PROPERTIES, CMISProperties.class); + addImpl(PROPERTY_STRING, CMISPropertyString.class); + addImpl(PROPERTY_DECIMAL, CMISPropertyDecimal.class); + addImpl(PROPERTY_INTEGER, CMISPropertyInteger.class); + addImpl(PROPERTY_BOOLEAN, CMISPropertyBoolean.class); + addImpl(PROPERTY_DATETIME, CMISPropertyDateTime.class); + addImpl(PROPERTY_URI, CMISPropertyUri.class); + addImpl(PROPERTY_ID, CMISPropertyId.class); + addImpl(PROPERTY_XML, CMISPropertyXml.class); + addImpl(PROPERTY_HTML, CMISPropertyHtml.class); } } diff --git a/source/java/org/apache/abdera/ext/cmis/CMISObject.java b/source/java/org/apache/abdera/ext/cmis/CMISObject.java new file mode 100644 index 0000000000..76dfbddc18 --- /dev/null +++ b/source/java/org/apache/abdera/ext/cmis/CMISObject.java @@ -0,0 +1,217 @@ +/* + * Copyright (C) 2005-2008 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 recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.apache.abdera.ext.cmis; + +import org.apache.abdera.factory.Factory; +import org.apache.abdera.model.Element; +import org.apache.abdera.model.ExtensibleElementWrapper; + + +/** + * CMIS Object for the Abdera ATOM library. + * + * Encapsulates access and modification of CMIS extension values to CMIS + * Object. + * + * NOTE: Potentially, this extension can be contributed to Abdera upon + * publication of CMIS. This is why it is organised under a + * non-Alfresco Java package. It follows the conventions of all + * other Abdera extensions. + * + * @author davidc + */ +public class CMISObject extends ExtensibleElementWrapper +{ + /** + * @param internal + */ + public CMISObject(Element internal) + { + super(internal); + } + + /** + * @param factory + */ + public CMISObject(Factory factory) + { + super(factory, CMISConstants.OBJECT); + } + + /** + * Gets all Properties for this CMIS Object + * + * @return properties + */ + public CMISProperties getProperties() + { + Element child = getFirstChild(CMISConstants.PROPERTIES); + if (child == null) + { + child = addExtension(CMISConstants.PROPERTIES); + } + return (CMISProperties)child; + } + + /** + * Gets name + * + * @return name property + */ + public CMISProperty getName() + { + return getProperties().find(CMISConstants.PROP_NAME); + } + + /** + * Gets id + * + * @return id property + */ + public CMISProperty getObjectId() + { + return getProperties().find(CMISConstants.PROP_OBJECT_ID); + } + + /** + * Gets base type + * + * @return base type property + */ + public CMISProperty getBaseType() + { + return getProperties().find(CMISConstants.PROP_BASETYPE); + } + + /** + * Gets object type + * + * @return object type property + */ + public CMISProperty getObjectTypeId() + { + return getProperties().find(CMISConstants.PROP_OBJECT_TYPE_ID); + } + + /** + * Is immutable? + * + * @return isImmutable property + */ + public CMISProperty isImmutable() + { + return getProperties().find(CMISConstants.PROP_IS_IMMUTABLE); + } + + /** + * Gets Latest Version + * + * @return latest version property + */ + public CMISProperty isLatestVersion() + { + return getProperties().find(CMISConstants.PROP_IS_LATEST_VERSION); + } + + /** + * Is Major Version? + * + * @return is major version property + */ + public CMISProperty isMajorVersion() + { + return getProperties().find(CMISConstants.PROP_IS_MAJOR_VERSION); + } + + /** + * Is Latest Major Version? + * + * @return is latest major version property + */ + public CMISProperty isLatestMajorVersion() + { + return getProperties().find(CMISConstants.PROP_IS_LATEST_MAJOR_VERSION); + } + + /** + * Version label + * + * @return version label property + */ + public CMISProperty getVersionLabel() + { + return getProperties().find(CMISConstants.PROP_VERSION_LABEL); + } + + /** + * Version series id + * + * @return version series id property + */ + public CMISProperty getVersionSeriesId() + { + return getProperties().find(CMISConstants.PROP_VERSION_SERIES_ID); + } + + /** + * Version Series Checked Out + * + * @return version series checked out property + */ + public CMISProperty isVersionSeriesCheckedOut() + { + return getProperties().find(CMISConstants.PROP_IS_VERSION_SERIES_CHECKED_OUT); + } + + /** + * Version Series Checked Out By + * + * @return version series checked out by property + */ + public CMISProperty getVersionSeriesCheckedOutBy() + { + return getProperties().find(CMISConstants.PROP_VERSION_SERIES_CHECKED_OUT_BY); + } + + /** + * Version Series Checked Out Id + * + * @return version series checked out id property + */ + public CMISProperty getVersionSeriesCheckedOutId() + { + return getProperties().find(CMISConstants.PROP_VERSION_SERIES_CHECKED_OUT_ID); + } + + /** + * Checkin Comment + * + * @return checkin comment property + */ + public CMISProperty getCheckinComment() + { + return getProperties().find(CMISConstants.PROP_CHECKIN_COMMENT); + } +} diff --git a/source/java/org/apache/abdera/ext/cmis/CMISProperties.java b/source/java/org/apache/abdera/ext/cmis/CMISProperties.java index 1eae6885b2..252ad3ca40 100644 --- a/source/java/org/apache/abdera/ext/cmis/CMISProperties.java +++ b/source/java/org/apache/abdera/ext/cmis/CMISProperties.java @@ -24,13 +24,16 @@ */ package org.apache.abdera.ext.cmis; +import java.util.ArrayList; +import java.util.List; + import org.apache.abdera.factory.Factory; import org.apache.abdera.model.Element; import org.apache.abdera.model.ElementWrapper; /** - * CMIS Object Element Wrapper for the Abdera ATOM library. + * CMIS Properties Element Wrapper for the Abdera ATOM library. * * Encapsulates access and modification of CMIS extension values to ATOM. * @@ -43,128 +46,59 @@ import org.apache.abdera.model.ElementWrapper; */ public class CMISProperties extends ElementWrapper { + /** + * @param internal + */ public CMISProperties(Element internal) { super(internal); } + /** + * @param factory + */ public CMISProperties(Factory factory) { super(factory, CMISConstants.PROPERTIES); } - public String getName() + /** + * Gets all property names + * + * @return list of property names + */ + public List getNames() { - return findPropertyString(CMISConstants.PROP_NAME); - } - - public String getObjectId() - { - return findPropertyID(CMISConstants.PROP_OBJECT_ID); - } - - public String getBaseType() - { - return findPropertyString(CMISConstants.PROP_BASETYPE); - } - - public String getObjectType() - { - return findPropertyString(CMISConstants.PROP_OBJECT_TYPE); - } - - public boolean isImmutable() - { - return findPropertyBoolean(CMISConstants.PROP_IS_IMMUTABLE); - } - - public boolean isLatestVersion() - { - return findPropertyBoolean(CMISConstants.PROP_IS_LATEST_VERSION); - } - - public boolean isMajorVersion() - { - return findPropertyBoolean(CMISConstants.PROP_IS_MAJOR_VERSION); - } - - public boolean isLatestMajorVersion() - { - return findPropertyBoolean(CMISConstants.PROP_IS_LATEST_MAJOR_VERSION); - } - - public String getVersionLabel() - { - return findPropertyString(CMISConstants.PROP_VERSION_LABEL); - } - - public String getVersionSeriesId() - { - return findPropertyID(CMISConstants.PROP_VERSION_SERIES_ID); - } - - public boolean isVersionSeriesCheckedOut() - { - return findPropertyBoolean(CMISConstants.PROP_VERSION_SERIES_IS_CHECKED_OUT); - } - - public String getVersionSeriesCheckedOutBy() - { - return findPropertyString(CMISConstants.PROP_VERSION_SERIES_CHECKED_OUT_BY); - } - - public String getVersionSeriesCheckedOutId() - { - return findPropertyID(CMISConstants.PROP_VERSION_SERIES_CHECKED_OUT_ID); - } - - public String getCheckinComment() - { - return findPropertyString(CMISConstants.PROP_CHECKIN_COMMENT); - } - - - public String findPropertyString(String name) - { - Element child = getFirstChild(CMISConstants.PROPERTY_STRING); - while(child != null) + List props = getElements(); + List names = new ArrayList(props.size()); + for (CMISProperty prop : props) { - if (name.equals(child.getAttributeValue(CMISConstants.PROPERTY_NAME))) + names.add(prop.getName()); + } + return names; + } + + /** + * Finds property by name + * + * @param name property name + * @return property + */ + public CMISProperty find(String name) + { + List elements = getElements(); + for (Element element : elements) + { + if (element instanceof CMISProperty) { - return child.getText(); + CMISProperty prop = (CMISProperty)element; + if (prop.getName().equals(name)) + { + return prop; + } } - child = child.getNextSibling(CMISConstants.PROPERTY_STRING); } return null; } - - public String findPropertyID(String name) - { - Element child = getFirstChild(CMISConstants.PROPERTY_ID); - while(child != null) - { - if (name.equals(child.getAttributeValue(CMISConstants.PROPERTY_NAME))) - { - return child.getText(); - } - child = child.getNextSibling(CMISConstants.PROPERTY_ID); - } - return null; - } - - public boolean findPropertyBoolean(String name) - { - Element child = getFirstChild(CMISConstants.PROPERTY_BOOLEAN); - while(child != null) - { - if (name.equals(child.getAttributeValue(CMISConstants.PROPERTY_NAME))) - { - return Boolean.valueOf(child.getText()); - } - child = child.getNextSibling(CMISConstants.PROPERTY_BOOLEAN); - } - return false; - } - - + } diff --git a/source/java/org/apache/abdera/ext/cmis/CMISProperty.java b/source/java/org/apache/abdera/ext/cmis/CMISProperty.java new file mode 100644 index 0000000000..67e9eed24e --- /dev/null +++ b/source/java/org/apache/abdera/ext/cmis/CMISProperty.java @@ -0,0 +1,387 @@ +/* + * Copyright (C) 2005-2008 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 recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.apache.abdera.ext.cmis; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.xml.namespace.QName; + +import org.apache.abdera.factory.Factory; +import org.apache.abdera.model.Element; +import org.apache.abdera.model.ElementWrapper; + + +/** + * CMIS Property for the Abdera ATOM library. + * + * Encapsulates access and modification of CMIS extension values to CMIS + * Property. + * + * NOTE: Potentially, this extension can be contributed to Abdera upon + * publication of CMIS. This is why it is organised under a + * non-Alfresco Java package. It follows the conventions of all + * other Abdera extensions. + * + * @author davidc + */ +public abstract class CMISProperty extends ElementWrapper +{ + /** + * @param internal + */ + public CMISProperty(Element internal) + { + super(internal); + } + + /** + * @param factory + * @param qname + */ + public CMISProperty(Factory factory, QName qname) + { + super(factory, qname); + } + + /** + * Gets the property type + * + * @return type + */ + public abstract String getType(); + + /** + * Gets the property name + * + * @return name + */ + public String getName() + { + return getAttributeValue(CMISConstants.PROPERTY_NAME); + } + + /** + * Is property value null? + * + * @return true => null + */ + public boolean isNull() + { + return getFirstChild(CMISConstants.PROPERTY_VALUE) == null ? true : false; + } + + /** + * Gets property value (as String) + * + * @return property value (or null, if not specified) + */ + public String getValue() + { + Element child = getFirstChild(CMISConstants.PROPERTY_VALUE); + if (child != null) + { + return child.getText(); + } + return null; + } + + /** + * Gets String value + * + * @return string value + */ + public String getStringValue() + { + return getValue(); + } + + /** + * Gets Decimal value + * + * @return decimal value + */ + public BigDecimal getDecimalValue() + { + return new BigDecimal(getValue()); + } + + /** + * Gets Integer value + * + * @return integer value + */ + public int getIntegerValue() + { + return new Integer(getValue()); + } + + /** + * Gets Boolean value + * + * @return boolean value + */ + public boolean getBooleanValue() + { + return Boolean.valueOf(getValue()); + } + + /** + * Gets Date value + * + * @return date value + */ + public Date getDateValue() + { + // TODO: + return null; + } + + + /** + * String Property + */ + public static class CMISPropertyString extends CMISProperty + { + public CMISPropertyString(Element internal) + { + super(internal); + } + + public CMISPropertyString(Factory factory, QName qname) + { + super(factory, qname); + } + + /* (non-Javadoc) + * @see org.apache.abdera.ext.cmis.CMISProperty#getType() + */ + @Override + public String getType() + { + return CMISConstants.PROP_TYPE_STRING; + } + } + + /** + * Decimal Property + */ + public static class CMISPropertyDecimal extends CMISProperty + { + public CMISPropertyDecimal(Element internal) + { + super(internal); + } + + public CMISPropertyDecimal(Factory factory, QName qname) + { + super(factory, qname); + } + + /* (non-Javadoc) + * @see org.apache.abdera.ext.cmis.CMISProperty#getType() + */ + @Override + public String getType() + { + return CMISConstants.PROP_TYPE_DECIMAL; + } + } + + /** + * Integer Property + */ + public static class CMISPropertyInteger extends CMISProperty + { + public CMISPropertyInteger(Element internal) + { + super(internal); + } + + public CMISPropertyInteger(Factory factory, QName qname) + { + super(factory, qname); + } + + /* (non-Javadoc) + * @see org.apache.abdera.ext.cmis.CMISProperty#getType() + */ + @Override + public String getType() + { + return CMISConstants.PROP_TYPE_INTEGER; + } + } + + /** + * Boolean Property + */ + public static class CMISPropertyBoolean extends CMISProperty + { + public CMISPropertyBoolean(Element internal) + { + super(internal); + } + + public CMISPropertyBoolean(Factory factory, QName qname) + { + super(factory, qname); + } + + /* (non-Javadoc) + * @see org.apache.abdera.ext.cmis.CMISProperty#getType() + */ + @Override + public String getType() + { + return CMISConstants.PROP_TYPE_BOOLEAN; + } + } + + /** + * DateTime Property + */ + public static class CMISPropertyDateTime extends CMISProperty + { + public CMISPropertyDateTime(Element internal) + { + super(internal); + } + + public CMISPropertyDateTime(Factory factory, QName qname) + { + super(factory, qname); + } + + /* (non-Javadoc) + * @see org.apache.abdera.ext.cmis.CMISProperty#getType() + */ + @Override + public String getType() + { + return CMISConstants.PROP_TYPE_DATETIME; + } + } + + /** + * URI Property + */ + public static class CMISPropertyUri extends CMISPropertyString + { + public CMISPropertyUri(Element internal) + { + super(internal); + } + + public CMISPropertyUri(Factory factory, QName qname) + { + super(factory, qname); + } + + /* (non-Javadoc) + * @see org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyString#getType() + */ + @Override + public String getType() + { + return CMISConstants.PROP_TYPE_URI; + } + } + + /** + * ID Property + */ + public static class CMISPropertyId extends CMISPropertyString + { + public CMISPropertyId(Element internal) + { + super(internal); + } + + public CMISPropertyId(Factory factory, QName qname) + { + super(factory, qname); + } + + /* (non-Javadoc) + * @see org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyString#getType() + */ + @Override + public String getType() + { + return CMISConstants.PROP_TYPE_ID; + } + } + + /** + * XML Property + */ + public static class CMISPropertyXml extends CMISPropertyString + { + public CMISPropertyXml(Element internal) + { + super(internal); + } + + public CMISPropertyXml(Factory factory, QName qname) + { + super(factory, qname); + } + + /* (non-Javadoc) + * @see org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyString#getType() + */ + @Override + public String getType() + { + return CMISConstants.PROP_TYPE_XML; + } + } + + /** + * HTML Property + */ + public static class CMISPropertyHtml extends CMISPropertyString + { + public CMISPropertyHtml(Element internal) + { + super(internal); + } + + public CMISPropertyHtml(Factory factory, QName qname) + { + super(factory, qname); + } + + /* (non-Javadoc) + * @see org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyString#getType() + */ + @Override + public String getType() + { + return CMISConstants.PROP_TYPE_HTML; + } + } +} diff --git a/source/test-resources/cmis/rest/createdocument.atomentry.xml b/source/test-resources/cmis/rest/createdocument.atomentry.xml index 2549bf844a..4cdb6fa636 100644 --- a/source/test-resources/cmis/rest/createdocument.atomentry.xml +++ b/source/test-resources/cmis/rest/createdocument.atomentry.xml @@ -2,7 +2,7 @@ ${NAME} ${NAME} (summary) - test content ${NAME} + ${CONTENT} document diff --git a/source/test-resources/cmis/rest/createdocument2.atomentry.xml b/source/test-resources/cmis/rest/createdocument2.atomentry.xml deleted file mode 100644 index 73f3396ac4..0000000000 --- a/source/test-resources/cmis/rest/createdocument2.atomentry.xml +++ /dev/null @@ -1,8 +0,0 @@ - - onesentence.txt - MQ== - - Document - onesentence.txt - - \ No newline at end of file diff --git a/source/test/java/org/alfresco/repo/cmis/ws/BaseServicePortTest.java b/source/test/java/org/alfresco/repo/cmis/ws/BaseServicePortTest.java index d9c5ebef7f..32fa700522 100644 --- a/source/test/java/org/alfresco/repo/cmis/ws/BaseServicePortTest.java +++ b/source/test/java/org/alfresco/repo/cmis/ws/BaseServicePortTest.java @@ -28,7 +28,6 @@ import javax.transaction.UserTransaction; import org.alfresco.cmis.CMISService; import org.alfresco.cmis.dictionary.CMISMapping; -import org.alfresco.cmis.property.CMISPropertyNameMapping; import org.alfresco.model.ContentModel; import org.alfresco.repo.node.integrity.IntegrityChecker; import org.alfresco.repo.security.authentication.AuthenticationComponent; @@ -122,11 +121,10 @@ public class BaseServicePortTest extends AbstractDependencyInjectionSpringContex protected String getPropertyIDValue(PropertiesType properties, String propertyName) { String result = null; - String realPropertyName = CMISPropertyNameMapping.getWebServiceName(propertyName); for (PropertyIDType property : properties.getPropertyID()) { - if (realPropertyName.equals(property.getName())) + if (propertyName.equals(property.getName())) { result = property.getValue(); break; @@ -139,11 +137,10 @@ public class BaseServicePortTest extends AbstractDependencyInjectionSpringContex protected String getPropertyStringValue(PropertiesType properties, String propertyName) { String result = null; - String realPropertyName = CMISPropertyNameMapping.getWebServiceName(propertyName); for (PropertyStringType property : properties.getPropertyString()) { - if (realPropertyName.equals(property.getName())) + if (propertyName.equals(property.getName())) { result = property.getValue(); break; @@ -156,11 +153,10 @@ public class BaseServicePortTest extends AbstractDependencyInjectionSpringContex protected boolean getPropertyBooleanValue(PropertiesType properties, String propertyName) { boolean result = false; - String realPropertyName = CMISPropertyNameMapping.getWebServiceName(propertyName); for (PropertyBooleanType property : properties.getPropertyBoolean()) { - if (realPropertyName.equals(property.getName())) + if (propertyName.equals(property.getName())) { result = property.isValue(); break; diff --git a/source/test/java/org/alfresco/repo/cmis/ws/DMObjectServicePortTest.java b/source/test/java/org/alfresco/repo/cmis/ws/DMObjectServicePortTest.java index 9fce38a475..6d89df6385 100644 --- a/source/test/java/org/alfresco/repo/cmis/ws/DMObjectServicePortTest.java +++ b/source/test/java/org/alfresco/repo/cmis/ws/DMObjectServicePortTest.java @@ -53,7 +53,7 @@ public class DMObjectServicePortTest extends BaseServicePortContentTest GetPropertiesResponse response = objectServicePort.getProperties(request); assertNotNull(response); - assertEquals(rootNodeRef.toString(), getPropertyIDValue(response.getObject().getProperties(), CMISMapping.PROP_PARENT)); + assertEquals(rootNodeRef.toString(), getPropertyIDValue(response.getObject().getProperties(), CMISMapping.PROP_PARENT_ID)); assertEquals(L0_FOLDER_0, getPropertyStringValue(response.getObject().getProperties(), CMISMapping.PROP_NAME)); } @@ -147,7 +147,7 @@ public class DMObjectServicePortTest extends BaseServicePortContentTest assertNotNull(response); assertNull(getPropertyStringValue(response.getObject().getProperties(), CMISMapping.PROP_CHECKIN_COMMENT)); - assertTrue(getPropertyBooleanValue(response.getObject().getProperties(), CMISMapping.PROP_VERSION_SERIES_IS_CHECKED_OUT)); + assertTrue(getPropertyBooleanValue(response.getObject().getProperties(), CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT)); assertEquals(getPropertyStringValue(response.getObject().getProperties(), CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getSystemUserName()); assertEquals(getPropertyIDValue(response.getObject().getProperties(), CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), workingCopyNodeRef.toString()); @@ -157,7 +157,7 @@ public class DMObjectServicePortTest extends BaseServicePortContentTest response = objectServicePort.getProperties(request); assertNotNull(response); assertNull(getPropertyStringValue(response.getObject().getProperties(), CMISMapping.PROP_CHECKIN_COMMENT)); - assertTrue(getPropertyBooleanValue(response.getObject().getProperties(), CMISMapping.PROP_VERSION_SERIES_IS_CHECKED_OUT)); + assertTrue(getPropertyBooleanValue(response.getObject().getProperties(), CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT)); assertEquals(getPropertyStringValue(response.getObject().getProperties(), CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getSystemUserName()); assertEquals(getPropertyIDValue(response.getObject().getProperties(), CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), workingCopyNodeRef.toString()); }