AnsweredAssumed Answered

new Aspect, mimic of auditable: init fired not other methods

Question asked by jbaton on Dec 16, 2005
Latest reply on Mar 28, 2006 by steel
Hi all,

I'm facing a problem on aspect creation (1.1 OS jboss bundle … rebuilded)

I've created a new aspect, it contains a sole date.
I need it to be initialised.
I made the corresponding class on the example of the AuditableAspect class.
The aspect appears in the UI, the init method is fired but not the onCreate/onUpdate/onAdd methods.

I've binded those methods in the same way that in the 'auditable' aspect.

I believe the problem is that the methods are 'badly' registered.
Looking at AuditableAspect.init() , I can not figure out what are the parameters of policyComponent.bindClassBehaviour().

The first QName is based on "" which does not appear in contentModel.xml where the auditable aspect is defined.

The second parameter, seems to use the namespace uri defined in the custom model (xpath like path == model/namespaces/namespace/uri)
The third parameter is a Behaviour instance.

How should one select the value of the first QName parameter ?

Thanks for your time.


Here is the java code (excerp)

public void init() {
// Create behaviours
onCreateObsoDate    = new JavaBehaviour(this, "onCreateObsoDate");
onAddObsoDate       = new JavaBehaviour(this, "onAddObsoDate");
onUpdateObsoDate    = new JavaBehaviour(this, "onUpdateObsoDate");
QName ASPECT_OBSO = QName.createQName("", "obsolescence");
policyComponent.bindClassBehaviour(QName.createQName("", "onCreateNode"),ASPECT_OBSO, onCreateObsoDate);
      policyComponent.bindClassBehaviour(QName.createQName("", "onAddAspect"), ASPECT_OBSO, onAddObsoDate);
policyComponent.bindClassBehaviour(QName.createQName("", "onUpdateNode"), ASPECT_OBSO, onUpdateObsoDate);

Here is the custom model

<model name="gc:obso_model" xmlns="">
   <description>custom Model for obsolescence date (GED-2)</description>

        <!– Import Alfresco Dictionary Definitions –>
      <import uri="" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="" prefix="cm"/>

      <!– Define a Namespace for my new definitions –>
      <namespace uri="" prefix="gc"/>

   <!– Type and Aspect definitions go here –>
      <aspect name="gc:obsolescence">
         <title>Date d'obsolescence</title>
            <property name="gc:obso_date">