/** * Returns the node type with the given name (if one exists) * * @param nodeTypeName the name of the node type to be returned * @return the node type with the given name (if one exists) * @see NodeTypes#getNodeType(Name) */ JcrNodeType getNodeType(Name nodeTypeName) { JcrNodeType nodeType = nodeTypes().getNodeType(nodeTypeName); if (nodeType != null) { nodeType = nodeType.with(context(), session); } return nodeType; }
@Override public JcrNodeType getNodeType(String nodeTypeName) throws NoSuchNodeTypeException, RepositoryException { session.checkLive(); Name ntName = context().getValueFactories().getNameFactory().create(nodeTypeName); JcrNodeType type = nodeTypes().getNodeType(ntName); if (type != null) { type = type.with(context(), session); return type; } throw new NoSuchNodeTypeException(JcrI18n.typeNotFound.text(nodeTypeName)); }
@Override public NodeTypeIterator getPrimaryNodeTypes() throws RepositoryException { session.checkLive(); Collection<JcrNodeType> rawTypes = nodeTypes().getPrimaryNodeTypes(); List<JcrNodeType> types = new ArrayList<JcrNodeType>(rawTypes.size()); // Need to return a version of the node type with the current context for (JcrNodeType type : rawTypes) { types.add(type.with(context(), session)); } return new JcrNodeTypeIterator(types); }