AnsweredAssumed Answered

How to Retrieve document url ?

Question asked by imranuddin on Jan 29, 2014
Latest reply on Feb 3, 2014 by jpotts
Hi All,

I have a requirement where in I have multiple version for a document and i need to retrieve the url of a particular version document

Following are the details

Node Reference Id workspace://SpacesStore/453e9426-645f-470e-b850-92e5d6ff30b7

v1.1

http://vfwappora147:9080/alfresco/d/d/versionStore/version2Store/10ebbb79-bf14-47ab-

8497-2fc434ceb1e6/RyanRobertspassport.pdf

v1.0

http://vfwappora147:9080/alfresco/d/d/versionStore/version2Store/c46c2345-e7f0-450c-

9cde-5423f03f22f7/RyanRobertspassport.pdf

My requirement is for example I want to Retrieve v1.1 document I need to get the v1.1 document id 10ebbb79-bf14-47ab-

8497-2fc434ceb1e6 so as i can frame the url and show up in the UI as a link.


I am able to retrieve meta data

name: RyanRobertspassport.pdf
version label: 1.1
version series id: workspace://SpacesStore/453e9426-645f-470e-b850-92e5d6ff30b7

using code

com.pega.apache.chemistry.opencmis.client.api.Session session =
  (com.pega.apache.chemistry.opencmis.client.api.Session)sessionObj;
String objIdString = "workspace://SpacesStore/453e9426-645f-470e-b850-92e5d6ff30b7";
com.pega.apache.chemistry.opencmis.client.api.CmisObject obj = null;
obj =  session.getObject(session.createObjectId(objIdString));
com.pega.apache.chemistry.opencmis.client.api.Document document = (com.pega.apache.chemistry.opencmis.client.api.Document) obj;
List<com.pega.apache.chemistry.opencmis.client.api.Document> documents = document.getAllVersions();
Iterator itr = documents.iterator();
while(itr.hasNext()) {
com.pega.apache.chemistry.opencmis.client.api.Document version = (com.pega.apache.chemistry.opencmis.client.api.Document)itr.next();
              oLog.infoForced("name: " + version.getName());
            oLog.infoForced("version label: " + version.getVersionLabel());
            oLog.infoForced("version series id: " + version.getVersionSeriesId());
            
I will be thankful if we can retrieve the url as meta data similar to version label, version serial id etc.

Outcomes