Retrieve All ODM-Managed Attributes on Update

In this way, if an Entry has an operational attribute, it will
be present in both the updated and existing objects so that
DirContextAdapter does not compute it as a new attribute.

Closes gh-446
This commit is contained in:
Josh Cummings
2024-10-10 12:11:00 -06:00
parent 849255ffa2
commit dfb7b4ceeb
5 changed files with 27 additions and 1 deletions

View File

@@ -1674,12 +1674,18 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
Assert.notNull(id, String.format("Unable to determine id for entry %s", entry.toString()));
DirContextOperations context = lookupContext(id);
String[] attributes = this.odm.manageClass(entry.getClass());
DirContextAdapter context = lookup(id, attributes, cast());
context.setUpdateMode(true);
this.odm.mapToLdapDataEntry(entry, context);
modifyAttributes(context);
}
}
private <T> ContextMapper<T> cast() {
return (ctx) -> (T) ctx;
}
/**
* {@inheritDoc}
*/