public ActionForward process(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws SystemException {
ProcessTopicForm ptForm = (ProcessTopicForm) form;
ForumDAO dao = ForumDAO.getInstance();
UserDAO userdao = UserDAO.getInstance();
HttpSession session = request.getSession();
User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
int fid = Integer.parseInt(ptForm.getFid());
int tid = Integer.parseInt(ptForm.getFid());
try {
Forum currForum = dao.getForumInfo(fid);
// check access rights if forum invisible
if ((currForum.getLocked() == IConst.Forum.STATUS_INVISIBLE)
&& (user.getStatus() < Integer.parseInt(Configurator
.getInstance().get(IConst.CONFIG.INVADER1)))) {
return (mapping.findForward(IConst.TOKEN.DENIED));
}
request.setAttribute(IConst.REQUEST.CURR_FORUM, currForum);
session.setAttribute(IConst.SESSION.CURR_FORUM, currForum);
updateLastVisitTime((HashMap) session
.getAttribute(IConst.SESSION.LAST_INTIME), ptForm.getTid(),
dao.now());
RecordsData recordsData = new RecordsData();
Topic currThread = dao.getThreadInfo(tid);
dao.fillMessagesList(user, recordsData, ptForm);
Iterator it = recordsData.getRecords().iterator();
boolean attachEnabled = Configurator.getInstance().getBoolean(
IConst.CONFIG.ENABLE_FILE_UPLOAD);
if (it.hasNext()) {
Message mess = (Message) it.next();
currThread.setSubject(mess.getHeading());
mess.setSenderInfo(userdao.getSenderInfo(mess.getSender()));
if (attachEnabled) {
mess.setAttachments(dao.getAttachmentsInfo(mess.getId()));
}
} else {
return (new ActionForward("/ShowForum.do?fid="
+ ptForm.getFid(), true));
}
while (it.hasNext()) {
Message mess = (Message) it.next();
mess.setSenderInfo(userdao.getSenderInfo(mess.getSender()));
if (attachEnabled) {
mess.setAttachments(dao.getAttachmentsInfo(mess.getId()));
}
}