1

Previously I was using alfresco 4.1.3 in which I have done too many customization Like. policy,custom action etc.

Now I have migrated my code to alfresco 5.01 and deployed it successfully. almost functionality are working fine but I am not able to call custom policy/behaviour.

Below is sample code.

public class OnCreateObjectPolicy extends AbstractConfigurablePolicy implements NodeServicePolicies.OnCreateNodePolicy{

    @Override
    public void onCreateNode(ChildAssociationRef childAssocRef) {
        System.out.println("************Create node called successfully");
    }

    @Override
    public void bindBehavior() {
        System.out.println("************bindBehavior called successfully");
    }


}

Any one can help?

Mathias Conradt
  • 28,420
  • 21
  • 138
  • 192
Ranjitsinh
  • 1,323
  • 1
  • 11
  • 28

1 Answers1

3

You need to register your policy/class in (any of) the context xml files as well. Just having them in your module/jar/class does not register them yet automatically. I'm sure you did that in your 4.1.3 installation, just copy it over.

Sample:

<bean id="onCreateNodePolicy" class="com.mycompany.alfresco.repo.policies.OnCreateNodePolicy" init-method="init">
    <property name="ServiceRegistry" ref="ServiceRegistry" />
    ...
</bean>
Mathias Conradt
  • 28,420
  • 21
  • 138
  • 192