AnsweredAssumed Answered

where should nodes get created?

Question asked by gengstrand on Jan 2, 2010
Latest reply on Jan 6, 2010 by gengstrand
I have put something similar to the following in the executeImpl method of an ActionExecuterAbstractBase subclass.

NodeRef parent = nodeService.getPrimaryParent(actionedUponNodeRef).getParentRef();
Map<QName, Serializable> props = new TreeMap<QName, Serializable>();
props.put(QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "name"), "test dump");
props.put(QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "title"), "testing node create");
props.put(QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "author"), "Glenn");
props.put(QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "description"), "test description");
nodeService.createNode(parent,
ContentModel.ASSOC_CHILDREN,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "test dump"),
QName.createQName("kato.model", "criteria"),
props);

Which, when run, generates this error.

Failed to run Actions due to error: 00020002 Found 1 integrity violations: The association source type is incorrect: Source Node: workspace://SpacesStore/b1761401-a167-4fdc-9241-885e9526543e Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/system/1.0}container], name={http://www.alfresco.org/model/system/1.0}children, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null] Required Source Type: {http://www.alfresco.org/model/system/1.0}container Actual Source Type: {http://www.alfresco.org/model/content/1.0}folder

I was trying to put this new node in the same folder as the node on which this action is being run.  What is the difference between a container and a folder?

Yes, I have registered a kato.model with a custom content type called criteria.

When I replaced that first line in the code excerpt with this.

NodeRef parent = nodeService.getRootNode(Repository.getStoreRef());

The node gets created and I can find it in search results but not by browsing around. Also, the node has a description but no content in it. How do you create a node with content?

Outcomes