1 16 package org.jmanage.webui.actions.config; 17 18 import org.jmanage.webui.actions.BaseAction; 19 import org.jmanage.webui.util.WebContext; 20 import org.jmanage.webui.util.Forwards; 21 import org.jmanage.webui.util.RequestAttributes; 22 import org.jmanage.webui.forms.ApplicationForm; 23 import org.jmanage.core.services.AccessController; 24 import org.jmanage.core.config.*; 25 import org.apache.struts.action.ActionForward; 26 import org.apache.struts.action.ActionMapping; 27 import org.apache.struts.action.ActionForm; 28 29 import javax.servlet.http.HttpServletRequest ; 30 import javax.servlet.http.HttpServletResponse ; 31 32 40 public class ShowAddApplicationAction extends BaseAction { 41 51 public ActionForward execute(WebContext context, 52 ActionMapping mapping, 53 ActionForm actionForm, 54 HttpServletRequest request, 55 HttpServletResponse response) 56 throws Exception { 57 AccessController.checkAccess(context.getServiceContext(), 58 ACL_ADD_APPLICATIONS); 59 ApplicationForm appForm = (ApplicationForm)actionForm; 60 ApplicationType appType = 61 ApplicationTypes.getApplicationType(appForm.getType()); 62 assert appType != null: "Invalid app type: " + appForm.getType(); 63 ModuleConfig moduleConfig = appType.getModule(); 64 MetaApplicationConfig metaAppConfig = moduleConfig.getMetaApplicationConfig(); 65 request.setAttribute(RequestAttributes.META_APP_CONFIG, metaAppConfig); 66 67 appForm.setHost(appType.getDefaultHost()); 68 appForm.setPort(appType.getDefaultPort()); 69 appForm.setURL(appType.getDefaultURL()); 70 71 72 request.setAttribute(RequestAttributes.NAV_CURRENT_PAGE, "Add Application"); 73 return mapping.findForward(Forwards.SUCCESS); 74 } 75 } 76 | Popular Tags |