in scim-server/src/main/java/org/apache/directory/scim/server/rest/AttributeUtil.java [308:336]
private Set<Attribute> findAttributeInSchema(Schema schema, AttributeReference attributeReference, boolean includeAttributeChain) {
if (schema == null) {
return Collections.emptySet();
}
Set<Attribute> attributes = new HashSet<>();
String attributeName = attributeReference.getAttributeName();
String subAttributeName = attributeReference.getSubAttributeName();
Attribute attribute = schema.getAttribute(attributeName);
if (attribute == null) {
return Collections.emptySet();
}
if (includeAttributeChain || subAttributeName == null) {
attributes.add(attribute);
}
if (subAttributeName != null) {
attribute = attribute.getAttribute(subAttributeName);
if (attribute == null) {
return Collections.emptySet();
}
attributes.add(attribute);
}
if (attribute.getType() == Type.COMPLEX && includeAttributeChain) {
Set<Attribute> remaininAttributes = attribute.getAttributes();
attributes.addAll(remaininAttributes);
}
return attributes;
}