From users-return-13720-apmail-jackrabbit-users-archive=jackrabbit.apache.org@jackrabbit.apache.org Mon Dec 14 13:53:45 2009 Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 64483 invoked from network); 14 Dec 2009 13:53:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Dec 2009 13:53:44 -0000 Received: (qmail 88599 invoked by uid 500); 14 Dec 2009 13:53:43 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 88569 invoked by uid 500); 14 Dec 2009 13:53:43 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 88530 invoked by uid 99); 14 Dec 2009 13:53:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Dec 2009 13:53:43 +0000 X-ASF-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.160.52] (HELO mail-pw0-f52.google.com) (209.85.160.52) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Dec 2009 13:53:40 +0000 Received: by pwi8 with SMTP id 8so2149768pwi.11 for ; Mon, 14 Dec 2009 05:53:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.141.100.18 with SMTP id c18mr3391491rvm.30.1260798799372; Mon, 14 Dec 2009 05:53:19 -0800 (PST) In-Reply-To: <4e4f46500912140425l38c864b8tac7a703cee669ae1@mail.gmail.com> References: <4e4f46500912140425l38c864b8tac7a703cee669ae1@mail.gmail.com> Date: Mon, 14 Dec 2009 13:53:19 +0000 Message-ID: <4e4f46500912140553j32820ea8xb449439ee832cfc@mail.gmail.com> Subject: Re: Versioning From: Ben Short To: users Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable OK I have found the solution.. VersionHistory versionHistory =3D session.getWorkspace().getVersionManager().getVersionHistory(page.getPath()= ); VersionIterator it =3D versionHistory.getAllVersions(); it.skip(1); while ( it.hasNext()) { =09 Version version =3D it.nextVersion(); NodeIterator nodeIterator =3D version.getNodes(); while(nodeIterator.hasNext()){ Node node =3D nodeIterator.nextNode(); System.out.println(node.getProperty("name").getString() + " " + node.getProperty("published").getString()); } } Why do I need to skip passed the first version? 2009/12/14 Ben Short : > Hi, > > I'm using Jackrabbit 2. Is the following scenario possible? > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Node page =3D testRootNode.addNode("page")= ; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0page.addMixin("mix:versionable"); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0page.setProperty("name", "1"); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0page.setProperty("published", true); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0session.save(); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0session.getWorkspace().getVersionManager()= .checkin(page.getPath()); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0session.getWorkspace().getVersionManager()= .checkout(page.getPath()); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0page.setProperty("name", "2"); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0page.setProperty("published", false); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0session.save(); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0session.getWorkspace().getVersionManager()= .checkin(page.getPath()); > > At this point I would want to get the node that has the published > property set to true. > > I can't see how to get the actual node from the version history so I > can query the bodes properties. > > How can I proceed? > > Ben Short >