try {      child.setSession(GrouperSessionFinder.getRootSession()); PrivilegeResolver.getInstance().grantPriv( GrouperSessionFinder.getRootSession(), child, s.getSubject(), AccessPrivilege.ADMIN ); child.setSession(this.s); } catch (Exception e) { throw new GroupAddException( "group created but unable to grant ADMIN to creator: " + e.getMessage() ); }
  public Group addChildGroup(String extension, String displayExtension)     throws  GroupAddException,            InsufficientPrivilegeException  {    PrivilegeResolver.getInstance().canCREATE(      GrouperSessionFinder.getRootSession(), this, this.s.getSubject()    );    if (this.equals(StemFinder.findRootStem(this.s))) {      throw new GroupAddException(        "cannot create groups at root stem level"      );    }     try {      Group g = GroupFinder.findByName(        this.s, this.constructName(this.getName(), extension)      );      throw new GroupAddException("group already exists");    }    catch (GroupNotFoundException eGNF) {      // Ignore.  This is what we want.    }    try {      Group child = new Group(this.s, this, extension, displayExtension);      // Set parent      child.setParent_stem(this);      // Add to children       Set children  = this.getChild_groups();      children.add(child);      this.setChild_groups(children);      HibernateHelper.save(this);      return child;    }    catch (Exception e) {      throw new GroupAddException(        "Unable to add group " + this.getName() + ":" + extension + ": "         + e.getMessage()      );    }  } // public Group addChildGroup(extension, displayExtension)