public static void registerMixinType ( Session session , String mixin ) throws RepositoryException { NodeTypeManager nodeTypeManager = session . getWorkspace ( ) . getNodeTypeManager ( ) ; if ( ! nodeTypeManager . hasNodeType ( mixin ) ) { NodeTypeTemplate nodeTypeTemplate = nodeTypeManager . createNodeTypeTemplate ( ) ; nodeTypeTemplate . setMixin ( true ) ; nodeTypeTemplate . setName ( mixin ) ; NodeTypeDefinition [ ] nodeTypes = new NodeTypeDefinition [ ] { nodeTypeTemplate } ; nodeTypeManager . registerNodeTypes ( nodeTypes , true ) ; } }
Register new mixin type if does not exists on workspace