AnsweredAssumed Answered

Custom model and custom content creation

Question asked by nowhere on Apr 22, 2009
Latest reply on Oct 11, 2010 by matjazmuhic
Hi all,
I have a problem, surely silly to you all.
I have created a custom content as follow:


<type name="my:nc">
      <title>My content</title>
      <parent>cm:content</parent>
      <properties>
         <property name="my:level">
            <type>d:text</type>
            <mandatory>true</mandatory>
            <constraints>
                                          <constraint type="LIST">                
                                              <parameter name="allowedValues">
                <list>
                                               <value>A</value>
                                               <value>B</value>
                     <value>C</value>
                                          </list>
                                             </parameter>
              </constraint>
                             </constraints>
            
                   </property>
            <property name="my:description">
            <type>d:text</type>
            <mandatory>true</mandatory>
         </property>         
      </properties>
      <associations>
         <child-association name="my:nc2v">
                       <source>
                           <mandatory>false</mandatory>
                           <many>false</many>
                       </source>
                       <target>
                           <class>my:ckvi</class>
                           <mandatory>true</mandatory>
                           <many>false</many>
                       </target>
                   </child-association>
      </associations>
   </type>

And I changed my "web-client-config.xml as follows:


    <config evaluator="string-compare" condition="Content Wizards">
      <content-types>
         <!– <type name="my:sop" /> –>
         <type name="my:nc" />
      </content-types>
   </config>
….

<config evaluator="node-type" condition="my:nc">
      <property-sheet>
                    
         <show-property name="my:level" show-in-edit-mode="true" />
         <show-property name="my:description" show-in-edit-mode="true" />
         <show-child-association name="my:nc2v" show-in-edit-mode="true"/>
   
      </property-sheet>
   </config>

so, I can create a content of type my:nc…
The problem is in association "nc2v" where I defined "Mandatory=true" for target class. When I create content it fails with following error:


   A system error happened during the operation: Found 1 integrity violations: The association child multiplicity has been violated: Source Node: workspace://SpacesStore/55b22865-065b-4fb0-b1fa-5905225bc315 Association: Association[ class=ClassDef[name={http://www.mymodel.com/model/content/1.0}nc], name={http://www.mymodel.com/model/content/1.0}nc2v, target class={http://www.mymodel.com/model/content/1.0}ckvi, source role=null, target role=null] Required child Multiplicity: 1..1 Actual child Multiplicity: 0




Obviously It disappear if I set mandatory false…but can't I set the association when I create the content? That's… I would like to set it in "create content wizard"  :?:
Thanks for any suggestion you would give me :)

Outcomes