diff --git a/config/alfresco/cmis-ws-context.xml b/config/alfresco/cmis-ws-context.xml index f75d92c6ab..bedeb70be2 100644 --- a/config/alfresco/cmis-ws-context.xml +++ b/config/alfresco/cmis-ws-context.xml @@ -299,7 +299,6 @@ - diff --git a/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.js b/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.js index 988ff8dacd..0c8926e43d 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.js +++ b/config/alfresco/templates/webscripts/org/alfresco/cmis/atomentry.lib.js @@ -127,7 +127,15 @@ function updateNode(node, entry, propNames, pwc) status.redirect = true; return null; } - + var mappedProperty = propDef.propertyAccessor.mappedProperty; + if (mappedProperty === null) + { + status.code = 500; + status.message = "Internal error: Property " + propName + " does not map to a write-able Alfresco property"; + status.redirect = true; + return null; + } + // extract value var prop = props.find(propName); var val = null; @@ -136,27 +144,19 @@ function updateNode(node, entry, propNames, pwc) // TODO: handle multi-valued properties val = prop.value; } - vals[propName] = val; + vals[mappedProperty.toString()] = val; } } // handle aspect specific properties // NOTE: atom entry values override cmis:values - if (entry.title != null) vals["cm_name"] = entry.title; - if (entry.summary != null) vals["cm_description"] = entry.summary; + if (entry.title != null) vals["cm:name"] = entry.title; + if (entry.summary != null) vals["cm:description"] = entry.summary; // update node values for (val in vals) { - var propName = cmis.mapPropertyName(val); - if (propName === null) - { - status.code = 500; - status.message = "Internal error: Property " + val + " does not map to a write-able Alfresco property"; - status.redirect = true; - return null; - } - node.properties[propName] = vals[val]; + node.properties[val] = vals[val]; updated = true; } diff --git a/config/alfresco/web-scripts-application-context.xml b/config/alfresco/web-scripts-application-context.xml index ede2a5e2a8..7422f586f5 100644 --- a/config/alfresco/web-scripts-application-context.xml +++ b/config/alfresco/web-scripts-application-context.xml @@ -109,7 +109,7 @@ - + @@ -472,7 +472,6 @@ - diff --git a/source/java/org/alfresco/repo/cmis/rest/CMISPropertyValueMethod.java b/source/java/org/alfresco/repo/cmis/rest/CMISPropertyValueMethod.java index 87dfef6b25..6bb347eb56 100644 --- a/source/java/org/alfresco/repo/cmis/rest/CMISPropertyValueMethod.java +++ b/source/java/org/alfresco/repo/cmis/rest/CMISPropertyValueMethod.java @@ -26,7 +26,7 @@ package org.alfresco.repo.cmis.rest; import java.util.List; -import org.alfresco.cmis.property.CMISPropertyService; +import org.alfresco.cmis.CMISService; import org.alfresco.repo.template.TemplateNode; import freemarker.ext.beans.BeanModel; @@ -45,14 +45,14 @@ import freemarker.template.TemplateScalarModel; */ public final class CMISPropertyValueMethod implements TemplateMethodModelEx { - private CMISPropertyService propertyService; + private CMISService cmisService; /** * Construct */ - public CMISPropertyValueMethod(CMISPropertyService propertyService) + public CMISPropertyValueMethod(CMISService cmisService) { - this.propertyService = propertyService; + this.cmisService = cmisService; } /** @@ -85,7 +85,7 @@ public final class CMISPropertyValueMethod implements TemplateMethodModelEx } // retrieve property value - result = propertyService.getProperty(node.getNodeRef(), propertyName); + result = cmisService.getProperty(node.getNodeRef(), propertyName); } } diff --git a/source/java/org/alfresco/repo/cmis/rest/CMISScript.java b/source/java/org/alfresco/repo/cmis/rest/CMISScript.java index 158ed25ba5..df3f202a28 100644 --- a/source/java/org/alfresco/repo/cmis/rest/CMISScript.java +++ b/source/java/org/alfresco/repo/cmis/rest/CMISScript.java @@ -33,9 +33,8 @@ import org.alfresco.cmis.CMISQueryEnum; import org.alfresco.cmis.CMISService; import org.alfresco.cmis.CMISTypesFilterEnum; import org.alfresco.cmis.dictionary.CMISDictionaryService; +import org.alfresco.cmis.dictionary.CMISPropertyDefinition; import org.alfresco.cmis.dictionary.CMISTypeDefinition; -import org.alfresco.cmis.dictionary.CMISTypeId; -import org.alfresco.cmis.property.CMISPropertyService; import org.alfresco.cmis.search.CMISQueryOptions; import org.alfresco.cmis.search.CMISQueryService; import org.alfresco.cmis.search.CMISResultSet; @@ -63,7 +62,6 @@ public class CMISScript extends BaseScopableProcessorExtension private Repository repository; private CMISService cmisService; private CMISDictionaryService cmisDictionaryService; - private CMISPropertyService cmisPropertyService; private CMISQueryService cmisQueryService; private Paging paging; @@ -118,16 +116,6 @@ public class CMISScript extends BaseScopableProcessorExtension this.cmisDictionaryService = cmisDictionaryService; } - /** - * Set the CMIS Property Service - * - * @param cmisPropertyService - */ - public void setCMISPropertyService(CMISPropertyService cmisPropertyService) - { - this.cmisPropertyService = cmisPropertyService; - } - /** * Set the CMIS Query Service * @@ -416,22 +404,16 @@ public class CMISScript extends BaseScopableProcessorExtension } } - - // - // Property Support - // - /** - * Map CMIS Property name to Alfresco property name (only for direct 1 to 1 mappings) + * Query the Property Definition for the given Property * - * @param propertyName CMIS property name - * @return Alfresco property name (or null, if there's no mapping) + * @param propertyName + * @return */ - public QName mapPropertyName(String propertyName) + public CMISPropertyDefinition queryProperty(String propertyName) { - return cmisPropertyService.mapPropertyName(propertyName); + return cmisDictionaryService.findProperty(propertyName, null); } - // // SQL Query diff --git a/source/java/org/alfresco/repo/cmis/rest/test/BaseCMISWebScriptTest.java b/source/java/org/alfresco/repo/cmis/rest/test/BaseCMISWebScriptTest.java index 8f7fc1eb43..5aec3fdc63 100644 --- a/source/java/org/alfresco/repo/cmis/rest/test/BaseCMISWebScriptTest.java +++ b/source/java/org/alfresco/repo/cmis/rest/test/BaseCMISWebScriptTest.java @@ -624,10 +624,14 @@ public class BaseCMISWebScriptTest extends BaseWebScriptTest protected NodeRef getNodeRef(Entry entry) { NodeRef nodeRef = null; - Element element = entry.getFirstChild(new QName("http://www.alfresco.org", "noderef")); - if (element != null) + CMISObject object = entry.getExtension(CMISConstants.OBJECT); + if (object != null) { - nodeRef = new NodeRef(element.getText()); + String strNodeRef = object.getObjectId().getValue(); + if (strNodeRef != null) + { + nodeRef = new NodeRef(object.getObjectId().getValue()); + } } return nodeRef; } diff --git a/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java index dcc58270ff..dd3d78ac70 100644 --- a/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java +++ b/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java @@ -44,8 +44,6 @@ import org.alfresco.cmis.dictionary.CMISDictionaryModel; import org.alfresco.cmis.dictionary.CMISDictionaryService; import org.alfresco.cmis.dictionary.CMISScope; import org.alfresco.cmis.dictionary.CMISTypeDefinition; -import org.alfresco.cmis.dictionary.CMISTypeId; -import org.alfresco.cmis.property.CMISPropertyService; import org.alfresco.cmis.search.CMISQueryService; import org.alfresco.model.ContentModel; import org.alfresco.repo.cmis.PropertyFilter; @@ -86,7 +84,6 @@ public class DMAbstractServicePort protected CMISDictionaryService cmisDictionaryService; protected CMISQueryService cmisQueryService; protected CMISService cmisService; - protected CMISPropertyService cmisPropertyService; protected DescriptorService descriptorService; protected NodeService nodeService; protected VersionService versionService; @@ -101,11 +98,6 @@ public class DMAbstractServicePort this.cmisService = cmisService; } - public void setCmisPropertyService(CMISPropertyService cmisPropertyService) - { - this.cmisPropertyService = cmisPropertyService; - } - public void setCmisDictionaryService(CMISDictionaryService cmisDictionaryService) { this.cmisDictionaryService = cmisDictionaryService; @@ -273,7 +265,7 @@ public class DMAbstractServicePort Map properties; if (NodeRef.isNodeRef(identifier)) { - properties = cmisPropertyService.getProperties(new NodeRef(identifier)); + properties = cmisService.getProperties(new NodeRef(identifier)); } else { diff --git a/source/java/org/alfresco/repo/cmis/ws/DMObjectServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMObjectServicePort.java index 17d9b8881c..edf539f080 100644 --- a/source/java/org/alfresco/repo/cmis/ws/DMObjectServicePort.java +++ b/source/java/org/alfresco/repo/cmis/ws/DMObjectServicePort.java @@ -37,7 +37,6 @@ import javax.xml.ws.Holder; import org.alfresco.cmis.dictionary.CMISDictionaryModel; import org.alfresco.cmis.dictionary.CMISScope; import org.alfresco.cmis.dictionary.CMISTypeDefinition; -import org.alfresco.cmis.dictionary.CMISTypeId; import org.alfresco.model.ContentModel; import org.alfresco.repo.cmis.PropertyFilter; import org.alfresco.repo.cmis.ws.DeleteTreeResponse.FailedToDelete; @@ -165,7 +164,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object break; } - String versionLabel = (String) cmisPropertyService.getProperty(newDocumentNodeRef, CMISDictionaryModel.PROP_VERSION_LABEL); + String versionLabel = (String) cmisService.getProperty(newDocumentNodeRef, CMISDictionaryModel.PROP_VERSION_LABEL); return versionLabel != null && versionLabel.contains(VERSION_DELIMETER) ? newDocumentNodeRef.toString() + CmisObjectsUtils.NODE_REFERENCE_ID_DELIMETER + versionLabel : newDocumentNodeRef.toString(); @@ -214,7 +213,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object NodeRef newFolderNodeRef = fileFolderService.create(folderNodeRef, name, type.getTypeId().getQName()).getNodeRef(); // TODO: // cmisPropertyService.setProperties(newFolderNodeRef, propertiesMap); - return (String) cmisPropertyService.getProperty(newFolderNodeRef, CMISDictionaryModel.PROP_OBJECT_ID); + return (String) cmisService.getProperty(newFolderNodeRef, CMISDictionaryModel.PROP_OBJECT_ID); } catch (FileExistsException e) { @@ -444,7 +443,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object response.setLength(BigInteger.valueOf(reader.getSize())); response.setMimeType(reader.getMimetype()); - String filename = (String) cmisPropertyService.getProperty(nodeRef, CMISDictionaryModel.PROP_NAME); + String filename = (String) cmisService.getProperty(nodeRef, CMISDictionaryModel.PROP_NAME); response.setFilename(filename); response.setStream(new DataHandler(new ContentReaderDataSource(reader, filename))); @@ -561,7 +560,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object // TODO: change token // no new version - objectId.value = (String) cmisPropertyService.getProperty(objectNodeRef, CMISDictionaryModel.PROP_OBJECT_ID); + objectId.value = (String) cmisService.getProperty(objectNodeRef, CMISDictionaryModel.PROP_OBJECT_ID); } /** diff --git a/source/java/org/alfresco/repo/cmis/ws/DMRepositoryServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMRepositoryServicePort.java index 1918f7dc19..43e2f0a5e2 100644 --- a/source/java/org/alfresco/repo/cmis/ws/DMRepositoryServicePort.java +++ b/source/java/org/alfresco/repo/cmis/ws/DMRepositoryServicePort.java @@ -146,7 +146,7 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re repositoryInfoType.setRepositoryName(serverDescriptor.getName()); repositoryInfoType.setRepositoryRelationship("self"); repositoryInfoType.setRepositoryDescription(""); - repositoryInfoType.setRootFolderId((String) cmisPropertyService.getProperty(cmisService.getDefaultRootNodeRef(), CMISDictionaryModel.PROP_OBJECT_ID)); + repositoryInfoType.setRootFolderId((String) cmisService.getProperty(cmisService.getDefaultRootNodeRef(), CMISDictionaryModel.PROP_OBJECT_ID)); repositoryInfoType.setVendorName("Alfresco"); repositoryInfoType.setProductName("Alfresco Repository (" + serverDescriptor.getEdition() + ")"); repositoryInfoType.setProductVersion(serverDescriptor.getVersion()); diff --git a/source/java/org/alfresco/repo/cmis/ws/DMVersioningServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMVersioningServicePort.java index c360fa07be..c1978265a7 100755 --- a/source/java/org/alfresco/repo/cmis/ws/DMVersioningServicePort.java +++ b/source/java/org/alfresco/repo/cmis/ws/DMVersioningServicePort.java @@ -125,7 +125,7 @@ public class DMVersioningServicePort extends DMAbstractServicePort implements Ve } NodeRef nodeRef = checkOutCheckInService.checkin(workingCopyNodeRef, createVersionProperties(checkinComment, major != null && major ? VersionType.MAJOR : VersionType.MINOR)); - documentId.value = (String) cmisPropertyService.getProperty(nodeRef, CMISDictionaryModel.PROP_OBJECT_ID); + documentId.value = (String) cmisService.getProperty(nodeRef, CMISDictionaryModel.PROP_OBJECT_ID); } /** @@ -157,7 +157,7 @@ public class DMVersioningServicePort extends DMAbstractServicePort implements Ve } NodeRef pwcNodeRef = checkoutNode(documentNodeRef); - documentId.value = (String) cmisPropertyService.getProperty(pwcNodeRef, CMISDictionaryModel.PROP_OBJECT_ID); + documentId.value = (String) cmisService.getProperty(pwcNodeRef, CMISDictionaryModel.PROP_OBJECT_ID); contentCopied.value = true; } diff --git a/source/java/org/alfresco/repo/cmis/ws/utils/AlfrescoObjectType.java b/source/java/org/alfresco/repo/cmis/ws/utils/AlfrescoObjectType.java index 60463d998a..e0039d5106 100755 --- a/source/java/org/alfresco/repo/cmis/ws/utils/AlfrescoObjectType.java +++ b/source/java/org/alfresco/repo/cmis/ws/utils/AlfrescoObjectType.java @@ -27,7 +27,7 @@ package org.alfresco.repo.cmis.ws.utils; import java.util.HashMap; import java.util.Map; -import org.alfresco.cmis.dictionary.CMISMapping; +import org.alfresco.cmis.mapping.CMISMapping; import org.alfresco.model.ContentModel; /** diff --git a/source/test/java/org/alfresco/repo/cmis/ws/DMObjectServiceTest.java b/source/test/java/org/alfresco/repo/cmis/ws/DMObjectServiceTest.java index d765ef5c48..32c257f231 100644 --- a/source/test/java/org/alfresco/repo/cmis/ws/DMObjectServiceTest.java +++ b/source/test/java/org/alfresco/repo/cmis/ws/DMObjectServiceTest.java @@ -31,7 +31,7 @@ import javax.activation.DataHandler; import javax.xml.ws.Holder; import org.alfresco.cmis.dictionary.CMISDictionaryModel; -import org.alfresco.cmis.dictionary.CMISMapping; +import org.alfresco.cmis.mapping.CMISMapping; import org.alfresco.repo.content.MimetypeMap; /** diff --git a/source/test/java/org/alfresco/repo/cmis/ws/DMRelationshipServiceTest.java b/source/test/java/org/alfresco/repo/cmis/ws/DMRelationshipServiceTest.java index 1844250023..3d24d57cd0 100755 --- a/source/test/java/org/alfresco/repo/cmis/ws/DMRelationshipServiceTest.java +++ b/source/test/java/org/alfresco/repo/cmis/ws/DMRelationshipServiceTest.java @@ -31,7 +31,7 @@ import java.net.URL; import javax.xml.namespace.QName; import javax.xml.ws.Service; -import org.alfresco.cmis.dictionary.CMISMapping; +import org.alfresco.cmis.mapping.CMISMapping; public class DMRelationshipServiceTest extends AbstractServiceTest {