javax.jcr.Node.getMixinNodeTypes()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(204)

本文整理了Java中javax.jcr.Node.getMixinNodeTypes()方法的一些代码示例,展示了Node.getMixinNodeTypes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getMixinNodeTypes()方法的具体详情如下:
包路径:javax.jcr.Node
类名称:Node
方法名:getMixinNodeTypes

Node.getMixinNodeTypes介绍

[英]Returns an array of NodeType objects representing the mixin node types in effect for this node. This includes only those mixin types explicitly assigned to this node. It does not include mixin types inherited through the addition of supertypes to the primary type hierarchy or through the addition of supertypes to the type hierarchy of any of the declared mixin types.
[中]返回NodeType对象的数组,这些对象表示此节点有效的mixin节点类型。这仅包括显式分配给此节点的那些mixin类型。它不包括通过将超类型添加到主类型层次结构或通过将超类型添加到任何已声明的mixin类型的类型层次结构而继承的mixin类型。

代码示例

代码示例来源:origin: apache/jackrabbit-oak

  1. @Override
  2. protected void runTest() throws Exception {
  3. for (int i = 0; i < 10000; i++) {
  4. node.getMixinNodeTypes();
  5. }
  6. }
  7. }

代码示例来源:origin: org.onehippo.cms7/hippo-repository-connector

  1. /**
  2. * @inheritDoc
  3. */
  4. public NodeType[] getMixinNodeTypes() throws RepositoryException {
  5. return node.getMixinNodeTypes();
  6. }

代码示例来源:origin: org.jcrom/jcrom

  1. static boolean hasMixinType(Node node, String mixinType) throws RepositoryException {
  2. for (NodeType nodeType : node.getMixinNodeTypes()) {
  3. if (nodeType.getName().equals(mixinType)) {
  4. return true;
  5. }
  6. }
  7. return false;
  8. }

代码示例来源:origin: org.onehippo.cms7/hippo-cms-console-frontend

  1. private Collection<String> getDeclaredMixinTypes(final Node node) throws RepositoryException {
  2. final List<String> result = new ArrayList<String>();
  3. for (NodeType nodeType : node.getMixinNodeTypes()) {
  4. result.add(nodeType.getName());
  5. }
  6. return result;
  7. }

代码示例来源:origin: org.chtijbug.drools/guvnor-repository

  1. private boolean hasMixin(Node node) {
  2. try {
  3. NodeType[] nodeTypes = node.getMixinNodeTypes();
  4. for (NodeType nodeType : nodeTypes) {
  5. if (nodeType.isNodeType("mix:shareable")) {
  6. return true;
  7. }
  8. }
  9. } catch (RepositoryException e) {
  10. }
  11. return false;
  12. }

代码示例来源:origin: org.onehippo.cms7/hippo-services-contenttype

  1. @Override
  2. public ContentType getContentTypeForNode(Node node) throws RepositoryException {
  3. Set<String> names = new HashSet<String>();
  4. names.add(node.getPrimaryNodeType().getName());
  5. for (NodeType mixin : node.getMixinNodeTypes()) {
  6. names.add(mixin.getName());
  7. }
  8. return getAggregatedContentType(names);
  9. }

代码示例来源:origin: org.onehippo.cms7/hippo-cms-api

  1. public long size() {
  2. long result = 0;
  3. try {
  4. if (nodeModel.getObject() != null) {
  5. NodeType[] nodeTypes = nodeModel.getObject().getMixinNodeTypes();
  6. result = nodeTypes.length;
  7. }
  8. } catch (RepositoryException e) {
  9. log.error(e.getMessage());
  10. }
  11. return result;
  12. }

代码示例来源:origin: org.chromattic/chromattic.core

  1. public boolean isReferenceable(Node node) throws RepositoryException {
  2. //
  3. for (NodeType nt : node.getMixinNodeTypes()) {
  4. if (nt.getName().equals("mix:referenceable")) {
  5. return true;
  6. }
  7. }
  8. //
  9. PrimaryTypeInfo ntInfo = (PrimaryTypeInfo)getTypeInfo(node.getPrimaryNodeType());
  10. //
  11. return ntInfo.getMixinNames().contains("mix:referenceable");
  12. }

代码示例来源:origin: apache/jackrabbit-oak

  1. private static boolean isOrderable(Node node) throws RepositoryException {
  2. if (node.getPrimaryNodeType().hasOrderableChildNodes()) {
  3. return true;
  4. }
  5. NodeType[] types = node.getMixinNodeTypes();
  6. for (NodeType type : types) {
  7. if (type.hasOrderableChildNodes()) {
  8. return true;
  9. }
  10. }
  11. return false;
  12. }

代码示例来源:origin: ModeShape/modeshape

  1. protected boolean hasMixin( Node node,
  2. String mixinNodeType ) throws RepositoryException {
  3. for (NodeType mixin : node.getMixinNodeTypes()) {
  4. if (mixin.getName().equals(mixinNodeType)) return true;
  5. }
  6. return false;
  7. }

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

  1. public static boolean hasPropertyDefinition(Node node, String propName) {
  2. try {
  3. return hasPropertyDefinition(node.getPrimaryNodeType(), node.getMixinNodeTypes(), propName);
  4. } catch (RepositoryException e) {
  5. throw new MetadataRepositoryException("Failed to retrieve property definitions for node: " + node, e);
  6. }
  7. }

代码示例来源:origin: ModeShape/modeshape

  1. protected void assertHasMixins( Node node,
  2. String... mixinNodeTypes ) throws RepositoryException {
  3. List<String> mixins = new ArrayList<String>();
  4. for (NodeType nodeType : node.getMixinNodeTypes()) {
  5. mixins.add(nodeType.getName());
  6. }
  7. for (String expectedMixin : mixinNodeTypes) {
  8. assertThat(expectedMixin + "mixin not found", mixins.contains(expectedMixin), is(true));
  9. }
  10. }

代码示例来源:origin: apache/jackrabbit-oak

  1. public static PropertyDefinition[] getAggregatedPropertyDefinitionss(Node node) throws RepositoryException {
  2. Set<PropertyDefinition> pDefs = newHashSet();
  3. PropertyDefinition pd[] = node.getPrimaryNodeType().getPropertyDefinitions();
  4. pDefs.addAll(Arrays.asList(pd));
  5. NodeType[] mixins = node.getMixinNodeTypes();
  6. for (NodeType mixin : mixins) {
  7. pd = mixin.getPropertyDefinitions();
  8. pDefs.addAll(Arrays.asList(pd));
  9. }
  10. return pDefs.toArray(new PropertyDefinition[pDefs.size()]);
  11. }

代码示例来源:origin: apache/jackrabbit-oak

  1. private static NodeDefinition[] getAggregatedNodeDefinitions(Node node) throws RepositoryException {
  2. Set<NodeDefinition> cDefs = newHashSet();
  3. NodeDefinition[] nd = node.getPrimaryNodeType().getChildNodeDefinitions();
  4. cDefs.addAll(Arrays.asList(nd));
  5. NodeType[] mixins = node.getMixinNodeTypes();
  6. for (NodeType mixin : mixins) {
  7. nd = mixin.getChildNodeDefinitions();
  8. cDefs.addAll(Arrays.asList(nd));
  9. }
  10. return cDefs.toArray(new NodeDefinition[cDefs.size()]);
  11. }

代码示例来源:origin: ModeShape/modeshape

  1. private void assertHasPackageMixin( final Node node ) throws Exception {
  2. for (final NodeType mixin : node.getMixinNodeTypes()) {
  3. if (ClassFileSequencerLexicon.PACKAGE.equals(mixin.getName())) {
  4. return;
  5. }
  6. }
  7. fail("Node '" + node.getPath() + "' does not have the java package mixin");
  8. }

代码示例来源:origin: apache/jackrabbit-oak

  1. /**
  2. * Verify that transient changes to jcr:mixinTypes are reflected in the
  3. * API call {@link javax.jcr.Node#getMixinNodeTypes()}.
  4. */
  5. public void testNodeGetMixinTypesWithTransientModifications() throws Exception {
  6. int noMixins = superuser.getNode(path).getMixinNodeTypes().length;
  7. Node node = superuser.getNode(path);
  8. node.addMixin(NodeType.MIX_CREATED);
  9. NodeType[] mixins = node.getMixinNodeTypes();
  10. assertEquals(noMixins+1, mixins.length);
  11. }

代码示例来源:origin: apache/jackrabbit

  1. public void testNodeGetMixinTypesWithTransientModifications() throws Exception {
  2. int noMixins = superuser.getNode(path).getMixinNodeTypes().length;
  3. Node node = superuser.getNode(path);
  4. node.addMixin(NodeType.MIX_CREATED);
  5. NodeType[] mixins = node.getMixinNodeTypes();
  6. assertEquals(noMixins+1, mixins.length);
  7. }
  8. }

代码示例来源:origin: ModeShape/modeshape

  1. protected void assertColumn( Node row, int index, String data ) throws RepositoryException {
  2. Node column = row.getNode("text:column[" + (index + 1) + "]");
  3. assertEquals(NT_UNSTRUCTURED, column.getPrimaryNodeType().getName());
  4. List<String> mixinNames = new ArrayList<String>();
  5. for (NodeType mixinType : column.getMixinNodeTypes()) {
  6. mixinNames.add(mixinType.getName());
  7. }
  8. assertTrue(mixinNames.contains(COLUMN));
  9. assertEquals(data, column.getProperty(DATA).getString());
  10. }
  11. }

代码示例来源:origin: apache/jackrabbit-oak

  1. public void testMixins() throws RepositoryException {
  2. acMgr.setPolicy(testRoot, acl);
  3. NodeType[] mixins = superuser.getNode(acl.getPath()).getMixinNodeTypes();
  4. NodeType[] expectedMixins = null;
  5. assertArrayEquals(expectedMixins, mixins);
  6. }

代码示例来源:origin: info.magnolia/magnolia-core

  1. @Test
  2. public void testNodeHasMixinLockable() throws AccessDeniedException, PathNotFoundException, RepositoryException {
  3. // GIVEN
  4. MockNode root = new MockNode("root");
  5. // WHEN
  6. Node child = NodeUtil.createPath(root, "some/really/important/page", "mgnl:page");
  7. // THEN
  8. Iterable<Node> nodes = NodeUtil.collectAllChildren(child);
  9. for (Node node : nodes) {
  10. assertTrue(node.getMixinNodeTypes()[0].getName().equals("mix:lockable"));
  11. }
  12. }

相关文章