if (NodeCardinality.NO_SAME_NAME_SIBLINGS == typesToCheck && definition.allowsSameNameSiblings()) continue; matchingDefs.add(definition);
if (NodeCardinality.NO_SAME_NAME_SIBLINGS == typesToCheck && definition.allowsSameNameSiblings()) continue; matchingDefs.add(definition);
JcrNodeDefinition with( ExecutionContext context ) { return new JcrNodeDefinition(context, this.nodeTypeManager, this.declaringNodeType, key(), name, getOnParentVersion(), isAutoCreated(), isMandatory(), isProtected(), allowsSameNameSiblings(), defaultPrimaryTypeName, requiredPrimaryTypeNames); }
JcrNodeDefinition with( RepositoryNodeTypeManager nodeTypeManager ) { return new JcrNodeDefinition(this.context, nodeTypeManager, this.declaringNodeType, key(), name, getOnParentVersion(), isAutoCreated(), isMandatory(), isProtected(), allowsSameNameSiblings(), defaultPrimaryTypeName, requiredPrimaryTypeNames); }
JcrNodeDefinition with( RepositoryNodeTypeManager nodeTypeManager ) { return new JcrNodeDefinition(this.context, nodeTypeManager, this.declaringNodeType, key(), name, getOnParentVersion(), isAutoCreated(), isMandatory(), isProtected(), allowsSameNameSiblings(), defaultPrimaryTypeName, requiredPrimaryTypeNames); }
JcrNodeDefinition with( ExecutionContext context ) { return new JcrNodeDefinition(context, this.nodeTypeManager, this.declaringNodeType, key(), name, getOnParentVersion(), isAutoCreated(), isMandatory(), isProtected(), allowsSameNameSiblings(), defaultPrimaryTypeName, requiredPrimaryTypeNames); }
if (definition.allowsSameNameSiblings()) { childNodeDefinitionsThatAllowSns.put(name, definition); } else {
if (definition.allowsSameNameSiblings()) { childNodeDefinitionsThatAllowSns.put(name, definition); } else {
/** * Creates a new <code>JcrNodeDefinition</code> that is identical to the current object, but with the given * <code>declaringNodeType</code>. Provided to support immutable pattern for this class. * * @param declaringNodeType the declaring node type for the new <code>JcrNodeDefinition</code> * @return a new <code>JcrNodeDefinition</code> that is identical to the current object, but with the given * <code>declaringNodeType</code>. */ JcrNodeDefinition with( JcrNodeType declaringNodeType ) { return new JcrNodeDefinition(this.context, declaringNodeType.nodeTypeManager(), declaringNodeType, key(), name, getOnParentVersion(), isAutoCreated(), isMandatory(), isProtected(), allowsSameNameSiblings(), defaultPrimaryTypeName, requiredPrimaryTypeNames); }
/** * Creates a new <code>JcrNodeDefinition</code> that is identical to the current object, but with the given * <code>declaringNodeType</code>. Provided to support immutable pattern for this class. * * @param declaringNodeType the declaring node type for the new <code>JcrNodeDefinition</code> * @return a new <code>JcrNodeDefinition</code> that is identical to the current object, but with the given * <code>declaringNodeType</code>. */ JcrNodeDefinition with( JcrNodeType declaringNodeType ) { return new JcrNodeDefinition(this.context, declaringNodeType.nodeTypeManager(), declaringNodeType, key(), name, getOnParentVersion(), isAutoCreated(), isMandatory(), isProtected(), allowsSameNameSiblings(), defaultPrimaryTypeName, requiredPrimaryTypeNames); }
props.add(propertyFactory.create(JcrLexicon.SAME_NAME_SIBLINGS, childNodeDef.allowsSameNameSiblings())); props.add(propertyFactory.create(JcrLexicon.ON_PARENT_VERSION, OnParentVersionAction.nameFromValue(childNodeDef.getOnParentVersion())));
props.add(propertyFactory.create(JcrLexicon.SAME_NAME_SIBLINGS, childNodeDef.allowsSameNameSiblings())); props.add(propertyFactory.create(JcrLexicon.ON_PARENT_VERSION, OnParentVersionAction.nameFromValue(childNodeDef.getOnParentVersion())));
if (node.allowsSameNameSiblings()) { foundSNS = true;
if (node.allowsSameNameSiblings()) { foundSNS = true;
private static void compareNodeTemplateToNodeDefinition( JcrNodeDefinitionTemplate template, JcrNodeDefinition definition ) { assertThat(definition, is(notNullValue())); assertThat(definition.getDeclaringNodeType(), is(notNullValue())); // Had to match on name to even get to the definition // assertThat(template.getName(), is(definition.getName())); assertThat(template.getOnParentVersion(), is(definition.getOnParentVersion())); assertThat(template.isAutoCreated(), is(definition.isAutoCreated())); assertThat(template.isMandatory(), is(definition.isMandatory())); assertThat(template.isProtected(), is(definition.isProtected())); assertThat(template.getDefaultPrimaryTypeName(), is(definition.getDefaultPrimaryTypeName())); assertThat(template.allowsSameNameSiblings(), is(definition.allowsSameNameSiblings())); // assertThat(template.getRequiredPrimaryTypeNames(), is(definition.getRequiredPrimaryTypeNames())); }
if (!defn.allowsSameNameSiblings()) {
if (!defn.allowsSameNameSiblings()) {
@Test public void shouldRegisterValidTypesFromCndFile() throws Exception { nodeTypeManager.registerNodeTypes(resourceAsUrl("cnd/validType.cnd"), true); NodeType nodeType = assertNodeType("modetest:testType"); assertThat(nodeType, is(notNullValue())); assertThat(nodeType.isMixin(), is(true)); assertThat(nodeType.hasOrderableChildNodes(), is(true)); assertThat(nodeType.getDeclaredSupertypes().length, is(2)); assertThat(nodeType.getDeclaredChildNodeDefinitions().length, is(1)); JcrNodeDefinition childNode = (JcrNodeDefinition)nodeType.getDeclaredChildNodeDefinitions()[0]; assertThat(childNode.getName(), is("modetest:namespace")); assertThat(childNode.getDefaultPrimaryType().getName(), is("mode:namespace")); assertThat(childNode.getRequiredPrimaryTypes().length, is(1)); assertThat(childNode.getRequiredPrimaryTypes()[0].getName(), is("mode:namespace")); assertThat(childNode.allowsSameNameSiblings(), is(false)); assertThat(childNode.isMandatory(), is(false)); assertThat(nodeType.getDeclaredPropertyDefinitions().length, is(1)); JcrPropertyDefinition property = (JcrPropertyDefinition)nodeType.getDeclaredPropertyDefinitions()[0]; assertThat(property.getName(), is("*")); assertThat(property.getRequiredType(), is(PropertyType.STRING)); assertThat(property.getValueConstraints().length, is(3)); assertThat(property.getValueConstraints()[0], is("foo")); assertThat(property.getValueConstraints()[1], is("bar")); assertThat(property.getValueConstraints()[2], is("baz")); assertThat(property.getDefaultValues().length, is(1)); assertThat(property.getDefaultValues()[0].getString(), is("foo")); }
if (!allowSns && !defn.allowsSameNameSiblings()) continue;
if (!allowSns && !defn.allowsSameNameSiblings()) continue;