AnsweredAssumed Answered

bindAssociationBehaviour ... how?

Question asked by marcus on Oct 16, 2006
Latest reply on Nov 8, 2006 by marcus
I'm trying to bind a behaviour to the onCreateChildAssociation event, but can't figure out what's meant for what… as you can see below, I've tried binding against both the parent and child class of the association, but my method for implementing the behaviour is never getting called when I add a new document to a folder. How should I be binding?


public void initialise() {
   QName onCreateChildName = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation");
   
   this.policyComponent.bindAssociationBehaviour(
         onCreateChildName,
         ContentModel.TYPE_FOLDER,
         new JavaBehaviour(this, "onCreateChildAssociation")
   );
   this.policyComponent.bindAssociationBehaviour(
         onCreateChildName,
         ContentModel.TYPE_CONTENT,
         new JavaBehaviour(this, "onCreateChildAssociation")
   );
   logger.debug("Behaviours bound");
}

public void onCreateChildAssociation(ChildAssociationRef childAssocRef)
{
   logger.debug("Added new child "+childAssocRef.getChildRef().getId()+" to "+childAssocRef.getParentRef().getId());
}

Outcomes