Hi !I have versionable node and I try to retrieve content of a specific version of a content node. For exemple i have a node called text.txt with 3 versions: 1.0, 1.1 and 1.2.I would retrieve content of version 1.1.For the moment : I create a node with content. 2 add versionnable apsect.3 update content -> create different versions.4 try to retrieve content :
VersionHistory versionHistory = WebServiceFactory.getAuthoringService().getVersionHistory(ReferenceFactory.newReference(uuid, nodePath));
Version[] versions = versionHistory.getVersions();
for(Version nodeVersion : versions) {
if(nodeVersion.getLabel().equals(version)) {
InputStream result = null;
Reference reference = new Reference(new Store(Constants.WORKSPACE_STORE, "lightWeightVersionStore"), nodeVersion.getId().getUuid(), nodeVersion.getId().getPath());
Predicate predicate = new Predicate(new Reference[] { reference }, new Store(Constants.WORKSPACE_STORE, "lightWeightVersionStore"), null);
Content[] contents = WebServiceFactory.getContentService().read(predicate, Constants.TYPE_CONTENT);
result = ContentUtils.getContentAsInputStream(contents[0]);
return result;
}
}
Any suggestions ?Thanks a lot 