AnsweredAssumed Answered

Exceptions adding custom aspect

Question asked by rmangi on Dec 28, 2005
Latest reply on Jan 25, 2006 by rmangi
Hello all. I'm trying to create a custom aspect and apply it to content and I'm getting exceptions.

It's a very simple aspect, just really trying to create a stub so I can play. Following are the steps I've taken:

XML for the aspect:
repository/config/alfresco/extension/projectModel.xml

<?xml version='1.0' encoding='UTF-8'?>
<model name="gto:projectModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <description>Model of a project in GTO-space</description>
   <author>Rick Mangi</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="gto.project.model" prefix="gto"/>
   </namespaces>

   <!– Type and Aspect definitions go here –>
      <aspects>
      <aspect name="gto:project">
         <title>GTO Project Specification</title>
         <properties>
            <property name="gto:projectName">
               <type>d:text</type>
            </property>
            <property name="gto:clientName">
                  <type>d:text</type>
               </property>
            <property name="gto:entryDate">
               <type>d:datetime</type>
            </property>
         </properties>
      </aspect>
    </aspects>
</model>

added to extension-context.xml:


    <bean id="extension.dictionaryBootstrap" class="org.alfresco.repo.dictionary.DictionaryBootstrap" init-method="bootstrap" depends-on="dictionaryBootstrap">
        <property name="dictionaryDAO"><ref bean="dictionaryDAO"/></property>
        <property name="models">
            <list>
                <value>alfresco/extension/projectModel.xml</value>
                <value>alfresco/extension/exampleModel.xml</value>
                <value>alfresco/extension/customModel.xml</value>
            </list>
        </property>
    </bean>
     

Added to web-client-config.xml


     <config evaluator="aspect-name" condition="gto:projectModel">
      <property-sheet>
         <show-property name="gto:projectName"/>
         <show-property name="gto:clientName"/>
         <show-property name="gto:entryDate"/>
      </property-sheet>
   </config>
  

and


   <config evaluator="string-compare" condition="Action Wizards">
      <types>
         <type name="folder" displayLabelId="space"/>
         <type name="content"/>
      </types>
      <aspects>
         …
         <aspect name="gto:projectModel" displayLabel="GTO Project Model"/>
      </aspects>

in web-client-config-edit-properties.xml


    <config evaluator="aspect-name" condition="gto:projectModel">
      <property-sheet>
         <show-property name="gto:projectName"/>
         <show-property name="gto:clientName"/>
         <show-property name="gto:entryDate"/>
      </property-sheet>
   </config>




I created a rule in the webclient for a space to try to apply the aspect. I've tried adding it to spaces and content but every time I add a type which would trigger the aspect to be added I get the following error:

Error  Please correct the errors below then click Finish.

    * A system error happened during the operation: The aspect is invalid: {gto.project.model}projectModel

and this exception:


11:58:24,897 ERROR [repo.action.ActionServiceImpl] An error was encountered whilst executing the action 'composite-action'.
org.alfresco.service.cmr.dictionary.InvalidAspectException: The aspect is invalid: {gto.project.model}projectModel
        at org.alfresco.repo.node.db.DbNodeServiceImpl.addAspect(DbNodeServiceImpl.java:490)

Does anybody have any ideas where to go from here?

Thanks,

Rick

Outcomes