private void explodeSubtypes(String nodeType, Set<String> set) throws RepositoryException { set.add(nodeType); NodeTypeIterator it = ntMgr.getNodeType(nodeType).getSubtypes(); while(it.hasNext()) { String subnt = String.valueOf(it.next()); if (!set.contains(subnt)) { set.add(subnt); explodeSubtypes(subnt, set); } } }
private void explodeSubtypes(String nodeType, Set<String> set) throws RepositoryException { set.add(nodeType); NodeTypeIterator it = ntMgr.getNodeType(nodeType).getSubtypes(); while(it.hasNext()) { String subnt = String.valueOf(it.next()); if (!set.contains(subnt)) { set.add(subnt); explodeSubtypes(subnt, set); } } }
private void explodeSubtypes(String nodeType, Set<String> set) throws RepositoryException { set.add(nodeType); NodeTypeIterator it = ntMgr.getNodeType(nodeType).getSubtypes(); while(it.hasNext()) { String subnt = String.valueOf(it.next()); if (!set.contains(subnt)) { set.add(subnt); explodeSubtypes(subnt, set); } } }
/** {@inheritDoc} */ public RemoteIterator getSubtypes() throws RemoteException { return getFactory().getRemoteNodeTypeIterator(type.getSubtypes()); }
Set<String> subtypeNames = asSetOfNames(type.getSubtypes());
@Test public void testGetSearchableNodeTypesExcludeSubTypesWhenSupertypeIsDefinedAsStrict() throws Exception { // GIVEN final NodeTypeManager nodeTypeManager = session.getWorkspace().getNodeTypeManager(); // mgnl:content is defined strict by default final NodeType nodeType = nodeTypeManager.getNodeType(NodeTypes.Content.NAME); final NodeTypeIterator subtypes = nodeType.getSubtypes(); // WHEN final Set<NodeType> searchableNodeTypes = jcrContainer.getSearchableNodeTypes(); // THEN assertTrue(searchableNodeTypes.contains(nodeType)); while (subtypes.hasNext()) { NodeType nt = subtypes.nextNodeType(); assertFalse(searchableNodeTypes.contains(nt)); } }
@Test public void testGetSearchableNodeTypesIncludeSubTypesWhenSupertypeIsNotDefinedAsStrict() throws Exception { // GIVEN ConfiguredNodeTypeDefinition def = new ConfiguredNodeTypeDefinition(); def.setName(NodeTypes.Content.NAME); connectorDefinition = new ConfiguredJcrContentConnectorDefinition(); connectorDefinition.addNodeType(def); connectorDefinition.setWorkspace(workspace); jcrContainer = new JcrContainerTestImpl(connectorDefinition); final NodeTypeManager nodeTypeManager = session.getWorkspace().getNodeTypeManager(); final NodeType nodeType = nodeTypeManager.getNodeType(NodeTypes.Content.NAME); final NodeTypeIterator subtypes = nodeType.getSubtypes(); // WHEN final Set<NodeType> searchableNodeTypes = jcrContainer.getSearchableNodeTypes(); // THEN assertTrue(searchableNodeTypes.contains(nodeType)); while (subtypes.hasNext()) { assertTrue(searchableNodeTypes.contains(subtypes.nextNodeType())); } }