Hi all,I have noticed that getAllVersions returns different properties for the exact same version than a call to getObject.Example sequence:<ol><li>Create a new Document named "TestV0.doc" (Version is 1.0)<li>Rename document to "TestV1.doc" (Version is still 1.0)<li>Check-out document<li>Check-in document as major (Version is now 2.0)<li>Rename document to "TestV2.doc" (Version is 2.0)</ol>When getting all versions, these objects are returned:1.0 -> "TestV0.doc"2.0 -> "TestV1.doc"But when using getObject, these objects are returned:1.0 -> "TestV0.doc"2.0 -> "TestV2.doc"You can reproduce this by running this Groovy script in the CMIS Workbench:
import org.apache.chemistry.opencmis.commons.*
import org.apache.chemistry.opencmis.commons.data.*
import org.apache.chemistry.opencmis.commons.enums.*
import org.apache.chemistry.opencmis.client.api.*
Document document = (Document) session.getObjectByPath("/test/TestV2.doc");
println "Latest version name: " + document.getName();
println "Latest version label: " + document.getVersionLabel();
for(CmisObject ver : document.getAllVersions())
{
println "Before: Version " + ver.getVersionLabel() + " name: " + ver.getName();
ver.refresh();
println "After: Version " + ver.getVersionLabel() + " name: " + ver.getName();
}
The refresh() call triggers OpenCMIS to read the object again by its ID.The above script produces this output:
Latest version name: TestV2.doc
Latest version label: 2.0
Before: Version 2.0 name: TestV1.doc
After: Version 2.0 name: TestV2.doc
Before: Version 1.0 name: TestV0.doc
After: Version 1.0 name: TestV0.doc
Please note also that the set of properties with name "TestV1.doc" is not accessible by ID.It seems like Alfresco is creating a new version of a node on each modification but keeps the version label unchanged. So there can be multiple versions of a node with the same version label. BOTH methods getObject() and getAllVersions() fail in returning the latest version for every node.The expected correct output is this:
Latest version name: TestV2.doc
Latest version label: 2.0
Before: Version 2.0 name: TestV2.doc
After: Version 2.0 name: TestV2.doc
Before: Version 1.0 name: TestV1.doc
After: Version 1.0 name: TestV1.doc