KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > policyframework > forms > AbstractWizardResourcePolicySelectionForm


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.forms;
21
22 import javax.servlet.http.HttpServletRequest JavaDoc;
23
24 import org.apache.struts.action.ActionMapping;
25
26 import com.sslexplorer.input.MultiSelectDataSource;
27 import com.sslexplorer.policyframework.DelegatedPoliciesDataSource;
28 import com.sslexplorer.policyframework.ResourceType;
29 import com.sslexplorer.policyframework.wizards.forms.AccessRightsDetailsForm;
30 import com.sslexplorer.security.LogonControllerFactory;
31 import com.sslexplorer.security.User;
32
33 /**
34  * Abstract implementation of a {@link com.sslexplorer.policyframework.forms.AbstractWizardPolicySelectionForm}
35  * that should be used for wizards that create delegatable resources.
36  *
37  * @author Brett Smith <a HREF="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
38  */

39 public class AbstractWizardResourcePolicySelectionForm extends AbstractWizardPolicySelectionForm {
40
41     private ResourceType resourceType;
42
43     /**
44      * Constructor.
45      *
46      * @param nextAvailable next button available
47      * @param previousAvailable previous button available
48      * @param page page
49      * @param pageName page name
50      * @param resourceBundle resource bundle
51      * @param resourcePrefix resource prefix
52      * @param stepIndex step
53      * @param resourceType resource type
54      */

55     public AbstractWizardResourcePolicySelectionForm(boolean nextAvailable, boolean previousAvailable, String JavaDoc page, String JavaDoc pageName, String JavaDoc resourceBundle, String JavaDoc resourcePrefix, int stepIndex, ResourceType resourceType) {
56         super(nextAvailable, previousAvailable, page, "sourceValues_selectedPolicies", false, false, pageName, resourceBundle,
57                         resourcePrefix, stepIndex);
58         this.resourceType = resourceType;
59     }
60     
61     /* (non-Javadoc)
62      * @see com.sslexplorer.policyframework.forms.AbstractWizardPolicySelectionForm#createDatasource(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
63      */

64     public MultiSelectDataSource createDatasource(ActionMapping mapping, HttpServletRequest JavaDoc request) {
65         try {
66             User u = LogonControllerFactory.getInstance().getUser(request);
67             return new DelegatedPoliciesDataSource(null, resourceType, (String JavaDoc)getWizardSequence(request).getAttribute(AccessRightsDetailsForm.ATTR_RESOURCE_PERMISSION_CLASS, null),
68                 u);
69         }
70         catch(Exception JavaDoc e) {
71             return null;
72         }
73     }
74
75 }
76
Popular Tags