private Set<QName> determineChangedProps(Map<QName, Serializable> oldProps, Map<QName, Serializable> newProps) {
Set<QName> result = new HashSet<QName>();
for (QName qn : oldProps.keySet()) {
if (newProps.get(qn) == null ||
newProps.get(qn).equals(oldProps.get(qn)) == false) {
result.add(qn);
}
}
for (QName qn : newProps.keySet()) {
if (oldProps.get(qn) == null) {
result.add(qn);
}
}
return result;
}
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) {
if (nodeService.exists(nodeRef)) {
Set<QName> changedProps = determineChangedProps(before, after);
if (changedProps.contains(YourModel.PROP_YOUR_CUSTOM_PROPERTY_QNAME)) {
// DO WHATEVER YOU WANT HERE
}
}
/**
* Register a Property-level Policy
*
* @param <P> the policy interface
* @param policy the policy interface class
* @return A delegate for the property-level policy (typed by the policy interface)
*/
public <P extends PropertyPolicy> PropertyPolicyDelegate<P> registerPropertyPolicy(Class<P> policy);
/**
* Bind a Service specific behaviour to a Property-level Policy
*
* @param policy the fully qualified policy name
* @param service the binding service
* @param behaviour the behaviour
* @return the registered behaviour definition
*/
public BehaviourDefinition<ServiceBehaviourBinding> bindPropertyBehaviour(QName policy, Object service, Behaviour behaviour);
getPolicyComponent().bindPropertyBehaviour(
NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME,
QName.createQName("myModel1", "AAA"),
this.onUpdateProperties);
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
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.