org.apache.jackrabbit.util.Text.getName()方法的使用及代码示例

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

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

Text.getName介绍

[英]Returns the name part of the path. If the given path is already a name (i.e. contains no slashes) it is returned.
[中]返回路径的名称部分。如果给定路径已经是一个名称(即不包含斜杠),则返回该名称。

代码示例

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

public String getName() {
    return Text.getName(principalPath);
  }
});

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

/**
 * Returns the name part of the path. If the given path is already a name
 * (i.e. contains no slashes) it is returned.
 *
 * @param path the path
 * @return the name part or <code>null</code> if <code>path</code> is <code>null</code>.
 */
public static String getName(String path) {
  return getName(path, '/');
}

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

/**
 * Returns the name part of the path. If the given path is already a name
 * (i.e. contains no slashes) it is returned.
 *
 * @param path the path
 * @return the name part or <code>null</code> if <code>path</code> is <code>null</code>.
 */
public static String getName(String path) {
  return getName(path, '/');
}

代码示例来源:origin: com.github.igor-suhorukov/dom-transformation

/**
 * Returns the name part of the path. If the given path is already a name
 * (i.e. contains no slashes) it is returned.
 *
 * @param path the path
 * @return the name part or <code>null</code> if <code>path</code> is <code>null</code>.
 */
public static String getName(String path) {
  return getName(path, '/');
}

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

public String getName() {
    return Text.getName(path);
  }
};

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

/**
 * Returns the name part of the path. If the given path is already a name
 * (i.e. contains no slashes) it is returned.
 *
 * @param path the path
 * @return the name part or <code>null</code> if <code>path</code> is <code>null</code>.
 */
public static String getName(String path) {
  return getName(path, '/');
}

代码示例来源:origin: com.github.igor-suhorukov/dom-transformation

/**
 * Same as {@link #getName(String)} but adding the possibility
 * to pass paths that end with a trailing '/'
 *
 * @see #getName(String)
 */
public static String getName(String path, boolean ignoreTrailingSlash) {
  if (ignoreTrailingSlash && path != null && path.endsWith("/") && path.length() > 1) {
    path = path.substring(0, path.length()-1);
  }
  return getName(path);
}

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

/**
 * Same as {@link #getName(String)} but adding the possibility
 * to pass paths that end with a trailing '/'
 *
 * @see #getName(String)
 */
public static String getName(String path, boolean ignoreTrailingSlash) {
  if (ignoreTrailingSlash && path != null && path.endsWith("/") && path.length() > 1) {
    path = path.substring(0, path.length()-1);
  }
  return getName(path);
}

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

/**
 * Same as {@link #getName(String)} but adding the possibility
 * to pass paths that end with a trailing '/'
 *
 * @see #getName(String)
 */
public static String getName(String path, boolean ignoreTrailingSlash) {
  if (ignoreTrailingSlash && path != null && path.endsWith("/") && path.length() > 1) {
    path = path.substring(0, path.length()-1);
  }
  return getName(path);
}

代码示例来源:origin: org.apache.continuum/continuum-buildagent-webdav

public String getDisplayName()
{
  String resPath = getResourcePath();
  return ( resPath != null ) ? Text.getName( resPath ) : resPath;
}

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

public void logInfos() {
    log.info("Configuration of {}", Text.getName(this.getClass().getName(), '.'));
    log.info("----------------------------------------------");
    Iterator iter = map.keySet().iterator();
    while (iter.hasNext()) {
      String name = (String) iter.next();
      log.info("  {}: {}", name, map.get(name));
    }
    log.info("----------------------------------------------");
  }
}

代码示例来源:origin: org.apache.jackrabbit/oak-authorization-cug

@Override
public boolean definesLocation(@NotNull TreeLocation location) {
  PropertyState p = location.getProperty();
  Tree tree = (p == null) ? location.getTree() : location.getParent().getTree();
  if (tree != null) {
    return (p == null) ? definesTree(tree) : definesProperty(tree, p);
  } else {
    String path = location.getPath();
    return REP_CUG_POLICY.equals(Text.getName(path)) || path.endsWith(REP_CUG_POLICY + '/' + REP_PRINCIPAL_NAMES);
  }
}

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

private ZipEntryImportContext(ImportContext context, ZipEntry entry, BoundedInputStream bin, Node contentNode) throws IOException, RepositoryException {
  super(contentNode, Text.getName(makeValidJCRPath(entry.getName(), true)),
      null, bin, context.getIOListener(), getIOManager().getDetector());
  this.entry = entry;
  String path = makeValidJCRPath(entry.getName(), true);
  importRoot = IOUtil.mkDirs(contentNode, Text.getRelativeParent(path, 1), getCollectionNodeType());
}

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

@Override
public boolean definesLocation(@NotNull TreeLocation location) {
  PropertyState p = location.getProperty();
  Tree tree = (p == null) ? location.getTree() : location.getParent().getTree();
  if (tree != null) {
    return (p == null) ? definesTree(tree) : definesProperty(tree, p);
  } else {
    String path = location.getPath();
    return REP_CUG_POLICY.equals(Text.getName(path)) || path.endsWith(REP_CUG_POLICY + '/' + REP_PRINCIPAL_NAMES);
  }
}

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

private static TreeLocation createNonExistingTreeLocation(@NotNull String path) {
  String name = Text.getName(path);
  Tree nonExistingTree = Mockito.mock(Tree.class);
  when(nonExistingTree.exists()).thenReturn(false);
  when(nonExistingTree.getName()).thenReturn(name);
  when(nonExistingTree.getPath()).thenReturn(path);
  when(nonExistingTree.getChild(name)).thenReturn(nonExistingTree);
  return TreeLocation.create(nonExistingTree);
}

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

@Test
public void testReorder3() throws Exception {
  Node n = testSession.getNode(path);
  // give 'add_child_nodes', 'nt-management' and 'remove_child_nodes' at
  // 'path' -> reorder must succeed
  allow(path, privilegesFromNames(new String[] {Privilege.JCR_ADD_CHILD_NODES,
      Privilege.JCR_REMOVE_CHILD_NODES, Privilege.JCR_NODE_TYPE_MANAGEMENT}));
  n.orderBefore(Text.getName(childNPath2), Text.getName(childNPath));
  testSession.save();
}

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

@Test
public void testHiddenGetName() {
  assertEquals(Text.getName(HIDDEN_PATH), getHiddenTree(immutable).getName());
}

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

@Test
public void testCopyInvisibleProperty() throws Exception {
  deny(childNPath, privilegesFromName(PrivilegeConstants.REP_READ_PROPERTIES));
  allow(targetPath, privilegesFromName(Privilege.JCR_ALL));
  testSession.getWorkspace().copy(path, destPath);
  Node copiedNode = testSession.getNode(destPath);
  String childName = Text.getName(childNPath);
  assertTrue(copiedNode.hasNode(childName));
  assertFalse(copiedNode.hasProperty(childName + '/'+ propertyName1));
  superuser.refresh(false);
  assertFalse(superuser.nodeExists(destPath + '/' + childName + '/' + propertyName1));
}

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

private void createTestNode(String testPath) throws RepositoryException {
  Batch b = rs.createBatch(si, getNodeId("/"));
  String name = Text.getName(testPath);
  b.addNode(getNodeId("/"), resolver.getQName(name), NameConstants.NT_UNSTRUCTURED, null);
  rs.submit(b);
}

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

@Test
public void testHasHiddenChild() {
  ImmutableTree parent = (ImmutableTree) TreeUtil.getTree(immutable, Text.getRelativeParent(HIDDEN_PATH, 1));
  assertNotNull(parent);
  assertTrue(parent.hasChild(Text.getName(HIDDEN_PATH)));
}

相关文章