Пример #1
0
 public static boolean subgroupExists(StemI stem, String systemNameOfGroup) {
   Set<GroupI> existingGroups = stem.getChildGroups();
   for (GroupI group : existingGroups) {
     if (group.getExtension().equals(systemNameOfGroup)) {
       return true;
     }
   }
   return false;
 }
Пример #2
0
 /**
  * Return a stem with matching group (sytem) extension, or null if that group doesn't exist
  *
  * @param groupExtension the extension of the group to find
  * @return
  */
 public static GroupI findChildGroup(StemI stem, String groupExtension) {
   Set<GroupI> groups = stem.getChildGroups();
   for (GroupI group : groups) {
     if (group.getExtension().equals(groupExtension)) {
       return group;
     }
   }
   return null;
 }
Пример #3
0
 /**
  * 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);
   }
 }