AnsweredAssumed Answered

Java nodeservice.createNode params

Question asked by spdaly on Sep 29, 2008
Latest reply on Oct 6, 2008 by rivarola
I'm trying to create a set of nodes from XML data parsed from a file that is uploaded via a web script.

Here's the scenario:  Order data is submitted into ALF via a web script called createOrder.  It creates a node and stores the XML as content.  This works perfectly.  I need to create two additional nodes of a custom type.  I need to create an order document and a printer's guide document.

Here's my model:


   <types>
      <type name="wp:doc">
         <title>Wearport Document</title>
         <parent>cm:content</parent>
         <associations>
            <association name="wp:relatedDocuments">
               <title>Related Documents</title>
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>wp:doc</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
         </associations>
         <mandatory-aspects>
            <aspect>cm:generalclassifiable</aspect>
         </mandatory-aspects>
      </type>
      <type name="wp:art">
         <title>Wearport Art</title>
         <parent>wp:doc</parent>
      </type>
      <type name="wp:order">
         <title>Wearport Order</title>
         <parent>cm:content</parent>
         <properties>
            <property name="wp:orderId">
               <type>d:text</type>
            </property>
            <property name="wp:specialInstructions">
               <type>d:text</type>
            </property>
         </properties>
         <associations>
            <association name="wp:orderDoc">
               <title> "Order Document"</title>
               <target>
                  <class>cm:content</class>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </target>
            </association>
            <association name="wp:printerGuide">
               <title>"Printer Guide"</title>
               <target>
                  <class>cm:content</class>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </target>
            </association>
         </associations>
      </type>
   </types>

So, wp:Order is the node created by the web script.  The behavior should create the wp:OrderDoc and reference the wp:Order node.

I have an OnCreateNode behaviour that parses the XML.  I thought that I would call createNode like this (this is a Java class BTW):

NodeRef orderDoc = nodeService.createNode(orderDataNode, ContentModel.ASSOC_REFERENCES,  WearportModel.ASSOC_ORDER_DOC, ContentModel.TYPE_CONTENT).getChildRef();

But the nodes don't get created.  I'm not understanding the "assocTypeQName" and "assocQName."

Outcomes