/** * Return a stem with matching display extension, or null if that stem doesn't exist * * @return */ public static StemI findChildStem(StemI parentStem, String displayExtension) { Set<StemI> existingStems = parentStem.getChildStems(); for (StemI stem : existingStems) { if (stem.getDisplayExtension().equals(displayExtension)) { return stem; } } return null; }
/** * WARNING: this will remove all sub-groups and sub-stems recursively. The stem itself is left * unchanged. * * @param stem * @throws InsufficientPrivilegeException * @throws GroupDeleteException * @throws StemDeleteException */ public static void deleteStemHierarchy(StemI curStem) throws GroupDeleteException, InsufficientPrivilegeException, StemDeleteException { Set<StemI> subStems = (Set<StemI>) curStem.getChildStems(); for (StemI stem : subStems) { deleteStemHierarchy(stem); stem.delete(); } Set<GroupI> groups = (Set<GroupI>) curStem.getChildGroups(); for (GroupI group : groups) { deleteGroup(group); } }