cancel
Showing results for 
Search instead for 
Did you mean: 

How to bind a policy behavior on custom property

vincent-kali
Star Contributor
Star Contributor

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

1 ACCEPTED ANSWER

afaust
Legendary Innovator
Legendary Innovator

You simply cannot bind onUpdateProperties on any specific property. The interface OnUpdatePropertiesPolicy extends from ClassPolicy,and thus does not support use of the bindPropertyBehaviour operation. In fact, there current does not exist ANY policy which extends from PropertyPolicy, and thus the operation bindPropertyBehaviour is not supported for any policy. The concept of a PropertyPolicy and binding on individual properties was an architectural idea / concept which was implemented "in case" it was needed in the future, but was - as far as I know - never utilized by any feature.

View answer in original post

2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator

You simply cannot bind onUpdateProperties on any specific property. The interface OnUpdatePropertiesPolicy extends from ClassPolicy,and thus does not support use of the bindPropertyBehaviour operation. In fact, there current does not exist ANY policy which extends from PropertyPolicy, and thus the operation bindPropertyBehaviour is not supported for any policy. The concept of a PropertyPolicy and binding on individual properties was an architectural idea / concept which was implemented "in case" it was needed in the future, but was - as far as I know - never utilized by any feature.

Clear. Thanks.

Welcome to the new Hyland Connect. Get started or submit feedback.