Correct way to get version of a document?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2011 02:46 AM
I pass for example "1.0" for args.version.
Is this a correct way to get a version of a document?
var version=doc.getVersion(args.version);var id = version.node.id;var requestedVersion = search.findNode("workspace://version2Store/"+id);
Is this a correct way to get a version of a document?
Labels:
- Labels:
-
Archive
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2011 10:28 AM
Hi,
Find the code for getting the version
Thanks,
Patil
Cignex Technologies
Bangalore
Find the code for getting the version
String versionLabel = "1.0"; //replace the above line with the version u want String nodeRef="workspace://SpacesStore/83196957-6bdb-4caa-87ff-d08f773cda4a"//replace the above line with the noderef u want VersionHistory versionHistory = serviceRegistry.getVersionService().getVersionHistory(new NodeRef(nodeRef)); String fileName = (String)this.serviceRegistry.getNodeService().getProperty(new NodeRef(nodeRef), ContentModel.PROP_NAME); if(null!= versionHistory){ Iterator<Version> versionIterator = versionHistory.getAllVersions().iterator(); Version version; /* * Frame the below url to get the contet of specific version * http://localhost:8080/alfresco/d/d/versionStore/version2Store/551de18e-e94a-4ad1-a867-898d1adb0e22/W... * the frozenNoderef to be used for the same to get the content of different version */ while(versionIterator.hasNext()){ version = versionIterator.next(); if(version.getVersionLabel().equals(versionLabel)){ versionURL = DownloadContentServlet.generateBrowserURL(version.getFrozenStateNodeRef(),fileName); //LOGGER.debug("Frozen nodeRef:::"+version.getFrozenStateNodeRef()); LOGGER.debug("The version URL of the contetn is:::"+versionURL); model.put(SutherlandBlmConstants.XMLRESPONSE, GetContentByVersionXML.getContentByVersion(versionURL, versionLabel , contextPath)); } } }
Thanks,
Patil
Cignex Technologies
Bangalore
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2011 04:50 PM
So. My way is no good?
Cause I want the whole document so I can do
Cause I want the whole document so I can do
model.doc = doc;
and make my ftl template the same for every document requested, either original or some old version.
