/** {@inheritDoc} */ public RemoteIterator getDeclaredSubtypes() throws RemoteException { return getFactory().getRemoteNodeTypeIterator(type.getDeclaredSubtypes()); }
private Collection<NodeType> getDescendentNodeTypes(NodeType nt) { Collection<NodeType> result = new HashSet<NodeType>(); NodeTypeIterator subNodeTypes = nt.getDeclaredSubtypes(); while (subNodeTypes.hasNext()) { NodeType subNodeType = subNodeTypes.nextNodeType(); if (!subNodeType.isAbstract()) { result.add(subNodeType); } result.addAll(getDescendentNodeTypes(subNodeType)); } return result; }
private Collection<NodeType> getDescendantNodeTypes(NodeType nt) { Collection<NodeType> result = new HashSet<>(); NodeTypeIterator subNodeTypes = nt.getDeclaredSubtypes(); while (subNodeTypes.hasNext()) { NodeType subNodeType = subNodeTypes.nextNodeType(); if (!subNodeType.isAbstract()) { result.add(subNodeType); } result.addAll(getDescendantNodeTypes(subNodeType)); } return result; }
String name = type.getName(); Set<String> declaredSubtypeNames = asSetOfNames(type.getDeclaredSubtypes()); Set<String> subtypeNames = asSetOfNames(type.getSubtypes());
/** * Creates a new rest node type. * * @param nodeType the {@code non-null} JCR {@link NodeType}. * @param baseUrl the {@code non-null} root url, which is used to construct urls to the children and properties of the node type */ public RestNodeType( NodeType nodeType, String baseUrl ) { this.name = nodeType.getName(); this.isMixin = nodeType.isMixin(); this.isAbstract = nodeType.isAbstract(); this.isQueryable = nodeType.isQueryable(); this.hasOrderableChildNodes = nodeType.hasOrderableChildNodes(); this.superTypesLinks = new TreeSet<String>(); for (NodeType superType : nodeType.getDeclaredSupertypes()) { String superTypeLink = RestHelper.urlFrom(baseUrl, RestHelper.NODE_TYPES_METHOD_NAME, RestHelper.URL_ENCODER.encode(superType.getName())); this.superTypesLinks.add(superTypeLink); } this.subTypesLinks = new TreeSet<String>(); for (NodeTypeIterator subTypeIterator = nodeType.getDeclaredSubtypes(); subTypeIterator.hasNext(); ) { String subTypeLink = RestHelper.urlFrom(baseUrl, RestHelper.NODE_TYPES_METHOD_NAME, RestHelper.URL_ENCODER.encode(subTypeIterator.nextNodeType().getName())); this.subTypesLinks.add(subTypeLink); } this.propertyTypes = new ArrayList<RestPropertyType>(); for (PropertyDefinition propertyDefinition : nodeType.getDeclaredPropertyDefinitions()) { this.propertyTypes.add(new RestPropertyType(propertyDefinition)); } }
@Test public void shouldSeeCmisTypesAsJcrTypes() throws Exception { NodeTypeManager manager = getSession().getWorkspace().getNodeTypeManager(); NodeTypeIterator it = manager.getNodeType("nt:file").getDeclaredSubtypes(); while (it.hasNext()) { NodeType nodeType = it.nextNodeType(); assertTrue(nodeType != null); } }