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); + } } /*