private List < Principal > principalOf ( JsonNode principalNodes ) { List < Principal > principals = new LinkedList < Principal > ( ) ; if ( principalNodes . asText ( ) . equals ( "*" ) ) { principals . add ( Principal . All ) ; return principals ; } Iterator < Map . Entry < String , JsonNode > > mapOfPrincipals = principalNodes . fields ( ) ; String schema ; JsonNode principalNode ; Entry < String , JsonNode > principal ; Iterator < JsonNode > elements ; while ( mapOfPrincipals . hasNext ( ) ) { principal = mapOfPrincipals . next ( ) ; schema = principal . getKey ( ) ; principalNode = principal . getValue ( ) ; if ( principalNode . isArray ( ) ) { elements = principalNode . elements ( ) ; while ( elements . hasNext ( ) ) { principals . add ( createPrincipal ( schema , elements . next ( ) ) ) ; } } else { principals . add ( createPrincipal ( schema , principalNode ) ) ; } } return principals ; }
Generates a list of principals from the Principal Json Node