cancel
Showing results for 
Search instead for 
Did you mean: 

getChildAssocs(): correct usage?

hbf
Champ on-the-rise
Champ on-the-rise
Hi,

I have a child-association

<child-association name="my:myassoc">
<!– … –>

and, given a node nodeRef, I want to get its children with respect to this association.

Which one is correct, (a) or (b)?

qname= new QName(/* … */, "myassoc");
List<ChildAssociationRef> lista = session.nodeService.getChildAssocs(nodeRef, qname, RegexQNamePattern.MATCH_ALL); // (a)
List<ChildAssociationRef> listb = session.nodeService.getChildAssocs(nodeRef, RegexQNamePattern.MATCH_ALL, qname); // (b)

From the API documentation it is not clear to me, what the second and third parameter are. Could somebody explain this?

Thanks,
Kaspar
2 REPLIES 2

rivarola
Champ on-the-rise
Champ on-the-rise
Hello Kaspar,

The first one is correct.
The second parameter of the method is the QName pattern of the association type.
The third parameter is the QName pattern of the association instance (often the same as the child node name, but qualified).

hbf
Champ on-the-rise
Champ on-the-rise
Sorry for the late reply.

Many thanks, Rivarola, that solved my problem completely!

Kaspar