jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "(Berry) A.W. van Halderen" <b.vanhalde...@hippo.nl>
Subject Re: References
Date Wed, 15 Aug 2007 14:52:44 GMT
On Wed, Aug 15, 2007 at 07:40:12AM -0700, Ishai Borovoy wrote:
> How can I easily get all the nodes that have refer to other node?
> For example I have Node A, B, C.
> A has reference property to C.
> B has reference property to C.
> 
> I want to get in some way (by code or by query) all the nodes that reference
> properties that refer to C. 

Assuming you use UUIDs (in A and B) and mix:referenable on C:

    Node C;
    Set<Node> allNodesThatReferToC = new HashSet<Node>;
    for(PropertyIterator iter = C.getReferences(); iter.hasNext(); )
      allNodesThatReferToC.add(iter.nextProperty().getParent());

\Berry
-- 
Berry A.W. van Halderen           b.vanhalderen@hippo.nl / berry@halderen.net
Disclaimer: the above is the author's personal opinion and is not the opinion
or policy of his employer or of the little green men that have been following
him all day.

Mime
View raw message