You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wire virtual catalogue selection into the browser history so that selecting "Emails" in the dropdown updates the URL and navigating directly to that URL restores the correct catalogue view. Reuses the existing$prefilter URL scheme — no new URL token types, no changes to Search.RESOLVER.
Part of:#3382 Depends on:#3662 (Phase 2 — virtual catalogue list IDs must exist before history can reference them)
The @Search_emails token is parsed by the existing handlePreFilterSearch() in CatalogueSearch, which puts it into classFilters keyed by "Search_emails". The constructor then recognises it as a virtual catalogue listId (not a class simple name) and pre-selects it.
Bug Fix in CatalogueSearch.handlePreFilterSearch()
Currently, when @Search_emails appears with no following field/value tokens (user just selected the catalogue), filterTokens is empty. SearchFilters.createFilterFromHistoryTokens([]) returns AllFilterParameter. The existing code then rejects this with a logger error:
// CURRENT — incorrectly rejects empty filter tokensif (!filter.equals(newFilter(newAllFilterParameter()))) {
classFilters.put(aClass, filter);
} else {
logger.error("Could not parse filter..."); // ← fires for @Search_emails with no fields
}
// FIXEDif (!filterTokens.isEmpty()) {
// User provided field/value tokens — use the parsed filterclassFilters.put(aClass, filter);
} elseif (!classes.isEmpty()) {
// @X with no filter tokens — valid: show the catalogue unfilteredclassFilters.put(aClass, newFilter(newAllFilterParameter()));
} else {
logger.error("Could not parse filter for classes: " + StringUtils.join(classes, ", "));
}
Note
This fix also benefits standard class selectors (@IndexedAIP with no filter), which previously had the same silent-rejection behaviour.
CatalogueSearch Constructor — Recognise Virtual ListIds in classFilters
After the existing loop over searchableClasses, add a block that checks for virtual catalogue listIds:
// After the searchableClasses loop:for (StringlistId : virtualCatalogueIds) {
if (classFilters.containsKey(listId)) {
FilteruserFilter = classFilters.get(listId);
// Merge with base ChildOfFilterParameter (Phase 2 logic)preselectedDropdownValue = listId;
// ... build and register the virtual list builder as in Phase 2
}
}
// After all list builders are registered:if (preselectedDropdownValue != null) {
searchWrapper.changeDropdownSelectedValue(preselectedDropdownValue);
}
Dropdown Change → History Push
In CatalogueSearch, register a value-change handler on the SearchWrapper dropdown. When the user switches to a virtual catalogue, push a new history token:
searchWrapper.addDropdownValueChangeHandler(event -> {
StringselectedValue = event.getValue();
if (virtualCatalogueIds.contains(selectedValue)) {
Stringlabel = ConfigurationManager.resolveTranslation(
RodaConstants.UI_LISTS_PROPERTY, selectedValue,
RodaConstants.UI_LISTS_CATALOGUE_LABEL_I18N_PROPERTY);
History.newItem(
Search.RESOLVER.getHistoryToken()
+ "/" + RodaConstants.SEARCH_WITH_PREFILTER_HANDLER
+ "/title/" + URL.encodeQueryString(label)
+ "/@" + selectedValue,
false// do not fire history change event — already handling it
);
}
});
Warning
Pass false as the second argument to History.newItem() to avoid a re-entrant history change event that would reload the page. The current view is already correct; we only want the URL to update for bookmarking/sharing.
No Changes Required
The following files do not need changes for this phase:
Overview
Wire virtual catalogue selection into the browser history so that selecting "Emails" in the dropdown updates the URL and navigating directly to that URL restores the correct catalogue view. Reuses the existing
$prefilterURL scheme — no new URL token types, no changes toSearch.RESOLVER.Part of: #3382
Depends on: #3662 (Phase 2 — virtual catalogue list IDs must exist before history can reference them)
URL Format
The existing prefilter URL scheme is:
Virtual catalogues use the
listIdin place of the class name. Examples:#search/$prefilter/title/Emails/@Search_emails#search/$prefilter/title/Emails/@Search_emails/subject_txt/quarterly#search/$prefilter/title/AIPs/@IndexedAIPThe
@Search_emailstoken is parsed by the existinghandlePreFilterSearch()inCatalogueSearch, which puts it intoclassFilterskeyed by"Search_emails". The constructor then recognises it as a virtual catalogue listId (not a class simple name) and pre-selects it.Bug Fix in
CatalogueSearch.handlePreFilterSearch()File:
roda-ui/roda-wui/src/main/java/org/roda/wui/client/common/search/CatalogueSearch.javaCurrently, when
@Search_emailsappears with no following field/value tokens (user just selected the catalogue),filterTokensis empty.SearchFilters.createFilterFromHistoryTokens([])returnsAllFilterParameter. The existing code then rejects this with a logger error:Fix: distinguish "empty filter tokens = valid catalogue selection" from "parse failure":
Note
This fix also benefits standard class selectors (
@IndexedAIPwith no filter), which previously had the same silent-rejection behaviour.CatalogueSearchConstructor — Recognise Virtual ListIds inclassFiltersAfter the existing loop over
searchableClasses, add a block that checks for virtual catalogue listIds:Dropdown Change → History Push
In
CatalogueSearch, register a value-change handler on theSearchWrapperdropdown. When the user switches to a virtual catalogue, push a new history token:Warning
Pass
falseas the second argument toHistory.newItem()to avoid a re-entrant history change event that would reload the page. The current view is already correct; we only want the URL to update for bookmarking/sharing.No Changes Required
The following files do not need changes for this phase:
Search.java—RESOLVERalready handles$prefiltertokensSearchWithPreFilters.java— already stripstitle/{TITLE}and passes the rest toCatalogueSearchFiles to Change
roda-ui/.../client/common/search/CatalogueSearch.javahandlePreFilterSearch, handle virtual listIds in constructor, add dropdown change handler