skip transient fields and also consider attribute names of non-annotated

fields
This commit is contained in:
Konrad Windszus
2016-10-13 17:58:17 +02:00
committed by Rob Winch
parent 9ab8cabedb
commit e84eda1096

View File

@@ -117,9 +117,18 @@ public class DefaultObjectDirectoryMapper implements ObjectDirectoryMapper {
Set<String> managedAttributeNames = new HashSet<String>();
// extract all relevant attributes
for (Field field : entityData.metaData) {
String[] attributesOfField = entityData.metaData.getAttribute(field).getAttributes();
AttributeMetaData attributeMetaData = entityData.metaData.getAttribute(field);
// skip transient field
if (attributeMetaData.isTransient()) {
continue;
}
String[] attributesOfField = attributeMetaData.getAttributes();
if (attributesOfField != null && attributesOfField.length > 0) {
// attribute names are either given through annotation
managedAttributeNames.addAll(Arrays.asList(attributesOfField));
} else {
// or implicitly by relying on the field name
managedAttributeNames.add(field.getName());
}
}
// always add the mandatory attribute objectclass (which is always used for the mapping)