3.1.2.2.3. Changing/Removing a node type

Changing a node type

If you want to replace the existing node type definition, you should pass ExtendedNodeTypeManager.REPLACE_IF_EXISTS as a second parameter for the ExtendedNodeTypeManager.registerNodeType method.

ExtendedNodeTypeManager nodeTypeManager = (ExtendedNodeTypeManager) session.getWorkspace()

                                                                           .getNodeTypeManager();
InputStream is = MyClass.class.getResourceAsStream("mynodetypes.xml");
.....
nodeTypeManager.registerNodeTypes(is,ExtendedNodeTypeManager.REPLACE_IF_EXISTS );

Removing a node type

Note

Node type is possible to remove only when the repository does not contain nodes of this type.

nodeTypeManager.unregisterNodeType("myNodeType");
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus