1 package net.sourceforge.formview.usecases.action; 2 3 import java.util.HashMap ; 4 import java.util.Map ; 5 6 import javax.servlet.http.HttpServletRequest ; 7 import javax.servlet.http.HttpServletResponse ; 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 request, 21 HttpServletResponse response) throws Exception { 22 ProjectWithRoleForm form = (ProjectWithRoleForm)actionForm; 23 String [] roles = form.getRoles(); 24 Map rolesMap = new HashMap (); 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 WEBFormViewUtil.savePermissionAdapter(request, permission); 35 36 37 return super.display(mapping, actionForm, request, response); 38 } 39 40 } 41 | Popular Tags |