Search code examples
javaalfrescocmis

CMIS Alfresco Copy all versions of a document


Basic copy CMIS method copy only the first version of document.

How to copy all versions because iterate versions for copy one by one throws duplicate document exception


Solution

  • Copying a document via CMIS behaves exactly the same as copying a document in Alfresco Share. The "current" version of the object is used as the source of the copy. None of the versions will be copied.

    If you want to do a copy that maintains the version history, you'll have to get all the versions of the source object, then copy the first version to create the new object, then check in each subsequent version, in order, on the copied object.

    For objects with a deep version history this could be a very expensive operation, so think hard about whether or not it makes sense to do this.