cancel
Showing results for 
Search instead for 
Did you mean: 

bindPropertyBehaviour not making callback

corstad
Champ in-the-making
Champ in-the-making
We were expecting the PolicyComponent's bindPropertyBehaviour method to call back to the registered onUpdateProperties method registered in a JavaBehaviour.

The log indicates the we are attempting to bind our behavior before the policy is registered.

INFO  PolicyComponentImpl Behaviour Java method[class=com.ourcorp.ourproject.policy.IndexNodePolicy, method=onUpdateProperties] is binding (ClassFeatureBinding[class={http://www.ourcorp.com/ourproject/docs/1.0}index;feature={http://www.ourcorp.com/ourproject/docs/1.0...]) to policy {http://www.alfresco.org}onUpdateProperties before the policy is registered

All of our class behaviour bindings are working as expected.

We even tried to register the property policy directly in our code, however, the PolicyComponent's registerPropertyPolicy method signature is not compatible with NodeServicePolicies.OnUpdatePropertiesPolicy.

  public abstract <P extends PropertyPolicy> PropertyPolicyDelegate<P> registerPropertyPolicy(Class<P> paramClass);
It expects a PropertyPolicy class and NodeServicePolicies.OnUpdatePropertiesPolicy extends ClassPolicy.

We are using Community Edition 3.4.c

Any idea how we can respond to a specific property being updated?

Thanks,

Cully.
5 REPLIES 5

resco
Champ in-the-making
Champ in-the-making
I set up the following Behaviour

public void init()
{
// Create behaviours
this.onUpdateProperties = new JavaBehaviour(this, “onUpdateProperties”, NotificationFrequency.TRANSACTION_COMMIT);
// Bind behaviours to node policies
this.policyComponent.bindPropertyBehaviour(NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME, ContentModel.ASPECT_TITLED, this.onUpdateProperties);
}

@Override
public void onUpdateProperties(NodeRef nodeRef, Map before, Map after)
{

}
And the method this.onUpdateProperties is never called when any property of the ASPECT_TITLED is modified. Is there something that I am doing incorrectly?

kaynezhang
World-Class Innovator
World-Class Innovator
Please check if you configured your class in spring
and if you place your spring configuration file in correct location

resco
Champ in-the-making
Champ in-the-making
 <bean id="testBehaviourT" class="com.impcs.repo.behaviour.TestBehaviourT" 
      depends-on="extension.dictionaryBootstrap" init-method="init">
      <property name="policyComponent">
         <ref bean="policyComponent" />
      </property>
      <property name="nodeService">
         <ref bean="nodeService" />
      </property>
      <property name="serviceRegistry">
         <ref bean="ServiceRegistry" />
      </property>
      <property name="dictionaryService">
         <ref bean="DictionaryService" />
      </property>   
      <property name="permissionService">
         <ref bean="PermissionService" />
      </property>
            
   </bean>

resco
Champ in-the-making
Champ in-the-making
<bean id="testBehaviour" class="com.impcs.repo.behaviour.TestBehaviour"
       init-method="init">
      <property name="policyComponent">
         <ref bean="policyComponent" />
      </property>
      <property name="nodeService">
         <ref bean="nodeService" />
      </property>
      <property name="serviceRegistry">
         <ref bean="ServiceRegistry" />
      </property>
      <property name="dictionaryService">
         <ref bean="DictionaryService" />
      </property>   
      <property name="permissionService">
         <ref bean="PermissionService" />
      </property>
            
   </bean>


Is this okay?

kaynezhang
World-Class Innovator
World-Class Innovator
Where did you place this spring configuration file?