I’m working on alfresco 3.4, and i’m trying to create a node and i have a problem after node creation modeled in a node browser that cannot see my new nodes, so
Can anyone help me and see me how to create a node and what are the create node method parameters ? can any one guide me and clarify the create node method.
Thanks
Mohammed Amr
Senior System Developer
Digital Series
EDIT: just checked, use ASSOC_CONTAINS instead of ASSOC_CHILDREN
There are different ways to create new content from your Java code, like using:
FileFolderService.create
NodeService.createNode
I assume you’re referring here to the latter method. Let’s see the method signature (there’s another version of
createNodethat also accepts aMapfor the initial properties, I’d just skip it for now):Let’s say we want to create a new node under a folder, your code will look like the following:
The result of this call will be a new node being created under
folderNode.The new node will be bound to its parent folder by an association of type
ContentModel.ASSOC_CONTAINS: this is the most critical part, as nodes can be related using a number of different associations, but the parent-child one that the node browser uses to display content as being filed one within the other is only this one.{foo}baris aQNamethat identifies this specific parent-child association itself. In the node browser, you can see the effect of this parameter in the node path, like/app:company_home/...../foo:bar.The last
ContentModel.TYPE_CONTENTparameter is, of course, the type you want to create the new node with. You might want to use aQNamethat refers to some custom type of yours.