Package org.opencms.workplace.tools
Class CmsToolManager
java.lang.Object
org.opencms.workplace.tools.CmsToolManager
Manages the registered tools, actualizing its state every time the workplace is reinitialize.
Manages also the configuration settings for the administration view, and provides several tool related methods.
- Since:
- 6.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringRoot location of the administration view.static final StringProperty definition name to look for.static final StringNavigation bar separator (html code).static final StringTool root separator.static final StringKey for the default tool root, if there is no configured root with this a key, a new one will be configured.static final StringTool path separator.static final StringLocation of the default admin view jsp page. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToolRoot(CmsToolRootHandler toolRoot) Adds a new tool root to the tool manager.voidCalled by themethod.CmsWorkplaceManager.initialize(CmsObject)generateNavBar(String toolPath, CmsWorkplace wp) Returns the navigation bar html code for the given tool path.Returns the base tool path for the active user.Returns the current user's root handler.Returns the current tool.Returns the current tool path.getParent(CmsWorkplace wp, String toolPath) Returns the path to the parent of the tool identified by the given tool path.Returns a list with all registered tools.Returns a list of tool roots.getToolsForPath(CmsWorkplace wp, String baseTool, boolean includeSubtools) Returns a list of all tools in the given path.Returns theobject for a given user.CmsToolUserDatabooleanhasToolPathForUrl(String url) Returnstrueif there is at least one tool registered using the given url.voidThis method initializes the tool manager for the current user.voidjspForwardPage(CmsWorkplace wp, String pagePath, Map<String, String[]> params) Redirects to the given page with the given parameters.voidjspForwardTool(CmsWorkplace wp, String toolPath, Map<String, String[]> params) Redirects to the given tool with the given parameters.static StringlinkForToolPath(CmsJspActionElement jsp, String toolPath) Returns the OpenCms link for the given tool path which requires no parameters.static StringlinkForToolPath(CmsJspActionElement jsp, String toolPath, Map<String, String[]> params) Returns the OpenCms link for the given tool path which requires parameters.resolveAdminTool(String rootKey, String toolPath) Returns the admin tool corresponding to the given abstract path.voidsetBaseToolPath(CmsWorkplace wp, String baseToolPath) Sets the base tool path.voidsetCurrentRoot(CmsWorkplace wp, String key) Sets the current user's root key.voidsetCurrentToolPath(CmsWorkplace wp, String currentToolPath) Sets the current tool path.
-
Field Details
-
ADMINVIEW_ROOT_LOCATION
Root location of the administration view.- See Also:
-
HANDLERCLASS_PROPERTY
Property definition name to look for.- See Also:
-
NAVBAR_SEPARATOR
Navigation bar separator (html code).- See Also:
-
ROOT_SEPARATOR
Tool root separator.- See Also:
-
ROOTKEY_DEFAULT
Key for the default tool root, if there is no configured root with this a key, a new one will be configured.- See Also:
-
TOOLPATH_SEPARATOR
Tool path separator.- See Also:
-
VIEW_JSPPAGE_LOCATION
Location of the default admin view jsp page.- See Also:
-
-
Constructor Details
-
CmsToolManager
public CmsToolManager()Default constructor.
-
-
Method Details
-
linkForToolPath
Returns the OpenCms link for the given tool path which requires no parameters.- Parameters:
jsp- the jsp action elementtoolPath- the tool path- Returns:
- the OpenCms link for the given tool path which requires parameters
-
linkForToolPath
public static String linkForToolPath(CmsJspActionElement jsp, String toolPath, Map<String, String[]> params) Returns the OpenCms link for the given tool path which requires parameters.Please note: Don't overuse the parameter map because this will likely introduce issues with encoding. If possible, don't pass parameters at all, or only very simple parameters with no special chars that can easily be parsed.
- Parameters:
jsp- the jsp action elementtoolPath- the tool pathparams- the map of required tool parameters- Returns:
- the OpenCms link for the given tool path which requires parameters
-
addToolRoot
Adds a new tool root to the tool manager.- Parameters:
toolRoot- the tool root to add
-
configure
Called by themethod.CmsWorkplaceManager.initialize(CmsObject)- Parameters:
cms- the admin cms context
-
getBaseToolPath
Returns the base tool path for the active user.- Parameters:
wp- the workplace object- Returns:
- the base tool path for the active user
-
getCurrentRoot
Returns the current user's root handler.- Parameters:
wp- the workplace context- Returns:
- the current user's root handler
-
getCurrentTool
Returns the current tool.- Parameters:
wp- the workplace object- Returns:
- the current tool
-
getCurrentToolPath
Returns the current tool path.- Parameters:
wp- the workplace object- Returns:
- the current tool path
-
getParent
Returns the path to the parent of the tool identified by the given tool path.The parent of the root is the same root.
- Parameters:
wp- the workplace objecttoolPath- the abstract tool path- Returns:
- his parent
-
getToolHandlers
Returns a list with all registered tools.- Returns:
- list if
CmsTool
-
getToolRoots
Returns a list of tool roots.- Returns:
- a list of
CmsToolRootHandlerobjects
-
getToolsForPath
Returns a list of all tools in the given path.- Parameters:
wp- the workplace contextbaseTool- the pathincludeSubtools- if the tools in subfolders should be also returned- Returns:
- a list of
CmsToolobjects
-
getUserData
Returns theobject for a given user.CmsToolUserData- Parameters:
wp- the workplace object- Returns:
- the current user data
-
hasToolPathForUrl
Returnstrueif there is at least one tool registered using the given url.- Parameters:
url- the url of the tool- Returns:
trueif there is at least one tool registered using the given url
-
initParams
This method initializes the tool manager for the current user.- Parameters:
wp- the jsp page coming from
-
jspForwardPage
public void jspForwardPage(CmsWorkplace wp, String pagePath, Map<String, String[]> params) throws IOException, javax.servlet.ServletExceptionRedirects to the given page with the given parameters.- Parameters:
wp- the workplace objectpagePath- the path to the page to redirect toparams- the parameters to send- Throws:
IOException- in case of errors during forwardingjavax.servlet.ServletException- in case of errors during forwarding
-
jspForwardTool
public void jspForwardTool(CmsWorkplace wp, String toolPath, Map<String, String[]> params) throws IOException, javax.servlet.ServletExceptionRedirects to the given tool with the given parameters.- Parameters:
wp- the workplace objecttoolPath- the path to the tool to redirect toparams- the parameters to send- Throws:
IOException- in case of errors during forwardingjavax.servlet.ServletException- in case of errors during forwarding
-
resolveAdminTool
Returns the admin tool corresponding to the given abstract path.- Parameters:
rootKey- the tool roottoolPath- the path- Returns:
- the corresponding tool, or
nullif not found
-
setBaseToolPath
Sets the base tool path.- Parameters:
wp- the workplace objectbaseToolPath- the base tool path to set
-
setCurrentRoot
Sets the current user's root key.- Parameters:
wp- the workplace contextkey- the current user's root key to set
-
setCurrentToolPath
Sets the current tool path.- Parameters:
wp- the workplace objectcurrentToolPath- the current tool path to set
-