@Test void testGetOriginalPath_LegacyVersionHistory_Tenant() { context.registerAdapter(ResourceResolver.class, Tenant.class, tenant); assertEquals("/content/a/b/c", Path.getOriginalPath("/content/versionhistory/tenant1/user1/a/b/c", resolver)); }
public static String getOriginalPath(@NotNull String path, @NotNull ResourceResolver resourceResolver) { if (StringUtils.isEmpty(path)) { return null; } Matcher versionHistoryMatcher = VERSION_HISTORY_PATTERN.matcher(path); if (versionHistoryMatcher.matches()) { return "/content" + versionHistoryMatcher.group(1); } Matcher legacyVersionHistoryMatcher = LEGACY_VERSION_HISTORY_PATTERN.matcher(path); if (legacyVersionHistoryMatcher.matches()) { if (isTenant(resourceResolver)) { legacyVersionHistoryMatcher = LEGACY_VERSION_HISTORY_TENANT_PATTERN.matcher(path); } if (legacyVersionHistoryMatcher.matches()) { return "/content" + legacyVersionHistoryMatcher.group(1); } } Matcher launchesMatcher = LAUNCHES_PATTERN.matcher(path); if (launchesMatcher.matches()) { return launchesMatcher.group(1); } return path; }
Path { public static String getOriginalPath(@NotNull String path, @NotNull ResourceResolver resourceResolver) { if (StringUtils.isEmpty(path)) { return null; } Matcher versionHistoryMatcher = VERSION_HISTORY_PATTERN.matcher(path); if (versionHistoryMatcher.matches()) { return "/content" + versionHistoryMatcher.group(1); } Matcher legacyVersionHistoryMatcher = LEGACY_VERSION_HISTORY_PATTERN.matcher(path); if (legacyVersionHistoryMatcher.matches()) { if (isTenant(resourceResolver)) { legacyVersionHistoryMatcher = LEGACY_VERSION_HISTORY_TENANT_PATTERN.matcher(path); } if (legacyVersionHistoryMatcher.matches()) { return "/content" + legacyVersionHistoryMatcher.group(1); } } Matcher launchesMatcher = LAUNCHES_PATTERN.matcher(path); if (launchesMatcher.matches()) { return launchesMatcher.group(1); } return path; } }
Path { public static String getOriginalPath(@NotNull String path, @NotNull ResourceResolver resourceResolver) { if (StringUtils.isEmpty(path)) { return null; } Matcher versionHistoryMatcher = VERSION_HISTORY_PATTERN.matcher(path); if (versionHistoryMatcher.matches()) { return "/content" + versionHistoryMatcher.group(1); } Matcher legacyVersionHistoryMatcher = LEGACY_VERSION_HISTORY_PATTERN.matcher(path); if (legacyVersionHistoryMatcher.matches()) { if (isTenant(resourceResolver)) { legacyVersionHistoryMatcher = LEGACY_VERSION_HISTORY_TENANT_PATTERN.matcher(path); } if (legacyVersionHistoryMatcher.matches()) { return "/content" + legacyVersionHistoryMatcher.group(1); } } Matcher launchesMatcher = LAUNCHES_PATTERN.matcher(path); if (launchesMatcher.matches()) { return launchesMatcher.group(1); } return path; } private  Path(); }
Path { public static String getOriginalPath(@NotNull String path, @NotNull ResourceResolver resourceResolver) { if (StringUtils.isEmpty(path)) { return null; } Matcher versionHistoryMatcher = VERSION_HISTORY_PATTERN.matcher(path); if (versionHistoryMatcher.matches()) { return "/content" + versionHistoryMatcher.group(1); } Matcher legacyVersionHistoryMatcher = LEGACY_VERSION_HISTORY_PATTERN.matcher(path); if (legacyVersionHistoryMatcher.matches()) { if (isTenant(resourceResolver)) { legacyVersionHistoryMatcher = LEGACY_VERSION_HISTORY_TENANT_PATTERN.matcher(path); } if (legacyVersionHistoryMatcher.matches()) { return "/content" + legacyVersionHistoryMatcher.group(1); } } Matcher launchesMatcher = LAUNCHES_PATTERN.matcher(path); if (launchesMatcher.matches()) { return launchesMatcher.group(1); } return path; } 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 String getOriginalPath(@NotNull String path, @NotNull ResourceResolver resourceResolver) { if (StringUtils.isEmpty(path)) { return null; } Matcher versionHistoryMatcher = VERSION_HISTORY_PATTERN.matcher(path); if (versionHistoryMatcher.matches()) { return "/content" + versionHistoryMatcher.group(1); } Matcher legacyVersionHistoryMatcher = LEGACY_VERSION_HISTORY_PATTERN.matcher(path); if (legacyVersionHistoryMatcher.matches()) { if (isTenant(resourceResolver)) { legacyVersionHistoryMatcher = LEGACY_VERSION_HISTORY_TENANT_PATTERN.matcher(path); } if (legacyVersionHistoryMatcher.matches()) { return "/content" + legacyVersionHistoryMatcher.group(1); } } Matcher launchesMatcher = LAUNCHES_PATTERN.matcher(path); if (launchesMatcher.matches()) { return launchesMatcher.group(1); } return path; } 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);  }