KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > properties > wizards > actions > ProfileDetailsAction


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.properties.wizards.actions;
21
22 import javax.servlet.http.HttpServletRequest JavaDoc;
23 import javax.servlet.http.HttpServletResponse JavaDoc;
24
25 import org.apache.struts.action.ActionForm;
26 import org.apache.struts.action.ActionForward;
27 import org.apache.struts.action.ActionMapping;
28
29 import com.sslexplorer.core.CoreUtil;
30 import com.sslexplorer.security.SessionInfo;
31 import com.sslexplorer.wizard.AbstractWizardSequence;
32 import com.sslexplorer.wizard.DefaultWizardSequence;
33 import com.sslexplorer.wizard.WizardStep;
34 import com.sslexplorer.wizard.actions.AbstractWizardAction;
35
36 /**
37  * <p>
38  * Action for profile resource details.
39  *
40  * @author James D Robinson <a HREF="mailto:james@3sp.com">&lt;james@3sp.com&gt;</a>
41  *
42  */

43 public class ProfileDetailsAction extends AbstractWizardAction {
44
45     /**
46      * Scope Constant
47      */

48     public final static String JavaDoc ATTR_PROFILE_SCOPE = "profileScope";
49
50     /**
51      * Construtor
52      */

53     public ProfileDetailsAction() {
54         super();
55     }
56
57     /*
58      * (non-Javadoc)
59      *
60      * @see com.sslexplorer.core.actions.CoreAction#getNavigationContext(org.apache.struts.action.ActionMapping,
61      * org.apache.struts.action.ActionForm,
62      * javax.servlet.http.HttpServletRequest,
63      * javax.servlet.http.HttpServletResponse)
64      */

65     public int getNavigationContext(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) {
66         return SessionInfo.USER_CONSOLE_CONTEXT | SessionInfo.MANAGEMENT_CONSOLE_CONTEXT;
67     }
68
69     /*
70      * (non-Javadoc)
71      *
72      * @see com.sslexplorer.wizard.actions.AbstractWizardAction#unspecified(org.apache.struts.action.ActionMapping,
73      * org.apache.struts.action.ActionForm,
74      * javax.servlet.http.HttpServletRequest,
75      * javax.servlet.http.HttpServletResponse)
76      */

77     public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request,
78                     HttpServletResponse JavaDoc response) throws Exception JavaDoc {
79         CoreUtil.addRequiredFieldMessage(this, request);
80         return super.unspecified(mapping, form, request, response);
81     }
82
83     /**
84      * @param mapping
85      * @param form
86      * @param request
87      * @param response
88      * @return ActionForward
89      * @throws Exception
90      */

91     public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
92                     throws Exception JavaDoc {
93         /*
94          * Because this wizard is started from the profiles page dispatch action
95          * we don't use redirect so the profile scope can be picked up by the
96          * first wizard form. Hence the need for this method
97          */

98         return unspecified(mapping, form, request, response);
99     }
100
101     /*
102      * (non-Javadoc)
103      *
104      * @see com.sslexplorer.wizard.actions.AbstractWizardAction#previous(org.apache.struts.action.ActionMapping,
105      * org.apache.struts.action.ActionForm,
106      * javax.servlet.http.HttpServletRequest,
107      * javax.servlet.http.HttpServletResponse)
108      */

109     public ActionForward previous(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
110                     throws Exception JavaDoc {
111         throw new Exception JavaDoc("No previous steps.");
112     }
113
114     /*
115      * (non-Javadoc)
116      *
117      * @see com.sslexplorer.wizard.actions.AbstractWizardAction#createWizardSequence(org.apache.struts.action.ActionMapping,
118      * org.apache.struts.action.ActionForm,
119      * javax.servlet.http.HttpServletRequest,
120      * javax.servlet.http.HttpServletResponse)
121      */

122     protected AbstractWizardSequence createWizardSequence(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request,
123                     HttpServletResponse JavaDoc response) throws Exception JavaDoc {
124         ActionForward fwd = mapping.findForward("finish");
125         DefaultWizardSequence seq = new DefaultWizardSequence(fwd, "properties", "profileWizard", CoreUtil.getReferer(request),
126                         "profileWizard", this.getSessionInfo(request));
127         seq.putAttribute(ATTR_PROFILE_SCOPE, request.getParameter("profileScope"));
128         seq.addStep(new WizardStep("/profileDetails.do", true));
129         seq.addStep(new WizardStep("/profilePolicySelection.do"));
130         seq.addStep(new WizardStep("/profileSummary.do"));
131         return seq;
132     }
133 }
134
Popular Tags