Package com.jalios.jcmsplugin.explorer
Class ExplorerUtils
- java.lang.Object
-
- com.jalios.jcmsplugin.explorer.ExplorerUtils
-
public class ExplorerUtils extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExplorerUtils.MatchingResult
-
Field Summary
Fields Modifier and Type Field Description static java.lang.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 com.jalios.jcms.Channel
channel
static java.lang.String
CONTENT_TYPES_PROP
Property used to retrieve list of content type to be proposed for refinementstatic java.lang.String
DEFAULT_VIEW_MODE_PROP
Property used to retrieve default view mode.static java.lang.String
VIEW_MODES_PROP
Property prefix used to find view modes.protected static java.util.Map<java.lang.String,java.lang.Object>
viewModesMap
-
Constructor Summary
Constructors Constructor Description ExplorerUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]
getAvailableSrc()
Retrieves the available data source in the explorer.static java.util.Set<java.lang.String>
getAvailableViewModes()
Return the view mode available for the explorer.static java.lang.String
getCategoryPathAsString(com.jalios.jcms.Category cat, java.util.Set<com.jalios.jcms.Category> roots, java.lang.String userLang)
static java.lang.String
getCollaborativeSpaceExplorerHomeUrl(com.jalios.jcms.workspace.Workspace csWorkspace, generated.PortletExplorer explorer, java.util.Locale locale)
static java.lang.String
getCollaborativeSpaceExplorerUrl(com.jalios.jcms.workspace.Workspace csWorkspace, generated.PortletExplorer explorer, java.util.Locale locale, com.jalios.jcms.Category cat)
static java.lang.String
getDefaultViewMode()
Return the default view mode to use if no view mode has been specified.static ExplorerUtils.MatchingResult
getMatchingPortletExplorer(com.jalios.jcms.Publication pub, com.jalios.jcms.workspace.Workspace workspace, com.jalios.jcms.Member member)
static java.util.Set<com.jalios.jcms.Category>
getPortletExplorerRootCategories(com.jalios.jcms.Member mbr, com.jalios.jcms.workspace.Workspace workspace, generated.PortletExplorer portletExplorer)
Returns the Set of root category for given member in given workspace for the given PortletExplorerstatic java.lang.String
getViewModeCss(java.lang.String viewMode)
Return the StyleSheet to use with the specified view mode.static java.lang.String
getViewModeJs(java.lang.String viewMode)
Return the JavaScript to use with the specified view mode.static java.lang.String
getViewModeJsp(java.lang.String viewMode)
Return the JSP used to present the specified view mode.static java.lang.String
getViewModeLabel(java.lang.String lang, java.lang.String viewMode)
Return the label to use for the specified view mode, in the specified language.static boolean
is10SP5OrGreater()
static boolean
is10SP7OrGreater()
static boolean
isDirectAccessAuthorized()
Checks if direct access to the explorer (using/plugins/ExplorerPlugin/jsp/explorer.jsp
) is authorized or not.static boolean
isValidCatMode(java.lang.String catMode)
Checks if the specified category refinement mode is a valid one.static boolean
isValidSrc(java.lang.String src)
Checks if the specified data source is a valid one (list ingetAvailableSrc()
)static boolean
isValidViewMode(java.lang.String viewMode)
Checks if the specified view mode is a valid one (listed ingetAvailableViewModes()
)
-
-
-
Field Detail
-
channel
public static final com.jalios.jcms.Channel channel
-
VIEW_MODES_PROP
public static final java.lang.String VIEW_MODES_PROP
Property prefix used to find view modes.- See Also:
- Constant Field Values
-
DEFAULT_VIEW_MODE_PROP
public static final java.lang.String DEFAULT_VIEW_MODE_PROP
Property used to retrieve default view mode.- See Also:
- Constant Field Values
-
CONTENT_TYPES_PROP
public static final java.lang.String CONTENT_TYPES_PROP
Property used to retrieve list of content type to be proposed for refinement- See Also:
- Constant Field Values
-
ALLOW_DIRECT_ACCESS_PROP
public static final java.lang.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
-
allowDirectAccess
protected static boolean allowDirectAccess
-
allowDirectAccessRead
protected static boolean allowDirectAccessRead
-
viewModesMap
protected static java.util.Map<java.lang.String,java.lang.Object> viewModesMap
-
-
Method Detail
-
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 java.util.Set<java.lang.String> 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 java.lang.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 java.lang.String getViewModeLabel(java.lang.String lang, java.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 labelviewMode
- a view mode value as returned bygetAvailableViewModes()
, e.g:"list"
.- Returns:
- an I18N string.
-
getViewModeJsp
public static java.lang.String getViewModeJsp(java.lang.String viewMode)
Return the JSP used to present the specified view mode.- Parameters:
viewMode
- a view mode value as returned bygetAvailableViewModes()
, 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 java.lang.String getViewModeCss(java.lang.String viewMode)
Return the StyleSheet to use with the specified view mode.- Parameters:
viewMode
- a view mode value as returned bygetAvailableViewModes()
, 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 java.lang.String getViewModeJs(java.lang.String viewMode)
Return the JavaScript to use with the specified view mode.- Parameters:
viewMode
- a view mode value as returned bygetAvailableViewModes()
, 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(java.lang.String viewMode)
Checks if the specified view mode is a valid one (listed ingetAvailableViewModes()
)- Parameters:
viewMode
- the view mode to check- Returns:
- true if this view mode can be used, false otherwise
-
getAvailableSrc
public static java.lang.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(java.lang.String src)
Checks if the specified data source is a valid one (list ingetAvailableSrc()
)- Parameters:
src
- the data source to check- Returns:
- true if this source can be used, false otherwise
-
isValidCatMode
public static boolean isValidCatMode(java.lang.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
-
getPortletExplorerRootCategories
public static java.util.Set<com.jalios.jcms.Category> getPortletExplorerRootCategories(com.jalios.jcms.Member mbr, com.jalios.jcms.workspace.Workspace workspace, generated.PortletExplorer portletExplorer)
Returns the Set of root category for given member in given workspace for the given PortletExplorer- Parameters:
mbr
- theMember
workspace
- theWorkspace
portletExplorer
- thePortletExplorer
- Returns:
- the Set of root
Category
for given parameters
-
getCategoryPathAsString
public static java.lang.String getCategoryPathAsString(com.jalios.jcms.Category cat, java.util.Set<com.jalios.jcms.Category> roots, java.lang.String userLang)
- Parameters:
cat
- the currentCategory
to start the pathroots
- the Set of root categories of an exploreruserLang
- the current user language- Returns:
- the given Category path as string for given roots
- Since:
- explorer-4.6
-
is10SP7OrGreater
public static boolean is10SP7OrGreater()
- Returns:
- true if this JPlatform version is >= 10.0.7.
-
is10SP5OrGreater
public static boolean is10SP5OrGreater()
- Returns:
- true if this JPlatform version is >= 10.0.5.
-
getCollaborativeSpaceExplorerUrl
public static java.lang.String getCollaborativeSpaceExplorerUrl(com.jalios.jcms.workspace.Workspace csWorkspace, generated.PortletExplorer explorer, java.util.Locale locale, com.jalios.jcms.Category cat)
-
getCollaborativeSpaceExplorerHomeUrl
public static java.lang.String getCollaborativeSpaceExplorerHomeUrl(com.jalios.jcms.workspace.Workspace csWorkspace, generated.PortletExplorer explorer, java.util.Locale locale)
-
getMatchingPortletExplorer
public static ExplorerUtils.MatchingResult getMatchingPortletExplorer(com.jalios.jcms.Publication pub, com.jalios.jcms.workspace.Workspace workspace, com.jalios.jcms.Member member)
-
-