cancel
Showing results for 
Search instead for 
Did you mean: 

Defining associations within Aspects

ppy62
Champ in-the-making
Champ in-the-making
Hello,

Reading the documentation I understand that it's possible to define associations in an Aspect.
When trying this I get an exception when the search button is pressed in Properties Edition.

The exception: org.alfresco.repo.search.SearcherException: Invalid type: {custom.model}provider

The model:
<model name="custom:customModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>  
   <description>Custom Model</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>

   <!– Introduction of new namespaces defined by this model –>
   <!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –>
   <namespaces>
      <namespace uri="custom.model" prefix="custom"/>
   </namespaces>
     
   <aspects>
            <aspect name="custom:client">
                    <title>The client</title>
                    <properties>
                                <property name="custom:clientID">
                                          <type>d:text</type>
                                </property>
                    </properties>
                    <associations>
                                  <association name="custom:providedby">
                                               <title>Provided by association</title>
                                               <source>
                                                       <mandatory>false</mandatory>
                                                       <many>true</many>
                                               </source>
                                               <target>
                                                       <class>custom:provider</class>
                                                       <mandatory>false</mandatory>
                                                       <many>true</many>
                                               </target>
                                  </association>
                    </associations>
            </aspect>
            <aspect name="custom:provider">
                    <title>The provider</title>
                    <properties>
                                <property name="custom:providerID">
                                          <type>d:text</type>
                                </property>
                    </properties>
            </aspect>
   </aspects>
</model>

The WEB client config:
<alfresco-config>
   <config evaluator="aspect-name" condition="custom:client">
      <property-sheet>
         <show-property name="custom:clientID"/>
         <show-association name="custom:providedby"/>
      </property-sheet>
   </config>

   <config evaluator="aspect-name" condition="custom:provider">
      <property-sheet>
         <show-property name="custom:providerID"/>
      </property-sheet>
   </config>

   <config evaluator="string-compare" condition="Action Wizards">
      <aspects>
         <aspect name="custom:client"/>
         <aspect name="custom:provider"/>
      </aspects>
   </config>

</alfresco-config>

Any clue about the problem?

Environment:
Alfresco CE 2.1 / JDK 1.6.0_07 / windows XP

Thank you.
Enjoy your day.

Patrick
4 REPLIES 4

loftux
Star Contributor
Star Contributor
You have created an association to an aspect, you can only make an association to an object. Create a custom type that you would like to associate with and you should be fine.

ppy62
Champ in-the-making
Champ in-the-making
That's fine!
Thank you.

johanpi
Champ in-the-making
Champ in-the-making
Hi

I have created a custom type and can add associations to it.

If I want to add associations to an aspect and I want the standard content type how do I do it?

Thanks

johanpi
Champ in-the-making
Champ in-the-making
Solved

I add the aspect "attachable" to the list of aspects.