cancel
Showing results for 
Search instead for 
Did you mean: 

Custom model and custom content creation

nowhere
Champ in-the-making
Champ in-the-making
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 Smiley Happy
4 REPLIES 4

joksy
Champ in-the-making
Champ in-the-making
Hi i don t have the solution, but the same things happen also to me… Smiley Sad

So is really strange seems that the integrityValidator run before the  "modify content property"-phase. So i see another post which the same problem. have you try to look in jira for see if some one post an issue in this sense??

Anyway the <mandatory>true</mandatory> not enforce the field to be filled. So at the end i don t have  a solution but I have the same problems as you Smiley Sad

Post a ticket in the issue site  Smiley Tongue

nowhere
Champ in-the-making
Champ in-the-making
Sorry, I didn't…

I left it an unresolved question (but at alfresco surely have one solution) because my aim is to create my content by webscripts and I can set all mandatory properties or association before creation so.

I hope you found a solution to this issue.

Greetings,
Nowhere

matjazmuhic
Champ on-the-rise
Champ on-the-rise
Anyone found the solution?

I have same problem when adding values to constraint with lucene search.

Smiley Sad

matjazmuhic
Champ on-the-rise
Champ on-the-rise
Seems like in order to solve "integrity check" problem, the code must be ran inside a "UserTransaction".