public class CmsToolManager extends java.lang.Object
Manages also the configuration settings for the administration view, and provides several tool related methods.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ADMINVIEW_ROOT_LOCATION
Root location of the administration view.
|
static java.lang.String |
HANDLERCLASS_PROPERTY
Property definition name to look for.
|
static java.lang.String |
NAVBAR_SEPARATOR
Navigation bar separator (html code).
|
static java.lang.String |
ROOT_SEPARATOR
Tool root separator.
|
static java.lang.String |
ROOTKEY_DEFAULT
Key for the default tool root, if there is no configured root with this a key, a new one will be configured.
|
static java.lang.String |
TOOLPATH_SEPARATOR
Tool path separator.
|
static java.lang.String |
VIEW_JSPPAGE_LOCATION
Location of the default admin view jsp page.
|
| Constructor and Description |
|---|
CmsToolManager()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addToolRoot(CmsToolRootHandler toolRoot)
Adds a new tool root to the tool manager.
|
void |
configure(CmsObject cms)
Called by the
method. |
java.lang.String |
generateNavBar(java.lang.String toolPath,
CmsWorkplace wp)
Returns the navigation bar html code for the given tool path.
|
java.lang.String |
getBaseToolPath(CmsWorkplace wp)
Returns the base tool path for the active user.
|
CmsToolRootHandler |
getCurrentRoot(CmsWorkplace wp)
Returns the current user's root handler.
|
CmsTool |
getCurrentTool(CmsWorkplace wp)
Returns the current tool.
|
java.lang.String |
getCurrentToolPath(CmsWorkplace wp)
Returns the current tool path.
|
java.lang.String |
getParent(CmsWorkplace wp,
java.lang.String toolPath)
Returns the path to the parent of the tool identified by the given tool path.
|
java.util.List<CmsTool> |
getToolHandlers()
Returns a list with all registered tools.
|
java.util.List<CmsToolRootHandler> |
getToolRoots()
Returns a list of tool roots.
|
java.util.List<CmsTool> |
getToolsForPath(CmsWorkplace wp,
java.lang.String baseTool,
boolean includeSubtools)
Returns a list of all tools in the given path.
|
CmsToolUserData |
getUserData(CmsWorkplace wp)
Returns the
object for a given user. |
boolean |
hasToolPathForUrl(java.lang.String url)
Returns
true if there is at least one tool registered using the given url. |
void |
initParams(CmsToolDialog wp)
This method initializes the tool manager for the current user.
|
void |
jspForwardPage(CmsWorkplace wp,
java.lang.String pagePath,
java.util.Map<java.lang.String,java.lang.String[]> params)
Redirects to the given page with the given parameters.
|
void |
jspForwardTool(CmsWorkplace wp,
java.lang.String toolPath,
java.util.Map<java.lang.String,java.lang.String[]> params)
Redirects to the given tool with the given parameters.
|
static java.lang.String |
linkForToolPath(CmsJspActionElement jsp,
java.lang.String toolPath)
Returns the OpenCms link for the given tool path which requires no parameters.
|
static java.lang.String |
linkForToolPath(CmsJspActionElement jsp,
java.lang.String toolPath,
java.util.Map<java.lang.String,java.lang.String[]> params)
Returns the OpenCms link for the given tool path which requires parameters.
|
CmsTool |
resolveAdminTool(java.lang.String rootKey,
java.lang.String toolPath)
Returns the admin tool corresponding to the given abstract path.
|
void |
setBaseToolPath(CmsWorkplace wp,
java.lang.String baseToolPath)
Sets the base tool path.
|
void |
setCurrentRoot(CmsWorkplace wp,
java.lang.String key)
Sets the current user's root key.
|
void |
setCurrentToolPath(CmsWorkplace wp,
java.lang.String currentToolPath)
Sets the current tool path.
|
public static final java.lang.String ADMINVIEW_ROOT_LOCATION
public static final java.lang.String HANDLERCLASS_PROPERTY
public static final java.lang.String NAVBAR_SEPARATOR
public static final java.lang.String ROOT_SEPARATOR
public static final java.lang.String ROOTKEY_DEFAULT
public static final java.lang.String TOOLPATH_SEPARATOR
public static final java.lang.String VIEW_JSPPAGE_LOCATION
public CmsToolManager()
public static java.lang.String linkForToolPath(CmsJspActionElement jsp, java.lang.String toolPath)
jsp - the jsp action elementtoolPath - the tool pathpublic static java.lang.String linkForToolPath(CmsJspActionElement jsp, java.lang.String toolPath, java.util.Map<java.lang.String,java.lang.String[]> params)
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.
jsp - the jsp action elementtoolPath - the tool pathparams - the map of required tool parameterspublic void addToolRoot(CmsToolRootHandler toolRoot)
toolRoot - the tool root to addpublic void configure(CmsObject cms)
CmsWorkplaceManager.initialize(CmsObject) method.cms - the admin cms contextpublic java.lang.String generateNavBar(java.lang.String toolPath, CmsWorkplace wp)
toolPath - the pathwp - the jsp pagepublic java.lang.String getBaseToolPath(CmsWorkplace wp)
wp - the workplace objectpublic CmsToolRootHandler getCurrentRoot(CmsWorkplace wp)
wp - the workplace contextpublic CmsTool getCurrentTool(CmsWorkplace wp)
wp - the workplace objectpublic java.lang.String getCurrentToolPath(CmsWorkplace wp)
wp - the workplace objectpublic java.lang.String getParent(CmsWorkplace wp, java.lang.String toolPath)
The parent of the root is the same root.
wp - the workplace objecttoolPath - the abstract tool pathpublic java.util.List<CmsTool> getToolHandlers()
CmsToolpublic java.util.List<CmsToolRootHandler> getToolRoots()
CmsToolRootHandler objectspublic java.util.List<CmsTool> getToolsForPath(CmsWorkplace wp, java.lang.String baseTool, boolean includeSubtools)
wp - the workplace contextbaseTool - the pathincludeSubtools - if the tools in subfolders should be also returnedCmsTool objectspublic CmsToolUserData getUserData(CmsWorkplace wp)
CmsToolUserData object for a given user.wp - the workplace objectpublic boolean hasToolPathForUrl(java.lang.String url)
true if there is at least one tool registered using the given url.url - the url of the tooltrue if there is at least one tool registered using the given urlpublic void initParams(CmsToolDialog wp)
wp - the jsp page coming frompublic void jspForwardPage(CmsWorkplace wp, java.lang.String pagePath, java.util.Map<java.lang.String,java.lang.String[]> params) throws java.io.IOException, javax.servlet.ServletException
wp - the workplace objectpagePath - the path to the page to redirect toparams - the parameters to sendjava.io.IOException - in case of errors during forwardingjavax.servlet.ServletException - in case of errors during forwardingpublic void jspForwardTool(CmsWorkplace wp, java.lang.String toolPath, java.util.Map<java.lang.String,java.lang.String[]> params) throws java.io.IOException, javax.servlet.ServletException
wp - the workplace objecttoolPath - the path to the tool to redirect toparams - the parameters to sendjava.io.IOException - in case of errors during forwardingjavax.servlet.ServletException - in case of errors during forwardingpublic CmsTool resolveAdminTool(java.lang.String rootKey, java.lang.String toolPath)
rootKey - the tool roottoolPath - the pathnull if not foundpublic void setBaseToolPath(CmsWorkplace wp, java.lang.String baseToolPath)
wp - the workplace objectbaseToolPath - the base tool path to setpublic void setCurrentRoot(CmsWorkplace wp, java.lang.String key)
wp - the workplace contextkey - the current user's root key to setpublic void setCurrentToolPath(CmsWorkplace wp, java.lang.String currentToolPath)
wp - the workplace objectcurrentToolPath - the current tool path to set