public void removeAllAttributes() { removeAttribute(UserAttributePredicates.matchAll()); }
public void removeAttribute(final UserAttribute a) { removeAttribute(UserAttributePredicates.matchEntity(a)); }
public void removeAttributeByKey(final String key) { removeAttribute(UserAttributePredicates.matchKey(key)); }
public void removeAttribute(final String key, final String value) { removeAttribute(UserAttributePredicates.matchKeyValue(key, value)); }
@Override public boolean apply(UserAttribute b) { if (!predicate.apply(b)) { return false; } Map<String, UserAttribute> aMap = a.getAttributesMap(), bMap = b.getAttributesMap(); Set<String> aKeys = aMap.keySet(), bKeys = bMap.keySet(); if (!aKeys.containsAll(bKeys) || !bKeys.containsAll(aKeys)) { return false; } for (String key : aKeys) { if (!matchAttribute(aMap.get(key)).apply(bMap.get(key))) { return false; } } return true; } };
public void removeAttributeByValue(final String value) { removeAttribute(UserAttributePredicates.matchValue(value)); }
public UserAttribute findAttribute(final String key, final String value) { return findAttribute(getAttributes(), UserAttributePredicates.matchKeyValue(key, value)); }
protected UserAttribute modifyOrAddAttribute(final UserAttribute original, final UserAttribute current) { if (original == null) { return addInternal(current); } if (UserAttributePredicates.matchAttribute(original).apply(current)) { return original; } removeMatched(original); return addInternal(current); }
public UserAttribute findAttribute(final String key) { return findAttribute(getAttributes(), UserAttributePredicates.matchKey(key)); }
@Override public UserAttribute findAttribute(final String key, final String value) { return findAttribute(getMainAttributes(), UserAttributePredicates.matchKeyValue(key, value)); }
@Override public boolean apply(UserAttribute input) { return matchEntity(a).apply(input.getParent()); } };
@Override public UserAttribute findAttribute(final String key) { return findAttribute(getMainAttributes(), UserAttributePredicates.matchKey(key)); }
public static Predicate<UserAttribute> matchAttribute(final UserAttribute a) { return new Predicate<UserAttribute>() { Predicate<UserAttribute> predicate = matchKeyValue(a.getKey(), a.getValue()); @Override public boolean apply(UserAttribute b) { if (!predicate.apply(b)) { return false; } Map<String, UserAttribute> aMap = a.getAttributesMap(), bMap = b.getAttributesMap(); Set<String> aKeys = aMap.keySet(), bKeys = bMap.keySet(); if (!aKeys.containsAll(bKeys) || !bKeys.containsAll(aKeys)) { return false; } for (String key : aKeys) { if (!matchAttribute(aMap.get(key)).apply(bMap.get(key))) { return false; } } return true; } }; } }
public UserAttribute findAttribute(UserAttribute attribute) { return findAttribute(getAttributes(), UserAttributePredicates.matchEntity(attribute)); }
public Collection<UserAttribute> findAttributesMatchingKey(final String key) { return findAttributesByPredicate(getAttributes(), UserAttributePredicates.matchKey(key)); }