I have custom content type, which has target association. I want to set up a policy, which perform some action, when association is removed. I wrote this policy as I usualy write another policies, but in some reason it does not work. My init() in OnDeleteAssociationPolicy implementation looks like this:
policyComponent.bindClassBehaviour(
QNAME,
PublishModel.pubWebContent,
new JavaBehaviour(this, QNAME.toPrefixString(), NotificationFrequency.EVERY_EVENT)
);
PublishModel.pubWebContent is qname of my custom content type. Now I think when onDeleteAssociation() is called, I should check which association was deleted. But this method is never called after remove association :(. How to set this policy? Should I provide PublishModel.pubMyAssociation instead of PublishModel.pubWebContent (that does not work too)?
I googled a little bit and found working piece of code, which helped me to get that policy worked. The point is to use bindAssociationBehavior instead of bindClassBehavior method. So working binging should look like this: