addAdminGroup(admin, AdminGroup.TEMPSUPERADMINGROUP);
final ArrayList<AdminEntity> adminentities = new ArrayList<AdminEntity>();
adminentities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, superAdminCN, caid));
admEntitySession.addAdminEntities(admin, AdminGroup.TEMPSUPERADMINGROUP, adminentities);
final ArrayList<AccessRule> accessrules = new ArrayList<AccessRule>();
accessrules.add(new AccessRule(AccessRulesConstants.ROLE_SUPERADMINISTRATOR, AccessRule.RULE_ACCEPT, false));
addAccessRules(admin, AdminGroup.TEMPSUPERADMINGROUP, accessrules);
}
// Add Special Admin Group
// Special admin group is a group that is not authenticated with client
// certificate, such as batch tool etc
if (AdminGroupData.findByGroupName(entityManager, AdminGroup.DEFAULTGROUPNAME) == null) {
LOG.debug("initialize: FinderEx, add default group.");
// Add Default Special Admin Group
try {
final AdminGroupData agdl = new AdminGroupData(Integer.valueOf(findFreeAdminGroupId()), AdminGroup.DEFAULTGROUPNAME);
entityManager.persist(agdl);
final ArrayList<AdminEntity> adminentities = new ArrayList<AdminEntity>();
adminentities.add(new AdminEntity(AdminEntity.SPECIALADMIN_BATCHCOMMANDLINEADMIN));
adminentities.add(new AdminEntity(AdminEntity.SPECIALADMIN_CACOMMANDLINEADMIN));
adminentities.add(new AdminEntity(AdminEntity.SPECIALADMIN_RAADMIN));
adminentities.add(new AdminEntity(AdminEntity.SPECIALADMIN_INTERNALUSER));
agdl.addAdminEntities(entityManager, adminentities);
final ArrayList<AccessRule> accessrules = new ArrayList<AccessRule>();
accessrules.add(new AccessRule(AccessRulesConstants.ROLE_ADMINISTRATOR, AccessRule.RULE_ACCEPT, true));
accessrules.add(new AccessRule(AccessRulesConstants.ROLE_SUPERADMINISTRATOR, AccessRule.RULE_ACCEPT, false));
accessrules.add(new AccessRule(AccessRulesConstants.REGULAR_CAFUNCTIONALTY, AccessRule.RULE_ACCEPT, true));
accessrules.add(new AccessRule(AccessRulesConstants.REGULAR_RAFUNCTIONALITY, AccessRule.RULE_ACCEPT, true));
accessrules.add(new AccessRule(AccessRulesConstants.REGULAR_LOGFUNCTIONALITY, AccessRule.RULE_ACCEPT, true));
accessrules.add(new AccessRule(AccessRulesConstants.REGULAR_SYSTEMFUNCTIONALITY, AccessRule.RULE_ACCEPT, true));
accessrules.add(new AccessRule(AccessRulesConstants.HARDTOKEN_HARDTOKENFUNCTIONALITY, AccessRule.RULE_ACCEPT, true));
accessrules.add(new AccessRule(AccessRulesConstants.CABASE, AccessRule.RULE_ACCEPT, true));
accessrules.add(new AccessRule(AccessRulesConstants.ENDENTITYPROFILEBASE, AccessRule.RULE_ACCEPT, true));
agdl.addAccessRules(entityManager, accessrules);
authTreeSession.signalForAuthorizationTreeUpdate();
} catch (Exception ce) {