/** * Writes the list of <code>Principal</code>s to the JSONGenerator. * * @param principals * the list of principals to be written. */ private void writePrincipals(List<Principal> principals) throws JsonGenerationException, IOException { if (principals.size() == 1 && principals.get(0).equals(Principal.All)) { writeJsonKeyValue(JsonDocumentFields.PRINCIPAL, Principal.All.getId()); } else { writeJsonObjectStart(JsonDocumentFields.PRINCIPAL); Map<String, List<String>> principalsByScheme = groupPrincipalByScheme(principals); List<String> principalValues; for (Map.Entry<String, List<String>> entry : principalsByScheme.entrySet()) { principalValues = principalsByScheme.get(entry.getKey()); if (principalValues.size() == 1) { writeJsonKeyValue(entry.getKey(), principalValues.get(0)); } else { writeJsonArray(entry.getKey(), principalValues); } } writeJsonObjectEnd(); } }
generator.writeStartObject(); writeJsonKeyValue(JsonDocumentFields.VERSION, policy.getVersion()); writeJsonKeyValue(JsonDocumentFields.POLICY_ID, policy.getId()); writeJsonKeyValue(JsonDocumentFields.STATEMENT_ID, statement.getId()); writeJsonKeyValue(JsonDocumentFields.STATEMENT_EFFECT, statement .getEffect().toString());
/** * Writes the list of <code>Principal</code>s to the JSONGenerator. * * @param principals the list of principals to be written. */ private void writePrincipals(List<Principal> principals) throws IOException { if (principals.size() == 1 && principals.get(0).equals(Principal.All)) { writeJsonKeyValue(JsonDocumentFields.PRINCIPAL, Principal.All.getId()); } else { writeJsonObjectStart(JsonDocumentFields.PRINCIPAL); Map<String, List<String>> principalsByScheme = groupPrincipalByScheme(principals); List<String> principalValues; for (Map.Entry<String, List<String>> entry : principalsByScheme.entrySet()) { principalValues = principalsByScheme.get(entry.getKey()); if (principalValues.size() == 1) { writeJsonKeyValue(entry.getKey(), principalValues.get(0)); } else { writeJsonArray(entry.getKey(), principalValues); } } writeJsonObjectEnd(); } }
/** * Writes the list of <code>Principal</code>s to the JSONGenerator. * * @param principals * the list of principals to be written. */ private void writePrincipals(List<Principal> principals) throws JsonGenerationException, IOException { if (principals.size() == 1 && principals.get(0).equals(Principal.All)) { writeJsonKeyValue(JsonDocumentFields.PRINCIPAL, Principal.All.getId()); } else { writeJsonObjectStart(JsonDocumentFields.PRINCIPAL); Map<String, List<String>> principalsByScheme = groupPrincipalByScheme(principals); List<String> principalValues; for (Map.Entry<String, List<String>> entry : principalsByScheme.entrySet()) { principalValues = principalsByScheme.get(entry.getKey()); if (principalValues.size() == 1) { writeJsonKeyValue(entry.getKey(), principalValues.get(0)); } else { writeJsonArray(entry.getKey(), principalValues); } } writeJsonObjectEnd(); } }
generator.writeStartObject(); writeJsonKeyValue(JsonDocumentFields.VERSION, policy.getVersion()); writeJsonKeyValue(JsonDocumentFields.POLICY_ID, policy.getId()); writeJsonKeyValue(JsonDocumentFields.STATEMENT_ID, statement.getId()); writeJsonKeyValue(JsonDocumentFields.STATEMENT_EFFECT, statement .getEffect().toString());
jsonWriter.beginObject(); writeJsonKeyValue(JsonDocumentFields.VERSION, policy.getVersion()); writeJsonKeyValue(JsonDocumentFields.POLICY_ID, policy.getId()); writeJsonKeyValue(JsonDocumentFields.STATEMENT_ID, statement.getId()); writeJsonKeyValue(JsonDocumentFields.STATEMENT_EFFECT, statement .getEffect().toString());
/** * Writes the list of <code>Principal</code>s to the JSONGenerator. * * @param principals * the list of principals to be written. */ private void writePrincipals(List<Principal> principals) throws JsonGenerationException, IOException { if (principals.size() == 1 && principals.get(0).equals(Principal.All)) { writeJsonKeyValue(JsonDocumentFields.PRINCIPAL, Principal.All.getId()); } else { writeJsonObjectStart(JsonDocumentFields.PRINCIPAL); Map<String, List<String>> principalsByScheme = groupPrincipalByScheme(principals); List<String> principalValues; for (Map.Entry<String, List<String>> entry : principalsByScheme.entrySet()) { principalValues = principalsByScheme.get(entry.getKey()); if (principalValues.size() == 1) { writeJsonKeyValue(entry.getKey(), principalValues.get(0)); } else { writeJsonArray(entry.getKey(), principalValues); } } writeJsonObjectEnd(); } }
/** * Writes the list of <code>Principal</code>s to the JSONGenerator. * * @param principals the list of principals to be written. */ private void writePrincipals(List<Principal> principals) throws IOException { if (principals.size() == 1 && principals.get(0).equals(Principal.All)) { writeJsonKeyValue(JsonDocumentFields.PRINCIPAL, Principal.All.getId()); } else { writeJsonObjectStart(JsonDocumentFields.PRINCIPAL); Map<String, List<String>> principalsByScheme = groupPrincipalByScheme(principals); List<String> principalValues; for (Map.Entry<String, List<String>> entry : principalsByScheme.entrySet()) { principalValues = principalsByScheme.get(entry.getKey()); if (principalValues.size() == 1) { writeJsonKeyValue(entry.getKey(), principalValues.get(0)); } else { writeJsonArray(entry.getKey(), principalValues); } } writeJsonObjectEnd(); } }
/** * Writes the list of <code>Principal</code>s to the JSONGenerator. * * @param principals the list of principals to be written. */ private void writePrincipals(List<Principal> principals) throws IOException { if (principals.size() == 1 && principals.get(0).equals(Principal.All)) { writeJsonKeyValue(JsonDocumentFields.PRINCIPAL, Principal.All.getId()); } else { writeJsonObjectStart(JsonDocumentFields.PRINCIPAL); Map<String, List<String>> principalsByScheme = groupPrincipalByScheme(principals); List<String> principalValues; for (Map.Entry<String, List<String>> entry : principalsByScheme.entrySet()) { principalValues = principalsByScheme.get(entry.getKey()); if (principalValues.size() == 1) { writeJsonKeyValue(entry.getKey(), principalValues.get(0)); } else { writeJsonArray(entry.getKey(), principalValues); } } writeJsonObjectEnd(); } }
generator.writeStartObject(); writeJsonKeyValue(JsonDocumentFields.VERSION, policy.getVersion()); writeJsonKeyValue(JsonDocumentFields.POLICY_ID, policy.getId()); writeJsonKeyValue(JsonDocumentFields.STATEMENT_ID, statement.getId()); writeJsonKeyValue(JsonDocumentFields.STATEMENT_EFFECT, statement .getEffect().toString());
jsonWriter.beginObject(); writeJsonKeyValue(JsonDocumentFields.VERSION, policy.getVersion()); writeJsonKeyValue(JsonDocumentFields.POLICY_ID, policy.getId()); writeJsonKeyValue(JsonDocumentFields.STATEMENT_ID, statement.getId()); writeJsonKeyValue(JsonDocumentFields.STATEMENT_EFFECT, statement .getEffect().toString());
jsonWriter.beginObject(); writeJsonKeyValue(JsonDocumentFields.VERSION, policy.getVersion()); writeJsonKeyValue(JsonDocumentFields.POLICY_ID, policy.getId()); writeJsonKeyValue(JsonDocumentFields.STATEMENT_ID, statement.getId()); writeJsonKeyValue(JsonDocumentFields.STATEMENT_EFFECT, statement .getEffect().toString());