You are here

createNode

createNode methods are used to create new nodes.

Note: Any unsaved property changes will be lost when this method is called. To preserve property changes call save() first.

createNode(name,type)

This method creates a new node of the specified type (a QName in either full or short form).

Parameters

name
The node name
type
The node type

Example

var node = myforum.createNode("My Discussion", "fm:forum");

createNode(name, type, assocType)

This method creates a new node of the specified type as a child of the current node with the given child association type.

Parameters

name
The node name
type
The node type
assocType
The QName of the child association type to create

Example

var node = myforum.createNode("My Discussion", "fm:forum", "fm:discussion");

createNode(name, type, properties)

This method creates a new node as a child of the current node with the specified properties.

Parameters

name
The node name
type
The node type
properties
An associative array of the properties to be added to the node upon creation. This is useful when a type requires the setting of mandatory properties.

Example

var node = companyhome.childByNamePath("Sites/test"); 
var forumName = "My Forum";
var properties = new Array();
properties['cm:title'] = "The forum title";
properties['cm:description'] = "The forum description";
var forum = node.createNode(forumName, "fm:forum", properties);   
        

createNode(name, type, properties, assocType)

This method creates a new node as a child of the current node. The node contains the specified child association name with the specified properties with that child association type.

Parameters

name
The node name
type
The node type
properties
An associative array of the properties to be added to the node upon creation
assocType
The QName of the child association type to create

        

createNode(name, type, properties, assocType, assocName)

This method creates a new node as a child of the current node. The node contains the specified child association name with the specified properties, and the given child association type and name.

Parameters

name
The node name
type
The node type
properties
An associative array of the properties to be added to the node upon creation
assocType
The QName of the child association type to create
assocName
The QName of the child association type to create