Introduction to the FDK Content Model - Alfresco Content Services - 23.4 - 23.4 - Ready - Alfresco - external

Alfresco Content Services

Platform
Alfresco
Product
Alfresco Content Services
Release
23.4
License

To be able to show how to use secondary child associations and peer-to-peer associations we will use a custom content model. For those of you that have been with Alfresco for a while you might remember the Forms Development Kit (FDK) custom model. It contains a Gadget type definition with some useful association definitions that we can use for demonstration purposes:

The diagram of the Froms Development Kit model with gadget type in the middle and 3 content types, person, and company types connected to the gadget type

The fdk:gadget type extends cm:content, which represents a file, so it can be used to represent for example a review of a gadget in a magazine. We can also see a number of associations defined for fdk:gadget representing things like gadget pictures (fdk:images), gadget company (fdk:company), gadget contact person (fdk:contact), gadget press release (fdk:pressRelease), and gadget reviews (fdk:reviews). Note that you cannot create an fdk:gadget without supplying a picture of it as the fdk:images association has been defined with cardinality 1..*, meaning one is mandatory.

For reference, the fdk:gadget type definition looks like this:

<typename="fdk:gadget">
   <parent>cm:content</parent>
   <properties>
       <property name="fdk:make">
           <type>d:text</type>
           <mandatory>true</mandatory>
       </property>
       <property name="fdk:model">
           <type>d:text</type>
           <mandatory>true</mandatory>
       </property>
       <property name="fdk:summary">
           <type>d:text</type>
           <mandatory>true</mandatory>
           <constraints>
               <constraint ref="fdk:summary" />
           </constraints>
       </property>
       <property name="fdk:type">
           <type>d:text</type>
           <constraints>
               <constraint ref="fdk:type" />
           </constraints>
       </property>
       <property name="fdk:subType">
           <type>d:text</type>
           <constraints>
               <constraint ref="fdk:subType" />
           </constraints>
       </property>
       <property name="fdk:rrp">
           <type>d:float</type>
       </property>
       <property name="fdk:releaseDate">
           <type>d:datetime</type>
       </property>
       <property name="fdk:endOfLifeDate">
           <type>d:date</type>
       </property>
       <property name="fdk:retailers">
           <type>d:text</type>
           <multiple>true</multiple>
       </property>
       <property name="fdk:rating">
           <type>d:int</type>
           <constraints>
               <constraint ref="fdk:percentage" />
           </constraints>
       </property>
   </properties>
   <associations>
       <association name="fdk:contact">
           <source>
               <mandatory>false</mandatory>
               <many>true</many>
           </source>
           <target>
               <class>cm:person</class>
               <mandatory>false</mandatory>
               <many>false</many>
           </target>
       </association>
       <association name="fdk:reviews">
           <source>
               <mandatory>false</mandatory>
               <many>true</many>
           </source>
           <target>
               <class>cm:content</class>
               <mandatory>false</mandatory>
               <many>true</many>
           </target>
       </association>
       <association name="fdk:company">
           <source>
               <mandatory>false</mandatory>
               <many>true</many>
           </source>
           <target>
               <class>fdk:company</class>
               <mandatory>false</mandatory>
               <many>false</many>
           </target>
       </association>
       <child-association name="fdk:pressRelease">
           <source>
               <mandatory>false</mandatory>
               <many>true</many>
           </source>
           <target>
               <class>cm:content</class>
               <mandatory>false</mandatory>
               <many>false</many>
           </target>
       </child-association>
       <child-association name="fdk:images">
           <source>
               <mandatory>false</mandatory>
               <many>true</many>
           </source>
           <target>
               <class>cm:content</class>
               <mandatory>true</mandatory>
               <many>true</many>
           </target>
       </child-association>
   </associations>
</type>

We have two child associations defined for the image and press release files, which will be automatically deleted when you delete the gadget file. Then we have the company, contact, and reviews associations that are peer-to-peer associations and these will not be deleted when you deleted the gadget file, which make sense as a company and contact person can be related to multiple gadgets.

Before we move on and use the FDK content model to demonstrate associations we need to install it into our Alfresco system. It’s assumed that you are using Alfresco SDK.