01: /*
02: * Created on Jan 23, 2004
03: *
04: * To change the template for this generated file go to
05: * Window - Preferences - Java - Code Generation - Code and Comments
06: */
07: package org.vfny.geoserver.action.validation;
08:
09: import org.apache.struts.action.ActionForm;
10: import org.apache.struts.action.ActionForward;
11: import org.apache.struts.action.ActionMapping;
12: import org.vfny.geoserver.action.ConfigAction;
13: import org.vfny.geoserver.config.validation.TestSuiteConfig;
14: import org.vfny.geoserver.config.validation.ValidationConfig;
15: import org.vfny.geoserver.form.validation.ValidationTestSuiteNewForm;
16: import org.vfny.geoserver.global.UserContainer;
17: import javax.servlet.ServletContext;
18: import javax.servlet.http.HttpServletRequest;
19: import javax.servlet.http.HttpServletResponse;
20:
21: /**
22: * ValidationTestSuiteNewAction purpose.
23: * <p>
24: * Description of ValidationTestSuiteNewAction ...
25: * </p>
26: *
27: * <p>
28: * Capabilities:
29: * </p>
30: * <ul>
31: * <li>
32: * Feature: description
33: * </li>
34: * </ul>
35: * <p>
36: * Example Use:
37: * </p>
38: * <pre><code>
39: * ValidationTestSuiteNewAction x = new ValidationTestSuiteNewAction(...);
40: * </code></pre>
41: *
42: * @author User, Refractions Research, Inc.
43: * @author $Author: jive $ (last modification)
44: * @version $Id: ValidationTestSuiteNewAction.java 6177 2007-02-19 10:11:27Z aaime $
45: */
46: public class ValidationTestSuiteNewAction extends ConfigAction {
47: public ActionForward execute(ActionMapping mapping,
48: ActionForm incomingForm, UserContainer user,
49: HttpServletRequest request, HttpServletResponse response) {
50: ValidationTestSuiteNewForm form = (ValidationTestSuiteNewForm) incomingForm;
51:
52: String newName = form.getNewName();
53:
54: TestSuiteConfig suiteConfig = new TestSuiteConfig();
55: suiteConfig.setName(newName);
56:
57: ServletContext context = this .getServlet().getServletContext();
58: ValidationConfig validationConfig = (ValidationConfig) context
59: .getAttribute(ValidationConfig.CONFIG_KEY);
60: validationConfig.addTestSuite(suiteConfig);
61:
62: request.getSession().setAttribute(
63: TestSuiteConfig.CURRENTLY_SELECTED_KEY, suiteConfig);
64:
65: return mapping.findForward("validationTest");
66: }
67: }
|