AnsweredAssumed Answered

how can I enable versioning on files via opencmis ?

Question asked by mmuller on May 11, 2012
Latest reply on Jan 15, 2013 by narithota
I have alfresco 4 and i attempt use cmis to enable and disable versioning of files.
I use alfresco open cmis extensions.
When I try add versionable proporties to alfrescoDocument
   
Map<String, String> newDocProps = new HashMap<String, String>();
   newDocProps.put("cm:versionable", "true");
   document.updateProperties(newDocProps);

but I get this exception
Exception in thread "main" java.lang.IllegalArgumentException: Property 'cm:versionable' is neither an object type property nor an aspect property!
   at org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl.convertProperties(AlfrescoObjectFactoryImpl.java:181)
   at org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject.updateProperties(AbstractCmisObject.java:314)
   at org.alfresco.cmis.client.impl.AlfrescoDocumentImpl.updateProperties(AlfrescoDocumentImpl.java:72)
   at org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject.updateProperties(AbstractCmisObject.java:278)
   at espeo.sikposk.cmis.CmisTest.main(CmisTest.java:57)

But phrase "cm:versionable" is right when use alfrecso webscript and all works.
var nodeRef = args.nodeRef;
var node = search.findNode("workspace://SpacesStore/ae1203ff-f8b8-421e-9f69-5bec5111ec05");
node.addAspect("cm:versionable");

When i attempt add versionable to node using opencmis and aspect, sample is below
   AlfrescoDocument alfDoc = (AlfrescoDocument) document;
   alfDoc.addAspect("cm:versionable");

get this exception

Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException: Bad Request
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:423)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:554)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getTypeDefinitionInternal(AbstractAtomPubService.java:821)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:80)
   at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:137)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getTypeDefinition(SessionImpl.java:508)
   at org.alfresco.cmis.client.impl.AlfrescoAspectsImpl.addAspect(AlfrescoAspectsImpl.java:93)
   at org.alfresco.cmis.client.impl.AlfrescoDocumentImpl.addAspect(AlfrescoDocumentImpl.java:126)
   at espeo.sikposk.cmis.CmisTest.main(CmisTest.java:64)

question is, How can i enable versioning in alfresco node via cmis?

what I've done wrong?

Outcomes