* javax.servlet.http.HttpServletResponse)
*/
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
String source = request.getParameter("source");
HelpForm helpForm = (HelpForm)form;
if(source == null) {
throw new Exception("Help action requires a source parameter.");
}
if(source.equalsIgnoreCase("property")) {
String name = request.getParameter("name");
if(name == null) {
throw new Exception("Help for property source requires a name parameter.");
}
String propertyClassName = request.getParameter("propertyClass");
if(propertyClassName == null) {
throw new Exception("Help for property source requires a propertyClass parameter.");
}
PropertyClass propertyClass = PropertyClassManager.getInstance().getPropertyClass(propertyClassName);
if(propertyClass == null) {
throw new Exception("Invalid property class.");
}
PropertyDefinition def = propertyClass.getDefinition(name);
if(def == null) {
throw new Exception("No property definition with name of " + name);
}
else{
// set the label and description from the messages resources if they have any.
// If there are Application resources for the definition then set the label and description
String label = CoreUtil.getMessage(request, def.getMessageResourcesKey(), def.getNameMessageResourceKey());
if (label != null){
def.setLabel(label);
}
// String description = messageResources == null ? null : messageResources.getMessage(def.getDescriptionMessageResourceKey());
String description = CoreUtil.getMessage(request, def.getMessageResourcesKey(), def.getDescriptionMessageResourceKey());
if (description != null){
def.setDescription(description);
}
}
request.setAttribute(Constants.REQ_ATTR_PROPERTY_DEFINITION, def);
return mapping.findForward("property");
}
else if(source.equalsIgnoreCase("help")) {
// load the documentation context menu
SessionInfo info = LogonControllerFactory.getInstance().getSessionInfo(request);
helpForm.setMenu(NavigationManager.getMenuTree(CoreMenuTree.MENU_ITEM_MENU_TREE).rebuildMenus(SessionInfo.HELP_CONTEXT,
info,
request,
Util.getOriginalRequest(request)));
return mapping.findForward("help");
}