From c604c9f09370453ac8a821f8ff43a2c21387e038 Mon Sep 17 00:00:00 2001 From: David Caruana Date: Fri, 6 Aug 2010 14:24:02 +0000 Subject: [PATCH] Merged BRANCHES/DEV/V3.3-BUG-FIX to HEAD: 21646: ALF-3752: Getting Parent on a specific version throws exception 21655: Fix ALF-4006: Incorrect search result after renaming a folder 21634: Fix ALF-3822: Storing of datetime does not work git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21662 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/cmis-api-context.xml | 1 + config/alfresco/model/cmisTestModel.xml | 4 +++ .../cmis/mapping/CMISServicesImpl.java | 33 ++++++++++++++++++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/config/alfresco/cmis-api-context.xml b/config/alfresco/cmis-api-context.xml index 8c2e00d104..f3304c716c 100644 --- a/config/alfresco/cmis-api-context.xml +++ b/config/alfresco/cmis-api-context.xml @@ -24,6 +24,7 @@ + diff --git a/config/alfresco/model/cmisTestModel.xml b/config/alfresco/model/cmisTestModel.xml index ccfd2e7231..be5ebe4d4b 100644 --- a/config/alfresco/model/cmisTestModel.xml +++ b/config/alfresco/model/cmisTestModel.xml @@ -41,6 +41,10 @@ d:boolean true + + Custom Document Property (datetime) + d:datetime + diff --git a/source/java/org/alfresco/cmis/mapping/CMISServicesImpl.java b/source/java/org/alfresco/cmis/mapping/CMISServicesImpl.java index 9714eb9d3e..a17a25fa52 100644 --- a/source/java/org/alfresco/cmis/mapping/CMISServicesImpl.java +++ b/source/java/org/alfresco/cmis/mapping/CMISServicesImpl.java @@ -80,6 +80,9 @@ import org.alfresco.service.cmr.coci.CheckOutCheckInServiceException; import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.InvalidAspectException; +import org.alfresco.service.cmr.model.FileExistsException; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.model.FileNotFoundException; import org.alfresco.service.cmr.repository.AssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ContentService; @@ -139,6 +142,7 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware, private CMISDictionaryService cmisDictionaryService; private SearchService searchService; private NodeService nodeService; + private FileFolderService fileFolderService; private ContentService contentService; private TenantAdminService tenantAdminService; private CMISRenditionService cmisRenditionService; @@ -249,6 +253,14 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware, this.nodeService = nodeService; } + /** + * @param fileFolderService + */ + public void setFileFolderService(FileFolderService fileFolderService) + { + this.fileFolderService = fileFolderService; + } + /** * Sets the content service. * @@ -940,7 +952,26 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware, { throw new CMISConstraintException("Unable to set property " + propertyName); } - nodeService.setProperty(nodeRef, property, value); + + if (property.equals(ContentModel.PROP_NAME)) + { + try + { + fileFolderService.rename(nodeRef, value.toString()); + } + catch (FileExistsException e) + { + throw new CMISConstraintException("Object already exists with name " + value.toString()); + } + catch (FileNotFoundException e) + { + throw new CMISInvalidArgumentException("Object with id " + nodeRef.toString() + " not found"); + } + } + else + { + nodeService.setProperty(nodeRef, property, value); + } } /*