日期:2014-05-19 浏览次数:20846 次
package cn.org.jshuwei.j2ee.test.action; import cn.org.jshuwei.j2ee.test.core.JshuweiContext; import cn.org.jshuwei.j2ee.util.StringUtil; import com.opensymphony.xwork2.ActionSupport; import org.apache.struts2.interceptor.ServletRequestAware; import org.apache.struts2.interceptor.ServletResponseAware; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.io.IOException; import java.io.PrintWriter; /** * Copyright 2009 huwei(jshuwei.org.cn) * Generate by huwei's generate Util * 本类由胡伟j2ee自动生成工具生成,欢迎与作者交流讨论, * <p>联系方式:<br>Web:http://jshuwei.org.cn <br>Email:huwei@jshuwei.org.cn<br>QQ:772627301<p/> */ public class BaseAction extends ActionSupport implements ServletRequestAware, ServletResponseAware { private static final long serialVersionUID = 1L; protected HttpServletRequest request; protected HttpServletResponse response; private String serviceId; private String serviceName; private int eventCode; protected Object requestObj; private int id; private int start; private int limit = 25; public void setServletRequest(HttpServletRequest httpServletRequest) { request = httpServletRequest; } public void setServletResponse(HttpServletResponse httpServletResponse) { response = httpServletResponse; } public HttpServletRequest getRequest() { return request; } public void setRequest(HttpServletRequest request) { this.request = request; } public HttpServletResponse getResponse() { return response; } public void setResponse(HttpServletResponse response) { this.response = response; } public String getServiceId() { return serviceId; } public void setServiceId(String serviceId) { this.serviceId = serviceId; } public String getServiceName() { return serviceName; } public void setServiceName(String serviceName) { this.serviceName = serviceName; } public int getEventCode() { return eventCode; } public void setEventCode(int eventCode) { this.eventCode = eventCode; } public Object getRequestObj() { return requestObj; } public void setRequestObj(Object requestObj) { this.requestObj = requestObj; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getStart() { return start; } public void setStart(int start) { this.start = start; } public int getLimit() { return limit; } public void setLimit(int limit) { this.limit = limit; } @SuppressWarnings("unchecked") public JshuweiContext generateJshuweiContext() { JshuweiContext jshuweiContext = new JshuweiContext(); if (serviceId != null || !"".equals(serviceId)) jshuweiContext.setServiceId(serviceId); if (serviceName != null || !"".equals(serviceName)) jshuweiContext.setServiceName(serviceName); if (eventCode != 0) jshuweiContext.setEventCode(eventCode); if (eventCode % 100 ==1) setRequestObj(new Integer[]{start,limit}); if (eventCode % 100 ==2 || eventCode % 100 ==6) setRequestObj(new Integer(id)); if (eventCode % 100 ==3) { List list = new ArrayList(); list.add(generateEntity()); list.add