private Attributes publishedAttributes;
// Temporarily expose the fields
- protected final AttributeDictionary properties;
- protected final AttributeDictionary credentials;
+ protected AttributeDictionary properties;
+ protected AttributeDictionary credentials;
protected DefaultLdapEntry(AbstractLdapDirectory directory, LdapName dn, Attributes attributes) {
Objects.requireNonNull(directory);
this.directory = directory;
this.dn = dn;
this.publishedAttributes = attributes;
- properties = new AttributeDictionary(false);
- credentials = new AttributeDictionary(true);
+// properties = new AttributeDictionary(false);
+// credentials = new AttributeDictionary(true);
}
@Override
}
public synchronized Attributes getAttributes() {
+ // lazy loading
+ if (publishedAttributes == null)
+ publishedAttributes = getDirectory().getDirectoryDao().doGetAttributes(dn);
return isEditing() ? getModifiedAttributes() : publishedAttributes;
}
public synchronized void publishAttributes(Attributes modifiedAttributes) {
publishedAttributes = modifiedAttributes;
}
-
+
/*
* PROPERTIES
*/
@Override
public Dictionary<String, Object> getProperties() {
+ if (properties == null)
+ properties = new AttributeDictionary(false);
return properties;
}
+ public Dictionary<String, Object> getCredentials() {
+ if (credentials == null)
+ credentials = new AttributeDictionary(false);
+ return credentials;
+ }
+
/*
* CREDENTIALS
*/
return false;
}
- Object storedValue = credentials.get(key);
+ Object storedValue = getCredentials().get(key);
if (storedValue == null || value == null)
return false;
if (!(value instanceof String || value instanceof byte[]))