I'm finding it really difficult to find useful documentation on this. Basically I have two custom types 'Concept' and 'ConceptScheme' defined in my alfresco content model. Concept scheme has an association to many child concepts. Like this:
<type name="ancoat:conceptScheme">
<title>Concept Scheme</title>
<parent>ancoat:ddiObject</parent>
<associations>
<child-association name="ancoat:categories">
<source>
<mandatory>true</mandatory>
<many>false</many>
</source>
<target>
<class>ancoat:concept</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
</associations>
<mandatory-aspects>
<aspect>ancoat:describedObject</aspect>
</mandatory-aspects>
</type>
I have two webscripts, one for creating the concept node, and one the concept scheme. I now want to create a webscript which takes some reference to each of those objects, and creates an association between them.
How do I do that? I've found the function Node.createAssociation, but I can't find any examples using it.
I would answer you the java way then.
Let's say that the namespace is
http://ancoat.com/model/content/1.0
for theancoat
prefix have this association :Then you can associate one node to others with the node service :
Where
pNode
is one node, andtargets
a list on nodes you want to do the association with.Now, with a child association, it might be a better way to use the
addChild
method :