com.jalios.jcmsplugin.explorer
Class ExplorerUtils

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

public class ExplorerUtils
extends Object


Field Summary
static String ALLOW_DIRECT_ACCESS_PROP
          Property used to check if direct access to the explorer (using /plugins/ExplorerPlugin/jsp/explorer.jsp) is authorized or not.
protected static boolean allowDirectAccess
           
protected static boolean allowDirectAccessRead
           
static Channel channel
           
static String CONTENT_TYPES_PROP
          Property used to retrieve list of content type to be proposed for refinement
protected static String[] contentTypes
           
static String DEFAULT_VIEW_MODE_PROP
          Property used to retrieve default view mode.
static String SESSIONCACHE_PROP
          Property used to check if session cache are enabled or not.
protected static boolean sessionCacheEnabled
           
protected static boolean sessionCacheEnabledRead
           
static String VIEW_MODES_PROP
          Property prefix used to find view modes.
protected static Map viewModesMap
           
 
Constructor Summary
ExplorerUtils()
           
 
Method Summary
static String[] getAvailableContentTypes()
          Retrieves the content types to be proposed for refinement.
static String[] getAvailableSrc()
          Retrieves the available data source in the explorer.
static Set getAvailableViewModes()
          Return the view mode available for the explorer.
static String getDefaultViewMode()
          Return the default view mode to use if no view mode has been specified.
static String getViewModeCss(String viewMode)
          Return the StyleSheet to use with the specified view mode.
static String getViewModeJs(String viewMode)
          Return the JavaScript to use with the specified view mode.
static String getViewModeJsp(String viewMode)
          Return the JSP used to present the specified view mode.
static String getViewModeLabel(String lang, String viewMode)
          Return the label to use for the specified view mode, in the specified language.
static boolean isDirectAccessAuthorized()
          Checks if direct access to the explorer (using /plugins/ExplorerPlugin/jsp/explorer.jsp) is authorized or not.
static boolean isSessionCacheEnabled()
          Checks if session cache should be used.
static boolean isValidCatMode(String catMode)
          Checks if the specified category refinement mode is a valid one.
static boolean isValidContentType(String cntType)
          Checks if the specified content type is allowed as a refinement.
static boolean isValidSrc(String src)
          Checks if the specified data source is a valid one (list in getAvailableSrc())
static boolean isValidViewMode(String viewMode)
          Checks if the specified view mode is a valid one (listed in getAvailableViewModes())
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

channel

public static final Channel channel

VIEW_MODES_PROP

public static final String VIEW_MODES_PROP
Property prefix used to find view modes.

See Also:
Constant Field Values

DEFAULT_VIEW_MODE_PROP

public static final String DEFAULT_VIEW_MODE_PROP
Property used to retrieve default view mode.

See Also:
Constant Field Values

CONTENT_TYPES_PROP

public static final String CONTENT_TYPES_PROP
Property used to retrieve list of content type to be proposed for refinement

See Also:
Constant Field Values

SESSIONCACHE_PROP

public static final String SESSIONCACHE_PROP
Property used to check if session cache are enabled or not.
Disable cache if there are to many users and that memory consumption is too high.

See Also:
Constant Field Values

ALLOW_DIRECT_ACCESS_PROP

public static final String ALLOW_DIRECT_ACCESS_PROP
Property used to check if direct access to the explorer (using /plugins/ExplorerPlugin/jsp/explorer.jsp) is authorized or not.

See Also:
Constant Field Values

sessionCacheEnabled

protected static boolean sessionCacheEnabled

sessionCacheEnabledRead

protected static boolean sessionCacheEnabledRead

allowDirectAccess

protected static boolean allowDirectAccess

allowDirectAccessRead

protected static boolean allowDirectAccessRead

viewModesMap

protected static Map viewModesMap

contentTypes

protected static String[] contentTypes
Constructor Detail

ExplorerUtils

public ExplorerUtils()
Method Detail

isSessionCacheEnabled

public static boolean isSessionCacheEnabled()
Checks if session cache should be used.

Returns:
true to use cache, false to recompute result set on each request.

isDirectAccessAuthorized

public static boolean isDirectAccessAuthorized()
Checks if direct access to the explorer (using /plugins/ExplorerPlugin/jsp/explorer.jsp) is authorized or not.

Returns:
true if authorized, false otherwise.

getAvailableViewModes

public static Set getAvailableViewModes()
Return the view mode available for the explorer.

As of current implementation, view modes are find from all properties starting with "jcmsplugins.explorer.view-mode.".

Returns:
a Set of view modes, e.g. {"list", "icon"}, never return null.

getDefaultViewMode

public static String getDefaultViewMode()
Return the default view mode to use if no view mode has been specified.

Returns:
a view mode (e.g "list")

getViewModeLabel

public static String getViewModeLabel(String lang,
                                      String viewMode)
Return the label to use for the specified view mode, in the specified language.

Parameters:
lang - the language in which to retrieve the label
viewMode - a view mode value as returned by getAvailableViewModes(), e.g: "list".
Returns:
an I18N string.

getViewModeJsp

public static String getViewModeJsp(String viewMode)
Return the JSP used to present the specified view mode.

Parameters:
viewMode - a view mode value as returned by getAvailableViewModes(), e.g: "list".
Returns:
a relative path of a jsp "/custom/list.jsp" WITH begining slash or an empty String if jjsp path could not be found.

getViewModeCss

public static String getViewModeCss(String viewMode)
Return the StyleSheet to use with the specified view mode.

Parameters:
viewMode - a view mode value as returned by getAvailableViewModes(), e.g: "list".
Returns:
a relative path of a css "custom/list.css" *without begining slash* or an empty String if css path could not be found.

getViewModeJs

public static String getViewModeJs(String viewMode)
Return the JavaScript to use with the specified view mode.

Parameters:
viewMode - a view mode value as returned by getAvailableViewModes(), e.g: "list".
Returns:
a relative path of a js "custom/list.js" *without begining slash* or an empty String if css path could not be found.

isValidViewMode

public static boolean isValidViewMode(String viewMode)
Checks if the specified view mode is a valid one (listed in getAvailableViewModes())

Parameters:
viewMode - the view mode to check
Returns:
true if this view mode can be used, false otherwise

getAvailableSrc

public static String[] getAvailableSrc()
Retrieves the available data source in the explorer. As of current implementation : { "all", "mine", "caddy" }

Returns:
an array of string indicating the data source to be used by the Explorer

isValidSrc

public static boolean isValidSrc(String src)
Checks if the specified data source is a valid one (list in getAvailableSrc())

Parameters:
src - the data source to check
Returns:
true if this source can be used, false otherwise

isValidCatMode

public static boolean isValidCatMode(String catMode)
Checks if the specified category refinement mode is a valid one. From "one", "and", "or".

Parameters:
catMode - the mode to check
Returns:
true if this catMode is valid, false otherwise

getAvailableContentTypes

public static String[] getAvailableContentTypes()
Retrieves the content types to be proposed for refinement.

Returns:
an array of content type, e.g. ["application/pdf", "image/"], never return null.

isValidContentType

public static boolean isValidContentType(String cntType)
Checks if the specified content type is allowed as a refinement.

Parameters:
cntType - the content type to check
Returns:
true if this content type is valid, false otherwise


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