javax.jcr.Item.getDepth()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(113)

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

Item.getDepth介绍

[英]Returns the depth of this Item in the workspace item graph.

  • The root node returns 0.
  • A property or child node of the root node returns 1.
  • A property or child node of a child node of the root returns 2.
  • And so on to thisItem.
    [中]返回此Item在工作区项目图中的深度。
    *根节点返回0。
    *根节点的属性或子节点返回1。
    *根的子节点的属性或子节点返回2。
    *依此类推到这个Item

代码示例

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

/** {@inheritDoc} */
public int getDepth() throws RepositoryException {
  return item.getDepth();
}

代码示例来源:origin: net.adamcin.oakpal/oakpal-core

@Override
public int getDepth() throws RepositoryException {
  return delegate.getDepth();
}

代码示例来源:origin: net.adamcin.commons/net.adamcin.commons.jcr

public int getDepth() throws RepositoryException
{ return this.item.getDepth(); }

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

/** {@inheritDoc} */
public int getDepth() throws RepositoryException, RemoteException {
  try {
    return item.getDepth();
  } catch (RepositoryException ex) {
    throw getRepositoryException(ex);
  }
}

代码示例来源:origin: brix-cms/brix-cms

public Integer execute() throws Exception {
    return getDelegate().getDepth();
  }
});

代码示例来源:origin: brix-cms/brix-cms

public int getDepth() throws RepositoryException {
  return getDelegate().getDepth();
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-commons

/**
 * Matches if the given depth is greater or equal the minimum depth and
 * less or equal the maximum depth and if the call to {@link #matches(Item)}
 * returns <code>true</code>.
 * @see Predicate#evaluate(java.lang.Object)
 */
public boolean evaluate(Object item) {
  if ( item instanceof Item ) {
    try {
      final int depth = ((Item)item).getDepth();
      return depth >= minDepth && depth <= maxDepth && matches((Item)item);
    } catch (RepositoryException re) {
      return false;
    }
  }
  return false;
}

代码示例来源:origin: org.apache.jackrabbit/com.springsource.org.apache.jackrabbit.commons

/**
 * Matches if the given depth is greater or equal the minimum depth and
 * less or equal the maximum depth and if the call to {@link #matches(Item)}
 * returns <code>true</code>.
 * @see org.apache.commons.collections.Predicate#evaluate(java.lang.Object)
 */
public boolean evaluate(Object item) {
  if ( item instanceof Item ) {
    try {
      final int depth = ((Item)item).getDepth();
      return depth >= minDepth && depth <= maxDepth && matches((Item)item);
    } catch (RepositoryException re) {
      return false;
    }
  }
  return false;
}

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

/**
 * Matches if the given depth is greater or equal the minimum depth and
 * less or equal the maximum depth and if the call to {@link #matches(Item)}
 * returns <code>true</code>.
 * @see Predicate#evaluate(java.lang.Object)
 */
public boolean evaluate(Object item) {
  if ( item instanceof Item ) {
    try {
      final int depth = ((Item)item).getDepth();
      return depth >= minDepth && depth <= maxDepth && matches((Item)item);
    } catch (RepositoryException re) {
      return false;
    }
  }
  return false;
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Matches if the given depth is greater or equal the minimum depth and
 * less or equal the maximum depth and if the call to {@link #matches(Item)}
 * returns <code>true</code>.
 * @see Predicate#evaluate(java.lang.Object)
 */
public boolean evaluate(Object item) {
  if ( item instanceof Item ) {
    try {
      final int depth = ((Item)item).getDepth();
      return depth >= minDepth && depth <= maxDepth && matches((Item)item);
    } catch (RepositoryException re) {
      return false;
    }
  }
  return false;
}

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

if(origin.getDepth() > 0 && origin.getParent().isNodeType("mix:versionable")) {
  if (!origin.getParent().isCheckedOut()) {
    origin.getParent().checkout();

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

@Override
protected void initPropertyNames() {
  super.initPropertyNames();
  if (exists()) {
    names.addAll(JcrDavPropertyNameSet.EXISTING_ITEM_BASE_SET);
    try {
      if (item.getDepth() > 0) {
        names.add(JCR_PARENT);
      }
    } catch (RepositoryException e) {
      log.warn("Error while accessing node depth: " + e.getMessage());
    }
    if (item.isNew()) {
      names.add(JCR_ISNEW);
    } else if (item.isModified()) {
      names.add(JCR_ISMODIFIED);
    }
  } else {
    names.addAll(JcrDavPropertyNameSet.ITEM_BASE_SET);
  }
}

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

/**
 * Fill the property set for this resource.
 */
@Override
protected void initProperties() {
  super.initProperties();
  if (exists()) {
    try {
      properties.add(new DefaultDavProperty<String>(JCR_NAME, item.getName()));
      properties.add(new DefaultDavProperty<String>(JCR_PATH, item.getPath()));
      int depth = item.getDepth();
      properties.add(new DefaultDavProperty<String>(JCR_DEPTH, String.valueOf(depth)));
      // add href-property for the items parent unless its the root item
      if (depth > 0) {
        String parentHref = getLocatorFromItem(item.getParent()).getHref(true);
        properties.add(new HrefProperty(JCR_PARENT, parentHref, false));
      }
    } catch (RepositoryException e) {
      // should not get here
      log.error("Error while accessing jcr properties: " + e.getMessage());
    }
  }
}

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

private void checkHierarchy() throws PathNotFoundException, RepositoryException, ItemNotFoundException,
    AccessDeniedException {
  for (Iterator<ItemInfo> itemInfos = itemInfoStore.getItemInfos(); itemInfos.hasNext();) {
    ItemInfo itemInfo = itemInfos.next();
    String jcrPath = toJCRPath(itemInfo.getPath());
    Item item = session.getItem(jcrPath);
    assertEquals(jcrPath, item.getPath());
    if (item.getDepth() > 0) {
      Node parent = item.getParent();
      if (item.isNode()) {
        assertTrue(item.isSame(parent.getNode(item.getName())));
      }
      else {
        assertTrue(item.isSame(parent.getProperty(item.getName())));
      }
    }
  }
}

相关文章