KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > formview > usecases > action > ProjectWithRoleAction


1 package net.sourceforge.formview.usecases.action;
2
3 import java.util.HashMap JavaDoc;
4 import java.util.Map JavaDoc;
5
6 import javax.servlet.http.HttpServletRequest JavaDoc;
7 import javax.servlet.http.HttpServletResponse JavaDoc;
8
9 import net.sourceforge.formview.usecases.form.ProjectWithRoleForm;
10 import net.sourceforge.formview.usecases.permission.RolePermisionAdapter;
11 import net.sourceforge.formview.util.WEBFormViewUtil;
12
13 import org.apache.struts.action.ActionForm;
14 import org.apache.struts.action.ActionForward;
15 import org.apache.struts.action.ActionMapping;
16
17 public class ProjectWithRoleAction extends ProjectAction {
18
19
20     public ActionForward display(ActionMapping mapping, ActionForm actionForm, HttpServletRequest JavaDoc request,
21             HttpServletResponse JavaDoc response) throws Exception JavaDoc {
22         ProjectWithRoleForm form = (ProjectWithRoleForm)actionForm;
23         String JavaDoc[] roles = form.getRoles();
24         // Construct Map of roles
25
Map JavaDoc rolesMap = new HashMap JavaDoc();
26         if (roles != null) {
27             for (int i = 0; i < roles.length; i++) {
28                 rolesMap.put(roles[i], roles[i]);
29             }
30         }
31         
32         RolePermisionAdapter permission = new RolePermisionAdapter(rolesMap);
33         // Save Role Permission Adapter into request
34
WEBFormViewUtil.savePermissionAdapter(request, permission);
35
36         
37         return super.display(mapping, actionForm, request, response);
38     }
39
40 }
41
Popular Tags