cancel
Showing results for 
Search instead for 
Did you mean: 

custom type in custom properties

pcuvecle
Champ in-the-making
Champ in-the-making
Hi,

Is it possible to do this :

<type name="custom:type1">
   <title>Type 1</title>
   <parent>cm:folder</parent>
   <properties>
     <property name="custom:type1_prop1">
        <type>custom:type2</type>
     </property>
   </properties>
</type>


<type name="custom:type2">
   <title>Type 2</title>
   <parent>sys:base</parent>
   <properties>
     <property name="custom:type2_prop1">
        <type>d:text</type>
     </property>
   </properties>
</type>

When I try I get this error :


org.alfresco.service.cmr.dictionary.DictionaryException: Property type 'custom:type2' of property 'custom:type1_prop1' is not found

1 custom model file on Alfresco 2.0.1 Enterprise.

Thanks for your help
3 REPLIES 3

kevinr
Star Contributor
Star Contributor
No that is not possible and does not make sense. It looks like you want an association? So you can do this:

<type name="custom:type1">
   <title>Type 1</title>
   <parent>cm:folder</parent>
   <associations>
      <association name="custom:type2assoc">
         <title>My Association To Type2</title>
         <source>
            <role>cm:type2assocOf</role>
            <mandatory>false</mandatory>
            <many>false</many>
         </source>
         <target>
            <class>custom:type2</class>
            <role>cm:type2assocTo</role>
            <mandatory>false</mandatory>
            <many>true</many>
         </target>
      </association>
   </associations>
</type>

<type name="custom:type2">
   <title>Type 2</title>
   <parent>sys:base</parent>
   <properties>
     <property name="custom:type2_prop1">
        <type>d:text</type>
     </property>
   </properties>
</type>

If you just want a single reference to the node (of any type, not constrained) you can do this:


<type name="custom:type1">
   <title>Type 1</title>
   <parent>cm:folder</parent>
   <properties>
     <property name="custom:type1_prop1">
        <type>d:noderef</type>
     </property>
   </properties>
</type>

It all depends what concepts you are trying to model.

Thanks,

Kevin

pcuvecle
Champ in-the-making
Champ in-the-making
Fair enough Smiley Happy

I was just wondering if it is possible to model a 1-1 association this way. But I understand that an association is the correct way to do this.

Thanks for this quick and helpful answer.

gilles
Champ in-the-making
Champ in-the-making
But using an association means that (in the web interface) you  need to create first the instance of the type you are allowed associate, then go into the details of an item, search for the type you can associate and choose the one you previously created. Right?
Imagine I want to create a 'Project' type. My project has a 'Coordinator' which contains contact details. I create a 'Project' type and a 'Contact_details' type. I don't want to have to create first my Contact_details instance and then search for it when I fill the details of my Project. How can I create a 'Coordinator' instance while editing my Project?
Actualy, I did what pcuvecle suggested, and I faced the same 'DictionaryException'. The association and his web component don't fit my needs.

TIA,

Gilles