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 "http://www.alfresco.org" 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.


Jerome


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("http://www.toto.com/ged/obso", "obsolescence");
       
policyComponent.bindClassBehaviour(QName.createQName("http://www.toto.com/ged/obso", "onCreateNode"),ASPECT_OBSO, onCreateObsoDate);
      
      policyComponent.bindClassBehaviour(QName.createQName("http://www.toto.com/ged/obso", "onAddAspect"), ASPECT_OBSO, onAddObsoDate);
       
policyComponent.bindClassBehaviour(QName.createQName("http://www.toto.com/ged/obso", "onUpdateNode"), ASPECT_OBSO, onUpdateObsoDate);


Here is the custom model


<model name="gc:obso_model" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <description>custom Model for obsolescence date (GED-2)</description>
   <author></author>
   <version>1.0</version>

   <imports>
        <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>

   <namespaces>
      <!– Define a Namespace for my new definitions –>
      <namespace uri="http://www.toto.com/ged/obso" prefix="gc"/>
   </namespaces>

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

Outcomes