in scim-core/src/main/java/org/apache/directory/scim/core/repository/PatchHandlerImpl.java [392:418]
public <T extends ScimResource> void applyMultiValue(T source, Map<String, Object> sourceAsMap, Schema schema, Attribute attribute, ValuePathExpression valuePathExpression, Object value) {
AttributeReference attributeReference = valuePathExpression.getAttributePath();
Collection<Map<String, Object>> items = (Collection<Map<String, Object>>) sourceAsMap.get(attributeReference.getAttributeName());
Predicate<Object> pred = FilterExpressions.inMemoryMap(valuePathExpression.getAttributeExpression(), schema);
// if there is a sub-attribute in the filter, only that sub-attribute is removed, otherwise the whole item is
// removed from the collection
if(attributeReference.hasSubAttribute()) {
items.forEach(item -> {
if (pred.test(item)) {
String subAttributeName = attributeReference.getSubAttributeName();
checkMutability(attribute.getAttribute(subAttributeName), item.get(subAttributeName));
item.remove(subAttributeName);
}
});
} else {
// remove any items that match
for (Iterator<Map<String, Object>> iter = items.iterator(); iter.hasNext();) {
Map<String, Object> item = iter.next();
if (pred.test(item)) {
checkMutability(attribute, item);
iter.remove();
}
}
}
}