log.info("Execuate SQL "+ statement);
ResultSet results = statement.executeQuery();
ArrayList<CapabilityToken> tokenList = new ArrayList<CapabilityToken>();
while(results.next()){
CapabilityToken captoken = CapabilityToken.Factory.newInstance();
captoken.setActor(results.getString(ALLOWED_ACTOR));
captoken.setResourceID(results.getString(RESOURCE_ID));
captoken.setActorType(results.getBoolean(IS_USER));
String capActionStr = results.getString(ACTION_TYPE);
Action capAction = Action.All;
if(capActionStr != null){
capAction = Action.valueOf(capActionStr);
}
//If use has give a search action, skip everything does not match
if(searchAction != null){
if(!capAction.equals(Action.All) && !capAction.equals(searchAction)){
break;
}
}
captoken.setAction(capAction.toString());
String assertion = results.getString(ASSERTION);
if(assertion != null){
captoken.setAssertions(assertion);
}
//TODO it throws a exception when I try to get null time stamp
// Timestamp notbefore = results.getTimestamp(NOT_BEFORE);