/** * @param ntName name * @return effective node type * @throws NoSuchNodeTypeException if node type does not exist */ public EffectiveNodeType getEffectiveNodeType(Name ntName) throws NoSuchNodeTypeException { return getEffectiveNodeType(ntName, entCache, registeredNTDefs); }
/** * @param ntName name * @return effective node type * @throws NoSuchNodeTypeException if node type does not exist */ public EffectiveNodeType getEffectiveNodeType(Name ntName) throws NoSuchNodeTypeException { return getEffectiveNodeType(ntName, entCache, registeredNTDefs); }
public EffectiveNodeType getEffectiveNodeType(Name ntName) throws NoSuchNodeTypeException { return ntReg.getEffectiveNodeType(ntName); }
public EffectiveNodeType getEffectiveNodeType(Name ntName) throws NoSuchNodeTypeException { return ntReg.getEffectiveNodeType(ntName); }
/** * Returns the effective node type representation of the given node types. * * @param mixins mixin types of the node (set of {@link Name names}); * @return effective node type * @throws NodeTypeConflictException if the given types are conflicting * @throws NoSuchNodeTypeException if one of the given types is not found */ public EffectiveNodeType getEffectiveNodeType(Set<Name> mixins) throws NodeTypeConflictException, NoSuchNodeTypeException { Name[] names = new Name[mixins.size()]; mixins.toArray(names); return getEffectiveNodeType(names, entCache, registeredNTDefs); }
/** * Returns the effective node type representation of the given node types. * * @param mixins mixin types of the node (set of {@link Name names}); * @return effective node type * @throws NodeTypeConflictException if the given types are conflicting * @throws NoSuchNodeTypeException if one of the given types is not found */ public EffectiveNodeType getEffectiveNodeType(Set<Name> mixins) throws NodeTypeConflictException, NoSuchNodeTypeException { Name[] names = new Name[mixins.size()]; mixins.toArray(names); return getEffectiveNodeType(names, entCache, registeredNTDefs); }
/** * Adds a new child node with the given name * * @param nodeName name of the new node * @param nodeTypeName node type name * @param id id of the new node * @return the node state * @throws NoSuchNodeTypeException if the node type does not exist * @throws ConstraintViolationException if there is a constraint violation * @throws RepositoryException if an error occurs */ public NodeStateEx addNode(Name nodeName, Name nodeTypeName, NodeId id) throws NoSuchNodeTypeException, ConstraintViolationException, RepositoryException { return addNode(nodeName, nodeTypeName, id, ntReg.getEffectiveNodeType(nodeTypeName).includesNodeType(NameConstants.MIX_REFERENCEABLE)); }
/** * Adds a new child node with the given name * * @param nodeName name of the new node * @param nodeTypeName node type name * @param id id of the new node * @return the node state * @throws NoSuchNodeTypeException if the node type does not exist * @throws ConstraintViolationException if there is a constraint violation * @throws RepositoryException if an error occurs */ public NodeStateEx addNode(Name nodeName, Name nodeTypeName, NodeId id) throws NoSuchNodeTypeException, ConstraintViolationException, RepositoryException { return addNode(nodeName, nodeTypeName, id, ntReg.getEffectiveNodeType(nodeTypeName).includesNodeType(NameConstants.MIX_REFERENCEABLE)); }
Node parent = (Node)session.getItem(path);//Jcr path to the parent node Node added = parent.addNode(newNodeName);//Add new node Workspace workspace = session.getWorkspace(); NodeTypeManager ntMgr = workspace.getNodeTypeManager(); NodeTypeRegistry ntReg=null; try { ntReg = ((NodeTypeManagerImpl) ntMgr).getNodeTypeRegistry(); } catch (ClassCastException e) { e.printStackTrace(); } NameFactory nameFactory = NameFactoryImpl.getInstance(); Name namejcr = nameFactory.create(type); EffectiveNodeType effnodetype = ntReg.getEffectiveNodeType(namejcr); //Here i get all the property definition for this type of node, so from here i //can know which of them are mandatory PropDef[] pdefs = effnodetype.getAllPropDefs();
private boolean isHippoDocument(final NodeState node) { try { final EffectiveNodeType nodeType = getContext().getNodeTypeRegistry().getEffectiveNodeType(node.getNodeTypeName()); return nodeType.includesNodeType(getIndexingConfig().getHippoDocumentName()); } catch (NoSuchNodeTypeException e) { log.error("Unexpected exception while checking node type", e); } return false; }
/** * Returns the effective (i.e. merged and resolved) node type representation * of this node's primary and mixin node types. * * @return the effective node type * @throws RepositoryException if an error occurs */ public EffectiveNodeType getEffectiveNodeType() throws RepositoryException { try { return ntReg.getEffectiveNodeType( nodeState.getNodeTypeName(), nodeState.getMixinTypeNames()); } catch (NodeTypeConflictException ntce) { String msg = "internal error: failed to build effective node type for node " + nodeState.getNodeId(); throw new RepositoryException(msg, ntce); } }
/** * Returns the effective (i.e. merged and resolved) node type representation * of this node's primary and mixin node types. * * @return the effective node type * @throws RepositoryException if an error occurs */ public EffectiveNodeType getEffectiveNodeType() throws RepositoryException { try { return ntReg.getEffectiveNodeType( nodeState.getNodeTypeName(), nodeState.getMixinTypeNames()); } catch (NodeTypeConflictException ntce) { String msg = "internal error: failed to build effective node type for node " + nodeState.getNodeId(); throw new RepositoryException(msg, ntce); } }
/** * Helper method that builds the effective (i.e. merged and resolved) * node type representation of the specified node's primary and mixin * node types. * * @param state * @return the effective node type * @throws RepositoryException */ private EffectiveNodeType getEffectiveNodeType( NodeTypeRegistry registry, NodeState state) throws RepositoryException { try { return registry.getEffectiveNodeType( state.getNodeTypeName(), state.getMixinTypeNames()); } catch (NodeTypeConflictException e) { throw new RepositoryException( "Failed to build effective node type of node state " + state.getId(), e); } }
/** * Returns the effective (i.e. merged and resolved) node type representation * of this node's primary and mixin node types. * * @return the effective node type * @throws RepositoryException if an error occurs */ public EffectiveNodeType getEffectiveNodeType() throws RepositoryException { try { return sessionContext.getNodeTypeRegistry().getEffectiveNodeType( data.getNodeState().getNodeTypeName(), data.getNodeState().getMixinTypeNames()); } catch (NodeTypeConflictException ntce) { String msg = "Failed to build effective node type for " + this; log.debug(msg); throw new RepositoryException(msg, ntce); } }
/** * Returns the effective (i.e. merged and resolved) node type representation * of this node's primary and mixin node types. * * @return the effective node type * @throws RepositoryException if an error occurs */ public EffectiveNodeType getEffectiveNodeType() throws RepositoryException { try { return sessionContext.getNodeTypeRegistry().getEffectiveNodeType( data.getNodeState().getNodeTypeName(), data.getNodeState().getMixinTypeNames()); } catch (NodeTypeConflictException ntce) { String msg = "Failed to build effective node type for " + this; log.debug(msg); throw new RepositoryException(msg, ntce); } }
/** * Helper method that builds the effective (i.e. merged and resolved) * node type representation of the specified node's primary and mixin * node types. * * @param state * @return the effective node type * @throws RepositoryException */ public EffectiveNodeType getEffectiveNodeType(NodeState state) throws RepositoryException { try { return context.getNodeTypeRegistry().getEffectiveNodeType( state.getNodeTypeName(), state.getMixinTypeNames()); } catch (NodeTypeConflictException ntce) { String msg = "internal error: failed to build effective node type for node " + safeGetJCRPath(state.getNodeId()); log.debug(msg); throw new RepositoryException(msg, ntce); } }
/** * Returns the effective (i.e. merged and resolved) node type representation * of this node's primary and mixin node types. * * @return the effective node type * @throws RepositoryException */ protected EffectiveNodeType getEffectiveNodeType(NodeState parent) throws RepositoryException { try { NodeTypeRegistry ntReg = getNodeTypeRegistry(); return ntReg.getEffectiveNodeType( parent.getNodeTypeName(), parent.getMixinTypeNames()); } catch (NodeTypeConflictException ntce) { String msg = "internal error: failed to build effective node type for node " + parent.getNodeId(); throw new RepositoryException(msg, ntce); } }
/** * Returns the effective (i.e. merged and resolved) node type representation * of this node's primary and mixin node types. * * @return the effective node type * @throws RepositoryException */ protected EffectiveNodeType getEffectiveNodeType(NodeState parent) throws RepositoryException { try { NodeTypeRegistry ntReg = getNodeTypeRegistry(); return ntReg.getEffectiveNodeType( parent.getNodeTypeName(), parent.getMixinTypeNames()); } catch (NodeTypeConflictException ntce) { String msg = "internal error: failed to build effective node type for node " + parent.getNodeId(); throw new RepositoryException(msg, ntce); } }
public boolean allowsSameNameSiblings(NodeId id) { try { NodeState ns = getNodeState(id); NodeState parent = getNodeState(ns.getParentId()); Name name = parent.getChildNodeEntry(id).getName(); EffectiveNodeType ent = ntReg.getEffectiveNodeType( parent.getNodeTypeName(), parent.getMixinTypeNames()); QNodeDefinition def = ent.getApplicableChildNodeDef(name, ns.getNodeTypeName(), ntReg); return def != null ? def.allowsSameNameSiblings() : false; } catch (Exception e) { log.warn("Unable to get node definition", e); return false; } }
public boolean allowsSameNameSiblings(NodeId id) { try { NodeState ns = getNodeState(id); NodeState parent = getNodeState(ns.getParentId()); Name name = parent.getChildNodeEntry(id).getName(); EffectiveNodeType ent = ntReg.getEffectiveNodeType( parent.getNodeTypeName(), parent.getMixinTypeNames()); QNodeDefinition def = ent.getApplicableChildNodeDef(name, ns.getNodeTypeName(), ntReg); return def != null ? def.allowsSameNameSiblings() : false; } catch (Exception e) { log.warn("Unable to get node definition", e); return false; } }