AnsweredAssumed Answered

behaviour not triggered on property changed

Question asked by tcuser on Apr 11, 2016
Latest reply on Apr 12, 2016 by tcuser
Hi all,

I'm trying to bind an Alfresco behaviour to a certain custom aspect preoperty change, but it isn't never triggered.

My aspect is defined as follows:

 
      <aspect name="sc:customAspect">
         <title>Custom Aspect</title>
         <properties>
            <property name="sc:customProperty">
               <type>d:text</type>
            </property>
         </properties>
      </aspect>


I want my behaviour to be triggered when customProperty is changed, so my init method is:

 
    public void init() {

        this.policyComponent.bindPropertyBehaviour(NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME,
                QName.createQName(TcModel.NAMESPACE_TC_CONTENT_MODEL, TcModel.ASPECT_CUSTOM_ASPECT),
                QName.createQName(TcModel.NAMESPACE_TC_CONTENT_MODEL, TcModel.PROP_CUSTOM_PROPERTY),
                new JavaBehaviour(this, "onUpdateProperties", NotificationFrequency.TRANSACTION_COMMIT));

    }


And the onUpdateProperties method is never reached. If I change my init mthod to:

 
    public void init() {

        this.policyComponent.bindClassBehaviour(NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME,
                QName.createQName(TcModel.NAMESPACE_TC_CONTENT_MODEL, TcModel.ASPECT_CUSTOM_ASPECT),
                new JavaBehaviour(this, "onUpdateProperties", NotificationFrequency.TRANSACTION_COMMIT));

    }


It works, but the problem is that it enters in onUpdateProperties everyTime I change any property of the node.

How can I bind the behaviour in this case? Thank you!!

Outcomes