/** * Groups the list of <code>Condition</code>s by the condition type and * condition key. * * @param conditions * the list of conditions to be grouped * @return a map of conditions grouped by type and then key. */ private Map<String, ConditionsByKey> groupConditionsByTypeAndKey( List<Condition> conditions) { Map<String, ConditionsByKey> conditionsByType = new LinkedHashMap<String, ConditionsByKey>(); String type; String key; ConditionsByKey conditionsByKey; for (Condition condition : conditions) { type = condition.getType(); key = condition.getConditionKey(); if (!(conditionsByType.containsKey(type))) { conditionsByType.put(type, new ConditionsByKey()); } conditionsByKey = conditionsByType.get(type); conditionsByKey.addValuesToKey(key, condition.getValues()); } return conditionsByType; }
values.add(fieldValue.asText()); conditions.add(new Condition().withType(conditionType) .withConditionKey(field.getKey()).withValues(values));
/** * Fluent version of {@link Condition#setConditionKey(String)} * @return this */ public Condition withConditionKey(String key) { setConditionKey(key); return this; }
/** * Fluent version of {@link Condition#setValues(List)} * @return this */ public Condition withValues(List<String> values) { setValues(values); return this; } }
/** * Fluent version of {@link Condition#setType(String)} * @return this */ public Condition withType(String type) { setType(type); return this; }
/** * Fluent version of {@link Condition#setValues(List)} * @return this */ public Condition withValues(String... values) { setValues(Arrays.asList(values)); return this; }
/** * Fluent version of {@link Condition#setType(String)} * @return this */ public Condition withType(String type) { setType(type); return this; }
values.add(fieldValue.asText()); conditions.add(new Condition().withType(conditionType) .withConditionKey(field.getKey()).withValues(values));
logger.trace("condition type: {}, conditionKey: {}", condition.getType(), condition.getConditionKey()); if (condition.getType().equals(ArnCondition.ArnComparisonType.ArnLike.name()) && condition.getConditionKey().equals(ConditionFactory.SOURCE_ARN_CONDITION_KEY)) { matchingConditionFound = true; for (String topicARN : topicARNs) { if (! condition.getValues().contains(topicARN)) { condition.getValues().add(topicARN);
/** * Fluent version of {@link Condition#setValues(List)} * @param values the values. * @return this */ @SuppressWarnings("checkstyle:hiddenfield") public Condition withValues(List<String> values) { setValues(values); return this; } }
/** * Fluent version of {@link Condition#setType(String)} * @param type the type. * @return this */ @SuppressWarnings("checkstyle:hiddenfield") public Condition withType(String type) { setType(type); return this; }
/** * Fluent version of {@link Condition#setConditionKey(String)} * @param key the key. * @return this */ public Condition withConditionKey(String key) { setConditionKey(key); return this; }
/** * Generates a condition instance for each condition type under the * Condition JSON node. * * @param conditions the complete list of conditions * @param conditionType the condition type for the condition being created. * @param conditionNode each condition node to be parsed. * @throws IOException */ private void convertConditionRecord(List<Condition> conditions, String conditionType, AwsJsonReader reader) throws IOException { reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); List<String> values = new LinkedList<String>(); if (reader.isContainer()) { reader.beginArray(); while (reader.hasNext()) { values.add(reader.nextString()); } reader.endArray(); } else { values.add(reader.nextString()); } conditions.add(new Condition().withType(conditionType).withConditionKey(name) .withValues(values)); } reader.endObject(); }
/** * Groups the list of <code>Condition</code>s by the condition type and * condition key. * * @param conditions the list of conditions to be grouped * @return a map of conditions grouped by type and then key. */ private Map<String, ConditionsByKey> groupConditionsByTypeAndKey( List<Condition> conditions) { Map<String, ConditionsByKey> conditionsByType = new HashMap<String, ConditionsByKey>(); String type; String key; ConditionsByKey conditionsByKey; for (Condition condition : conditions) { type = condition.getType(); key = condition.getConditionKey(); if (!(conditionsByType.containsKey(type))) { conditionsByType.put(type, new ConditionsByKey()); } conditionsByKey = conditionsByType.get(type); conditionsByKey.addValuesToKey(key, condition.getValues()); } return conditionsByType; }
/** * Fluent version of {@link Condition#setValues(List)} * @return this */ public Condition withValues(List<String> values) { setValues(values); return this; } }
/** * Fluent version of {@link Condition#setType(String)} * @param type the type. * @return this */ @SuppressWarnings("checkstyle:hiddenfield") public Condition withType(String type) { setType(type); return this; }
/** * Fluent version of {@link Condition#setConditionKey(String)} * @return this */ public Condition withConditionKey(String key) { setConditionKey(key); return this; }
values.add(fieldValue.asText()); conditions.add(new Condition().withType(conditionType) .withConditionKey(field.getKey()).withValues(values));
/** * Groups the list of <code>Condition</code>s by the condition type and * condition key. * * @param conditions * the list of conditions to be grouped * @return a map of conditions grouped by type and then key. */ private Map<String, ConditionsByKey> groupConditionsByTypeAndKey( List<Condition> conditions) { Map<String, ConditionsByKey> conditionsByType = new LinkedHashMap<String, ConditionsByKey>(); String type; String key; ConditionsByKey conditionsByKey; for (Condition condition : conditions) { type = condition.getType(); key = condition.getConditionKey(); if (!(conditionsByType.containsKey(type))) { conditionsByType.put(type, new ConditionsByKey()); } conditionsByKey = conditionsByType.get(type); conditionsByKey.addValuesToKey(key, condition.getValues()); } return conditionsByType; }
/** * Fluent version of {@link Condition#setValues(List)} * @param values the values. * @return this */ @SuppressWarnings("checkstyle:hiddenfield") public Condition withValues(String... values) { setValues(Arrays.asList(values)); return this; }