@Override protected void runTest() throws Exception { for (int i = 0; i < 10000; i++) { node.getMixinNodeTypes(); } } }
/** * @inheritDoc */ public NodeType[] getMixinNodeTypes() throws RepositoryException { return node.getMixinNodeTypes(); }
static boolean hasMixinType(Node node, String mixinType) throws RepositoryException { for (NodeType nodeType : node.getMixinNodeTypes()) { if (nodeType.getName().equals(mixinType)) { return true; } } return false; }
private Collection<String> getDeclaredMixinTypes(final Node node) throws RepositoryException { final List<String> result = new ArrayList<String>(); for (NodeType nodeType : node.getMixinNodeTypes()) { result.add(nodeType.getName()); } return result; }
private boolean hasMixin(Node node) { try { NodeType[] nodeTypes = node.getMixinNodeTypes(); for (NodeType nodeType : nodeTypes) { if (nodeType.isNodeType("mix:shareable")) { return true; } } } catch (RepositoryException e) { } return false; }
@Override public ContentType getContentTypeForNode(Node node) throws RepositoryException { Set<String> names = new HashSet<String>(); names.add(node.getPrimaryNodeType().getName()); for (NodeType mixin : node.getMixinNodeTypes()) { names.add(mixin.getName()); } return getAggregatedContentType(names); }
public long size() { long result = 0; try { if (nodeModel.getObject() != null) { NodeType[] nodeTypes = nodeModel.getObject().getMixinNodeTypes(); result = nodeTypes.length; } } catch (RepositoryException e) { log.error(e.getMessage()); } return result; }
public boolean isReferenceable(Node node) throws RepositoryException { // for (NodeType nt : node.getMixinNodeTypes()) { if (nt.getName().equals("mix:referenceable")) { return true; } } // PrimaryTypeInfo ntInfo = (PrimaryTypeInfo)getTypeInfo(node.getPrimaryNodeType()); // return ntInfo.getMixinNames().contains("mix:referenceable"); }
private static boolean isOrderable(Node node) throws RepositoryException { if (node.getPrimaryNodeType().hasOrderableChildNodes()) { return true; } NodeType[] types = node.getMixinNodeTypes(); for (NodeType type : types) { if (type.hasOrderableChildNodes()) { return true; } } return false; }
protected boolean hasMixin( Node node, String mixinNodeType ) throws RepositoryException { for (NodeType mixin : node.getMixinNodeTypes()) { if (mixin.getName().equals(mixinNodeType)) return true; } return false; }
public static boolean hasPropertyDefinition(Node node, String propName) { try { return hasPropertyDefinition(node.getPrimaryNodeType(), node.getMixinNodeTypes(), propName); } catch (RepositoryException e) { throw new MetadataRepositoryException("Failed to retrieve property definitions for node: " + node, e); } }
protected void assertHasMixins( Node node, String... mixinNodeTypes ) throws RepositoryException { List<String> mixins = new ArrayList<String>(); for (NodeType nodeType : node.getMixinNodeTypes()) { mixins.add(nodeType.getName()); } for (String expectedMixin : mixinNodeTypes) { assertThat(expectedMixin + "mixin not found", mixins.contains(expectedMixin), is(true)); } }
public static PropertyDefinition[] getAggregatedPropertyDefinitionss(Node node) throws RepositoryException { Set<PropertyDefinition> pDefs = newHashSet(); PropertyDefinition pd[] = node.getPrimaryNodeType().getPropertyDefinitions(); pDefs.addAll(Arrays.asList(pd)); NodeType[] mixins = node.getMixinNodeTypes(); for (NodeType mixin : mixins) { pd = mixin.getPropertyDefinitions(); pDefs.addAll(Arrays.asList(pd)); } return pDefs.toArray(new PropertyDefinition[pDefs.size()]); }
private static NodeDefinition[] getAggregatedNodeDefinitions(Node node) throws RepositoryException { Set<NodeDefinition> cDefs = newHashSet(); NodeDefinition[] nd = node.getPrimaryNodeType().getChildNodeDefinitions(); cDefs.addAll(Arrays.asList(nd)); NodeType[] mixins = node.getMixinNodeTypes(); for (NodeType mixin : mixins) { nd = mixin.getChildNodeDefinitions(); cDefs.addAll(Arrays.asList(nd)); } return cDefs.toArray(new NodeDefinition[cDefs.size()]); }
private void assertHasPackageMixin( final Node node ) throws Exception { for (final NodeType mixin : node.getMixinNodeTypes()) { if (ClassFileSequencerLexicon.PACKAGE.equals(mixin.getName())) { return; } } fail("Node '" + node.getPath() + "' does not have the java package mixin"); }
/** * Verify that transient changes to jcr:mixinTypes are reflected in the * API call {@link javax.jcr.Node#getMixinNodeTypes()}. */ public void testNodeGetMixinTypesWithTransientModifications() throws Exception { int noMixins = superuser.getNode(path).getMixinNodeTypes().length; Node node = superuser.getNode(path); node.addMixin(NodeType.MIX_CREATED); NodeType[] mixins = node.getMixinNodeTypes(); assertEquals(noMixins+1, mixins.length); }
public void testNodeGetMixinTypesWithTransientModifications() throws Exception { int noMixins = superuser.getNode(path).getMixinNodeTypes().length; Node node = superuser.getNode(path); node.addMixin(NodeType.MIX_CREATED); NodeType[] mixins = node.getMixinNodeTypes(); assertEquals(noMixins+1, mixins.length); } }
protected void assertColumn( Node row, int index, String data ) throws RepositoryException { Node column = row.getNode("text:column[" + (index + 1) + "]"); assertEquals(NT_UNSTRUCTURED, column.getPrimaryNodeType().getName()); List<String> mixinNames = new ArrayList<String>(); for (NodeType mixinType : column.getMixinNodeTypes()) { mixinNames.add(mixinType.getName()); } assertTrue(mixinNames.contains(COLUMN)); assertEquals(data, column.getProperty(DATA).getString()); } }
public void testMixins() throws RepositoryException { acMgr.setPolicy(testRoot, acl); NodeType[] mixins = superuser.getNode(acl.getPath()).getMixinNodeTypes(); NodeType[] expectedMixins = null; assertArrayEquals(expectedMixins, mixins); }
@Test public void testNodeHasMixinLockable() throws AccessDeniedException, PathNotFoundException, RepositoryException { // GIVEN MockNode root = new MockNode("root"); // WHEN Node child = NodeUtil.createPath(root, "some/really/important/page", "mgnl:page"); // THEN Iterable<Node> nodes = NodeUtil.collectAllChildren(child); for (Node node : nodes) { assertTrue(node.getMixinNodeTypes()[0].getName().equals("mix:lockable")); } }