As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
var version=doc.getVersion(args.version); var id = version.node.id; var requestedVersion = search.findNode("workspace://version2Store/"+id);
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/WorkflowApproach.txt * 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)); } } }
model.doc = doc;