Class CmsHookListSearchCategory

All Implemented Interfaces:
Serializable, Cloneable, Iterable<String>, Collection<String>, Deque<String>, List<String>, Queue<String>

A hook on the list of categories of the CmsSearchParameters (see CmsSearchParameters.setCategories(List)) that will set the page to display of the search parameters to start (1) whenever a change in the amount of categories takes place.

This hook monitors the actions of the CmsWidgetDialog: During a request - response cycle it clears the list (prepareCommit) of categories and adds all request parameters (actionCommitValue) to the list.

The strategy here is to save all categories in a backup at "onClear" - time and then wait until all add operations are finished. This is when the iterator() method is triggered by the running search (CmsSearch.getSearchResult()). At that time it is detected wether we have "lost" categories. If this is the case, the search page will be reset to start.

Warning

This procedure is highly unstable as coupled to the behaviour of CmsWidgetDialog. It will only be successful if the request parameter "action" has a value in
  1. CmsWidgetDialog.DIALOG_SAVE
  2. CmsDialog.DIALOG_BACK
  3. CmsDialog.DIALOG_CONTINUE
Search page links (CmsSearch.getPageLinks()) contain a parameter "action" with value "search" which has to be rewritten to one of those values or the order of operations on widget - managed collections does not work together with the detection strategy for category changes used here.

Since:
6.0.0
See Also: