/** * {@inheritDoc} */ @Override public boolean isNodeType(Name nodeTypeName) { return ent.includesNodeType(nodeTypeName); }
/** * {@inheritDoc} */ @Override public boolean isNodeType(Name nodeTypeName) { return ent.includesNodeType(nodeTypeName); }
/** * Checks if this node type is directly or indirectly derived from the * specified node type. * * @param nodeTypeName the name of a node type. * @return true if this node type is directly or indirectly derived from the * specified node type, otherwise false. */ public boolean isDerivedFrom(Name nodeTypeName) { return !nodeTypeName.equals(ntd.getName()) && ent.includesNodeType(nodeTypeName); }
/** * Checks if this node type is directly or indirectly derived from the * specified node type. * * @param nodeTypeName the name of a node type. * @return true if this node type is directly or indirectly derived from the * specified node type, otherwise false. */ public boolean isDerivedFrom(Name nodeTypeName) { return !nodeTypeName.equals(ntd.getName()) && ent.includesNodeType(nodeTypeName); }
/** * {@inheritDoc} */ public void invalidate(Name name) { // remove all affected effective node types from aggregates cache // (copy keys first to prevent ConcurrentModificationException) ArrayList<Key> keys = new ArrayList<Key>(sortedKeys); for (Iterator<Key> keysIter = keys.iterator(); keysIter.hasNext();) { Key k = keysIter.next(); EffectiveNodeType ent = get(k); if (ent.includesNodeType(name)) { remove(k); } } }
/** * {@inheritDoc} */ public void invalidate(Name name) { /** * remove all affected effective node types from aggregates cache * (copy keys first to prevent ConcurrentModificationException) */ ArrayList<Key> keys = new ArrayList<Key>(aggregates.keySet()); for (Iterator<Key> keysIter = keys.iterator(); keysIter.hasNext();) { Key k = keysIter.next(); EffectiveNodeType ent = get(k); if (ent.includesNodeType(name)) { remove(k); } } }
/** * {@inheritDoc} */ public void invalidate(Name name) { // remove all affected effective node types from aggregates cache // (copy keys first to prevent ConcurrentModificationException) ArrayList<Key> keys = new ArrayList<Key>(sortedKeys); for (Iterator<Key> keysIter = keys.iterator(); keysIter.hasNext();) { Key k = keysIter.next(); EffectiveNodeType ent = get(k); if (ent.includesNodeType(name)) { remove(k); } } }
/** * {@inheritDoc} */ public void invalidate(Name name) { /** * remove all affected effective node types from aggregates cache * (copy keys first to prevent ConcurrentModificationException) */ ArrayList<Key> keys = new ArrayList<Key>(aggregates.keySet()); for (Iterator<Key> keysIter = keys.iterator(); keysIter.hasNext();) { Key k = keysIter.next(); EffectiveNodeType ent = get(k); if (ent.includesNodeType(name)) { remove(k); } } }
/** * 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)); }
/** * Checks if the underlying node is versionable, i.e. has 'mix:versionable' or a * 'mix:simpleVersionable'. * @param state node state * @return <code>true</code> if this node is full versionable, i.e. is * of nodetype mix:versionable * @throws UnsupportedRepositoryOperationException if this node is not versionable at all */ protected boolean checkVersionable(NodeStateEx state) throws UnsupportedRepositoryOperationException, RepositoryException { if (state.getEffectiveNodeType().includesNodeType(NameConstants.MIX_VERSIONABLE)) { return true; } else if (state.getEffectiveNodeType().includesNodeType(NameConstants.MIX_SIMPLE_VERSIONABLE)) { return false; } else { String msg = "Unable to perform a versioning operation on a " + "non versionable node: " + safeGetJCRPath(state); log.debug(msg); throw new UnsupportedRepositoryOperationException(msg); } }
/** * Checks if the underlying node is versionable, i.e. has 'mix:versionable' or a * 'mix:simpleVersionable'. * @param state node state * @return <code>true</code> if this node is full versionable, i.e. is * of nodetype mix:versionable * @throws UnsupportedRepositoryOperationException if this node is not versionable at all */ protected boolean checkVersionable(NodeStateEx state) throws UnsupportedRepositoryOperationException, RepositoryException { if (state.getEffectiveNodeType().includesNodeType(NameConstants.MIX_VERSIONABLE)) { return true; } else if (state.getEffectiveNodeType().includesNodeType(NameConstants.MIX_SIMPLE_VERSIONABLE)) { return false; } else { String msg = "Unable to perform a versioning operation on a " + "non versionable node: " + safeGetJCRPath(state); log.debug(msg); throw new UnsupportedRepositoryOperationException(msg); } }
if (ntReg.getEffectiveNodeType(ntName).includesNodeType(element.getNodeTypeName())) { List<IndexingRule> perNtConfig = nt2rules.get(ntName); if (perNtConfig == null) {
if (ntReg.getEffectiveNodeType(ntName).includesNodeType(element.getNodeTypeName())) { List<IndexingRule> perNtConfig = nt2rules.get(ntName); if (perNtConfig == null) {
/** * Determines whether the specified node is <i>shareable</i>, i.e. whether the mixin type <code>mix:shareable</code> * is either directly assigned or indirectly inherited. * * @param state * node state to check * @return true if the specified node is <i>shareable</i>, false otherwise. * @throws RepositoryException * if an error occurs */ private boolean isShareable(NodeState state) throws RepositoryException { // shortcut: check some well-known built-in types first Name primary = state.getNodeTypeName(); Set<Name> mixins = state.getMixinTypeNames(); if (mixins.contains(NameConstants.MIX_SHAREABLE)) { return true; } try { EffectiveNodeType type = ntReg.getEffectiveNodeType(primary, mixins); return type.includesNodeType(NameConstants.MIX_SHAREABLE); } catch (NodeTypeConflictException ntce) { String msg = "internal error: failed to build effective node type for node " + state.getNodeId(); log.debug(msg); throw new RepositoryException(msg, ntce); } }
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; }
/** * Determines whether the specified node is <i>shareable</i>, i.e. whether the mixin type <code>mix:shareable</code> * is either directly assigned or indirectly inherited. * * @param state * node state to check * @return true if the specified node is <i>shareable</i>, false otherwise. * @throws RepositoryException * if an error occurs */ private boolean isShareable(NodeState state) throws RepositoryException { // shortcut: check some well-known built-in types first Name primary = state.getNodeTypeName(); Set<Name> mixins = state.getMixinTypeNames(); if (mixins.contains(NameConstants.MIX_SHAREABLE)) { return true; } try { EffectiveNodeType type = ntReg.getEffectiveNodeType(primary, mixins); return type.includesNodeType(NameConstants.MIX_SHAREABLE); } catch (NodeTypeConflictException ntce) { String msg = "internal error: failed to build effective node type for node " + state.getNodeId(); log.debug(msg); throw new RepositoryException(msg, ntce); } }
/** * Same as {@link Node#isNodeType(String)} except that it takes a * <code>Name</code> instead of a <code>String</code>. * * @param ntName name of node type * @return <code>true</code> if this node is of the specified node type; * otherwise <code>false</code> */ public boolean isNodeType(Name ntName) throws RepositoryException { // first do trivial checks without using type hierarchy Name primary = data.getNodeState().getNodeTypeName(); if (ntName.equals(primary)) { return true; } Set<Name> mixins = data.getNodeState().getMixinTypeNames(); if (mixins.contains(ntName)) { return true; } // check effective node type try { NodeTypeRegistry registry = sessionContext.getNodeTypeRegistry(); EffectiveNodeType type = registry.getEffectiveNodeType(primary, mixins); return type.includesNodeType(ntName); } catch (NodeTypeConflictException e) { String msg = "Failed to build effective node type for " + this; log.debug(msg); throw new RepositoryException(msg, e); } }
/** * Determines whether the specified node is <i>shareable</i>, i.e. * whether the mixin type <code>mix:shareable</code> is either * directly assigned or indirectly inherited. * * @param state node state to check * @return true if the specified node is <i>shareable</i>, false otherwise. * @throws RepositoryException if an error occurs */ private boolean isShareable(NodeState state) throws RepositoryException { // shortcut: check some wellknown built-in types first Name primary = state.getNodeTypeName(); Set<Name> mixins = state.getMixinTypeNames(); if (mixins.contains(NameConstants.MIX_SHAREABLE)) { return true; } try { NodeTypeRegistry registry = context.getNodeTypeRegistry(); EffectiveNodeType type = registry.getEffectiveNodeType(primary, mixins); return type.includesNodeType(NameConstants.MIX_REFERENCEABLE); } catch (NodeTypeConflictException ntce) { String msg = "internal error: failed to build effective node type for node " + state.getNodeId(); log.debug(msg); throw new RepositoryException(msg, ntce); } } }
/** * Recursively collects all base versions of this configuration tree. * * @param root node to traverse * @param baseVersions set of base versions to fill * @throws RepositoryException if an error occurs */ private void collectBaseVersions(NodeStateEx root, Set<NodeId> baseVersions) throws RepositoryException { if (!baseVersions.isEmpty()) { // base version of configuration root already recorded if (root.hasProperty(NameConstants.JCR_CONFIGURATION) && root.getEffectiveNodeType().includesNodeType(NameConstants.MIX_VERSIONABLE)) { // don't traverse into child nodes that have a jcr:configuration // property as they belong to a different configuration. return; } } InternalVersion baseVersion = getBaseVersion(root); if (baseVersion.isRootVersion()) { String msg = "Unable to checkin configuration as it has unversioned child node: " + safeGetJCRPath(root); log.debug(msg); throw new UnsupportedRepositoryOperationException(msg); } baseVersions.add(baseVersion.getId()); for (NodeStateEx child: root.getChildNodes()) { collectBaseVersions(child, baseVersions); } }