As part of https://forum.xwiki.org/t/replace-concept-of-user-in-new-user-api-and-more/6470 (see points 6, 7, 8), we need the ability to modify a configuration source. My specific need is to be able to modify a user’s properties without exposing Documents and XObjects/XProperties.
I see 2 options for modifying
- Option 1: setProperty() + save() methods. Each calls to setProperty will store the changes in a map in memory and the call to save() will persist them in one go.
void setProperty(String key, Object value); void save();
- Option 2: setProperties() accepting a Map. The persistence is done when the set method is called.
void setProperties(Map<String, Object> properties);
ATM my preference goes to option 1 since it makes it simpler to use (if you need to do operations in between calls to setProperty for ex) and more clearly explains what’s happening. It’s also similar to what we do in the Document API.