Class BaseSearchPageBean

All Implemented Interfaces:
IPageFlowScopeAdapter, ISearchBarPageBean, ISearchPageBean, ISearchResultsPageBean, Serializable, EventListener, PhaseListener, HttpSessionBindingListener

public abstract class BaseSearchPageBean extends BaseWebPageBean implements ISearchBarPageBean, ISearchResultsPageBean, ISearchPageBean
Base class for a CAF view that contains both a searchbar and search results table in the same view.
See Also:
  • Field Details

    • SEARCH_RESULT_PREFERENCES_APPLIED_KEY

      protected static final String SEARCH_RESULT_PREFERENCES_APPLIED_KEY
      Attribute name used to flag whether the search result preferences have been applied to the search result table control.
      See Also:
    • fSavedSearchProvider

      protected transient ISavedSearchProvider fSavedSearchProvider
      Reference to the current saved search provider
    • fSearchQueryFactory

      protected transient ISearchQueryFactory fSearchQueryFactory
      Reference to the current search query factory
    • fSearchOptionsManager

      protected transient ISearchOptionsManager fSearchOptionsManager
      Reference to the current search options manager
    • fSearchResultsOptionsManager

      protected transient ISearchResultsOptionsManager fSearchResultsOptionsManager
      Reference to the current search result options manager
    • fViewableColumns

      protected transient List<SelectItem> fViewableColumns
      Temporary list of viewable columns
    • fSortableColumns

      protected transient List<SelectItem> fSortableColumns
      Temporary list of sortable columns
    • fPreviousInvocationID

      protected int fPreviousInvocationID
      Holds the search invocation ID for the previous request
    • fQueryChanged

      protected boolean fQueryChanged
      indicates if current query has changed and new search is needed
    • resultsSearchQuery

      protected ISearchQuery resultsSearchQuery
      Holds the active search query for the search results table control
  • Constructor Details

    • BaseSearchPageBean

      public BaseSearchPageBean()
  • Method Details

    • getSearchResultsOptionsManager

      public ISearchResultsOptionsManager getSearchResultsOptionsManager()
      Gets the search results options manager
      Returns:
      searh results options manager
    • getSavedSearchProvider

      public ISavedSearchProvider getSavedSearchProvider()
      Description copied from interface: ISearchBarPageBean
      Creates and returns implementation of ISavedSearchProvider
      Specified by:
      getSavedSearchProvider in interface ISearchBarPageBean
    • getSearchOptionsManager

      public ISearchOptionsManager getSearchOptionsManager()
      Description copied from interface: ISearchBarPageBean
      Creates and returns implementation of ISearchOptionsManager
      Specified by:
      getSearchOptionsManager in interface ISearchBarPageBean
    • getSearchQueryFactory

      public ISearchQueryFactory getSearchQueryFactory()
      Description copied from interface: ISearchBarPageBean
      Creates and returns implementation of ISearchQueryFactory
      Specified by:
      getSearchQueryFactory in interface ISearchBarPageBean
    • loadSearchQueryDefaults

      public void loadSearchQueryDefaults(ISearchQuery query)
      Description copied from interface: ISearchBarPageBean
      Page bean may load default values into search query object
      Specified by:
      loadSearchQueryDefaults in interface ISearchBarPageBean
    • persistDisplayOptions

      public String persistDisplayOptions() throws Exception
      Description copied from interface: ISearchResultsPageBean
      Action handler for the drag-to-resize/reorder-columns updates. By default, it will persist the search results options via the portlet's preference beans' storePreferences() method.
      Specified by:
      persistDisplayOptions in interface ISearchResultsPageBean
      Returns:
      status of the action handler
      Throws:
      Exception
    • getActiveSearchQueryString

      public String getActiveSearchQueryString()
      Controls may use this method to determine if there is an active query
      Returns:
      empty string if there is not an active query, or "non-empty" if there is an active query
    • isSearchBarOnSimpleTab

      public boolean isSearchBarOnSimpleTab()
      Returns true if the active searchbar tab is the the 'Search' tab
      Returns:
      true if the active searchbar tab is the 'Search' tab
    • isSearchBarOnAdvancedTab

      public boolean isSearchBarOnAdvancedTab()
      Returns true if the active searchbar tab is the the 'Advanced' tab
      Returns:
      true if the active searchbar tab is the 'Advanced' tab
    • isSearchBarOnOptionsTab

      public boolean isSearchBarOnOptionsTab()
      Returns true if the active searchbar tab is the the 'Options' tab
      Returns:
      true if the active searchbar tab is the 'Options' tab
    • isSearchBarOnSavedTab

      public boolean isSearchBarOnSavedTab()
      Returns true if the active searchbar tab is the the 'Saved' tab
      Returns:
      true if the active searchbar tab is the 'Saved' tab
    • getSearchBarControl

      public abstract SearchBar getSearchBarControl()
      Retrieves the SearchBar control for this page
      Returns:
      SearchBar control for the page
    • getActiveSearchResultsControl

      public abstract UIComponent getActiveSearchResultsControl()
      Return the active search results component (table, tree, whatever).
      Returns:
      active search results component
    • getSafeSearchBarControl

      protected SearchBar getSafeSearchBarControl()
      Wrapper around the getSearchBarControl method that throws an exception if the SearchBar value is null
      Returns:
      SearchBar control for the page
    • getActiveSearchQuery

      public ISearchQuery getActiveSearchQuery()
      Gets the active search query object for the SearchBar control.
      Specified by:
      getActiveSearchQuery in interface ISearchPageBean
      Returns:
      Returns the activeSearchQuery.
    • getResultsSearchQuery

      public ISearchQuery getResultsSearchQuery()
      Gets the active search query object for the SearchResults control.
      Returns:
      Returns the resultsSearchQuery.
    • getActiveSavedSearch

      public ISavedSearch getActiveSavedSearch()
      Gets the active saved search object for the SearchBar control.
      Returns:
      Returns the activeSavedSearch.
    • createSearchQuery

      protected ISearchQuery createSearchQuery()
      Creates and returns a new SearchQuery object for the SearchBar control. Sub-classes may override to provide an alternate ISearchQuery implementation.
      Returns:
      Returns a new ISearchQuery object
    • beforeRenderResponse

      protected void beforeRenderResponse()
      Overrides the default behavior to detect when a search query has changed and apply user preferences to the search result table control before rendering.
      Overrides:
      beforeRenderResponse in class BaseViewBean
      See Also:
    • isQueryChanged

      public boolean isQueryChanged()
      Returns whether the query has changed from the previous request
      Returns:
      true if the query has changed, false otherwise
    • getDisplayColumnsPreference

      public String[] getDisplayColumnsPreference()
      Delegates to the same API on the current search result options manager
      See Also:
    • setDisplayColumnsPreference

      public void setDisplayColumnsPreference(String[] columnDisplay)
      Delegates to the same API on the current search result options manager
      See Also:
    • getInitialPageSize

      public int getInitialPageSize()
      Delegates to the same API on the current search result options manager
      See Also:
    • setInitialPageSize

      public void setInitialPageSize(int pageSize)
      Delegates to the same API on the current search result options manager
      See Also:
    • getInitialExportPageSize

      public int getInitialExportPageSize()
    • setInitialExportPageSize

      public void setInitialExportPageSize(int pageSize)
    • getColumnWidthsPreference

      public String getColumnWidthsPreference()
      Delegates to the same API on the current search result options manager
      See Also:
    • setColumnWidthsPreference

      public void setColumnWidthsPreference(String columnWidths)
      Delegates to the same API on the current search result options manager
      See Also:
    • getInitialSortByPreference

      public String getInitialSortByPreference()
      Delegates to the same API on the current search result options manager
      See Also:
    • setInitialSortByPreference

      public void setInitialSortByPreference(String sortBy)
      Delegates to the same API on the current search result options manager
      See Also:
    • getInitialSortAscendingPreference

      public Boolean getInitialSortAscendingPreference()
      Delegates to the same API on the current search result options manager
      See Also:
    • setInitialSortAscendingPreference

      public void setInitialSortAscendingPreference(Boolean ascending)
      Delegates to the same API on the current search result options manager
      See Also:
    • getSortableColumnList

      public List<SelectItem> getSortableColumnList()
      Returns the list of sortable columns
      Returns:
      list of sortable columns
    • getViewableColumnList

      public List<SelectItem> getViewableColumnList()
      Returns the list of viewable columns
      Returns:
      list of viewable columns
    • loadColumnInfoForControl

      public static void loadColumnInfoForControl(DataTable dataTable, List<SelectItem> viewableColumnList, List<SelectItem> sortableColumnList)
      Loads the column info for the requested control
      Parameters:
      viewableColumnList - list where the viewable columns are added
      sortableColumnList - list where the sortable columns are added
    • applyUserPreferences

      public static void applyUserPreferences(DataTable dataTable, String[] columnDisplay, String initialSortBy, String columnWidth, boolean initialSortAscending)
      Apply the user preferences to the data table.
      Parameters:
      dataTable - the search result table control
      columnDisplay - array of columns to display
      initialSortBy - column id to sort by
      columnWidth - widths of the displayed columns
      initialSortAscending - sort order
    • doSearch

      public String doSearch()
      Action handler for executing a search
      Returns:
      outcome of the actions