Node CRUD operations:

addNode

Adds a new node to the repository.

// userId is the current user ID
Node node = new Node(parentNodeId, name, creatorID, userId);
// set remaining node fields
node = contentManager.addNode(node, userId);
// node id is filled

updateNode

Updates an existing content with the new data.

Example using IContentManager

// userId is the current user ID
node = contentManager.getNodeById(nodeId, userId);
// set changing node fields
contentManager.updateNode(node, userId);

Example using Node object

node = contentManager.getNodeById(nodeId, userId);
// set changing node fields
node.update();

moveNode

Moves a node to another parent node.

// userId is the current user ID
contentManager.moveNode(nodeToMoveId, nodeDestinationId, userId);

deleteNode

Deletes an existing node from the repository. Cascade delete can be set.

Example using IContentManager

// userId is the current user ID
contentManager.deleteNode(nodeId, userId);

Example using Node object

node = contentManager.getNodeById(nodeId, userId);
node.delete();

To delete cascade

Example using IContentManager

contentManager.deleteNode(nodeId, userId, true);

Example using Node object

node = contentManager.getNodeById(nodeId, userId);
node.deleteCascade();

Back to CMS User Guide.