cancel
Showing results for 
Search instead for 
Did you mean: 

What is the role tag for in customModel.xml

stevewickii
Champ in-the-making
Champ in-the-making
Can anyone tell me how alfresco uses the <role> tag in the customModel.xml file?

Exerpt from contentModel.xml
      <aspect name="cm:referencing">
         <title>Referencing</title>
         <associations>
            <association name="cm:references">
               <source>
                  <role>cm:referencedBy</role>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:content</class>
                  <role>cm:references</role>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
         </associations>
      </aspect>

In this example cm:referencedBy and cm:references are two roles, but I don't understand what they are used for.

The role tag is not documented in the Data Dictionary Guide http://wiki.alfresco.com/wiki/Data_Dictionary_Guide#Child_Associations.
1 REPLY 1

moschops
Champ in-the-making
Champ in-the-making
I noticed the same thing in the content model last night.  I have not been able track down any documentation for it but have not yet looked at the Alfresco source code to determine if it is actually used at the moment.  If you create an association that has a <role> at both ends and go into the node explorer I see no mention of the names used in the <role> at either source or target end of the association.  My guess was it should have automatically added an aspect with same name on source and/or target - or that the name in the role could be used in an API level query (or Lucene search) to simplify enumerating nodes that are related to the current one.    So for now it seems like this is at best a documentation end - providing the text you "partOf" and "hasPart" type of annotation would see in at either end of an arrow in an entity relationship diagram.

If someone knows more please post - perhaps there will be more use of <role> in a future release.