private Statement convertStatement(JSONObject jStatement) throws JSONException {
if (!Arrays.asList(JSONObject.getNames(jStatement)).contains(JsonDocumentFields.STATEMENT_EFFECT)) {
return null;
}
Statement statement;
String jEffect = jStatement.getString(JsonDocumentFields.STATEMENT_EFFECT);
if (JsonDocumentFields.EFFECT_VALUE_ALLOW.equals(jEffect)) {
statement = new Statement(Effect.Allow);
} else {
statement = new Statement(Effect.Deny);
}
if (Arrays.asList(JSONObject.getNames(jStatement)).contains(JsonDocumentFields.STATEMENT_ID)) {
statement.setId(jStatement.getString(JsonDocumentFields.STATEMENT_ID));
}
convertActions(statement, jStatement);
convertResources(statement, jStatement);
convertCondition(statement, jStatement);