- 浏览: 7260 次
最近访客 更多访客>>
最新评论
-
ttxiangyou:
呵呵,这个是乎有点乱呢?可以发到我邮箱吗?
zou_wei_f ...
不用迭代算法而快速实现的jsp树结构 -
wangjian3q:
xDataTree.js 给我一份呢??谢谢您了
wangji ...
不用迭代算法而快速实现的jsp树结构
/*
* All rights reserved.
*
* $Id: SelectReaderAction.java,v 1.14 2004/06/10 15:06:48 guoq Exp $
*/
package cn.com.detech.deinfo.mission.web;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.StringTokenizer;
import cn.com.detech.deinfo.mission.model.ReaderBean;
import cn.com.detech.deinfo.platform.DeInfoConstant;
import cn.com.detech.deinfo.users.BeanDepartment;
import cn.com.detech.deinfo.users.BeanGroup;
import cn.com.detech.deinfo.users.BeanPosition;
import cn.com.detech.deinfo.users.BeanUser;
import cn.com.detech.deinfo.users.CacheDepartments;
import cn.com.detech.deinfo.users.CacheGroups;
import cn.com.detech.deinfo.users.CacheObjects;
import cn.com.detech.deinfo.users.CachePositions;
import cn.com.detech.deinfo.users.CacheUsers;
import cn.com.detech.deinfo.users.User;
import cn.com.detech.struts.action.DEBaseAction;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
/**
* 传阅人名单选择ActionBean类
* NOTE: This source is automatically generated please do not modify this file. Either subclass or
* remove the record in src/records/definitions.
* @author 曾刚
*/
public class SelectReaderAction extends DEBaseAction
{
public SelectReaderAction(){
FUNCTION_POINT = "";
}
protected static Class getClassName(){
return SelectReaderAction.class;
}
//------------------------------------------------------ Local Forwards
static final String FORWARD_success = "success";
static final String FORWARD_failure = "failure";
static final String FORWARD_Select = "Select";
static final String FORWARD_Select2 = "Select2";//add by weij;
static final String FORWARD_Back = "Back";//add by weij;
static final String FORWARD_ChangeDept = "ChangeDept";
static final String FORWARD_ChangeGroup = "ChangeGroup";
static final String FORWARD_Save = "Save";
/*static final*/ String DEFAULT_POSITION = "待定";
//------------------------------------------------------ Action Methods
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
* Return an ActionForward instance describing where and how
* control should be forwarded, or null if the response has
* already been completed.
*
* @param mapping The ActionMapping used to select this instance
* @param aform The optional ActionForm bean for this request (if any)
* @param request 待处理的HTTP请求
* @param response 生成的HTTP回应
* @return 页面迁移
* @throws Exception
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm myform,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception
{try{
SelectReaderForm form = (SelectReaderForm)myform;
String action = form.getAction();
if ( action == null ) {
action = "Select";
}
log.debug("enter sel people ,action is:"+action);
DEFAULT_POSITION=getMessage("mission.selectreader.tobe");
if(action.equalsIgnoreCase("Select")){
return doSelect(mapping, form, request, response, user);
}
// add by weij;
if(action.equalsIgnoreCase("Select2")){
return doSelect2(mapping, form, request, response, user);
}
if(action.equalsIgnoreCase("ChangeDept")){
return doChangeDept(mapping, form, request, response, user);
}
if(action.equalsIgnoreCase("ChangeGroup")){
return doChangeGroup(mapping, form, request, response, user);
}
if(action.equalsIgnoreCase("Save")){
return doSave(mapping, form, request, response, user);
}
if(action.equalsIgnoreCase("Cancel")){
return doCancel(mapping, form, request, response, user);
}
// add by weij;
if(action.equalsIgnoreCase("Save2")){
return doSave2(mapping, form, request, response, user);
}
}catch(Exception e){e.printStackTrace();
}
return mapping.findForward(FORWARD_Select);
}
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doSelect(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {
// Add your logic code here
form.reset();
HttpSession session = request.getSession();
CacheObjects objCacheObjects = (CacheObjects)session.getServletContext().getAttribute(DeInfoConstant.PLATFORM_CONTEXT);
CacheUsers users = objCacheObjects.getUsers();
CacheDepartments departments = objCacheObjects.getDepartments();
CacheGroups groups = objCacheObjects.getGroups();
form.reset();
ArrayList deptList = departments.getDepartments();
BeanDepartment nbd = new BeanDepartment();
nbd.setDeptID(9998);
nbd.setDepartmentName(getMessage("mission.selectreader.sel_dept"));
deptList.add(0, nbd);
form.setDeptList(deptList);
form.setSelDeptID("9998");
//加用户组
Iterator it = groups.getIterator0();
ArrayList groupList = new ArrayList();
while (it.hasNext()) {
BeanGroup nbg = (BeanGroup) it.next();
groupList.add(nbg);
}
BeanGroup nbg = new BeanGroup();
nbg.setGroupID(9998);
nbg.setGroupName(getMessage("mission.selectreader.sel_group"));
groupList.add(0, nbg);
form.setGroupList(groupList);
form.setSelGroupID("9998");
form.setEmpList(new ArrayList());
ArrayList readerList = new ArrayList();
session.removeAttribute("ReaderIDs");//add by weij;
/*ArrayList readerIDList = (ArrayList)session.getAttribute("ReaderIDs");
if (readerIDList == null)
readerIDList = new ArrayList();
session.setAttribute("readerIDList", readerIDList); //生成副本
if (readerIDList != null && readerIDList.size() > 0) {
Iterator ior = readerIDList.iterator();
ArrayList readerNameList = new ArrayList();
session.removeAttribute("ReaderNames");//add by weij;
String tmpStr = (String)session.getAttribute("ReaderNames");
if (tmpStr == null)
tmpStr = new String("");
session.setAttribute("readerNameStr", tmpStr); //生成副本
if (tmpStr != null && !tmpStr.equals("")) {
StringTokenizer st = new StringTokenizer(tmpStr, "#");
while(st.hasMoreTokens()) {
readerNameList.add((String)st.nextElement());
}
}
Iterator ier = readerNameList.iterator();
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
int userID = Integer.parseInt((String)ior.next());
String readerStr = (String)ier.next();
StringTokenizer st = new StringTokenizer(readerStr, "&&&&&&&&");
if(st.hasMoreTokens()) {
nrb.setUserName((String)st.nextElement());
nrb.setDeptName((String)st.nextElement());
}
StringTokenizer st1 = new StringTokenizer((String)st.nextElement(), "&&");
if(st1.hasMoreTokens()) {
nrb.setPositionName((String)st1.nextElement());
}
nrb.setUserID(userID);
readerList.add(nrb);
}
form.setReaderList(readerList);
String[] as = new String[1];
as[0] = "";
form.setSelectedIDStr(as);
}
else*/
form.setReaderList(readerList);
return (mapping.findForward(FORWARD_Select));
}
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doSelect2(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {
// Add your logic code here
form.reset();
HttpSession session = request.getSession();
CacheObjects objCacheObjects = (CacheObjects)session.getServletContext().getAttribute(DeInfoConstant.PLATFORM_CONTEXT);
CacheUsers users = objCacheObjects.getUsers();
CacheDepartments departments = objCacheObjects.getDepartments();
CacheGroups groups = objCacheObjects.getGroups();
form.reset();
ArrayList deptList = departments.getDepartments();
BeanDepartment nbd = new BeanDepartment();
nbd.setDeptID(9998);
nbd.setDepartmentName(getMessage("mission.selectreader.sel_dept"));
deptList.add(0, nbd);
form.setDeptList(deptList);
form.setSelDeptID("9998");
//加用户组
Iterator it = groups.getIterator0();
ArrayList groupList = new ArrayList();
while (it.hasNext()) {
BeanGroup nbg = (BeanGroup) it.next();
groupList.add(nbg);
}
BeanGroup nbg = new BeanGroup();
nbg.setGroupID(9998);
nbg.setGroupName(getMessage("mission.selectreader.sel_group"));
groupList.add(0, nbg);
form.setGroupList(groupList);
form.setSelGroupID("9998");
form.setEmpList(new ArrayList());
ArrayList readerList = new ArrayList();
session.removeAttribute("ReaderIDs2");//add by weij;
/*ArrayList readerIDList = (ArrayList)session.getAttribute("ReaderIDs2");
if (readerIDList == null)
readerIDList = new ArrayList();
session.setAttribute("readerIDList", readerIDList); //生成副本
if (readerIDList != null && readerIDList.size() > 0) {
Iterator ior = readerIDList.iterator();
ArrayList readerNameList = new ArrayList();
session.removeAttribute("ReaderNames");//add by weij;
String tmpStr = (String)session.getAttribute("ReaderNames");
if (tmpStr == null)
tmpStr = new String("");
session.setAttribute("readerNameStr", tmpStr); //生成副本
if (tmpStr != null && !tmpStr.equals("")) {
StringTokenizer st = new StringTokenizer(tmpStr, "#");
while(st.hasMoreTokens()) {
readerNameList.add((String)st.nextElement());
}
}
Iterator ier = readerNameList.iterator();
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
int userID = Integer.parseInt((String)ior.next());
String readerStr = (String)ier.next();
StringTokenizer st = new StringTokenizer(readerStr, "&&&&&&&&");
if(st.hasMoreTokens()) {
nrb.setUserName((String)st.nextElement());
nrb.setDeptName((String)st.nextElement());
}
StringTokenizer st1 = new StringTokenizer((String)st.nextElement(), "&&");
if(st1.hasMoreTokens()) {
nrb.setPositionName((String)st1.nextElement());
}
nrb.setUserID(userID);
readerList.add(nrb);
}
form.setReaderList(readerList);
String[] as = new String[1];
as[0] = "";
form.setSelectedIDStr(as);
}
else*/
form.setReaderList(readerList);
return (mapping.findForward(FORWARD_Select2));
}
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doChangeDept(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {
// Add your logic code here
HttpSession session = request.getSession();
CacheObjects objCacheObjects = (CacheObjects)session.getServletContext().getAttribute(DeInfoConstant.PLATFORM_CONTEXT);
CacheUsers users = objCacheObjects.getUsers();
CachePositions positions = objCacheObjects.getPositions();
CacheDepartments departments = objCacheObjects.getDepartments();
String selDeptID = form.getSelDeptID();
String readerNameStr = form.getReaderNameStr();
session.setAttribute("readerNameStr", readerNameStr);
String[] tmpIDArray = form.getSelectedIDStr();
if(tmpIDArray!=null)
log.debug("tmpIDArray.length == "+tmpIDArray.length);
form.reset2();
ArrayList readerIDList = new ArrayList();
if (tmpIDArray != null) {
for (int i = 0; i < tmpIDArray.length; i ++) {
readerIDList.add(tmpIDArray[i]);
}
session.setAttribute("readerIDList", readerIDList);
}
ArrayList tmpList = new ArrayList();
ArrayList empList = new ArrayList();
if (selDeptID == null || selDeptID.equals("") || selDeptID.equals("0")) {
form.setAction("Select");
return (mapping.findForward(FORWARD_Select));
}
if (selDeptID.equals("9998")) {
form.setEmpList(empList);
}
else {
int deptID = Integer.parseInt(selDeptID);
String departmentName = ((BeanDepartment)departments.getDeptByID(deptID)).getDepartmentName();
tmpList = users.getUsersByDeptID(deptID);
Iterator it = tmpList.iterator();
while(it.hasNext()) {
BeanUser nbu = (BeanUser)it.next();
int userID = nbu.getUserID();
int positionID = 0;
if (userID == 1) { //如果是系统管理员
positionID = 1; //直接设置其职务为待定
} else {
positionID = users.getUserPosition(userID, deptID);
}
//int positionID = users.getUserPosition(userID, deptID);
BeanPosition beanp = (BeanPosition) positions.getPositionByID(positionID);
String positionName = getMessage("mission.selectreader.tobe");
if(beanp!=null) positionName = beanp.getPosition();
String userName = "";
BeanUser buser = (BeanUser) users.getUserByID(userID);
if (buser != null) {
userName = buser.getUserName();
}
//String userName = ((BeanUser)users.getUserByID(userID)).getUserName();
ReaderBean rb = new ReaderBean();
rb.setUserID(userID);
rb.setUserName(userName);
rb.setDeptID(deptID);
rb.setDeptName(departmentName);
rb.setPositionID(positionID);
rb.setPositionName(positionName);
empList.add(rb);
}
}
form.setEmpList(empList);
form.setSelDeptID(selDeptID);
form.setSelGroupID("9998");
ArrayList readerList = new ArrayList();
readerIDList = (ArrayList) session.getAttribute("readerIDList");
if (readerIDList != null && readerIDList.size() > 0) {
Iterator ior = readerIDList.iterator();
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
String ids = (String) ior.next();
StringTokenizer st = new StringTokenizer(ids, "#");
int i = 0;
int userID = 0;
int deptID = 0;
int positionID = 0;
while (st.hasMoreTokens()) {
if (i == 0)
userID = Integer.parseInt((String) st.nextElement());
else if (i == 1)
deptID = Integer.parseInt((String) st.nextElement());
else if (i == 2)
positionID =
Integer.parseInt((String) st.nextElement());
;
i++;
}
String userName =
((BeanUser) users.getUserByID(userID)).getUserName();
String deptName =
((BeanDepartment) departments.getDeptByID(deptID))
.getDepartmentName();
String positionName = getPosition(positions, positionID);
nrb.setUserID(userID);
nrb.setUserName(userName);
nrb.setDeptID(deptID);
nrb.setDeptName(deptName);
nrb.setPositionID(positionID);
nrb.setPositionName(positionName);
readerList.add(nrb);
}
/*ArrayList readerList = new ArrayList();
readerIDList = (ArrayList)session.getAttribute("readerIDList");
if (readerIDList != null && readerIDList.size() > 0) {
Iterator ior = readerIDList.iterator();
ArrayList readerNameList = new ArrayList();
String tmpStr = (String)session.getAttribute("readerNameStr");
if (tmpStr != null && !tmpStr.equals("")) {
StringTokenizer st = new StringTokenizer(tmpStr, "#");
while(st.hasMoreTokens()) {
readerNameList.add((String)st.nextElement());
}
}
Iterator ier = readerNameList.iterator();
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
int userID = Integer.parseInt((String)ior.next());
String readerStr = "";
if(ier.hasNext())
readerStr = (String)ier.next();
StringTokenizer st = new StringTokenizer(readerStr, "&&&&&&&&");
if(st.hasMoreTokens()) {
nrb.setUserName((String)st.nextElement());
nrb.setDeptName((String)st.nextElement());
}
String ststr = "";
if(st.hasMoreElements()) ststr = (String)st.nextElement();
StringTokenizer st1 = new StringTokenizer(ststr, "&&");
if(st1.hasMoreTokens()) {
nrb.setPositionName((String)st1.nextElement());
}
nrb.setUserID(userID);
readerList.add(nrb);
}*/
form.setReaderList(readerList);
form.setSelectedIDStr(null);
}
else
form.setReaderList(readerList);
return (mapping.findForward(FORWARD_Select));
}
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doChangeGroup(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {
// Add your logic code here
HttpSession session = request.getSession();
CacheObjects objCacheObjects =
(CacheObjects) session.getServletContext().getAttribute(
DeInfoConstant.PLATFORM_CONTEXT);
CacheUsers users = objCacheObjects.getUsers();
CacheDepartments departments = objCacheObjects.getDepartments();
CachePositions positions = objCacheObjects.getPositions();
CacheGroups groups = objCacheObjects.getGroups();
String selGroupID = form.getSelGroupID();
String readerNameStr = form.getReaderNameStr();
//session.removeAttribute("readerNameStr");
session.setAttribute("readerNameStr", readerNameStr);
String[] tmpIDArray = form.getSelectedIDStr();
form.reset();
ArrayList readerIDList = new ArrayList();
if (tmpIDArray != null) {
for (int i = 0; i < tmpIDArray.length; i++) {
readerIDList.add(tmpIDArray[i]);
}
}
//session.removeAttribute("readerIDList");
session.setAttribute("readerIDList", readerIDList);
ArrayList empList = new ArrayList();
ArrayList tmpList = new ArrayList();
HashMap hm = new HashMap();
if (selGroupID == null
|| selGroupID.equals("")
|| selGroupID.equals("0")) {
form.setAction("Select");
return (mapping.findForward(FORWARD_Select));
}
if (selGroupID.equals("9998")) {
form.setEmpList(empList);
} else {
tmpList = users.getUsersByGroupID(Integer.parseInt(selGroupID));
Iterator it = tmpList.iterator();
while (it.hasNext()) {
BeanGroup bg = (BeanGroup) it.next();
int userID = bg.getUserID();
int deptID = bg.getDeptID();
//要排除用户组中用户重复的情况
if (userID == 0 && deptID == 0) { //所有用户都属于该用户组
ArrayList alist = users.getUsers();
Iterator ior = alist.iterator();
while (ior.hasNext()) {
BeanUser bu = (BeanUser) ior.next();
int uid = bu.getUserID();
String userName = users.getUserByID(uid).getUserName();
int did =
((BeanDepartment) (users
.getDeptsByUserID(uid)
.get(0)))
.getDeptID();
String departmentName =
((BeanDepartment) (users
.getDeptsByUserID(uid)
.get(0)))
.getDepartmentName();
int pid = users.getUserPosition(uid, did);
String positionName = getPosition(positions, pid);
ReaderBean rb = new ReaderBean();
rb.setUserID(uid);
rb.setUserName(userName);
rb.setDeptID(did);
rb.setDeptName(departmentName);
rb.setPositionID(pid);
rb.setPositionName(positionName);
hm.put(new Integer(uid), rb);
}
} else if (userID == 0 && deptID != 0) { //某部门下的所有用户属于该用户组
ArrayList alist = users.getUsersByDeptID(deptID);
Iterator irr = alist.iterator();
while (irr.hasNext()) {
BeanUser bu = (BeanUser) irr.next();
int uid = bu.getUserID();
String userName = users.getUserByID(uid).getUserName();
String departmentName =
((BeanDepartment) departments.getDeptByID(deptID))
.getDepartmentName();
int pid = users.getUserPosition(uid, deptID);
String positionName = getPosition(positions, pid);
ReaderBean rb = new ReaderBean();
rb.setUserID(uid);
rb.setUserName(userName);
rb.setDeptID(deptID);
rb.setDeptName(departmentName);
rb.setPositionID(pid);
rb.setPositionName(positionName);
hm.put(new Integer(uid), rb);
}
} else if (userID != 0) {
String userName = users.getUserByID(userID).getUserName();
String departmentName =
((BeanDepartment) departments.getDeptByID(deptID))
.getDepartmentName();
//log.error("开始取userID:" + userID + ",deptID:" + deptID + " 对应的positionID的值。");
int positionID = 0;
if (userID == 1) { //如果是系统管理员
positionID = 1; //直接设置其职务为代定
} else {
positionID = users.getUserPosition(userID, deptID);
}
//log.error("positionID:####" + positionID + "####");
String positionName = getPosition(positions, positionID);
ReaderBean rb = new ReaderBean();
rb.setUserID(userID);
rb.setUserName(userName);
rb.setDeptID(deptID);
rb.setDeptName(departmentName);
rb.setPositionID(positionID);
rb.setPositionName(positionName);
hm.put(new Integer(userID), rb);
}
}
}
empList.addAll(hm.values());
form.setEmpList(empList);
form.setSelGroupID(selGroupID);
form.setSelDeptID("9998");
ArrayList readerList = new ArrayList();
readerIDList = (ArrayList) session.getAttribute("readerIDList");
if (readerIDList != null && readerIDList.size() > 0) {
Iterator ior = readerIDList.iterator();
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
String ids = (String) ior.next();
StringTokenizer st = new StringTokenizer(ids, "#");
int i = 0;
int userID = 0;
int deptID = 0;
int positionID = 0;
while (st.hasMoreTokens()) {
if (i == 0)
userID = Integer.parseInt((String) st.nextElement());
else if (i == 1)
deptID = Integer.parseInt((String) st.nextElement());
else if (i == 2)
positionID =
Integer.parseInt((String) st.nextElement());
i++;
}
String userName =
((BeanUser) users.getUserByID(userID)).getUserName();
String deptName =
((BeanDepartment) departments.getDeptByID(deptID))
.getDepartmentName();
String positionName = getPosition(positions, positionID);
nrb.setUserID(userID);
nrb.setUserName(userName);
nrb.setDeptID(deptID);
nrb.setDeptName(deptName);
nrb.setPositionID(positionID);
nrb.setPositionName(positionName);
readerList.add(nrb);
}
/*ArrayList readerNameList = new ArrayList();
String tmpStr = (String)session.getAttribute("readerNameStr");
if (tmpStr != null && !tmpStr.equals("")) {
StringTokenizer st = new StringTokenizer(tmpStr, "#");
while(st.hasMoreTokens()) {
readerNameList.add((String)st.nextElement());
}
}
Iterator ier = readerNameList.iterator();
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
int userID = Integer.parseInt((String)ior.next());
String readerStr = (String)ier.next();
StringTokenizer st = new StringTokenizer(readerStr, "&&&&&&&&");
if(st.hasMoreTokens()) {
nrb.setUserName((String)st.nextElement());
nrb.setDeptName((String)st.nextElement());
}
StringTokenizer st1 = new StringTokenizer((String)st.nextElement(), "&&");
if(st1.hasMoreTokens()) {
nrb.setPositionName((String)st1.nextElement());
}
nrb.setUserID(userID);
readerList.add(nrb);
}*/
form.setReaderList(readerList);
form.setSelectedIDStr(null);
} else {
form.setReaderList(readerList);
form.setSelectedIDStr(null);
}
return (mapping.findForward(FORWARD_Select));
}
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doSave(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {
// Add your logic code here
HttpSession session = request.getSession();
String readerNameStr = form.getReaderNameStr();
session.removeAttribute("readerNameStr");
setReaderID("ReaderIDs",mapping,form,request,response,user);
session.removeAttribute("readerIDList");
//}
return (mapping.findForward(FORWARD_Back));
}
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doCancel(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {
log.debug("enter save:");
// Add your logic code here
HttpSession session = request.getSession();
String readerNameStr = form.getReaderNameStr();
session.removeAttribute("readerNameStr");
session.removeAttribute("readerIDList");
form.reset();
return (mapping.findForward(FORWARD_Back));
}
// add by weij;
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doSave2(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {
// Add your logic code here
HttpSession session = request.getSession();
String readerNameStr = form.getReaderNameStr();
session.removeAttribute("readerNameStr");
setReaderID("ReaderIDs2",mapping,form,request,response,user);
session.removeAttribute("readerIDList");
//}
return (mapping.findForward(FORWARD_Back));
}
private String getPosition(CachePositions posts, int pid) {
String position = DEFAULT_POSITION;
BeanPosition bpost0 = (BeanPosition) posts.getPositionByID(pid);
if (bpost0 != null) {
position = bpost0.getPosition();
}
return position;
}
private boolean setReaderID(String attrName,
ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
{
String[] tmpIDArray = form.getSelectedIDStr();
ArrayList readerIDList = new ArrayList();
if (tmpIDArray != null) {
for (int i = 0; i < tmpIDArray.length; i ++) {
readerIDList.add(tmpIDArray[i]);
log.debug("tmpIDArray[i]:"+tmpIDArray[i]);
}
}
if (readerIDList != null && readerIDList.size() > 0) {
ArrayList readerList = new ArrayList();
Iterator ior = readerIDList.iterator();
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
String ids = (String) ior.next();
log.debug("ids: "+ids);
StringTokenizer st = new StringTokenizer(ids, "#");
log.debug("StringTokenizer:"+st.toString());
int i = 0;
int userID = 0;
int deptID = 0;
int positionID = 0;
while (st.hasMoreTokens()) {
if (i == 0)
userID = Integer.parseInt((String) st.nextElement());
else if (i == 1)
deptID = Integer.parseInt((String) st.nextElement());
else if (i == 2)
positionID =
Integer.parseInt((String) st.nextElement());
;
i++;
}
log.debug("userid:"+userID);
readerList.add((new Integer(userID)).toString());
}
System.out.println("arrname:"+attrName);
HttpSession session = request.getSession();
session.setAttribute(attrName,readerList);
if(readerList!=null)
System.out.println("readerList.size:"+readerList.size());
else
System.out.println("readerList is null!!!");
}
return true;
}
}
* All rights reserved.
*
* $Id: SelectReaderAction.java,v 1.14 2004/06/10 15:06:48 guoq Exp $
*/
package cn.com.detech.deinfo.mission.web;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.StringTokenizer;
import cn.com.detech.deinfo.mission.model.ReaderBean;
import cn.com.detech.deinfo.platform.DeInfoConstant;
import cn.com.detech.deinfo.users.BeanDepartment;
import cn.com.detech.deinfo.users.BeanGroup;
import cn.com.detech.deinfo.users.BeanPosition;
import cn.com.detech.deinfo.users.BeanUser;
import cn.com.detech.deinfo.users.CacheDepartments;
import cn.com.detech.deinfo.users.CacheGroups;
import cn.com.detech.deinfo.users.CacheObjects;
import cn.com.detech.deinfo.users.CachePositions;
import cn.com.detech.deinfo.users.CacheUsers;
import cn.com.detech.deinfo.users.User;
import cn.com.detech.struts.action.DEBaseAction;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
/**
* 传阅人名单选择ActionBean类
* NOTE: This source is automatically generated please do not modify this file. Either subclass or
* remove the record in src/records/definitions.
* @author 曾刚
*/
public class SelectReaderAction extends DEBaseAction
{
public SelectReaderAction(){
FUNCTION_POINT = "";
}
protected static Class getClassName(){
return SelectReaderAction.class;
}
//------------------------------------------------------ Local Forwards
static final String FORWARD_success = "success";
static final String FORWARD_failure = "failure";
static final String FORWARD_Select = "Select";
static final String FORWARD_Select2 = "Select2";//add by weij;
static final String FORWARD_Back = "Back";//add by weij;
static final String FORWARD_ChangeDept = "ChangeDept";
static final String FORWARD_ChangeGroup = "ChangeGroup";
static final String FORWARD_Save = "Save";
/*static final*/ String DEFAULT_POSITION = "待定";
//------------------------------------------------------ Action Methods
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
* Return an ActionForward instance describing where and how
* control should be forwarded, or null if the response has
* already been completed.
*
* @param mapping The ActionMapping used to select this instance
* @param aform The optional ActionForm bean for this request (if any)
* @param request 待处理的HTTP请求
* @param response 生成的HTTP回应
* @return 页面迁移
* @throws Exception
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm myform,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception
{try{
SelectReaderForm form = (SelectReaderForm)myform;
String action = form.getAction();
if ( action == null ) {
action = "Select";
}
log.debug("enter sel people ,action is:"+action);
DEFAULT_POSITION=getMessage("mission.selectreader.tobe");
if(action.equalsIgnoreCase("Select")){
return doSelect(mapping, form, request, response, user);
}
// add by weij;
if(action.equalsIgnoreCase("Select2")){
return doSelect2(mapping, form, request, response, user);
}
if(action.equalsIgnoreCase("ChangeDept")){
return doChangeDept(mapping, form, request, response, user);
}
if(action.equalsIgnoreCase("ChangeGroup")){
return doChangeGroup(mapping, form, request, response, user);
}
if(action.equalsIgnoreCase("Save")){
return doSave(mapping, form, request, response, user);
}
if(action.equalsIgnoreCase("Cancel")){
return doCancel(mapping, form, request, response, user);
}
// add by weij;
if(action.equalsIgnoreCase("Save2")){
return doSave2(mapping, form, request, response, user);
}
}catch(Exception e){e.printStackTrace();
}
return mapping.findForward(FORWARD_Select);
}
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doSelect(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {
// Add your logic code here
form.reset();
HttpSession session = request.getSession();
CacheObjects objCacheObjects = (CacheObjects)session.getServletContext().getAttribute(DeInfoConstant.PLATFORM_CONTEXT);
CacheUsers users = objCacheObjects.getUsers();
CacheDepartments departments = objCacheObjects.getDepartments();
CacheGroups groups = objCacheObjects.getGroups();
form.reset();
ArrayList deptList = departments.getDepartments();
BeanDepartment nbd = new BeanDepartment();
nbd.setDeptID(9998);
nbd.setDepartmentName(getMessage("mission.selectreader.sel_dept"));
deptList.add(0, nbd);
form.setDeptList(deptList);
form.setSelDeptID("9998");
//加用户组
Iterator it = groups.getIterator0();
ArrayList groupList = new ArrayList();
while (it.hasNext()) {
BeanGroup nbg = (BeanGroup) it.next();
groupList.add(nbg);
}
BeanGroup nbg = new BeanGroup();
nbg.setGroupID(9998);
nbg.setGroupName(getMessage("mission.selectreader.sel_group"));
groupList.add(0, nbg);
form.setGroupList(groupList);
form.setSelGroupID("9998");
form.setEmpList(new ArrayList());
ArrayList readerList = new ArrayList();
session.removeAttribute("ReaderIDs");//add by weij;
/*ArrayList readerIDList = (ArrayList)session.getAttribute("ReaderIDs");
if (readerIDList == null)
readerIDList = new ArrayList();
session.setAttribute("readerIDList", readerIDList); //生成副本
if (readerIDList != null && readerIDList.size() > 0) {
Iterator ior = readerIDList.iterator();
ArrayList readerNameList = new ArrayList();
session.removeAttribute("ReaderNames");//add by weij;
String tmpStr = (String)session.getAttribute("ReaderNames");
if (tmpStr == null)
tmpStr = new String("");
session.setAttribute("readerNameStr", tmpStr); //生成副本
if (tmpStr != null && !tmpStr.equals("")) {
StringTokenizer st = new StringTokenizer(tmpStr, "#");
while(st.hasMoreTokens()) {
readerNameList.add((String)st.nextElement());
}
}
Iterator ier = readerNameList.iterator();
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
int userID = Integer.parseInt((String)ior.next());
String readerStr = (String)ier.next();
StringTokenizer st = new StringTokenizer(readerStr, "&&&&&&&&");
if(st.hasMoreTokens()) {
nrb.setUserName((String)st.nextElement());
nrb.setDeptName((String)st.nextElement());
}
StringTokenizer st1 = new StringTokenizer((String)st.nextElement(), "&&");
if(st1.hasMoreTokens()) {
nrb.setPositionName((String)st1.nextElement());
}
nrb.setUserID(userID);
readerList.add(nrb);
}
form.setReaderList(readerList);
String[] as = new String[1];
as[0] = "";
form.setSelectedIDStr(as);
}
else*/
form.setReaderList(readerList);
return (mapping.findForward(FORWARD_Select));
}
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doSelect2(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {
// Add your logic code here
form.reset();
HttpSession session = request.getSession();
CacheObjects objCacheObjects = (CacheObjects)session.getServletContext().getAttribute(DeInfoConstant.PLATFORM_CONTEXT);
CacheUsers users = objCacheObjects.getUsers();
CacheDepartments departments = objCacheObjects.getDepartments();
CacheGroups groups = objCacheObjects.getGroups();
form.reset();
ArrayList deptList = departments.getDepartments();
BeanDepartment nbd = new BeanDepartment();
nbd.setDeptID(9998);
nbd.setDepartmentName(getMessage("mission.selectreader.sel_dept"));
deptList.add(0, nbd);
form.setDeptList(deptList);
form.setSelDeptID("9998");
//加用户组
Iterator it = groups.getIterator0();
ArrayList groupList = new ArrayList();
while (it.hasNext()) {
BeanGroup nbg = (BeanGroup) it.next();
groupList.add(nbg);
}
BeanGroup nbg = new BeanGroup();
nbg.setGroupID(9998);
nbg.setGroupName(getMessage("mission.selectreader.sel_group"));
groupList.add(0, nbg);
form.setGroupList(groupList);
form.setSelGroupID("9998");
form.setEmpList(new ArrayList());
ArrayList readerList = new ArrayList();
session.removeAttribute("ReaderIDs2");//add by weij;
/*ArrayList readerIDList = (ArrayList)session.getAttribute("ReaderIDs2");
if (readerIDList == null)
readerIDList = new ArrayList();
session.setAttribute("readerIDList", readerIDList); //生成副本
if (readerIDList != null && readerIDList.size() > 0) {
Iterator ior = readerIDList.iterator();
ArrayList readerNameList = new ArrayList();
session.removeAttribute("ReaderNames");//add by weij;
String tmpStr = (String)session.getAttribute("ReaderNames");
if (tmpStr == null)
tmpStr = new String("");
session.setAttribute("readerNameStr", tmpStr); //生成副本
if (tmpStr != null && !tmpStr.equals("")) {
StringTokenizer st = new StringTokenizer(tmpStr, "#");
while(st.hasMoreTokens()) {
readerNameList.add((String)st.nextElement());
}
}
Iterator ier = readerNameList.iterator();
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
int userID = Integer.parseInt((String)ior.next());
String readerStr = (String)ier.next();
StringTokenizer st = new StringTokenizer(readerStr, "&&&&&&&&");
if(st.hasMoreTokens()) {
nrb.setUserName((String)st.nextElement());
nrb.setDeptName((String)st.nextElement());
}
StringTokenizer st1 = new StringTokenizer((String)st.nextElement(), "&&");
if(st1.hasMoreTokens()) {
nrb.setPositionName((String)st1.nextElement());
}
nrb.setUserID(userID);
readerList.add(nrb);
}
form.setReaderList(readerList);
String[] as = new String[1];
as[0] = "";
form.setSelectedIDStr(as);
}
else*/
form.setReaderList(readerList);
return (mapping.findForward(FORWARD_Select2));
}
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doChangeDept(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {
// Add your logic code here
HttpSession session = request.getSession();
CacheObjects objCacheObjects = (CacheObjects)session.getServletContext().getAttribute(DeInfoConstant.PLATFORM_CONTEXT);
CacheUsers users = objCacheObjects.getUsers();
CachePositions positions = objCacheObjects.getPositions();
CacheDepartments departments = objCacheObjects.getDepartments();
String selDeptID = form.getSelDeptID();
String readerNameStr = form.getReaderNameStr();
session.setAttribute("readerNameStr", readerNameStr);
String[] tmpIDArray = form.getSelectedIDStr();
if(tmpIDArray!=null)
log.debug("tmpIDArray.length == "+tmpIDArray.length);
form.reset2();
ArrayList readerIDList = new ArrayList();
if (tmpIDArray != null) {
for (int i = 0; i < tmpIDArray.length; i ++) {
readerIDList.add(tmpIDArray[i]);
}
session.setAttribute("readerIDList", readerIDList);
}
ArrayList tmpList = new ArrayList();
ArrayList empList = new ArrayList();
if (selDeptID == null || selDeptID.equals("") || selDeptID.equals("0")) {
form.setAction("Select");
return (mapping.findForward(FORWARD_Select));
}
if (selDeptID.equals("9998")) {
form.setEmpList(empList);
}
else {
int deptID = Integer.parseInt(selDeptID);
String departmentName = ((BeanDepartment)departments.getDeptByID(deptID)).getDepartmentName();
tmpList = users.getUsersByDeptID(deptID);
Iterator it = tmpList.iterator();
while(it.hasNext()) {
BeanUser nbu = (BeanUser)it.next();
int userID = nbu.getUserID();
int positionID = 0;
if (userID == 1) { //如果是系统管理员
positionID = 1; //直接设置其职务为待定
} else {
positionID = users.getUserPosition(userID, deptID);
}
//int positionID = users.getUserPosition(userID, deptID);
BeanPosition beanp = (BeanPosition) positions.getPositionByID(positionID);
String positionName = getMessage("mission.selectreader.tobe");
if(beanp!=null) positionName = beanp.getPosition();
String userName = "";
BeanUser buser = (BeanUser) users.getUserByID(userID);
if (buser != null) {
userName = buser.getUserName();
}
//String userName = ((BeanUser)users.getUserByID(userID)).getUserName();
ReaderBean rb = new ReaderBean();
rb.setUserID(userID);
rb.setUserName(userName);
rb.setDeptID(deptID);
rb.setDeptName(departmentName);
rb.setPositionID(positionID);
rb.setPositionName(positionName);
empList.add(rb);
}
}
form.setEmpList(empList);
form.setSelDeptID(selDeptID);
form.setSelGroupID("9998");
ArrayList readerList = new ArrayList();
readerIDList = (ArrayList) session.getAttribute("readerIDList");
if (readerIDList != null && readerIDList.size() > 0) {
Iterator ior = readerIDList.iterator();
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
String ids = (String) ior.next();
StringTokenizer st = new StringTokenizer(ids, "#");
int i = 0;
int userID = 0;
int deptID = 0;
int positionID = 0;
while (st.hasMoreTokens()) {
if (i == 0)
userID = Integer.parseInt((String) st.nextElement());
else if (i == 1)
deptID = Integer.parseInt((String) st.nextElement());
else if (i == 2)
positionID =
Integer.parseInt((String) st.nextElement());
;
i++;
}
String userName =
((BeanUser) users.getUserByID(userID)).getUserName();
String deptName =
((BeanDepartment) departments.getDeptByID(deptID))
.getDepartmentName();
String positionName = getPosition(positions, positionID);
nrb.setUserID(userID);
nrb.setUserName(userName);
nrb.setDeptID(deptID);
nrb.setDeptName(deptName);
nrb.setPositionID(positionID);
nrb.setPositionName(positionName);
readerList.add(nrb);
}
/*ArrayList readerList = new ArrayList();
readerIDList = (ArrayList)session.getAttribute("readerIDList");
if (readerIDList != null && readerIDList.size() > 0) {
Iterator ior = readerIDList.iterator();
ArrayList readerNameList = new ArrayList();
String tmpStr = (String)session.getAttribute("readerNameStr");
if (tmpStr != null && !tmpStr.equals("")) {
StringTokenizer st = new StringTokenizer(tmpStr, "#");
while(st.hasMoreTokens()) {
readerNameList.add((String)st.nextElement());
}
}
Iterator ier = readerNameList.iterator();
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
int userID = Integer.parseInt((String)ior.next());
String readerStr = "";
if(ier.hasNext())
readerStr = (String)ier.next();
StringTokenizer st = new StringTokenizer(readerStr, "&&&&&&&&");
if(st.hasMoreTokens()) {
nrb.setUserName((String)st.nextElement());
nrb.setDeptName((String)st.nextElement());
}
String ststr = "";
if(st.hasMoreElements()) ststr = (String)st.nextElement();
StringTokenizer st1 = new StringTokenizer(ststr, "&&");
if(st1.hasMoreTokens()) {
nrb.setPositionName((String)st1.nextElement());
}
nrb.setUserID(userID);
readerList.add(nrb);
}*/
form.setReaderList(readerList);
form.setSelectedIDStr(null);
}
else
form.setReaderList(readerList);
return (mapping.findForward(FORWARD_Select));
}
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doChangeGroup(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {
// Add your logic code here
HttpSession session = request.getSession();
CacheObjects objCacheObjects =
(CacheObjects) session.getServletContext().getAttribute(
DeInfoConstant.PLATFORM_CONTEXT);
CacheUsers users = objCacheObjects.getUsers();
CacheDepartments departments = objCacheObjects.getDepartments();
CachePositions positions = objCacheObjects.getPositions();
CacheGroups groups = objCacheObjects.getGroups();
String selGroupID = form.getSelGroupID();
String readerNameStr = form.getReaderNameStr();
//session.removeAttribute("readerNameStr");
session.setAttribute("readerNameStr", readerNameStr);
String[] tmpIDArray = form.getSelectedIDStr();
form.reset();
ArrayList readerIDList = new ArrayList();
if (tmpIDArray != null) {
for (int i = 0; i < tmpIDArray.length; i++) {
readerIDList.add(tmpIDArray[i]);
}
}
//session.removeAttribute("readerIDList");
session.setAttribute("readerIDList", readerIDList);
ArrayList empList = new ArrayList();
ArrayList tmpList = new ArrayList();
HashMap hm = new HashMap();
if (selGroupID == null
|| selGroupID.equals("")
|| selGroupID.equals("0")) {
form.setAction("Select");
return (mapping.findForward(FORWARD_Select));
}
if (selGroupID.equals("9998")) {
form.setEmpList(empList);
} else {
tmpList = users.getUsersByGroupID(Integer.parseInt(selGroupID));
Iterator it = tmpList.iterator();
while (it.hasNext()) {
BeanGroup bg = (BeanGroup) it.next();
int userID = bg.getUserID();
int deptID = bg.getDeptID();
//要排除用户组中用户重复的情况
if (userID == 0 && deptID == 0) { //所有用户都属于该用户组
ArrayList alist = users.getUsers();
Iterator ior = alist.iterator();
while (ior.hasNext()) {
BeanUser bu = (BeanUser) ior.next();
int uid = bu.getUserID();
String userName = users.getUserByID(uid).getUserName();
int did =
((BeanDepartment) (users
.getDeptsByUserID(uid)
.get(0)))
.getDeptID();
String departmentName =
((BeanDepartment) (users
.getDeptsByUserID(uid)
.get(0)))
.getDepartmentName();
int pid = users.getUserPosition(uid, did);
String positionName = getPosition(positions, pid);
ReaderBean rb = new ReaderBean();
rb.setUserID(uid);
rb.setUserName(userName);
rb.setDeptID(did);
rb.setDeptName(departmentName);
rb.setPositionID(pid);
rb.setPositionName(positionName);
hm.put(new Integer(uid), rb);
}
} else if (userID == 0 && deptID != 0) { //某部门下的所有用户属于该用户组
ArrayList alist = users.getUsersByDeptID(deptID);
Iterator irr = alist.iterator();
while (irr.hasNext()) {
BeanUser bu = (BeanUser) irr.next();
int uid = bu.getUserID();
String userName = users.getUserByID(uid).getUserName();
String departmentName =
((BeanDepartment) departments.getDeptByID(deptID))
.getDepartmentName();
int pid = users.getUserPosition(uid, deptID);
String positionName = getPosition(positions, pid);
ReaderBean rb = new ReaderBean();
rb.setUserID(uid);
rb.setUserName(userName);
rb.setDeptID(deptID);
rb.setDeptName(departmentName);
rb.setPositionID(pid);
rb.setPositionName(positionName);
hm.put(new Integer(uid), rb);
}
} else if (userID != 0) {
String userName = users.getUserByID(userID).getUserName();
String departmentName =
((BeanDepartment) departments.getDeptByID(deptID))
.getDepartmentName();
//log.error("开始取userID:" + userID + ",deptID:" + deptID + " 对应的positionID的值。");
int positionID = 0;
if (userID == 1) { //如果是系统管理员
positionID = 1; //直接设置其职务为代定
} else {
positionID = users.getUserPosition(userID, deptID);
}
//log.error("positionID:####" + positionID + "####");
String positionName = getPosition(positions, positionID);
ReaderBean rb = new ReaderBean();
rb.setUserID(userID);
rb.setUserName(userName);
rb.setDeptID(deptID);
rb.setDeptName(departmentName);
rb.setPositionID(positionID);
rb.setPositionName(positionName);
hm.put(new Integer(userID), rb);
}
}
}
empList.addAll(hm.values());
form.setEmpList(empList);
form.setSelGroupID(selGroupID);
form.setSelDeptID("9998");
ArrayList readerList = new ArrayList();
readerIDList = (ArrayList) session.getAttribute("readerIDList");
if (readerIDList != null && readerIDList.size() > 0) {
Iterator ior = readerIDList.iterator();
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
String ids = (String) ior.next();
StringTokenizer st = new StringTokenizer(ids, "#");
int i = 0;
int userID = 0;
int deptID = 0;
int positionID = 0;
while (st.hasMoreTokens()) {
if (i == 0)
userID = Integer.parseInt((String) st.nextElement());
else if (i == 1)
deptID = Integer.parseInt((String) st.nextElement());
else if (i == 2)
positionID =
Integer.parseInt((String) st.nextElement());
i++;
}
String userName =
((BeanUser) users.getUserByID(userID)).getUserName();
String deptName =
((BeanDepartment) departments.getDeptByID(deptID))
.getDepartmentName();
String positionName = getPosition(positions, positionID);
nrb.setUserID(userID);
nrb.setUserName(userName);
nrb.setDeptID(deptID);
nrb.setDeptName(deptName);
nrb.setPositionID(positionID);
nrb.setPositionName(positionName);
readerList.add(nrb);
}
/*ArrayList readerNameList = new ArrayList();
String tmpStr = (String)session.getAttribute("readerNameStr");
if (tmpStr != null && !tmpStr.equals("")) {
StringTokenizer st = new StringTokenizer(tmpStr, "#");
while(st.hasMoreTokens()) {
readerNameList.add((String)st.nextElement());
}
}
Iterator ier = readerNameList.iterator();
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
int userID = Integer.parseInt((String)ior.next());
String readerStr = (String)ier.next();
StringTokenizer st = new StringTokenizer(readerStr, "&&&&&&&&");
if(st.hasMoreTokens()) {
nrb.setUserName((String)st.nextElement());
nrb.setDeptName((String)st.nextElement());
}
StringTokenizer st1 = new StringTokenizer((String)st.nextElement(), "&&");
if(st1.hasMoreTokens()) {
nrb.setPositionName((String)st1.nextElement());
}
nrb.setUserID(userID);
readerList.add(nrb);
}*/
form.setReaderList(readerList);
form.setSelectedIDStr(null);
} else {
form.setReaderList(readerList);
form.setSelectedIDStr(null);
}
return (mapping.findForward(FORWARD_Select));
}
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doSave(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {
// Add your logic code here
HttpSession session = request.getSession();
String readerNameStr = form.getReaderNameStr();
session.removeAttribute("readerNameStr");
setReaderID("ReaderIDs",mapping,form,request,response,user);
session.removeAttribute("readerIDList");
//}
return (mapping.findForward(FORWARD_Back));
}
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doCancel(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {
log.debug("enter save:");
// Add your logic code here
HttpSession session = request.getSession();
String readerNameStr = form.getReaderNameStr();
session.removeAttribute("readerNameStr");
session.removeAttribute("readerIDList");
form.reset();
return (mapping.findForward(FORWARD_Back));
}
// add by weij;
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doSave2(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {
// Add your logic code here
HttpSession session = request.getSession();
String readerNameStr = form.getReaderNameStr();
session.removeAttribute("readerNameStr");
setReaderID("ReaderIDs2",mapping,form,request,response,user);
session.removeAttribute("readerIDList");
//}
return (mapping.findForward(FORWARD_Back));
}
private String getPosition(CachePositions posts, int pid) {
String position = DEFAULT_POSITION;
BeanPosition bpost0 = (BeanPosition) posts.getPositionByID(pid);
if (bpost0 != null) {
position = bpost0.getPosition();
}
return position;
}
private boolean setReaderID(String attrName,
ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
{
String[] tmpIDArray = form.getSelectedIDStr();
ArrayList readerIDList = new ArrayList();
if (tmpIDArray != null) {
for (int i = 0; i < tmpIDArray.length; i ++) {
readerIDList.add(tmpIDArray[i]);
log.debug("tmpIDArray[i]:"+tmpIDArray[i]);
}
}
if (readerIDList != null && readerIDList.size() > 0) {
ArrayList readerList = new ArrayList();
Iterator ior = readerIDList.iterator();
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
String ids = (String) ior.next();
log.debug("ids: "+ids);
StringTokenizer st = new StringTokenizer(ids, "#");
log.debug("StringTokenizer:"+st.toString());
int i = 0;
int userID = 0;
int deptID = 0;
int positionID = 0;
while (st.hasMoreTokens()) {
if (i == 0)
userID = Integer.parseInt((String) st.nextElement());
else if (i == 1)
deptID = Integer.parseInt((String) st.nextElement());
else if (i == 2)
positionID =
Integer.parseInt((String) st.nextElement());
;
i++;
}
log.debug("userid:"+userID);
readerList.add((new Integer(userID)).toString());
}
System.out.println("arrname:"+attrName);
HttpSession session = request.getSession();
session.setAttribute(attrName,readerList);
if(readerList!=null)
System.out.println("readerList.size:"+readerList.size());
else
System.out.println("readerList is null!!!");
}
return true;
}
}
相关推荐
ztsc_109339.apk
永磁同步电机的高频正弦电压注入的速度观测,Simulink,PMSM,高频正弦。
智慧燃气发展研究报告
如何通过智能卡读写器SDK接入鸿蒙操作系统?通过智能卡读写器提供的SDK范例可以将智能卡读写器接入在运行鸿蒙操作系统的智能终端设备上。
谭浩强编写的《C程序设计(第五版)》PPT、书中源码、习题答案以及习题库
人力资源+大数据+薪酬报告+涨薪调薪,在学习、工作生活中,越来越多的事务都会使用到报告,通常情况下,报告的内容含量大、篇幅较长。那么什么样的薪酬报告才是有效的呢?以下是小编精心整理的调薪申请报告,欢迎大家分享。相信老板看到这样的报告,一定会考虑涨薪的哦。
分布式驱动汽车稳定性控制。 采用分层式直接横摆力矩控制,上层滑模控制,下层基于轮胎滑移率最优分配。 滑模控制跟踪横摆角速度和质心侧偏角误差。 七自由度整车模型输出实际质心侧偏角和横摆角速度,二自由度模型输出理想质心侧偏角和横摆角速度。 附m文件,有参考文献和说明文档
注意:此文档为最终版本,方便大家记录,但更新主要还是在博客更新
汇川.H5U框架程序,汇川TIT700系列触摸屏框架程序 1.汇川H5U-A8系列cpu 自制封装多个FB功能块程序,轴控制功能块,气缸动作报警功能块,XY矩阵功能块,等等。 只需写动作步序,其他全部调用FB 和HMI可以无实物仿真 仿真HMI地址127.0.0.1 A1349.H5U原框架
学生作业-作业打卡盖章。该项目为html前端项目,依据学生作业提交情况,通过点击名字进行打卡盖章。涉及html、js、css,其中js中涉及监听函数;窗口中的列表数据来源于data.jso,可自行修改
Spring面试专题.pdf
2025年蓝色简约时尚婚礼邀请函模板
深层过滤纸板是一种由纤维素材料制成的平板或薄片,具有过滤液体或气体的能力。它通常由纤维素纤维(如木浆)经过湿法造纸工艺制成,形成一张薄而均匀的纸板。深层过滤纸板设计用于过滤任何类型的液体,包括葡萄酒、油、啤酒和果汁等,广泛应用于食品饮料、制药、化工等领域。 随着酿酒行业和饮料行业的不断壮大,对深层过滤纸板的需求也在增加。深层过滤纸板常用于过滤液体中的杂质和固体颗粒,确保产品的质量和纯度。因此,这些行业的发展推动了过滤纸板的需求。为了满足酿酒行业和饮料行业对过滤效果、速度和成本的不断追求,深层过滤纸板制造商进行了技术创新和改进。他们不断改良过滤纸板的材料、结构和制造工艺,以提高其过滤效率和性能,同时降低生产成本。环保意识的提升推动了过滤纸板行业朝着绿色、可持续发展的方向发展。包括可降解材料的应用,再生纤维的使用以及生产过程的绿色化都是行业发展的趋势。 目前在全球范围内,工业化的发展仍处于高速阶段,企业在生产过程中要求更高的过滤处理标准,从而促进了深层过滤纸板行业的发展。随着生物技术产业的发展,越来越多的实验室需要使用过滤纸板进行细胞和菌群的分离,同时也需要更高精度的滤料来处理许多疾病的检
该项目包含完整的前后端代码、数据库脚本和相关工具,简单部署即可运行。功能完善、界面美观、操作简单,具有很高的实际应用价值,非常适合作为Java毕业设计或Java课程设计使用。 所有项目均经过严格调试,确保可运行!下载后即可快速部署和使用。 1 适用场景: 毕业设计 期末大作业 课程设计 2 项目特点: 代码完整:详细代码注释,适合新手学习和使用 功能强大:涵盖常见的核心功能,满足大部分课程设计需求 部署简单:有基础的人,只需按照教程操作,轻松完成本地或服务器部署 高质量代码:经过严格测试,确保无错误,稳定运行 3 技术栈和工具 前端:HTML + Vue.js 后端框架:Spring Boot 开发环境:IntelliJ IDEA 数据库:MySQL(建议使用 5.7 版本,更稳定) 数据库可视化工具:Navicat 部署环境:Tomcat(推荐 7.x 或 8.x 版本),Maven
easy-interceptor修改请求头和响应头.zip
代码复现;冷热电气多门互补的微能源网鲁棒优化调度MATLAB复现 随着能源结构调整,集成风/光等可再生能源输入、冷热电气等多种能源互补输出的微能源网得到了逐步发展,如何协调调度微能源网内冷热电气源网荷成为当前研究热点。 建立了冷热电气多能互补的微能源网在孤岛/并网模式下的协调调度模型,并利用供热/供冷系统的热惯性和热/冷负荷的柔性,发挥供热/供冷系统的“储能”功能,以电转气(P2G)装置实现电—气网络双向互通。 模型采用鲁棒线性优化理论将随机优化模型进行确定性转化,取得经济性和鲁棒性的适当折中。 算例仿真验证了温度负荷储能特性对微能源网灵活调度的优化作用和鲁棒性指标对优化结果的协 调作用。 关键词:微能源网;多能互补;温度负荷;储能特性;鲁棒优化
三电平T型变器双闭环PI控制-调制实现在60度坐标系 变器 减少了普通SVPWM的矢量计算时间,在60度坐标系完成高效计算,控制效果很好。 可以发参考资料
该项目包含完整的前后端代码、数据库脚本和相关工具,简单部署即可运行。功能完善、界面美观、操作简单,具有很高的实际应用价值,非常适合作为Java毕业设计或Java课程设计使用。 所有项目均经过严格调试,确保可运行!下载后即可快速部署和使用。 1 适用场景: 毕业设计 期末大作业 课程设计 2 项目特点: 代码完整:详细代码注释,适合新手学习和使用 功能强大:涵盖常见的核心功能,满足大部分课程设计需求 部署简单:有基础的人,只需按照教程操作,轻松完成本地或服务器部署 高质量代码:经过严格测试,确保无错误,稳定运行 3 技术栈和工具 前端:HTML + Vue.js 后端框架:Spring Boot 开发环境:IntelliJ IDEA 数据库:MySQL(建议使用 5.7 版本,更稳定) 数据库可视化工具:Navicat 部署环境:Tomcat(推荐 7.x 或 8.x 版本),Maven
箱线图(Box Plot)是一种用于展示数据分布的图形工具,能够有效地显示数据的集中趋势和离散程度。以下是箱线图的主要特点和组成部分: 主要特点 数据分布:箱线图可以清晰地展示数据的中位数、四分位数和潜在的异常值。 多组比较:可以将多组数据在同一张图中进行可视化,便于比较不同组之间的差异。 易于理解:由于其结构清晰,读取和理解相对简单。 使用场景 数据分析:用于探讨数据的分布和变化,识别异常值。 统计总结:在数据报告和研究中,用于直观表达数据特征。
ChromeDriver 是一个用于自动化 Chrome 浏览器的工具,它是由 Selenium WebDriver 提供支持的。在测试领域,尤其是Web应用程序的自动化测试中,ChromeDriver扮演着至关重要的角色。标题"chromedriver version 118.0.5993.70"表明这是 ChromeDriver 的一个特定版本,版本号为118.0.5993.70,通常这样的更新会带来性能优化、新功能以及对Chrome浏览器新版本的支持。 描述中的“chromedriver测试版本”意味着这可能是一个用于测试目的的构建,可能包含了最新的改进或者尚未广泛发布的特性。开发者和测试工程师会使用这样的测试版本来确保他们的自动化测试脚本能够兼容即将推出的 ChromeDriver 正式版本。 标签“测试 chromedriver”进一步强调了该软件在测试环境中的应用,特别是与 Chrome 浏览器的自动化测试相关的场景。ChromeDriver 允许测试人员通过编写 Selen。内容来源于网络分享,如有侵权请联系我删除。另外如果没有积分的同学需要下载,请私信我。