agl =  admingrouphome.findByPrimaryKey(new AdminGroupPK(oldname, caid)); Collection accessrules = agl.getAccessRuleObjects(); Collection adminentities = agl.getAdminEntityObjects(); AdminGroupDataLocal newagl = admingrouphome.create(newname, caid); newagl.addAccessRules(accessrules); newagl.addAdminEntities(adminentities); removeAdminGroup(admin, oldname, caid);
agl =  admingrouphome.findByGroupNameAndCAId(oldname, caid); agl.setAdminGroupName(newname); agl.setCAId(caid);
    public void renameAdminGroup(Admin admin, String oldname, int caid, String newname) throws AdminGroupExistsException {      if(!(oldname.equals(DEFAULTGROUPNAME) && caid == ILogSessionLocal.INTERNALCAID)){          boolean success = false;        AdminGroupDataLocal agl = null;        try{          agl = admingrouphome.findByPrimaryKey(new AdminGroupPK(newname, caid));          throw new AdminGroupExistsException();        }catch(FinderException e){          success = true;        }        if(success){          try{            agl =  admingrouphome.findByPrimaryKey(new AdminGroupPK(oldname, caid));            Collection accessrules = agl.getAccessRuleObjects();            Collection adminentities = agl.getAdminEntityObjects();            AdminGroupDataLocal newagl = admingrouphome.create(newname, caid);            newagl.addAccessRules(accessrules);            newagl.addAdminEntities(adminentities);            removeAdminGroup(admin, oldname, caid);            signalForAuthorizationTreeUpdate();                    }catch(Exception e){            error("Can't rename admingroup:"+e.getMessage());            success = false;          }        }        if(success)          logsession.log(admin, caid, LogEntry.MODULE_RA, new java.util.Date(),null, null, LogEntry.EVENT_INFO_EDITEDADMINISTRATORPRIVILEGES,"Renamed administratorgroup " + oldname + " to " + newname + ".");        else          logsession.log(admin, caid, LogEntry.MODULE_RA, new java.util.Date(),null, null, LogEntry.EVENT_ERROR_EDITEDADMINISTRATORPRIVILEGES,"Error renaming administratorgroup " + oldname + " to " + newname + ".");      }    } // renameAdminGroup