Delete Nodes
To delete nodes, use the delete() method of the controller.
- Obtain an appropriate controller.
- Locate the resource to delete. Use an appropriate locator of the controller, or search the model by iterating until the required node is found.
- Delete the resource using the delete() method of the controller.
- Persist the modifications using the commit() method of the controller.
Example
Delete a node (error handling omitted):
// Obtain locator of ContentModelController final Locator locator = cmController.getLocator(); // Locate page to delete final ContentPage page = (ContentPage) locator.findByUniqueName("MyPage"); cmController.delete(page); cmController.commit();