From c2a0a63f048c418c17293c440ce413cbc8c4256b Mon Sep 17 00:00:00 2001 From: David Caruana Date: Mon, 10 May 2010 15:26:19 +0000 Subject: [PATCH] Merged BRANCHES/V3.3 to HEAD: 20155: Fix ALF-2755: AtomPub create document with versioning state major (and supplied content stream) does not version the content stream, Fix ALF-2756: AtomPub create document with versioning state checkedout cause duplicate name exception 20161: Fix ALF-2760: AtomPub binding renders aspect multi-valued id properties incorrectly 20162: FIx ALF-2705: ClassCastException in getProperties() git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20163 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/cmis/lib/atomentry.lib.atom.ftl | 2 +- .../webscripts/org/alfresco/cmis/lib/modify.lib.js | 10 ++++++---- .../org/alfresco/repo/cmis/ws/utils/PropertyUtil.java | 8 ++++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/config/alfresco/templates/webscripts/org/alfresco/cmis/lib/atomentry.lib.atom.ftl b/config/alfresco/templates/webscripts/org/alfresco/cmis/lib/atomentry.lib.atom.ftl index a7d26770a1..f6f6341969 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/cmis/lib/atomentry.lib.atom.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/cmis/lib/atomentry.lib.atom.ftl @@ -386,7 +386,7 @@ [#macro booleanvalue value]${value?string}[/#macro] [#macro datetimevalue value]${xmldate(value)}[/#macro] [#macro urivalue value]${value?xml}[/#macro] -[#macro idvalue value]${value?xml}[/#macro] +[#macro idvalue value][#if value?is_hash && value.nodeRef??]${value.nodeRef?xml}[#else]${value?xml}[/#if][/#macro] [#-- --] [#-- CMIS Relationships --] diff --git a/config/alfresco/templates/webscripts/org/alfresco/cmis/lib/modify.lib.js b/config/alfresco/templates/webscripts/org/alfresco/cmis/lib/modify.lib.js index b60e459c39..ae06d3abfe 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/cmis/lib/modify.lib.js +++ b/config/alfresco/templates/webscripts/org/alfresco/cmis/lib/modify.lib.js @@ -29,10 +29,6 @@ function createNode(parent, entry, slug, versioningState) if (baseType == DOCUMENT_TYPE_ID) { node = parent.createFile(name); - if (versioningState != null) - { - node = cmis.applyVersioningState(node, versioningState); - } } else if (baseType == FOLDER_TYPE_ID) { @@ -66,6 +62,12 @@ function createNode(parent, entry, slug, versioningState) var exclude = [ PROP_OBJECT_TYPE_ID, PROP_NAME ]; var updated = updateNode(node, entry, exclude, function(propDef) {return patchValidator(propDef, true);}); + // apply versioning state + if (baseType == DOCUMENT_TYPE_ID && versioningState != null) + { + node = cmis.applyVersioningState(node, versioningState); + } + // only return node if updated successfully return (updated == null) ? null : node; } diff --git a/source/java/org/alfresco/repo/cmis/ws/utils/PropertyUtil.java b/source/java/org/alfresco/repo/cmis/ws/utils/PropertyUtil.java index 6681fb45a6..2a3268281b 100644 --- a/source/java/org/alfresco/repo/cmis/ws/utils/PropertyUtil.java +++ b/source/java/org/alfresco/repo/cmis/ws/utils/PropertyUtil.java @@ -612,9 +612,13 @@ public class PropertyUtil if (value instanceof Collection) { - for (String propertyValue : (Collection) value) + for (Serializable propertyValue : (Collection) value) { - property.getValue().add(propertyValue); + // NOTE: CMIS multi-valued values cannot contain null + if (propertyValue != null) + { + property.getValue().add(propertyValue.toString()); + } } } else