com.jalios.jcmsplugin.explorer
Class ExplorerConfiguration

java.lang.Object
  extended by com.jalios.jcmsplugin.explorer.ExplorerConfiguration

public class ExplorerConfiguration
extends Object

Class holding configuration options of the Explorer.

Version:
$Revision: 21399 $

Field Summary
static String EXPLORER_BASE_QUERY
          QueryHandler attribute used to indicated that the QueryHandler which contains this attribute is a 'serverside' QueryHandler used for an Explorer.
static String EXPLORER_USER_QUERY
          QueryHandler attribute used to indicated that the QueryHandler which contains this attribute is being used for user refinement in an Explorer.
static String REVISION
           
 
Constructor Summary
ExplorerConfiguration()
          Default constructor which builds a new ExplorerConfiguration with the default options.
 
Method Summary
 boolean canChangeCheckPstatus()
          Checks if the user is allowed to change the checkPstatus option for the Explorer.
 boolean canChangeSearchInFiles()
          Checks if the user is allowed to change the searchInFiles option for the Explorer.
 boolean canChangeViewMode()
          Checks if the user is allowed to change the view mode of the Explorer.
 String getCatMode()
          Retrieves the category refinement mode to use in this this configuration
 String[] getContentTypes()
          Retrieves the content types to use for refinement.
 List getFieldsList()
          Retrieves list of fields that should be displayed in explorer view.
static ExplorerConfiguration getInstance(javax.servlet.http.HttpServletRequest request)
          Retrieve the current ExplorerConfiguration stored in request attribute or create a default new one if it could not be found.
 Set getOpenedCategorySet()
          Retrieves the categories to open in the TreeCat
 Set getQueryHandlerSet()
          Retrieves the Set of QueryHandler to use as starting queries for the Explorer using this ExplorerConfiguration.
 Set getRefineCategorySet()
          Retrieves the categories selected by user for refinenement
 Workspace getRefineWorkspace()
          Retrieves the Workspace on which the refinement is being performed
 Set getRootCategorySet()
          Retrieves the root categories to use in the Explorer refinement options
 String getSort()
          Retrieve the sort order used for the Explorer.
 String getSrc()
          Retrieves the data source used in this configuration
 QueryHandler getUserQueryHandler()
          Retrieves the QueryHandler dedicated to receive all the final user refinement options.
 String getViewMode()
          Retrieves the view mode specified in this configuration
 boolean hasValidResultCache()
          Checks the current status of the result cache
 boolean isNavigationVisible()
          Check the categories panel should be displayed by default or not.
 boolean isRefiningOnDocument()
          Checks if FileDocument is the only type selected in types' refine options.
 boolean isReverse()
          Retrieves the current sort order (ascending or descending, depending on the comparator).
 boolean isSearchOptionsVisible()
          Check the search options panel should be displayed by default or not.
 boolean isSidebarVisible()
          Check the sidebar should be displayed by default or not.
 void putInRequest(javax.servlet.http.HttpServletRequest request)
          Put this ExplorerConfiguration as a request attribute (overwriting any prior ExplorerConfiguration attribute).
 void removeFromRequest(javax.servlet.http.HttpServletRequest request)
          Remove the current ExplorerConfiguration instance request attribute.
 void setAllowCheckPstatusChange(boolean allowCheckPstatusChange)
          Allows user to change the checkPstatus value to display invisible publication
 void setAllowSearchInFiles(boolean allowSearchInFiles)
          Allows user to change the searchInFiles value to perform text search on files
 void setAllowViewModeChange(boolean allowViewModeChange)
          Allows user to change the viewMode value.
 void setCatMode(String catMode)
          Changes the category user refinement mode to use in this this configuration
 void setCheckPstatus(boolean checkPstatus)
          Change the current checkpstatus option for all queryhandler to display visible or invisible publications.
 void setCheckPstatus(boolean checkPstatus, boolean checkAuthorization)
          Change the current checkpstatus option for all queryhandler to display visible or invisible publications.
 void setContentTypes(String[] contentTypes)
          Change the user content type refinement to use
 void setFieldsList(List fieldsList)
          Sets the list of fields that should be displayed in explorer view.
 void setOpenedCategories(Collection categories)
          Sets the categories to be opened in the TreeCat.
 void setPstatus(String[] pstatus)
          Sets the pstatus to use for refinement in the Explorer
 void setQueryHandlerSet(Set queryHandlerSet)
          Defines the Set of QueryHandler to be used as starting queries for the Explorer using this ExplorerConfiguration.
 void setRefineCategories(Collection categories)
          Sets the categories to be use for refinement
 void setRefineWorkspace(String wsId)
          Sets the workspace to be used by explorer for refinement
 void setReverse(boolean reverse)
          Set the sort order (ascending or descending) to use.
 void setRootCategorySet(Set rootCategorySet)
          Defines the root categories to be used in the explorer
 void setSearchInFiles(boolean searchInFiles)
          Change the current searchInFiles option for all queryhandler to perform text search in files too.
 void setSearchInFiles(boolean searchInFiles, boolean checkAuthorization)
          Change the current searchInFiles option for all queryhandler to perform text search in files too.
 void setShowNavigation(boolean showNavigation)
          Sets the default visibility of the categories panel.
 void setShowSearchOptions(boolean showSearchOptions)
          Sets the default visibility of the search options panel.
 void setShowSidebar(boolean showSidebar)
          Sets the default visibility of the sidebar.
 void setSort(String sort)
          Sets the sort order to use for the Explorer.
 void setSrc(String src)
          Changes the data source of this configuration
 void setText(String text)
          Sets the text to search
 void setTypes(String[] types)
          Sets the user type refinement to be use in the Explorer
 void setViewMode(String viewMode)
          Changes the view mode of this configuration.
 void toggleCategory(String catId)
          Add or remove the specified category from the current user refinement.
 String toString()
           
 void validateResultCache()
          Validate the cache status of the explorer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

EXPLORER_BASE_QUERY

public static final String EXPLORER_BASE_QUERY
QueryHandler attribute used to indicated that the QueryHandler which contains this attribute is a 'serverside' QueryHandler used for an Explorer. 'serverside' queryhandlers are the queryhandler which cannot be modified by the end user, thus defining a scope of publication being manipulated.


EXPLORER_USER_QUERY

public static final String EXPLORER_USER_QUERY
QueryHandler attribute used to indicated that the QueryHandler which contains this attribute is being used for user refinement in an Explorer.

Constructor Detail

ExplorerConfiguration

public ExplorerConfiguration()
Default constructor which builds a new ExplorerConfiguration with the default options.

Method Detail

putInRequest

public void putInRequest(javax.servlet.http.HttpServletRequest request)
Put this ExplorerConfiguration as a request attribute (overwriting any prior ExplorerConfiguration attribute).

Parameters:
request - the request in which to put this ExplorerConfiguration

removeFromRequest

public void removeFromRequest(javax.servlet.http.HttpServletRequest request)
Remove the current ExplorerConfiguration instance request attribute.

Parameters:
request - the request in which to remove the current ExplorerConfiguration

getInstance

public static ExplorerConfiguration getInstance(javax.servlet.http.HttpServletRequest request)
Retrieve the current ExplorerConfiguration stored in request attribute or create a default new one if it could not be found.

Parameters:
request - the request from which to retrieve the request attribute
Returns:
an ExplorerConfiguration instance (never return null)

validateResultCache

public void validateResultCache()
Validate the cache status of the explorer.


hasValidResultCache

public boolean hasValidResultCache()
Checks the current status of the result cache

Returns:
true if the cache is uptodate false otherwise.

setQueryHandlerSet

public void setQueryHandlerSet(Set queryHandlerSet)
Defines the Set of QueryHandler to be used as starting queries for the Explorer using this ExplorerConfiguration.
Those queries are defined on the server side and cannot be changed by the user whatsoever. There is a dedicated user query handler for the refinment option decided by the user (getUserQueryHandler()).

Parameters:
queryHandlerSet - a Set of QueryHandler, if null or empty, a set with a new QueryHandler using default value is defined.

getQueryHandlerSet

public Set getQueryHandlerSet()
Retrieves the Set of QueryHandler to use as starting queries for the Explorer using this ExplorerConfiguration.

Returns:
a Set of QueryHandler, never return null

setRootCategorySet

public void setRootCategorySet(Set rootCategorySet)
Defines the root categories to be used in the explorer

Parameters:
rootCategorySet - a Set of Category, if null the channel

getRootCategorySet

public Set getRootCategorySet()
Retrieves the root categories to use in the Explorer refinement options

Returns:
a Set of Category, never return null.

setAllowCheckPstatusChange

public void setAllowCheckPstatusChange(boolean allowCheckPstatusChange)
Allows user to change the checkPstatus value to display invisible publication

Parameters:
allowCheckPstatusChange - true to allow user to change the default option, false otherwise

canChangeCheckPstatus

public boolean canChangeCheckPstatus()
Checks if the user is allowed to change the checkPstatus option for the Explorer.

Returns:
true if the user can change it, false otherwise.

setAllowSearchInFiles

public void setAllowSearchInFiles(boolean allowSearchInFiles)
Allows user to change the searchInFiles value to perform text search on files

Parameters:
allowSearchInFiles - true to allow user to change the default option, false otherwise

canChangeSearchInFiles

public boolean canChangeSearchInFiles()
Checks if the user is allowed to change the searchInFiles option for the Explorer.

Returns:
true if the user can change it, false otherwise.

setAllowViewModeChange

public void setAllowViewModeChange(boolean allowViewModeChange)
Allows user to change the viewMode value.

Parameters:
allowViewModeChange - true to allow view mode change, false otherwise.

canChangeViewMode

public boolean canChangeViewMode()
Checks if the user is allowed to change the view mode of the Explorer.

Returns:
true if the user can change view mode, false otherwise

isSidebarVisible

public boolean isSidebarVisible()
Check the sidebar should be displayed by default or not.

Returns:
true to display the sidebar, false otherwise

setShowSidebar

public void setShowSidebar(boolean showSidebar)
Sets the default visibility of the sidebar.

Parameters:
showSidebar - true to display sidebar, false otherwise.

isNavigationVisible

public boolean isNavigationVisible()
Check the categories panel should be displayed by default or not.

Returns:
true to display the categories panel, false otherwise

setShowNavigation

public void setShowNavigation(boolean showNavigation)
Sets the default visibility of the categories panel.

Parameters:
showNavigation - true to display categories panel, false otherwise.

isSearchOptionsVisible

public boolean isSearchOptionsVisible()
Check the search options panel should be displayed by default or not.

Returns:
true to display the search options panel, false otherwise

setShowSearchOptions

public void setShowSearchOptions(boolean showSearchOptions)
Sets the default visibility of the search options panel.

Parameters:
showSearchOptions - true to search options panel, false otherwise.

getFieldsList

public List getFieldsList()
Retrieves list of fields that should be displayed in explorer view.

Returns:
a List of field name e.g. { "id", "title", "mdate" }
See Also:
ExplorerFields

setFieldsList

public void setFieldsList(List fieldsList)
Sets the list of fields that should be displayed in explorer view.

Parameters:
fieldsList - a List of field name e.g. { "id", "title", "mdate" }
See Also:
ExplorerFields

getUserQueryHandler

public QueryHandler getUserQueryHandler()
Retrieves the QueryHandler dedicated to receive all the final user refinement options.

Do not change option of this queryhandler, use method of this class.

Returns:
a QueryHandler instance, never return null.

setViewMode

public void setViewMode(String viewMode)
Changes the view mode of this configuration.

Parameters:
viewMode - a string from the ExplorerUtils.getAvailableViewModes(), if an invalid mode or null, the default value (as returned by ExplorerUtils.getDefaultViewMode() will be used.

getViewMode

public String getViewMode()
Retrieves the view mode specified in this configuration

Returns:
a string from the ExplorerUtils.getAvailableViewModes().

setSrc

public void setSrc(String src)
Changes the data source of this configuration

Parameters:
src - a string from ExplorerUtils.getAvailableSrc() if null or invalid, the default value is used

getSrc

public String getSrc()
Retrieves the data source used in this configuration

Returns:
a string from ExplorerUtils.getAvailableSrc() or null when using default value

setCatMode

public void setCatMode(String catMode)
Changes the category user refinement mode to use in this this configuration

Parameters:
catMode - the mode to use, from "one", "and", "or".

getCatMode

public String getCatMode()
Retrieves the category refinement mode to use in this this configuration

Returns:
a string from "one", "and", "or" (never returns something else)

toggleCategory

public void toggleCategory(String catId)
Add or remove the specified category from the current user refinement. Use the current category refinement mode.

Parameters:
catId - the id of the Category to toggle

setRefineCategories

public void setRefineCategories(Collection categories)
Sets the categories to be use for refinement

Parameters:
categories - a Collection of Category

getRefineCategorySet

public Set getRefineCategorySet()
Retrieves the categories selected by user for refinenement

Returns:
a set of Category

setOpenedCategories

public void setOpenedCategories(Collection categories)
Sets the categories to be opened in the TreeCat.

Parameters:
categories - a Collection of Category

getOpenedCategorySet

public Set getOpenedCategorySet()
Retrieves the categories to open in the TreeCat

Returns:
a set of Category

setPstatus

public void setPstatus(String[] pstatus)
Sets the pstatus to use for refinement in the Explorer

Parameters:
pstatus - an array of String, each string being a pstatus, eg. {"-10", "20"}

setCheckPstatus

public void setCheckPstatus(boolean checkPstatus)
Change the current checkpstatus option for all queryhandler to display visible or invisible publications.
The value will be changed only if allowed by canChangeCheckPstatus()

Parameters:
checkPstatus - true to display only publication in a visible state, false to display all publications

setCheckPstatus

public void setCheckPstatus(boolean checkPstatus,
                            boolean checkAuthorization)
Change the current checkpstatus option for all queryhandler to display visible or invisible publications.
If the authorization check is asked, the value will be changed only if allowed by canChangeCheckPstatus()

Parameters:
checkPstatus - true to display only publication in a visible state, false to display all publications
checkAuthorization - whether to check for value of canChangeCheckPstatus() before performing any change. true to check for authorization, false to bypass current authorization settings.

setText

public void setText(String text)
Sets the text to search

Parameters:
text - whatever text to search

setSearchInFiles

public void setSearchInFiles(boolean searchInFiles)
Change the current searchInFiles option for all queryhandler to perform text search in files too.
The value will be changed only if allowed by canChangeSearchInFiles()

Parameters:
searchInFiles - true to perform text search in files, false otherwise

setSearchInFiles

public void setSearchInFiles(boolean searchInFiles,
                             boolean checkAuthorization)
Change the current searchInFiles option for all queryhandler to perform text search in files too.
If the authorization check is asked, the value will be changed only if allowed by canChangeSearchInFiles()

Parameters:
searchInFiles - true to perform text search in files, false otherwise
checkAuthorization - whether to check for value of canChangeSearchInFiles() before performing any change. true to check for authorization, false to bypass current authorization settings

setTypes

public void setTypes(String[] types)
Sets the user type refinement to be use in the Explorer

Parameters:
types - an array of String, each string being a classname, eg. {"Content", "generated.Article"}

isRefiningOnDocument

public boolean isRefiningOnDocument()
Checks if FileDocument is the only type selected in types' refine options.

Returns:
true if FileDocument only are being displayed, false if any other type is being displayed too

setContentTypes

public void setContentTypes(String[] contentTypes)
Change the user content type refinement to use

Parameters:
contentTypes - an array of String, each string being a content type regexp from the allowed values ExplorerUtils.getAvailableContentTypes(), eg. {"text/*", "application/msword"}

getContentTypes

public String[] getContentTypes()
Retrieves the content types to use for refinement.

Returns:
an array of String, each string being a content type regexp eg. {"text/*", "application/msword"}

setRefineWorkspace

public void setRefineWorkspace(String wsId)
Sets the workspace to be used by explorer for refinement

Parameters:
wsId - a Workspace ID or null to reset workspace refinement

getRefineWorkspace

public Workspace getRefineWorkspace()
Retrieves the Workspace on which the refinement is being performed

Returns:
the Workspace used for refinement, if any or null if using all user's workspace

getSort

public String getSort()
Retrieve the sort order used for the Explorer.

Returns:
a String indicating the comparator that will be retrieved using com.jalios.jcms.Publication#getComparator(String, boolean, com.jalios.jcms.QueryResultSet)

setSort

public void setSort(String sort)
Sets the sort order to use for the Explorer.

Parameters:
sort - a String indicating the comparator to used, must be a valid parameter of com.jalios.jcms.Publication#getComparator(String, boolean, com.jalios.jcms.QueryResultSet)

isReverse

public boolean isReverse()
Retrieves the current sort order (ascending or descending, depending on the comparator).

Returns:
true if the reverse order of the comparator is used false if the comparator is used as is.

setReverse

public void setReverse(boolean reverse)
Set the sort order (ascending or descending) to use.

Parameters:
reverse - true to use the reverse order of the comparator currently in use, false if the comparator will be used as is.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2001-2007 Jalios SA. All Rights Reserved.