AnsweredAssumed Answered

CMIS Atompub copy issue

Question asked by mikemars on Nov 9, 2012
Latest reply on Mar 4, 2014 by jpotts

Environment: Alfresco 4.0d, OpenCmis 0.8.0, Alfresco OpenCmis Extension 0.4

I have an issue when trying to copy a document which has custom aspects with custom properties using the ATOMPUB binding (This works fine for the now deprecated WEBSERVICE binding which implements the createDocumentFromSource() method).

public void doCopy(Document mySourceDocument, Folder myTargetFolder) {


If I simply do this then I get the following exception:

java.lang.IllegalArgumentException: Property 'ex:myCustomProperty' is neither an object type property nor an aspect property!
   at org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl.convertProperties(
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(
   at org.alfresco.cmis.client.impl.AlfrescoDocumentImpl.copyViaClient(
   at org.apache.chemistry.opencmis.client.runtime.DocumentImpl.copy(
   at org.apache.chemistry.opencmis.client.runtime.DocumentImpl.copy(
I can update the code to use the other copy method and specify the Aspect which defines this property:

 myPropertiesMap.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document,P:ex:myCustomAspect")

mySourceDocument.copy(myTargetFolder, myPropertiesMap, …

So now it copies, but the value hasn't been set for ex:myCustomAspect, so I go in and add the property and value to myPropertiesMap:

myPropertiesMap.put("ex:myCustomProperty", "myCopiedValue");

So far, so good.

The issues I have is that setting the property value this way overrides any behaviours I have in Alfresco which may want to change the value of the property, or not copy the value at all.

Has anyone else come across this problem, or have a suggested solution?

I am wanting to move away from using the Webservice binding as it has been deprecated and also because it throws an error trying to delete nodes which have rules directly applied to them.

Many Thanks.