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

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

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

Item.getPath介绍

[英]Returns the normalized absolute path to this item.
[中]返回此项的标准化绝对路径。

代码示例

代码示例来源:origin: org.apache.jackrabbit.vault/vault-cli

public String getPath() {
  try {
    return item.getPath();
  } catch (RepositoryException e) {
    return "";
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr

public boolean isSame(Item item) throws RepositoryException {
   return nodePath.equals(item.getPath());
    /*
    The ability to address the same piece of data via more than one path is a
    common feature of many content storage systems. In JCR this feature is
    supported through shareable nodes.
    */
//        return this.item.isSame(item);
  }

代码示例来源:origin: io.wcm/io.wcm.testing.jcr-mock

/**
 * Add item
 * @param item item
 * @throws RepositoryException
 */
void addItem(final Item item) throws RepositoryException {
 this.items.put(item.getPath(), item);
}

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

/**
   * @see Predicate#evaluate(java.lang.Object)
   */
  public boolean evaluate(Object item) {
    if ( item instanceof Item ) {
      try {
        return regex.matcher(((Item)item).getPath()).matches();
      } catch (RepositoryException re) {
        return false;
      }
    }
    return false;
  }
}

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

private ZipEntryExportContext(Item exportRoot, OutputStream out, ExportContext context, int pos) {
  super(exportRoot, out != null, context.getIOListener());
  this.out = out;
  try {
    String entryPath = (exportRoot.getPath().length() > pos) ? exportRoot.getPath().substring(pos) : "";
    entry = new ZipEntry(entryPath);
  } catch (RepositoryException e) {
    // should never occur
  }
}

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

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

代码示例来源:origin: org.onehippo.cms7/jcrdiff-core

@Override
public String getPath() throws JcrDiffException {
  try {
    return jcrItem.getPath();
  } catch (RepositoryException e) {
    throw new JcrDiffException("Could not get item path", e);
  }
}

代码示例来源:origin: org.onehippo.jcr.console/hippo-jcr-console-api

public void registerVisitedItem(Item item) {
  if (item != null && item.isNode()) {
    try {
      synchronized (visitedNodePathSet) {
        visitedNodePathSet.add(item.getPath());
      }
    } catch (RepositoryException e) {
      log.warn("Failed to retrieve item path.", e);
    }
  }
}

代码示例来源:origin: io.wcm/io.wcm.testing.jcr-mock

RangeIterator listChildren(final String parentPath, final ItemFilter filter) throws RepositoryException {
 List<Item> children = new ArrayList<Item>();
 // build regex pattern for all child paths of parent
 Pattern pattern = Pattern.compile("^" + Pattern.quote(parentPath) + "/[^/]+$");
 // collect child resources
 for (Item item : this.items.values()) {
  if (pattern.matcher(item.getPath()).matches()
    && (filter == null || filter.accept(item))) {
   children.add(item);
  }
 }
 return new RangeIteratorAdapter(children.iterator(), children.size());
}

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

public boolean matches(Item itemToMatch) {
  try {
    // TODO: missing proper impl
    return matches(itemToMatch.getPath());
  } catch (RepositoryException e) {
    log.error("Unable to determine match. {}", e.getMessage());
    return false;
  }
}

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

public boolean matches(Item itemToMatch) {
  try {
    // TODO: missing proper impl
    return matches(itemToMatch.getPath());
  } catch (RepositoryException e) {
    log.error("Unable to determine match. {}", e.getMessage());
    return false;
  }
}

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

@Override
public void beforeItemSave(Item item) throws RepositoryException {
  events = changeLog.removeAndGetAffectedEvents(item.getPath());
  if (events != null && !events.isEmpty()) {
    for (EventsListener l : eventsListeners) {
      l.handleEventsBeforeSave(session, item, events);
    }
  }
}

代码示例来源:origin: org.apache.sling/org.apache.sling.servlets.post

public void move(Object src, Object dstParent, String name)
throws PersistenceException {
  try {
    final Session session = ((Item)src).getSession();
    final Item source = ((Item)src);
    final String targetParentPath = ((Node)dstParent).getPath();
    final String targetPath = (targetParentPath.equals("/") ? "" : targetParentPath) + '/' + name;
    session.move(source.getPath(), targetPath);
  } catch ( final RepositoryException re) {
    throw new PersistenceException(re.getMessage(), re);
  }
}

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

@Override
protected void setUp() throws Exception {
  super.setUp();
  removeItem = createRemoveItem();
  removePath = removeItem.getPath();
}

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

Node nodeFor( ResolvedRequest request ) throws RepositoryException {
  Session session = session(request);
  Item item = session.getItem(request.getPath());
  if (item instanceof Property) {
    throw new WebdavException(WebdavI18n.errorPropertyPath.text(item.getPath()));
  }
  return (Node)item;
}

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

/**
 * Check whether we can traverse the hierarchy when the item info for a deep item
 * is retrieved first.
 * @throws RepositoryException
 */
public void testGetItemInfosDeepFirst() throws RepositoryException {
  final String targetPath = "/node2/node21/node211/node2111/node21111/node211111/node2111111";
  assertEquals(targetPath, session.getItem(targetPath).getPath());
  checkHierarchy();
}

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

public void testGetItemOrNullExistingProperty() throws RepositoryException {
  JackrabbitSession js = (JackrabbitSession) superuser;
  Item item = js.getItemOrNull(PATH_EXISTING_PROPERTY);
  assertNotNull(item);
  assertTrue(item instanceof Property);
  assertEquals(item.getPath(), PATH_EXISTING_PROPERTY);
}

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

public void testGetItemOrNullExistingNode() throws RepositoryException {
  JackrabbitSession js = (JackrabbitSession) superuser;
  Item item = js.getItemOrNull(PATH_EXISTING_NODE);
  assertNotNull(item);
  assertTrue(item instanceof Node);
  assertEquals(item.getPath(), PATH_EXISTING_NODE);
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework-compatibility

@Test
public void getJcrItemWhenWorkbenchPathIsNotRoot() throws RepositoryException {
  // GIVEN
  Node node1 = AbstractJcrContainerTest.createNode(rootNode, "node1", NodeTypes.Content.NAME, PROPERTY_1, "name1");
  node1.getSession().save();
  // WHEN
  connectorDefinition.setRootPath("/node1");
  Item res = container.getJcrItem(JcrItemUtil.getItemId(node1));
  // THEN
  assertNotNull(res);
  assertEquals("/node1", res.getPath());
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework-compatibility

@Test
public void testSetCommonAttributesWithNode() throws Exception {
  // GIVEN
  String nodeName = "nodeName";
  Node testNode = session.getRootNode().addNode(nodeName);
  // WHEN
  DummyJcrAdapter adapter = new DummyJcrAdapter(testNode);
  // THEN
  assertTrue(adapter.isNode());
  assertEquals(workspaceName, adapter.getWorkspace());
  assertEquals(testNode.getIdentifier(), adapter.getItemId().getUuid());
  assertEquals(testNode.getPath(), adapter.getJcrItem().getPath());
}

相关文章