adminentities = ((AdminGroup) accessuserpair[ADMINGROUP]).getAdminEntities(); Iterator iter = adminentities.iterator(); while(iter.hasNext()){ AdminEntity adminentity = (AdminEntity) iter.next();  if(adminentity.match(admininformation)){ int thisuserstate = ((AccessRule) accessuserpair[ACCESSRULE]).getRuleState(); int thisuserstateprio = adminentity.getPriority();  if( stateprio < thisuserstateprio){ state=thisuserstate; stateprio=thisuserstateprio; } else{ if( stateprio == thisuserstateprio){  if(state < thisuserstate){
if(admininformation.isGroupUser()){ if(((AdminGroup) accessuserpair[ADMINGROUP]).getAdminGroupId() == admininformation.getGroupId()){ state = ((AccessRule) accessuserpair[ACCESSRULE]).getRuleState(); } }else{ adminentities = ((AdminGroup) accessuserpair[ADMINGROUP]).getAdminEntities(); Iterator iter = adminentities.iterator(); while(iter.hasNext()){ AdminEntity adminentity = (AdminEntity) iter.next();  if(adminentity.match(admininformation)){ int thisuserstate = ((AccessRule) accessuserpair[ACCESSRULE]).getRuleState(); int thisuserstateprio = adminentity.getPriority();  if( stateprio < thisuserstateprio){ state=thisuserstate; stateprio=thisuserstateprio; } else{ if( stateprio == thisuserstateprio){  if(state < thisuserstate){
       private int matchInformation(AdminInformation admininformation){          log.debug(">matchInformation");          final int ACCESSRULE = 0;          final int ADMINGROUP  = 1;          int state     = STATE_UNKNOWN;          int stateprio = 0;          Object[] accessuserpair;          Collection adminentities;                     for (int i = 0; i < useraccesspairs.size();i++){             accessuserpair = (Object[]) useraccesspairs.get(i);            adminentities = ((AdminGroup) accessuserpair[ADMINGROUP]).getAdminEntities();            Iterator iter = adminentities.iterator();            while(iter.hasNext()){              AdminEntity adminentity = (AdminEntity) iter.next();                // If user entity match.              if(adminentity.match(admininformation)){                int thisuserstate = ((AccessRule) accessuserpair[ACCESSRULE]).getRuleState();                int thisuserstateprio = adminentity.getPriority();                // If rule has higher priority, it's state is to be used.                if( stateprio < thisuserstateprio){                   state=thisuserstate;                   stateprio=thisuserstateprio;                }                else{                  if( stateprio == thisuserstateprio){                    // If the priority is the same then decline has priority over accept.                    if(state < thisuserstate){                        state=thisuserstate;                    }                  }                }              }            }          }          log.debug("<matchInformation: returns " + state );          return state;       }