Class BaseSearchResultPageBean

All Implemented Interfaces:
IPageFlowScopeAdapter, ISearchPageBean, ISearchResultsPageBean, Serializable, EventListener, PhaseListener, HttpSessionBindingListener
Direct Known Subclasses:
BaseSearchBarPlusTableResultPageBean, BaseSearchBarPlusTreeResultPageBean, BaseTableSearchResultPageBean, BaseTreeSearchResultPageBean

public abstract class BaseSearchResultPageBean extends BasePortletPageBean implements ISearchPageBean, ISearchResultsPageBean
Base page bean for search result pages
Since:
7.0
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:
    • fViewableColumns

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

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

      protected String fPreviousRequestSearchQuery
      holds the query string for the previous request
    • fActiveSearchQuery

      protected ISearchQuery fActiveSearchQuery
      Holds the active search query for the search results table control
    • fQueryChanged

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

    • BaseSearchResultPageBean

      public BaseSearchResultPageBean()
  • Method Details

    • getActiveSearchQuery

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

      protected void setActiveSearchQuery(ISearchQuery activeSearchQuery)
      Sets the active search query object for the SearchBar control.
      Parameters:
      activeSearchQuery - The activeSearchQuery to set.
    • 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
    • isQueryChanged

      public boolean isQueryChanged()
      Returns whether the query has changed from the previous request
      Returns:
      true if the query has changed, false otherwise
    • 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:
    • beforeApplyRequestValues

      protected void beforeApplyRequestValues()
      Overrides the default behavior to destroy old cached query object if the query string has changed.
      Overrides:
      beforeApplyRequestValues in class BaseViewBean
      See Also:
    • isApplyPreferencesNeeded

      protected boolean isApplyPreferencesNeeded()
      Returns wheter the user options need to be applied to the search result control
      Returns:
      true if apply prefererences is needed, false otherwise
    • applyUserPreferences

      protected void applyUserPreferences(DataTable dataTable)
      Apply the user preferences to the data table.
      Parameters:
      dataTable - the search result table control
    • getActiveSearchQueryString

      public String getActiveSearchQueryString()
      Return the active search query string. Usually via a portlet property that is wired to a search bar portlet.
      Returns:
      the search query string
    • getActiveSearchResultsControl

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

      public String[] getDisplayColumnsPreference()
      Return the display column preference. Usually via a portlet property that is configured from the portlet edit mode.
      Returns:
      array of column ids that should be displayed in the given order
    • setDisplayColumnsPreference

      public void setDisplayColumnsPreference(String[] columnDisplay)
      Sets the display column preference. Usually via a portlet property that is configured from the portlet edit mode. param array of column ids that should be displayed in the given order
    • getColumnWidthsPreference

      public String getColumnWidthsPreference()
      Return the column widths preference. Usually via a portlet property that is configured from the portlet edit mode.
      Returns:
      csv-style map of column ids to column widths (ie "colOne=60%,colTwo=40%,colThree=20px")
    • setColumnWidthsPreference

      public void setColumnWidthsPreference(String columnWidths)
      Sets the column widths preference. Usually via a portlet property that is configured from the portlet edit mode. param csv-style map of column ids to column widths (ie "colOne=60%,colTwo=40%,colThree=20px")
    • setInitialSortByPreference

      public void setInitialSortByPreference(String value)
      Sets the initialSortBy preference.
      Parameters:
      value - the column id to sort by
    • getInitialSortByPreference

      public String getInitialSortByPreference()
      Return the initialSortBy preference. Usually via a portlet property that is configured from the portlet edit mode.
      Returns:
      id of the column to sort by initially
    • setInitialSortAscendingPreference

      public void setInitialSortAscendingPreference(Boolean value)
      Sets the initialSortAscendinbg preference.
      Parameters:
      value - true to sort in ascending order, false otherwise
    • getInitialSortAscendingPreference

      public Boolean getInitialSortAscendingPreference()
      Return the initialSortBy preference. Usually via a portlet property that is configured from the portlet edit mode.
      Returns:
      id of the column to sort by initially
    • setInitialPageSize

      public void setInitialPageSize(int value)
      Sets the initial page size preference
      Parameters:
      value - number of rows to display on each page of search results
    • getInitialPageSize

      public int getInitialPageSize()
      Return the initialPageSize preference value. Usually via a portlet property that is configured from the portlet edit mode.
    • persistDisplayOptions

      public String persistDisplayOptions() throws Exception
      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:
      javax.portlet.PortletModeException
      Exception
    • 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
    • isSearchBarAvailable

      public boolean isSearchBarAvailable() throws Exception
      Returns true if there is a wired search bar portlet to drive results portlet. It may be used to implement a Refresh button on the search result screen if there is no search bar available
      Throws:
      Exception