AdminGroupDataLocal agdl = admingrouphome.create("Public Web Users",  ILogSessionLocal.INTERNALCAID);
AdminGroupDataLocal agdl = admingrouphome.create(new Integer(findFreeAdminGroupId()),"Public Web Users",  ILogSessionLocal.INTERNALCAID);
    public void initialize(Admin admin, int caid) throws AdminGroupExistsException{         // Check if admingroup table is empty, if so insert default superuser         // and create "special edit accessrules count group"       try{         Collection result = admingrouphome.findAll();         if(result.size()==0){          // Authorization table is empty, fill with default and special admingroups.           String admingroupname = "Temporary Super Administrator Group";              addAdminGroup(admin, admingroupname, caid);            ArrayList adminentities = new ArrayList();           adminentities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME,AdminEntity.TYPE_EQUALCASEINS,"SuperAdmin",caid));                      addAdminEntities(admin, admingroupname, caid, adminentities);           ArrayList accessrules = new ArrayList();           accessrules.add(new AccessRule("/public_web_user",AccessRule.RULE_ACCEPT,false));           accessrules.add(new AccessRule("/administrator",AccessRule.RULE_ACCEPT,false));           accessrules.add(new AccessRule("/super_administrator",AccessRule.RULE_ACCEPT,false));           accessrules.add(new AccessRule("/ca_functionality",AccessRule.RULE_ACCEPT,true));           accessrules.add(new AccessRule("/ra_functionality",AccessRule.RULE_ACCEPT,true));           accessrules.add(new AccessRule("/log_functionality",AccessRule.RULE_ACCEPT,true));           accessrules.add(new AccessRule("/system_functionality",AccessRule.RULE_ACCEPT,true));           accessrules.add(new AccessRule("/hardtoken_functionality",AccessRule.RULE_ACCEPT,true));                      accessrules.add(new AccessRule("/ca",AccessRule.RULE_ACCEPT,true));            accessrules.add(new AccessRule("/endentityprofilesrules",AccessRule.RULE_ACCEPT,true));                       addAccessRules(admin, admingroupname, caid, accessrules);                    }       }catch(FinderException e){}         // Add Special Admin Group       try{          admingrouphome.findByPrimaryKey(new AdminGroupPK(DEFAULTGROUPNAME, ILogSessionLocal.INTERNALCAID));          }catch(FinderException e){         // Add Default Group         try{             AdminGroupDataLocal agdl = admingrouphome.create(DEFAULTGROUPNAME,  ILogSessionLocal.INTERNALCAID);                   ArrayList adminentities = new ArrayList();           adminentities.add(new AdminEntity(AdminEntity.SPECIALADMIN_BATCHCOMMANDLINEADMIN));           adminentities.add(new AdminEntity(AdminEntity.SPECIALADMIN_CACOMMANDLINEADMIN));              adminentities.add(new AdminEntity(AdminEntity.SPECIALADMIN_RACOMMANDLINEADMIN));             adminentities.add(new AdminEntity(AdminEntity.SPECIALADMIN_INTERNALUSER));           agdl.addAdminEntities(adminentities);                    ArrayList accessrules = new ArrayList();           accessrules.add(new AccessRule("/administrator",AccessRule.RULE_ACCEPT,true));           accessrules.add(new AccessRule("/super_administrator",AccessRule.RULE_ACCEPT,false));           accessrules.add(new AccessRule("/ca_functionality",AccessRule.RULE_ACCEPT,true));           accessrules.add(new AccessRule("/ra_functionality",AccessRule.RULE_ACCEPT,true));           accessrules.add(new AccessRule("/log_functionality",AccessRule.RULE_ACCEPT,true));           accessrules.add(new AccessRule("/system_functionality",AccessRule.RULE_ACCEPT,true));           accessrules.add(new AccessRule("/hardtoken_functionality",AccessRule.RULE_ACCEPT,true));                      accessrules.add(new AccessRule("/ca",AccessRule.RULE_ACCEPT,true));            accessrules.add(new AccessRule("/endentityprofilesrules",AccessRule.RULE_ACCEPT,true));                      agdl.addAccessRules(accessrules);                      signalForAuthorizationTreeUpdate();         }catch(CreateException ce){}       }	   // Add Public Web Group	   this.removeAdminGroup(admin, "Public Web Users",  ILogSessionLocal.INTERNALCAID);	   try{		  admingrouphome.findByPrimaryKey(new AdminGroupPK("Public Web Users", ILogSessionLocal.INTERNALCAID));   	   }catch(FinderException e){	   	   	 	     try{           	   	 		   AdminGroupDataLocal agdl = admingrouphome.create("Public Web Users",  ILogSessionLocal.INTERNALCAID);        		   ArrayList adminentities = new ArrayList();		   adminentities.add(new AdminEntity(AdminEntity.SPECIALADMIN_PUBLICWEBUSER));		 		   agdl.addAdminEntities(adminentities);         		   ArrayList accessrules = new ArrayList();		   accessrules.add(new AccessRule("/public_web_user",AccessRule.RULE_ACCEPT,false));		 		   accessrules.add(new AccessRule("/ca_functionality/basic_functions",AccessRule.RULE_ACCEPT,false));		   accessrules.add(new AccessRule("/ca_functionality/view_certificate",AccessRule.RULE_ACCEPT,false));		   accessrules.add(new AccessRule("/ca_functionality/create_certificate",AccessRule.RULE_ACCEPT,false));		   accessrules.add(new AccessRule("/ca_functionality/store_certificate",AccessRule.RULE_ACCEPT,false));		   accessrules.add(new AccessRule("/ra_functionality/view_end_entity",AccessRule.RULE_ACCEPT,false));			 		   accessrules.add(new AccessRule("/ca",AccessRule.RULE_ACCEPT,true)); 		   accessrules.add(new AccessRule("/endentityprofilesrules",AccessRule.RULE_ACCEPT,true)); 		                                                       		   agdl.addAccessRules(accessrules);           		  signalForAuthorizationTreeUpdate();	      }catch(CreateException ce){}	       	   }      }