AnsweredAssumed Answered

Working with the fm:discussable aspect.

Question asked by risenhoover on Aug 20, 2008
I am trying to add a comment to a node by adding the fm:discussable aspect to the node.  Here's the relevant information from the content model:


   <aspects>
      <aspect name="fm:discussable">
         <associations>
            <child-association name="fm:discussion">
               <source>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>fm:forum</class>
                  <mandatory enforced="true">true</mandatory>
                  <many>false</many>
               </target>
               <duplicate>false</duplicate>
            </child-association>
         </associations>
      </aspect>
   </aspects>

Essentially, it looks like the "fm:discussable" aspect requires a "fm:forum" class to be created and then attached to the "fm:discussable" via a child relationship called "fm:discussion."  This is how I interpret it, but it's probably wrong, since it's not working for me…

Here's the relevant web script code:

   var props = new Array(1);
    var discussion = node.createNode("Test Discussion", "fm:forum");
    props["fm.discussion"] = discussion;

    node.addAspect("fm:discussable", props);

    node.save();

I'm creating the forum and including it in the addAspect() call since it's a mandatory relationship.  Unfortunately, I get an exception, stating the association child multiplicity has been violated.  (Sounds serious!)


Found 1 integrity violations:
The association child multiplicity has been violated:
   Source Node: workspace://SpacesStore/836dc1fb-6e45-11dd-9347-d1a109457541
   Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/forum/1.0}discussable], name={http://www.alfresco.org/model/forum/1.0}discussion, target class={http://www.alfresco.org/model/forum/1.0}forum, source role=null, target role=null]
   Required child Multiplicity: 1..1
   Actual child Multiplicity: 0

Any thoughts on what I could be doing wrong?

Outcomes