content = content
+ "<TD class=tdline28 width=\"1%\"> </TD><TD class=tdline28><B>消息</B></TD><TD class=tdline28 width=\"15%\"><B>发送时间</B></TD></TR>";
// 生成消息标题行
SysUserCache userCache = (SysUserCache) request.getSession()
.getAttribute(Globals.SYS_USER_CACHE);
SysUser user = userCache.getUser();
Message message = new Message();
ArrayList messageList = new ArrayList();
// 查询好友发送的信息
if (choose.equals("1")) {
Object o = BeanUtil
.getEmptyObject("cn.edu.pku.dr.requirement.elicitation.data.Message");
Class clazz = o.getClass();
SelectCommand scmd = DAOFactory.getSelectCommand(clazz);
Filter filter1 = DAOFactory.getFilter();
Filter filter2 = DAOFactory.getFilter("messageReceiver",
SQLOperator.EQUAL, user.getUserId());
Filter filter3 = DAOFactory.getFilter("creatorId",
SQLOperator.NOT_EQUAL, "3");
Filter filter4 = DAOFactory.getFilter("useState",
SQLOperator.EQUAL, "Y");
filter1.addFilter(filter2);
filter1.addFilter(filter3, LogicOperator.AND);
filter1.addFilter(filter4, LogicOperator.AND);
scmd.setFilter(filter1);
Session session = SessionFactory.openSession();
messageList = session.query(scmd);
}
// 查询系统发送的消息
else if (choose.equals("2")) {
message.setMessageReceiver(user.getUserId());
Long sys = new Long("3");
message.setCreatorId(sys);
message.setUseState("Y");
messageList = dp.query(message);
}
// 处理我发送的信息
else if (choose.equals("3")) {
message.setCreatorId(user.getUserId());
message.setUseState("Y");
messageList = dp.query(message);
}
for (int i = 0; i < messageList.size(); i++) {
message = (Message) messageList.get(i);