jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: API to cleanup dangling reference?
Date Tue, 21 Jul 2009 19:12:06 GMT
On Tue, Jul 21, 2009 at 8:42 PM, Khanapurkar, Mona
A.<Mona.A.Khanapurkar@idearc.com> wrote:
> Does Jackrabbit have an API to cleanup dangling references?

If you are talking about REFERENCE properties, it is impossible to
have dangling references right within the JCR API, because you cannot
remove a node that is still being pointed at. See the javadoc of the
Item.remove() method [1]:

A ReferentialIntegrityException will be thrown on save if this item or
an item in its subtree is currently the target of a REFERENCE property
located in this workspace but outside this item's subtree and the
current Session has read access to that REFERENCE property.

If you use STRING or PATH properties as ("weak") references, the best
way to check for them is by running an xpath search:
//*[@referenceProp='/dangling/path']

[1] http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Item.html#remove()

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message