Class CmsHookListSearchCategory
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<String>,Collection<String>,Deque<String>,List<String>,Queue<String>,SequencedCollection<String>
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 :
During a request - response cycle it clears the list (prepareCommit)
of categories and adds all request parameters (actionCommitValue) to the list. CmsWidgetDialog
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 ().
At that time it is detected wether we have "lost" categories. If this is the
case, the search page will be reset to start. CmsSearch.getSearchResult()
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-
CmsWidgetDialog.DIALOG_SAVE -
CmsDialog.DIALOG_BACK -
CmsDialog.DIALOG_CONTINUE
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:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionCmsHookListSearchCategory(org.opencms.search.CmsSearchParameters peer) CmsHookListSearchCategory(org.opencms.search.CmsSearchParameters peer, Collection<String> c) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidA category has been added: do nothing.protected voidReact on the performed operationby informing argument peer.List.add(java.lang.Object)protected voidTakes a copy of the current categories contained to a backup list as this operation is triggered by.CmsWidgetDialog.ACTION_SAVEprotected voidReact on the performed operationby informing argument peer.List.clear()protected voidSet the search page of the peer Object () to zero if the internal backup list of categories (taken at clear time which is triggered byCmsSearch.setSearchPage(int)) was empty (no restriction) and now categories are contained or if the new backup list of categories is no subset of the current categories any more (more restrictive search than before).CmsWidgetDialog.ACTION_SAVEprotected voidonIteratorCall(Object peer) React on the performed operationby informing argument peer.List.iterator()protected voidA category has been removed: set search page to start page as new results may / will be smaller.Methods inherited from class org.opencms.workplace.tools.searchindex.CmsHookList
add, add, clear, get, iterator, removeMethods inherited from class java.util.LinkedList
addAll, addAll, addFirst, addLast, clone, contains, descendingIterator, element, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, reversed, set, size, spliterator, toArray, toArrayMethods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, listIterator, removeAll, replaceAll, retainAll, sort, subList
-
Constructor Details
-
CmsHookListSearchCategory
- Parameters:
peer- the search parameters to modify upon category modifications.
-
CmsHookListSearchCategory
- Parameters:
peer- the search parameters to modify upon category modificationsc- a collection with all values for this list
-
-
Method Details
-
onAdded
A category has been added: do nothing.- Specified by:
onAddedin classCmsHookList- Parameters:
peer- the object reactions on operations shall be made on in this "listlet" methodindex- the index the element was added atelement- the element that was added- See Also:
-
onAdded
Description copied from class:CmsHookListReact on the performed operationby informing argument peer.List.add(java.lang.Object)- Specified by:
onAddedin classCmsHookList- Parameters:
peer- the object reactions on operations shall be made on in this "listlet" methodadded- the element that was successfully added- See Also:
-
onClear
Takes a copy of the current categories contained to a backup list as this operation is triggered by.CmsWidgetDialog.ACTION_SAVE- Specified by:
onClearin classCmsHookList- Parameters:
peer- the object reactions on operations shall be made on in this "listlet" method- See Also:
-
onCleared
Description copied from class:CmsHookListReact on the performed operationby informing argument peer.List.clear()This is called after the actual clear operation has taken place.
- Specified by:
onClearedin classCmsHookList- Parameters:
peer- the object reactions on operations shall be made on in this "listlet" method- See Also:
-
onGetCall
Set the search page of the peer Object () to zero if the internal backup list of categories (taken at clear time which is triggered byCmsSearch.setSearchPage(int)) was empty (no restriction) and now categories are contained or if the new backup list of categories is no subset of the current categories any more (more restrictive search than before).CmsWidgetDialog.ACTION_SAVE- Specified by:
onGetCallin classCmsHookList- Parameters:
peer- the object reactions on operations shall be made on in this "listlet" methodindex- the index of the Object to get- See Also:
-
onIteratorCall
Description copied from class:CmsHookListReact on the performed operationby informing argument peer.List.iterator()Note that the iterator is only obtained but not given to the requesting client when this handler is invoked.
- Specified by:
onIteratorCallin classCmsHookList- Parameters:
peer- the object reactions on operations shall be made on in this "listlet" method- See Also:
-
onRemoved
A category has been removed: set search page to start page as new results may / will be smaller.- Specified by:
onRemovedin classCmsHookList- Parameters:
peer- the object reactions on operations shall be made on in this "listlet" methodindex- the index where the value has been removed- See Also:
-