cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS Atompub copy issue

mikemars
Champ in-the-making
Champ in-the-making
Hi,

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) {

   mySourceDocument.copy(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(AlfrescoObjectFactoryImpl.java:186)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:726)
   at org.alfresco.cmis.client.impl.AlfrescoDocumentImpl.copyViaClient(AlfrescoDocumentImpl.java:96)
   at org.apache.chemistry.opencmis.client.runtime.DocumentImpl.copy(DocumentImpl.java:143)
   at org.apache.chemistry.opencmis.client.runtime.DocumentImpl.copy(DocumentImpl.java:160)
   
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.
1 REPLY 1

jpotts
World-Class Innovator
World-Class Innovator
This is an old post, so hopefully you worked it out but for everyone else, if you are running Alfresco 4.2.x, it supports CMIS 1.1. CMIS 1.1 supports aspects out-of-the-box. You don't need the OpenCMIS extension when using the CMIS 1.1 bindings. You can simply do the copy and all of your custom aspects and values will copy over just fine.

As a reminder, the CMIS 1.1 AtomPub URL is:

http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom

And the CMIS 1.1 Browser Binding URL is:

http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser

The copy is known to work with custom aspects for Alfresco 4.2.x, CMIS 1.1, and OpenCMIS 0.10.0.

Jeff