private Collection < Group > findGroups ( Session session , Group parent , boolean recursive ) throws Exception { List < Group > groups = new ArrayList < Group > ( ) ; String parentId = parent == null ? "" : parent . getId ( ) ; NodeIterator childNodes = utils . getGroupNode ( session , parentId ) . getNodes ( ) ; while ( childNodes . hasNext ( ) ) { Node groupNode = childNodes . nextNode ( ) ; if ( ! groupNode . getName ( ) . startsWith ( JCROrganizationServiceImpl . JOS_MEMBERSHIP ) ) { Group group = readGroup ( groupNode ) ; groups . add ( group ) ; if ( recursive ) { groups . addAll ( findGroups ( session , group , recursive ) ) ; } } } return groups ; }
Find children groups . Parent group is not included in result .