KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > policyframework > wizards > forms > PolicySummaryForm


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.policyframework.wizards.forms;
21
22 import java.util.ArrayList JavaDoc;
23 import java.util.Iterator JavaDoc;
24 import java.util.List JavaDoc;
25
26 import javax.servlet.http.HttpServletRequest JavaDoc;
27
28 import org.apache.commons.logging.Log;
29 import org.apache.commons.logging.LogFactory;
30
31 import com.sslexplorer.boot.PropertyList;
32 import com.sslexplorer.core.UserDatabaseManager;
33 import com.sslexplorer.security.LogonControllerFactory;
34 import com.sslexplorer.security.UserDatabase;
35 import com.sslexplorer.wizard.AbstractWizardSequence;
36 import com.sslexplorer.wizard.forms.DefaultWizardForm;
37
38 public class PolicySummaryForm extends DefaultWizardForm {
39     
40     final static Log log = LogFactory.getLog(PolicySummaryForm.class);
41
42     // Private statics for sequence attributes
43

44     // Private instance variables
45
private String JavaDoc policyName;
46     private String JavaDoc policyDescription;
47     private List JavaDoc selectedAccounts;
48     private List JavaDoc selectedRoles;
49     // TODO commented in case nested policies are re-introduced
50

51     public PolicySummaryForm() {
52         super(false, true, "/WEB-INF/jsp/content/policyframework/policyWizard/policySummary.jspf",
53             "", true, true, "policySummary", "policyframework", "policyWizard.policySummary", 3);
54     }
55
56     /*
57      * (non-Javadoc)
58      *
59      * @see com.sslexplorer.wizard.forms.AbstractWizardForm#init(com.sslexplorer.wizard.AbstractWizardSequence)
60      */

61     public void init(AbstractWizardSequence sequence, HttpServletRequest JavaDoc request) throws Exception JavaDoc {
62         policyName = (String JavaDoc)sequence.getAttribute(PolicyDetailsForm.ATTR_RESOURCE_NAME, "");
63         policyDescription = (String JavaDoc)sequence.getAttribute(PolicyDetailsForm.ATTR_RESOURCE_DESCRIPTION, "");
64         PropertyList la = (PropertyList)sequence.getAttribute(PolicyPrincipalSelectionForm.ATTR_SELECTED_ACCOUNTS, null);
65         PropertyList lr = (PropertyList)sequence.getAttribute(PolicyPrincipalSelectionForm.ATTR_SELECTED_ROLES, null);
66         selectedAccounts = new ArrayList JavaDoc();
67         UserDatabase udb = UserDatabaseManager.getInstance().getUserDatabase(LogonControllerFactory.getInstance().getSessionInfo(request).getUser().getRealm());
68         for(Iterator JavaDoc i = la.iterator(); i.hasNext(); ) {
69             selectedAccounts.add(udb.getAccount(i.next().toString()).getPrincipalName());
70         }
71         selectedRoles = new ArrayList JavaDoc();
72         for(Iterator JavaDoc i = lr.iterator(); i.hasNext(); ) {
73             selectedRoles.add(udb.getRole(i.next().toString()).getPrincipalName());
74         }
75     }
76
77     /**
78      * @return Returns the policyName.
79      */

80     public String JavaDoc getPolicyName() {
81         return policyName;
82     }
83
84     /**
85      * @return Returns the selectedRoles.
86      */

87     public List JavaDoc getSelectedRoles() {
88         return selectedRoles;
89     }
90
91     /**
92      * @return Returns the selectedAccounts.
93      */

94     public List JavaDoc getSelectedAccounts() {
95         return selectedAccounts;
96     }
97
98     /**
99      * @return Returns the policyDescription.
100      */

101     public String JavaDoc getPolicyDescription() {
102         return policyDescription;
103     }
104 }
105
Popular Tags