1 56 package com.ivata.groupware.business.addressbook.struts; 57 58 import java.lang.reflect.InvocationTargetException ; 59 60 import javax.servlet.http.HttpServletRequest ; 61 import javax.servlet.http.HttpServletResponse ; 62 import javax.servlet.http.HttpSession ; 63 64 import org.apache.commons.beanutils.PropertyUtils; 65 import org.apache.struts.action.ActionErrors; 66 import org.apache.struts.action.ActionForm; 67 import org.apache.struts.action.ActionMapping; 68 69 import com.ivata.mask.MaskFactory; 70 import com.ivata.mask.util.StringHandling; 71 import com.ivata.mask.util.SystemException; 72 import com.ivata.mask.web.struts.MaskAction; 73 import com.ivata.mask.web.struts.MaskAuthenticator; 74 75 86 public class GroupFrameAction extends MaskAction { 87 97 public GroupFrameAction(MaskFactory maskFactory, MaskAuthenticator authenticator) { 98 super(maskFactory, authenticator); 99 } 100 101 125 public String execute(final ActionMapping mapping, 126 final ActionErrors errors, 127 final ActionForm form, 128 final HttpServletRequest request, 129 final HttpServletResponse response, 130 final HttpSession session) 131 throws SystemException { 132 String mode = request.getParameter("mode"); 133 if (StringHandling.isNullOrEmpty(mode)) { 134 throw new SystemException("No mode specified in GroupFrameAction"); 135 } 136 137 String menuPage, contentFrameName; 140 String contentPage = "/util/loading.jsp"; 142 143 if ("group".equals(mode)) { 144 menuPage = "/addressBook/groupTree.action?mode=group"; 145 contentFrameName = "ivataGroup"; 146 } else if ("addressBook".equals(mode)) { 147 menuPage = "/addressBook/groupList.action?mode=addressBook"; 148 contentFrameName = "ivataAddressBook"; 149 } else if ("userGroup".equals(mode)) { 150 menuPage = "/addressBook/groupList.action?mode=userGroup"; 151 contentFrameName = "ivataUserGroup"; 152 } else { 153 throw new SystemException("ERROR in GroupFrameAction: unidentified mode '" 154 + mode 155 + "'"); 156 } 157 158 try { 159 PropertyUtils.setProperty(form, "contentFrameName", contentFrameName); 160 PropertyUtils.setProperty(form, "contentPage", contentPage); 161 PropertyUtils.setProperty(form, "menuFrameName", 162 contentFrameName + "List"); 163 PropertyUtils.setProperty(form, "menuPage", menuPage); 164 } catch (IllegalAccessException e) { 165 throw new SystemException(e); 166 } catch (InvocationTargetException e) { 167 throw new SystemException(e); 168 } catch (NoSuchMethodException e) { 169 throw new SystemException(e); 170 } 171 return null; 172 } 173 } 174 | Popular Tags |