KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > properties > attributes > wizards > actions > AttributeDefinitionDetailsAction


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.attributes.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.policyframework.Permission;
31 import com.sslexplorer.policyframework.PolicyConstants;
32 import com.sslexplorer.properties.attributes.AbstractAttributeKey;
33 import com.sslexplorer.properties.attributes.AttributeDefinition;
34 import com.sslexplorer.properties.attributes.AttributesPropertyClass;
35 import com.sslexplorer.properties.impl.userattributes.UserAttributes;
36 import com.sslexplorer.security.LogonControllerFactory;
37 import com.sslexplorer.security.SessionInfo;
38 import com.sslexplorer.wizard.AbstractWizardSequence;
39 import com.sslexplorer.wizard.DefaultWizardSequence;
40 import com.sslexplorer.wizard.WizardStep;
41 import com.sslexplorer.wizard.actions.AbstractWizardAction;
42
43 /**
44  * Allows an administrator to create a new <i>Attribute Definition</i> of
45  * some type. The name is also provided here.
46  *
47  * @author brett
48  * @see AttributesPropertyClass
49  * @see AbstractAttributeKey
50  * @see AttributeDefinition
51  */

52 public class AttributeDefinitionDetailsAction extends AbstractWizardAction {
53
54     /**
55      * Selected Property class (of type {@link AttributesPropertyClass}.
56      */

57     public final static String JavaDoc ATTR_CLASS = "class";
58
59     /**
60      * Name of attribute definition
61      */

62     public final static String JavaDoc ATTR_NAME = "name";
63
64     /**
65      * Description of attribute definition
66      */

67     public final static String JavaDoc ATTR_DESCRIPTION = "description";
68
69     /**
70      * Constructor
71      */

72     public AttributeDefinitionDetailsAction() {
73         super(PolicyConstants.ATTRIBUTE_DEFINITIONS_RESOURCE_TYPE, new Permission[] {PolicyConstants.PERM_MAINTAIN });
74     }
75     
76     public int getNavigationContext(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) {
77         return SessionInfo.MANAGEMENT_CONSOLE_CONTEXT;
78     }
79
80     public ActionForward previous(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
81                     throws Exception JavaDoc {
82         throw new Exception JavaDoc("No previous steps.");
83     }
84
85     /*
86      * (non-Javadoc)
87      *
88      * @see com.sslexplorer.wizard.actions.AbstractWizardAction#createWizardSequence(org.apache.struts.action.ActionMapping,
89      * org.apache.struts.action.ActionForm,
90      * javax.servlet.http.HttpServletRequest,
91      * javax.servlet.http.HttpServletResponse)
92      */

93     protected AbstractWizardSequence createWizardSequence(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request,
94                     HttpServletResponse JavaDoc response) throws Exception JavaDoc {
95         ActionForward fwd = mapping.findForward("finish");
96         SessionInfo session = LogonControllerFactory.getInstance().getSessionInfo(request);
97         DefaultWizardSequence seq = new DefaultWizardSequence(fwd, "properties", "attributeDefinitionWizard", CoreUtil.getReferer(request),
98                         "attributeDefinitionWizard", session);
99         seq.putAttribute(ATTR_CLASS, UserAttributes.NAME);
100         seq.addStep(new WizardStep("/attributeDefinitionDetails.do", true));
101         seq.addStep(new WizardStep("/attributeDefinitionOptions.do"));
102         seq.addStep(new WizardStep("/attributeDefinitionSummary.do"));
103         return seq;
104     }
105 }
106
Popular Tags