/** * Validates the given node type names. * * @param nodeTypeNames the node type names. * @return the node type names as oak names. * @throws javax.jcr.nodetype.NoSuchNodeTypeException if one of the node type names refers to * an non-existing node type. * @throws javax.jcr.RepositoryException if an error occurs while reading from the * node type manager. */ @Nullable private String[] validateNodeTypeNames(@Nullable String[] nodeTypeNames) throws NoSuchNodeTypeException, RepositoryException { if (nodeTypeNames == null) { return null; } String[] oakNames = new String[nodeTypeNames.length]; for (int i = 0; i < nodeTypeNames.length; i++) { ntMgr.getNodeType(nodeTypeNames[i]); oakNames[i] = namePathMapper.getOakName(nodeTypeNames[i]); } return oakNames; }
/** * Validates the given node type names. * * @param nodeTypeNames the node type names. * @return the node type names as oak names. * @throws javax.jcr.nodetype.NoSuchNodeTypeException if one of the node type names refers to * an non-existing node type. * @throws javax.jcr.RepositoryException if an error occurs while reading from the * node type manager. */ @Nullable private String[] validateNodeTypeNames(@Nullable String[] nodeTypeNames) throws NoSuchNodeTypeException, RepositoryException { if (nodeTypeNames == null) { return null; } String[] oakNames = new String[nodeTypeNames.length]; for (int i = 0; i < nodeTypeNames.length; i++) { ntMgr.getNodeType(nodeTypeNames[i]); oakNames[i] = namePathMapper.getOakName(nodeTypeNames[i]); } return oakNames; }
/** * Validates the given node type names. * * @param nodeTypeNames the node type names. * @return the node type names as oak names. * @throws javax.jcr.nodetype.NoSuchNodeTypeException if one of the node type names refers to * an non-existing node type. * @throws javax.jcr.RepositoryException if an error occurs while reading from the * node type manager. */ @CheckForNull private String[] validateNodeTypeNames(@Nullable String[] nodeTypeNames) throws NoSuchNodeTypeException, RepositoryException { if (nodeTypeNames == null) { return null; } String[] oakNames = new String[nodeTypeNames.length]; for (int i = 0; i < nodeTypeNames.length; i++) { ntMgr.getNodeType(nodeTypeNames[i]); oakNames[i] = namePathMapper.getOakName(nodeTypeNames[i]); } return oakNames; }
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); } } }
EffectiveNodeTypeImpl( NodeTypeImpl primary, NodeTypeImpl[] mixins, ReadOnlyNodeTypeManager ntMgr) { this.ntMgr = ntMgr; addNodeType(checkNotNull(primary)); for (NodeTypeImpl mixin : checkNotNull(mixins)) { addNodeType(mixin); } if (!nodeTypes.containsKey(NT_BASE)) { try { nodeTypes.put( NT_BASE, (NodeTypeImpl) ntMgr.getNodeType(NT_BASE)); // FIXME } catch (RepositoryException e) { // TODO: ignore/warning/error? } } }
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); } } }
nb = ntBefore.getNodeType(nodeType); } catch (NoSuchNodeTypeException ex) { LOG.info(nodeType + " not present in 'before' state"); na = ntAfter.getNodeType(nodeType); } catch (NoSuchNodeTypeException ex) { LOG.info(nodeType + " was removed");
nb = ntBefore.getNodeType(nodeType); } catch (NoSuchNodeTypeException ex) { LOG.info(nodeType + " not present in 'before' state"); na = ntAfter.getNodeType(nodeType); } catch (NoSuchNodeTypeException ex) { LOG.info(nodeType + " was removed");
nb = ntBefore.getNodeType(nodeType); } catch (NoSuchNodeTypeException ex) { LOG.info(nodeType + " not present in 'before' state"); na = ntAfter.getNodeType(nodeType); } catch (NoSuchNodeTypeException ex) { LOG.info(nodeType + " was removed");
EffectiveNodeTypeImpl( NodeTypeImpl primary, NodeTypeImpl[] mixins, ReadOnlyNodeTypeManager ntMgr) { this.ntMgr = ntMgr; this.valueFactory = new PartialValueFactory(ntMgr.getNamePathMapper()); addNodeType(checkNotNull(primary)); for (NodeTypeImpl mixin : checkNotNull(mixins)) { addNodeType(mixin); } if (!nodeTypes.containsKey(NT_BASE)) { try { nodeTypes.put( NT_BASE, (NodeTypeImpl) ntMgr.getNodeType(NT_BASE)); // FIXME } catch (RepositoryException e) { // TODO: ignore/warning/error? } } }
EffectiveNodeTypeImpl( NodeTypeImpl primary, NodeTypeImpl[] mixins, ReadOnlyNodeTypeManager ntMgr) { this.ntMgr = ntMgr; this.valueFactory = new PartialValueFactory(ntMgr.getNamePathMapper()); addNodeType(checkNotNull(primary)); for (NodeTypeImpl mixin : checkNotNull(mixins)) { addNodeType(mixin); } if (!nodeTypes.containsKey(NT_BASE)) { try { nodeTypes.put( NT_BASE, (NodeTypeImpl) ntMgr.getNodeType(NT_BASE)); // FIXME } catch (RepositoryException e) { // TODO: ignore/warning/error? } } }
PropertyDefinition mockPropertyDefinition(@NotNull String declaringNt, boolean mv) throws Exception { PropertyDefinition def = Mockito.mock(PropertyDefinition.class); when(def.isMultiple()).thenReturn(mv); when(def.getDeclaringNodeType()).thenReturn(ReadOnlyNodeTypeManager.getInstance(root, getNamePathMapper()).getNodeType(declaringNt)); return def; }
@Override public boolean canAddChildNode(String childNodeName, String nodeTypeName) { NodeType type; try { type = getManager().getNodeType(nodeTypeName); if (type.isAbstract()) { return false; } } catch (NoSuchNodeTypeException e) { return false; } catch (RepositoryException e) { log.warn("Unable to access node type " + nodeTypeName, e); return false; } // FIXME: properly calculate matching definition for (NodeDefinition definition : getChildNodeDefinitions()) { String name = definition.getName(); if (matches(childNodeName, name) || RESIDUAL_NAME.equals(name)) { if (definition.isProtected()) { return false; } for (String required : definition.getRequiredPrimaryTypeNames()) { if (type.isNodeType(required)) { return true; } } } } return false; }
@Override public boolean canAddChildNode(String childNodeName, String nodeTypeName) { NodeType type; try { type = getManager().getNodeType(nodeTypeName); if (type.isAbstract()) { return false; } } catch (NoSuchNodeTypeException e) { return false; } catch (RepositoryException e) { log.warn("Unable to access node type " + nodeTypeName, e); return false; } // FIXME: properly calculate matching definition for (NodeDefinition definition : getChildNodeDefinitions()) { String name = definition.getName(); if (matches(childNodeName, name) || RESIDUAL_NAME.equals(name)) { if (definition.isProtected()) { return false; } for (String required : definition.getRequiredPrimaryTypeNames()) { if (type.isNodeType(required)) { return true; } } } } return false; }
@Override public boolean canAddChildNode(String childNodeName, String nodeTypeName) { NodeType type; try { type = getManager().getNodeType(nodeTypeName); if (type.isAbstract()) { return false; } } catch (NoSuchNodeTypeException e) { return false; } catch (RepositoryException e) { log.warn("Unable to access node type " + nodeTypeName, e); return false; } // FIXME: properly calculate matching definition for (NodeDefinition definition : getChildNodeDefinitions()) { String name = definition.getName(); if (matches(childNodeName, name) || RESIDUAL_NAME.equals(name)) { if (definition.isProtected()) { return false; } for (String required : definition.getRequiredPrimaryTypeNames()) { if (type.isNodeType(required)) { return true; } } } } return false; }
private static void assertAutoCreatedItems(@NotNull Tree authorizableTree, @NotNull String ntName, @NotNull Root root) throws Exception { NodeType repUser = ReadOnlyNodeTypeManager.getInstance(root, NamePathMapper.DEFAULT).getNodeType(ntName); for (NodeDefinition cnd : repUser.getChildNodeDefinitions()) { if (cnd.isAutoCreated()) { assertTrue(authorizableTree.hasChild(cnd.getName())); } } for (PropertyDefinition pd : repUser.getPropertyDefinitions()) { if (pd.isAutoCreated()) { assertTrue(authorizableTree.hasProperty(pd.getName())); } } } }