AnsweredAssumed Answered

CMIS Version History - Retrieving Assets from version2Store correctly

Question asked by manifest0 on Apr 9, 2013
Latest reply on Apr 17, 2013 by jpotts
Hi all,

Recently I have been developing a tool for the developers in my organisation to use to create manifest files for their projects. My tool uses CMIS queries to our alfresco CMIS node to browse and retrieve documents, group them into sections and then export them with an .xml file which can be read by a manifest loader. I'm having some issues with retrieving the previous versions of documents.

For example, if I have a document called white.png (v1.0) which gets updated to black.png (v1.1), I want the developer to be able to choose either of these versions to use and export to their manifest. However, my tool currently browses the workspace IDs and as only black.png exists in the workspace store, it is the only one that the developer is able to select (the older version exists in the version2Store). If I execute a C# CMIS query such as doc.getAllVersions() I get a list of size 2, with both elements sharing the same VersionSeriesId. They do, however, have separate ContentStreamIds, and point to different .bin files. I reasoned that my task was to get the version2Store ID of the previous versions, with which I could retrieve the data correctly. As C#'s DotCMIS doesn't appear to allow me to do this, I used a REST HttpRequest as follows:
http://<HOST>/alfresco/service/cmis/i/< DOCUMENT-ID>/versions?

and parsed the resulting data, which successfully points me to the version2Store ID.

This is where I am stuck however, as I cannot put that ID back into my CMIS layer in my calls such as getNameByID(version2StoreId) as the CMIS layer only connects to the workspace - and that document doesn't exist in the workspace! Am I missing some crucial way to get previous versions of documents correctly using CMIS? On a similar note, does Alfresco support branching assets - as this is effectively what I'm trying to achieve.

Thanks for your time.