public NodeDefinition[] getChildNodeDefinitions() { if (ntd != null) { return ntd.getDeclaredChildNodeDefinitions(); } else { return new NodeDefinition[0]; } }
public NodeDefinition[] getDeclaredChildNodeDefinitions() { return ntd.getDeclaredChildNodeDefinitions(); }
public boolean canRemoveItem(String s) { boolean canRemove = true; // check mandatory /protected properties for (Object pdt : ntd.getPropertyDefinitionTemplates()) { if (((PropertyDefinition) pdt).getName().equals(s)) { if (((PropertyDefinition) pdt).isMandatory() || ((PropertyDefinition) pdt).isProtected()) { canRemove = false; return canRemove; } } } // check mandatory /protected child items for (NodeDefinition nd : ntd.getDeclaredChildNodeDefinitions()) { if (nd.getName().equals(s)) { if (nd.isMandatory() || nd.isProtected()) { canRemove = false; return canRemove; } } } return canRemove; }
@Test public void testCreateSimpleMixinNodeTypeLastModified() throws RepositoryException { // GIVEN String name = NodeTypes.Content.NAME; List<String> superTypes = new ArrayList<String>(); superTypes.add(NodeTypes.Created.NAME); superTypes.add(NodeTypes.Activatable.NAME); superTypes.add(NodeTypes.LastModified.NAME); superTypes.add(NodeTypes.Renderable.NAME); superTypes.add(NodeTypes.Versionable.NAME); // WHEN NodeTypeTemplate nodeTypeTemplate = NodeTypeTemplateUtil.createSimpleNodeType(nodeTypeManager, name, superTypes); // THEN assertNotNull(nodeTypeTemplate); assertEquals(NodeTypes.Content.NAME, nodeTypeTemplate.getName()); assertFalse(nodeTypeTemplate.isMixin()); assertEquals(5, nodeTypeTemplate.getDeclaredSupertypeNames().length); assertEquals(2, nodeTypeTemplate.getPropertyDefinitionTemplates().size()); assertEquals(1, nodeTypeTemplate.getDeclaredChildNodeDefinitions().length); NodeDefinition child = nodeTypeTemplate.getDeclaredChildNodeDefinitions()[0]; assertEquals("*", child.getName()); assertFalse(child.isAutoCreated()); assertFalse(child.isMandatory()); assertFalse(child.allowsSameNameSiblings()); assertEquals(OnParentVersionAction.COPY, child.getOnParentVersion()); }
public void testEmptyNodeTypeTemplate() throws Exception { NodeTypeTemplate ntt = ntm.createNodeTypeTemplate(); assertNull(ntt.getName()); assertFalse(ntt.isMixin()); assertFalse(ntt.isAbstract()); assertFalse(ntt.hasOrderableChildNodes()); // note: isQueryable cannot be tested as defautl value is defined // by the implementation assertNotNull(ntt.getDeclaredSupertypeNames()); assertEquals(0, ntt.getDeclaredSupertypeNames().length); assertNull(ntt.getPrimaryItemName()); assertNull(ntt.getDeclaredChildNodeDefinitions()); assertNull(ntt.getDeclaredPropertyDefinitions()); assertNotNull(ntt.getNodeDefinitionTemplates()); assertTrue(ntt.getNodeDefinitionTemplates().isEmpty()); assertNotNull(ntt.getPropertyDefinitionTemplates()); assertTrue(ntt.getPropertyDefinitionTemplates().isEmpty()); }
ndefs.add(ndTemplate); assertNotNull(ntt.getDeclaredChildNodeDefinitions()); assertEquals(1, ntt.getDeclaredChildNodeDefinitions().length); assertEquals(ndTemplate, ntt.getDeclaredChildNodeDefinitions()[0]);
assertEquals(ntt.getPrimaryItemName(), ntd.getPrimaryItemName()); assertTrue(Arrays.equals(ntt.getDeclaredSupertypeNames(), ntd.getDeclaredSupertypeNames())); NodeDefinition[] nda = ntt.getDeclaredChildNodeDefinitions(); NodeDefinition[] nda1 = ntd.getDeclaredChildNodeDefinitions(); assertEquals(nda.length, nda1.length);