I'd like to ensure that a given property is always set as uppercase string.
I tried to use a java Behavior to update property value before commit, but this has no effect (see below).
Any
behavior declaration:
<code>
eventManager.bindClassBehaviour(
NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME,
myModel.myAspect,
new JavaBehaviour(this, "onUpdateProperties", Behaviour.NotificationFrequency.FIRST_EVENT)
);
...
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) {
// modifying property value of 'after' map has no effect
}
</code>
Idea suggestion ?
Thanks
Modifying the after map NEVER has any effect. The after map is just a shallow copy of the node properties state provided to the behaviour - it does not allow for direct mutation. You have to use the NodeService to make actual, persistent changes to nodes from within your behaviour.
OK. I'd like to apply some string 'normalization' to specific properties when set by the user in UI (either share or any other external custom UI).
I was thinking about using behaviors to do that: 1) test if the value set is a normalized value, if not reset the value with the normalize value (which will trigger again the behavior….).
Do you think there's a more efficient way to do that ?
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.