public String getName() { return Text.getName(principalPath); } });
/** * 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, '/'); }
/** * 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, '/'); }
/** * 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, '/'); }
public String getName() { return Text.getName(path); } };
/** * 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, '/'); }
/** * 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); }
/** * 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); }
/** * 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); }
public String getDisplayName() { String resPath = getResourcePath(); return ( resPath != null ) ? Text.getName( resPath ) : resPath; }
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("----------------------------------------------"); } }
@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); } }
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()); }
@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); } }
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); }
@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(); }
@Test public void testHiddenGetName() { assertEquals(Text.getName(HIDDEN_PATH), getHiddenTree(immutable).getName()); }
@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)); }
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); }
@Test public void testHasHiddenChild() { ImmutableTree parent = (ImmutableTree) TreeUtil.getTree(immutable, Text.getRelativeParent(HIDDEN_PATH, 1)); assertNotNull(parent); assertTrue(parent.hasChild(Text.getName(HIDDEN_PATH))); }