How to bind a policy behavior on custom property

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
vincent-kali
Established Member

How to bind a policy behavior on custom property

Jump to solution

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 Solution

Accepted Solutions
afaust
Master

Re: How to bind a policy behavior on custom property

Jump to solution

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.

2 Replies
afaust
Master

Re: How to bind a policy behavior on custom property

Jump to solution

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.

vincent-kali
Established Member

Re: How to bind a policy behavior on custom property

Jump to solution

Clear. Thanks.