@Test void testGetAbsoluteLevel() { assertEquals("/content", Text.getAbsoluteParent("/content/a/b/c", Path.getAbsoluteLevel("/content", resolver))); assertEquals("/content/a", Text.getAbsoluteParent("/content/a/b/c", Path.getAbsoluteLevel("/content/a", resolver))); assertEquals("/content/a/b", Text.getAbsoluteParent("/content/a/b/c", Path.getAbsoluteLevel("/content/a/b", resolver))); assertEquals(2, Path.getAbsoluteLevel("/content/a/b", resolver)); assertEquals(1, Path.getAbsoluteLevel("/content/a", resolver)); assertEquals(0, Path.getAbsoluteLevel("/content", resolver)); assertEquals(-1, Path.getAbsoluteLevel("/", resolver)); assertEquals(-1, Path.getAbsoluteLevel("", resolver)); assertEquals(-1, Path.getAbsoluteLevel(null, resolver)); }
public static int getAbsoluteLevel(@NotNull String path, @NotNull ResourceResolver resourceResolver) { if (StringUtils.isEmpty(path) || StringUtils.equals(path, "/")) { return -1; } String originalPath = getOriginalPath(path, resourceResolver); return StringUtils.countMatches(originalPath, "/") - 1; }
Path { public static int getAbsoluteLevel(@NotNull String path, @NotNull ResourceResolver resourceResolver) { if (StringUtils.isEmpty(path) || StringUtils.equals(path, "/")) { return -1; } String originalPath = getOriginalPath(path, resourceResolver); return StringUtils.countMatches(originalPath, "/") - 1; } }
Path { public static int getAbsoluteLevel(@NotNull String path, @NotNull ResourceResolver resourceResolver) { if (StringUtils.isEmpty(path) || StringUtils.equals(path, "/")) { return -1; } String originalPath = getOriginalPath(path, resourceResolver); return StringUtils.countMatches(originalPath, "/") - 1; } private  Path(); }
Path { public static int getAbsoluteLevel(@NotNull String path, @NotNull ResourceResolver resourceResolver) { if (StringUtils.isEmpty(path) || StringUtils.equals(path, "/")) { return -1; } String originalPath = getOriginalPath(path, resourceResolver); return StringUtils.countMatches(originalPath, "/") - 1; } private  Path(); static String getAbsoluteParent(@NotNull String path, int parentLevel, @NotNull ResourceResolver resourceResolver); @SuppressWarnings("null") static Page getAbsoluteParent(@NotNull Page page, int parentLevel, @NotNull ResourceResolver resourceResolver); static int getAbsoluteLevel(@NotNull String path, @NotNull ResourceResolver resourceResolver); static String getOriginalPath(@NotNull String path, @NotNull ResourceResolver resourceResolver); static boolean isExperienceFragmentPath(@NotNull String path); static boolean isEditableTemplatePath(@NotNull String path); }
Path { public static int getAbsoluteLevel(@NotNull String path, @NotNull ResourceResolver resourceResolver) { if (StringUtils.isEmpty(path) || StringUtils.equals(path, "/")) { return -1; } String originalPath = getOriginalPath(path, resourceResolver); return StringUtils.countMatches(originalPath, "/") - 1; } private  Path(); static String getAbsoluteParent(@NotNull String path, int parentLevel, @NotNull ResourceResolver resourceResolver); @SuppressWarnings("null") static Page getAbsoluteParent(@NotNull Page page, int parentLevel, @NotNull ResourceResolver resourceResolver); static int getAbsoluteLevel(@NotNull String path, @NotNull ResourceResolver resourceResolver); static String getOriginalPath(@NotNull String path, @NotNull ResourceResolver resourceResolver); static boolean isExperienceFragmentPath(@NotNull String path); static boolean isEditableTemplatePath(@NotNull String path);  }