Does any body know how to create a named version using webdav in jackrabbit/sling
On Sat, Sep 24, 2011 at 1:48 AM, Furst, Carl [via Jackrabbit] < [email protected]> wrote: > Do you make use of this: > > > > http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/version/Version.html#getCreated%28%29 > > and > > http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/version/VersionHistory.html#getVersion(java.lang.String) > > > > > > Carl Furst > > > -----Original Message----- > From: Parvez Ahmad [mailto:[hidden > email]<http://user/SendEmail.jtp?type=node&node=3837960&i=0>] > > Sent: Monday, September 12, 2011 7:28 AM > To: [hidden email] <http://user/SendEmail.jtp?type=node&node=3837960&i=1>; > [hidden email] <http://user/SendEmail.jtp?type=node&node=3837960&i=2>; > [hidden email] <http://user/SendEmail.jtp?type=node&node=3837960&i=3>; [hidden > email] <http://user/SendEmail.jtp?type=node&node=3837960&i=4> > Subject: version creation using httpclient > > Sir, > My best regards. I am fan of jackrabbit team and make my living by use of > your invention-- jackrabbit. > > I am struggling to create version for a file from last 15 days. Version is > getting created but I am unable to retrieve > the version labels using code. > > I use jackrabit/apache sling. I want to retrieve version labels. Please > help > > > regards > Ahmad > Srinagar Kashmir India > > Sample code i use is :- > public void createVersion(String un_encoded_virtual_Path){ > String virtualPath = Utility.encodePath(un_encoded_virtual_Path); > String remotePath = getServerRoot() + virtualPath; > int status; > try { > VersionControlMethod vcMethod = new > VersionControlMethod(remotePath); > executeMethod(vcMethod); > vcMethod.releaseConnection(); > > // execute check in and check out methods > > if(urlExists(remotePath)){ > /** > CheckoutMethod checkOut = new > CheckoutMethod(remotePath); > executeMethod(checkOut); > checkOut.releaseConnection(); > */ > > CheckinMethod checkIn = new CheckinMethod(remotePath); > executeMethod(checkIn); > checkIn.releaseConnection(); > } > > > LabelMethod lbMethod = new LabelMethod(remotePath,"FLINTOFF", > LabelInfo.TYPE_ADD); > status = executeMethod(lbMethod); > System.out.println("status : " + status + "--" + > lbMethod.getResponseBodyAsString()); > > > > } catch (Exception e2){ > e2.printStackTrace(); > } > > > > } > public List<VersionVo> getVersions(String un_encoded_virtual_Path){ > List<VersionVo> lstVersions = new ArrayList<VersionVo>(); > String virtualPath = Utility.encodePath(un_encoded_virtual_Path); > String remotePath = getServerRoot() + virtualPath; > try { > /// get versions > // create the report > /// HERE I SEE THE PROBLEM > > ReportInfo reportInfo = new > ReportInfo(ReportType.VERSION_TREE ,DavConstants.DEPTH_INFINITY); > ReportMethod report = new ReportMethod(remotePath, > reportInfo); > client.executeMethod(report); > MultiStatus multiStatus = > report.getResponseBodyAsMultiStatus(); > MultiStatusResponse responses[] = > multiStatus.getResponses(); > String responseAsString = ""; > VersionVo v; > for(int i = 0; i < responses.length; i++) { > responseAsString += responses[i].getHref() + "\n"; > v = new VersionVo(); > v.setVersionNodePath(responses[i].getHref()); > > v.setVersionComment("version-" +i++); > v.setCreatedDate("hhhhh"); > lstVersions.add(v); > } > > > report.releaseConnection(); > > } catch (Exception e2){ > e2.printStackTrace(); > } > return lstVersions; > } > > > > > > > ********************************************************** > > MLB.com: Where Baseball is Always On > > *smime.p7s* (3K) Download Attachment<http://attachment/3837960/0/smime.p7s> > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://jackrabbit.510166.n4.nabble.com/version-creation-using-httpclient-tp3807209p3837960.html > To unsubscribe from version creation using httpclient, click > here<http://jackrabbit.510166.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3807209&code=cGFydmV6MTJAZ21haWwuY29tfDM4MDcyMDl8LTE4NjQ4MjI2NTY=>. > > -- View this message in context: http://jackrabbit.510166.n4.nabble.com/version-creation-using-httpclient-tp3807209p3855274.html Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
