AnsweredAssumed Answered

child-assiociations behaviour

Question asked by federico.tesei on Dec 6, 2007
Latest reply on Mar 18, 2010 by viralshah
Hi to all,

By principle a child association should perform a cascade delete starting from root deletion node.
Hence we have defined a custom content model [ ref attached files  customModel e web-client-config-custom xml files ] that define a Tab content with two child-association;
> a description
> and an image.
Through the web client we succeed in creating an instance of Tab content that   show in the web-client properties pane the associations previuosly defined.
On the other side
    the view through the doc_info.ftl shows the Assoc: section empty.
    the search through the Node Browser show no Association as well  while  the  contrary the two children  are showed correctly
My first assumption was that child-association is not showed through info_doc.ftl or Node Browser search.
But I can't explain why the root node deletion does not delete the descendant in a cascade fashion as stated by design.
http://forums.alfresco.com/viewtopic.php?t=4797&highlight=
Have  the child associations been really enforced ?
If not what is going wrong ?

thanks for your help

federico



Model.xml on /extension

<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="rt:regtosmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>
   <description>Some Model</description>
   <author>Sombody</author>
   <version>1.0</version>

   <!– Imports are required to allow references to definitions in other models –>
   <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 –>
   <namespaces>
      <namespace uri="http://www.some.company.it/model/content/1.0" prefix="rt" />
   </namespaces>

   <constraints>
      <constraint name="rt:conttype" type="LIST">
         <parameter name="allowedValues">
            <list>
               <value>tab</value>
               <value>description</value>
               <value>image</value>
            </list>
         </parameter>
      </constraint>
   </constraints>

   <types>
      <!– Enterprise-wide generic document type –>
      <type name="rt:doc">
         <title>Some Company documents</title>
         <parent>cm:content</parent>
         <mandatory-aspects>
           <aspect>cm:generalclassifiable</aspect>
           <aspect>rt:typed</aspect>
         </mandatory-aspects>
      </type>

      <type name="rt:tab">
         <title>Generic tab</title>
         <parent>rt:doc</parent>
         <mandatory-aspects>
           <aspect>cm:versionable</aspect>
           <aspect>rt:linkable</aspect>
         </mandatory-aspects>
      </type>

      <type name="rt:description">
         <title>Descriptive text</title>
         <parent>rt:doc</parent>
         <mandatory-aspects>
           <aspect>cm:versionable</aspect>
         </mandatory-aspects>
      </type>

      <type name="rt:image">
         <title>Image</title>
         <parent>rt:doc</parent>
      </type>
   </types>

   <aspects>
      <aspect name="rt:webable">
         <title>Some Company webable</title>
         <properties>
            <property name="rt:published">
               <type>d:date</type>
            </property>
            <property name="rt:isActive">
               <type>d:boolean</type>
               <default>false</default>
            </property>
         </properties>
      </aspect>
      <aspect name="rt:linkable">
         <title>Some Company linkable</title>
         <associations>
            <child-association name="rt:link_description">
               <title>Linked description</title>
               <source>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>rt:description</class>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </target>
            </child-association>
            <child-association name="rt:link_image">
               <title>Linked image(s)</title>
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>rt:image</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </child-association>
         </associations>
      </aspect>
      <aspect name="rt:typed">
         <title>Some Company typedable</title>
         <properties>
            <property name="rt:type">
               <type>d:text</type>
                     <constraints>
                        <constraint ref="rt:conttype" />
                     </constraints>
            </property>
         </properties>
      </aspect>
   </aspects>

</model>


web-client config on /extension
<alfresco-config>

   <!–  add webable aspect properties to property sheet –>
   <config evaluator="aspect-name" condition="rt:webable">
      <property-sheet>
         <show-property name="rt:published" display-label-id="published" />
         <show-property name="rt:isActive" display-label-id="isActive" read-only="true" />
      </property-sheet>
   </config>

   <!– show related documents association on schedaparco property sheet –>
   <config evaluator="node-type" condition="rt:tab">
      <property-sheet>
         <show-property name="rt:type" display-label-id="type" />
         <show-child-association name="rt:link_description" />
         <show-child-association name="rt:link_image" />
      </property-sheet>
   </config>

   <config evaluator="node-type" condition="rt:description">
      <property-sheet>
         <show-property name="rt:type" display-label-id="type" />
      </property-sheet>
   </config>

   <config evaluator="node-type" condition="rt:image">
      <property-sheet>
         <show-property name="rt:type" display-label-id="type" />
      </property-sheet>
   </config>
      
   <!–  add someco types to add content list –>
   <config evaluator="string-compare" condition="Content Wizards">
      <content-types>
         <type name="rt:doc" />
         <type name="rt:tab" />
         <type name="rt:description" />
         <type name="rt:image" />
      </content-types>
   </config>

   <config evaluator="string-compare" condition="Action Wizards">
       <!– The list of aspects to show in the add/remove features action –>
       <!– and the has-aspect condition –>   
      <aspects>
         <aspect name="rt:webable"/>
      </aspects>

      <!– The list of types shown in the is-subtype condition –>
      <subtypes>
         <type name="rt:doc" />
         <type name="rt:tab" />
         <type name="rt:description" />
         <type name="rt:image" />
      </subtypes>      

      <!– The list of content and/or folder types shown in the specialise-type action –>
      <specialise-types>
         <type name="rt:doc" />
         <type name="rt:tab" />
         <type name="rt:description" />
         <type name="rt:image" />
      </specialise-types>      
   </config>   
   
   <config evaluator="string-compare" condition="Advanced Search">
      <advanced-search>
         <content-types>
         <type name="rt:doc" />
         <type name="rt:tab" />
         <type name="rt:description" />
         <type name="rt:image" />
         </content-types>
         <custom-properties>
            <meta-data  property="rt:type" display-label-id="type" />
            <meta-data aspect="rt:webable" property="rt:published" display-label-id="published" />
            <meta-data aspect="rt:webable" property="rt:isActive" display-label-id="isActive" />
         </custom-properties>
      </advanced-search>
   </config>
</alfresco-config>

Outcomes