Delete Nodes
To delete nodes, use the delete() method of the controller.
To delete a node...
- Obtain an appropriate controller.
- Locate the resource to delete. To do this, 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 1 - Deleting 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"); // delete the page cmController.delete(page); // commit the controller cmController.commit();
Parent: Modify portal resources and topologies
Related:
Create resources
Move or Inserting Nodes