AnsweredAssumed Answered

How to bind a policy behavior on custom property

Question asked by vincent-kali on May 1, 2019
Latest reply on May 1, 2019 by vincent-kali

Hi,

I'd like to bind a behavior to a custom property update policy.

The issue is that the callback function is never called.

I'm likely not using the appropriate policy, but I can't find any example on this.

Binding behavior to a custom type or aspect is working fine.

 

Code used:

private PolicyComponent eventManager;

...

// this works

eventManager.bindClassBehaviour(NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME, MY_QNAME_URI.ASPECT_BUSINESSPROPERTIES, new JavaBehaviour(this, "onUpdateProperties", Behaviour.NotificationFrequency.TRANSACTION_COMMIT));

// this does not work (onUpdateProperties2 never called)

eventManager.bindPropertyBehaviour(NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME, MY_QNAME_URI.ASPECT_BUSINESSPROPERTIES, MY_QNAME_URI.PROP_VENDORID , new JavaBehaviour(this,"onUpdateProperties2", NotificationFrequency.TRANSACTION_COMMIT));

 ...

public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) {...}

...

public void onUpdateProperties2(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) {...}

 

 

Any suggestion / example on how to use bindPropertyBehaviour ?

Thanks,

Vincent

Outcomes