for (AbstractAttributable attributable : attributables) {
AbstractVirAttr virAttr = attributable.getVirtualAttribute(mapping.getIntAttrName());
if (virAttr != null) {
if (virAttr.getValues() != null) {
for (String value : virAttr.getValues()) {
AbstractAttrValue attrValue = new UAttrValue();
attrValue.setStringValue(value);
values.add(attrValue);
}
}
if (vAttrsToBeRemoved != null && vAttrsToBeUpdated != null) {
if (vAttrsToBeUpdated.containsKey(mapping.getIntAttrName())) {
virAttr.setValues(vAttrsToBeUpdated.get(mapping.getIntAttrName()).getValuesToBeAdded());
} else if (vAttrsToBeRemoved.contains(mapping.getIntAttrName())) {
virAttr.getValues().clear();
} else {
throw new RuntimeException("Virtual attribute has not to be updated");
}
}
}
LOG.debug("Retrieved virtual attribute {}"
+ "\n* IntAttrName {}"
+ "\n* IntMappingType {}"
+ "\n* Attribute values {}",
virAttr, mapping.getIntAttrName(), mapping.getIntMappingType(), values);
}
break;
case UserDerivedSchema:
case RoleDerivedSchema:
case MembershipDerivedSchema:
for (AbstractAttributable attributable : attributables) {
AbstractDerAttr derAttr = attributable.getDerivedAttribute(mapping.getIntAttrName());
if (derAttr != null) {
AbstractAttrValue attrValue = new UAttrValue();
attrValue.setStringValue(derAttr.getValue(attributable.getAttributes()));
values.add(attrValue);
}
LOG.debug("Retrieved derived attribute {}"
+ "\n* IntAttrName {}"
+ "\n* IntMappingType {}"
+ "\n* Attribute values {}",
derAttr, mapping.getIntAttrName(), mapping.getIntMappingType(), values);
}
break;
case Username:
for (AbstractAttributable attributable : attributables) {
AbstractAttrValue attrValue = new UAttrValue();
attrValue.setStringValue(((SyncopeUser) attributable).getUsername());
values.add(attrValue);
}
break;
case SyncopeUserId:
for (AbstractAttributable attributable : attributables) {
AbstractAttrValue attrValue = new UAttrValue();
attrValue.setStringValue(attributable.getId().toString());
values.add(attrValue);
}
break;
case Password:
AbstractAttrValue attrValue = new UAttrValue();
if (password != null) {
attrValue.setStringValue(password);
}
values.add(attrValue);
break;