com.webmethods.caf.faces.bean.search
Class BaseSearchResultPageBean

java.lang.Object
  extended by com.webmethods.caf.faces.bean.BaseFacesBean
      extended by com.webmethods.caf.faces.bean.BaseFacesSessionBean
          extended by com.webmethods.caf.faces.bean.BaseViewBean
              extended by com.webmethods.caf.faces.bean.BasePortletPageBean
                  extended by com.webmethods.caf.faces.bean.search.BaseSearchResultPageBean
All Implemented Interfaces:
IPageFlowScopeAdapter, ISearchPageBean, ISearchResultsPageBean
Direct Known Subclasses:
BaseTableSearchResultPageBean, BaseTreeSearchResultPageBean

public abstract class BaseSearchResultPageBean
extends BasePortletPageBean
implements ISearchPageBean, ISearchResultsPageBean

Base page bean for search result pages

Since:
7.0

Nested Class Summary
 
Nested classes/interfaces inherited from class com.webmethods.caf.faces.bean.BaseViewBean
BaseViewBean.ClientIdsContentProvider
 
Field Summary
protected  ISearchQuery fActiveSearchQuery
          Holds the active search query for the search results table control
protected  String fPreviousRequestSearchQuery
          holds the query string for the previous request
protected  boolean fQueryChanged
          indicates if current query has changed and new search is needed
protected  List fSortableColumns
          Temporary list of sortable columns
protected  List fViewableColumns
          Temporary list of viewable columns
protected static 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.
 
Fields inherited from class com.webmethods.caf.faces.bean.BaseViewBean
clientIds, initialized
 
Fields inherited from class com.webmethods.caf.faces.bean.BaseFacesSessionBean
fExpireWithPageFlow
 
Fields inherited from class com.webmethods.caf.faces.bean.BaseFacesBean
DATA_BINDING_CLIENTS, OUTCOME_ERROR, OUTCOME_OK, resourcesProviders
 
Constructor Summary
BaseSearchResultPageBean()
           
 
Method Summary
protected  void applyUserPreferences(DataTable dataTable)
          Apply the user preferences to the data table.
protected  void beforeApplyRequestValues()
          Overrides the default behavior to destroy old cached query object if the query string has changed.
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.
protected  ISearchQuery createSearchQuery()
          Creates and returns a new SearchQuery object for the SearchBar control.
 ISearchQuery getActiveSearchQuery()
          Gets the active search query object for the SearchBar control.
 String getActiveSearchQueryString()
          Return the active search query string.
abstract  UIComponent getActiveSearchResultsControl()
          Return the active search results component (table, tree, whatever).
 String getColumnWidthsPreference()
          Return the column widths preference.
 String[] getDisplayColumnsPreference()
          Return the display column preference.
 int getInitialPageSize()
          Return the initialPageSize preference value.
 Boolean getInitialSortAscendingPreference()
          Return the initialSortBy preference.
 String getInitialSortByPreference()
          Return the initialSortBy preference.
 List getSortableColumnList()
          Returns the list of sortable columns
 List getViewableColumnList()
          Returns the list of viewable columns
protected  boolean isApplyPreferencesNeeded()
          Returns wheter the user options need to be applied to the search result control
 boolean isQueryChanged()
          Returns whether the query has changed from the previous request
 boolean isSearchBarAvailable()
          Returns true if there is a wired search bar portlet to drive results portlet.
 String persistDisplayOptions()
          Action handler for the drag-to-resize/reorder-columns updates.
protected  void setActiveSearchQuery(ISearchQuery activeSearchQuery)
          Sets the active search query object for the SearchBar control.
 void setColumnWidthsPreference(String columnWidths)
          Sets the column widths preference.
 void setDisplayColumnsPreference(String[] columnDisplay)
          Sets the display column preference.
 void setInitialPageSize(int value)
          Sets the initial page size preference
 void setInitialSortAscendingPreference(Boolean value)
          Sets the initialSortAscendinbg preference.
 void setInitialSortByPreference(String value)
          Sets the initialSortBy preference.
 
Methods inherited from class com.webmethods.caf.faces.bean.BasePortletPageBean
beforeWorkspaceLoad, callInitialize, clearNavigationState, createActionUrl, createRenderUrl, getActivePreferencesBean, getPreferences, getRequestID, gotoPage, switchToPortletMode
 
Methods inherited from class com.webmethods.caf.faces.bean.BaseViewBean
afterApplyRequestValues, afterInvokeApplication, afterPhase, afterProcessValidations, afterRenderResponse, afterRestoreView, afterUpdateModelValues, beforeInvokeApplication, beforePhase, beforeProcessValidations, beforeRestoreView, beforeUpdateModelValues, findComponent, findComponentInRoot, getApplicationScope, getClientIds, getPhaseId, getRealPath, getRequestParam, getRequestScope, getSessionScope, gotoPage, initialize, isAsyncRequest, release, resetPageFlowStorage, streamFileDataToResponse
 
Methods inherited from class com.webmethods.caf.faces.bean.BaseFacesSessionBean
getExpireWithPageFlow, setExpireWithPageFlow, valueBound, valueUnbound
 
Methods inherited from class com.webmethods.caf.faces.bean.BaseFacesBean
createMethodBinding, createValueBinding, error, error, error, error, error, getBean, getFacesContext, getLocale, getResourceInputStream, getResources, getResourcesProvider, getRootCause, getStackTrace, getTreeAttribute, isUserInRole, log, log, log, putTreeAttribute, resetDataBindingClients, resolveDataBinding, resolveDataBinding, resolveExpression, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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:
Constant Field Values

fViewableColumns

protected transient List fViewableColumns
Temporary list of viewable columns


fSortableColumns

protected transient List 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 Detail

BaseSearchResultPageBean

public BaseSearchResultPageBean()
Method Detail

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:
BaseViewBean.beforeRenderResponse()

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:
BaseViewBean.beforeApplyRequestValues()

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:
PortletModeException
Exception

getSortableColumnList

public List getSortableColumnList()
Returns the list of sortable columns

Returns:
list of sortable columns

getViewableColumnList

public List 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