jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Bocanegra <tobias.bocane...@day.com>
Subject Re: Removing a version
Date Fri, 18 Nov 2005 17:51:51 GMT
hi nicolas,
this is probably a bug in jackrabbit. thank you for reporting it. can
you please file a jira issue
(http://issues.apache.org/jira/browse/JCR) for this? thanks.

regards, toby

On 11/18/05, Nicolas Belisle <Nicolas.Belisle@bibl.ulaval.ca> wrote:
> Hi,
>
> I'm trying to remove a version of a Node, but the
> VersionHistory.removeVersion() method throws :
> "javax.jcr.ReferentialIntegrityException: Unable to remove version. At
> least once referenced.".
>
> Secton 8.2.2.10 (Removal of Versions) of the specification indicates that
> the version graph should be automatically repaired upon removal. Then,
> VersionHistory.removeVersion() should take care of references. In fact, a
> user cannot alter the references (jcr:predecessors and jcr:successors),
> since they are protected properties.
>
> Here's the example :
>
>         Node root1 = session.getRootNode() ;
>         Node test1 = root1.addNode("test") ;
>         test1.addMixin("mix:versionable");
>         test1.setProperty("test", "1");
>         session.save();
>         test1.checkin();
>
>         test1.checkout();
>         test1.setProperty("test", "2");
>         session.save();
>         test1.checkin();
>
>         test1.checkout();
>         test1.setProperty("test", "3");
>         session.save();
>         test1.checkin();
>
>         VersionHistory vh = test1.getVersionHistory();
>         for (VersionIterator vi = vh.getAllVersions(); vi.hasNext(); ) {
>             Version currenVersion = vi.nextVersion();
>             String versionName = currenVersion.getName();
>             if (!versionName.equals("jcr:rootVersion")) {
>                 String propertyValue =
> currenVersion.getNode("jcr:frozenNode").getProperty("test").getString();
>                 System.out.println("Removing version : " + versionName + "
> with value: " + propertyValue);
>                 vh.removeVersion(versionName);
>             }
>         }
>
> Something I do wrong ?
>
>
> Many thanks,
>
>
> Nicolas
>
>


--
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Mime
View raw message