1 25 26 package org.objectweb.jonas.webapp.jonasadmin.security; 27 28 import java.io.IOException ; 29 import java.util.ArrayList ; 30 import java.util.Arrays ; 31 32 import javax.servlet.ServletException ; 33 import javax.servlet.http.HttpServletRequest ; 34 import javax.servlet.http.HttpServletResponse ; 35 36 import org.apache.struts.action.ActionForm; 37 import org.apache.struts.action.ActionForward; 38 import org.apache.struts.action.ActionMapping; 39 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction; 40 41 44 45 public class ApplyRealmsAction extends JonasBaseAction { 46 47 49 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 50 , HttpServletRequest p_Request, HttpServletResponse p_Response) 51 throws IOException , ServletException { 52 53 String sForward = null; 54 55 ItemsRealmsForm oForm = (ItemsRealmsForm) p_Form; 57 ArrayList alRealms = (ArrayList ) m_Session.getAttribute("listRealms"); 59 60 Arrays.sort(oForm.getSelectedItems()); 62 63 try { 65 ArrayList alSelected = new ArrayList (); 67 if (alRealms != null) { 68 int iPos; 69 RealmItem oRealmItem = null; 70 for (int i = 0; i < alRealms.size(); i++) { 71 oRealmItem = (RealmItem) alRealms.get(i); 72 iPos = Arrays.binarySearch(oForm.getSelectedItems(), oRealmItem.getName()); 73 if (iPos >= 0) { 74 alSelected.add(new RealmItem(oRealmItem.getName(), oRealmItem.getType())); 75 } 76 } 77 } 78 oForm.setSelectedRealmItem(alSelected); 80 } 81 catch (Throwable t) { 82 addGlobalError(t); 83 saveErrors(p_Request, m_Errors); 84 return (p_Mapping.findForward("Global Error")); 85 } 86 87 return (p_Mapping.findForward("Confirm Realms")); 89 } 90 91 93 } 94 | Popular Tags |