package com.zte.tbs.workroom.ui.web.workroomInfo.action; import java.math.BigInteger; import java.text.ParseException; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Vector; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.beanutils.BeanUtils; import org.ecside.util.RequestUtil; import com.zte.ssb.framework.base.BaseAction; import com.zte.ssb.framework.base.util.PageInfo; import com.zte.ssb.framework.util.ApplicationGlobalResource; import com.zte.ssb.webcontainer.action.ActionForm; import com.zte.ssb.webcontainer.action.ActionForward; import com.zte.ssb.webcontainer.action.ActionMapping; import com.zte.tbs.workroom.access.workroomInfo.model.TbsTopicPost; import com.zte.tbs.workroom.access.workroomInfo.model.TbsWorkroom; import com.zte.tbs.workroom.business.workroomInfo.service.intf.ITbsCategoryDS; import com.zte.tbs.workroom.business.workroomInfo.service.intf.ITbsTopicPostDS; import com.zte.tbs.workroom.business.workroomInfo.service.intf.ITbsWorkroomDS; import com.zte.tbs.workroom.common.util.UtilConstants; import com.zte.tbs.workroom.common.util.UtilTools; import com.zte.tbs.workroom.ui.web.workroomInfo.form.TbsTopicPostForm; public final class TbsTopicPostAction extends BaseAction { public ActionForward preAdd(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { if (log.isDebugEnabled()) { log.debug("Entering 'preAdd' method"); } String wId = request.getParameter("workroomId"); BigInteger workroomId = BigInteger.valueOf(Long.parseLong(wId)); ITbsWorkroomDS workDS = (ITbsWorkroomDS)getBean("tbsWorkroomDS"); TbsWorkroom workroom = workDS.getTbsWorkroom(workroomId); ITbsCategoryDS cateDS = (ITbsCategoryDS)getBean("tbsCategoryDS"); List categoryList = cateDS.getTbsCategorys(workroomId); request.setAttribute("workroom", workroom); request.setAttribute("categoryList", categoryList); return mapping.findForward("addTopic"); } public ActionForward add(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { if (log.isDebugEnabled()) { log.debug("Entering 'add' method"); } ApplicationGlobalResource appresource = ApplicationGlobalResource.getInstance(); HttpSession session = request.getSession(); String userId = session.getAttribute(appresource.getValueByKey(UtilConstants.USER_ID)).toString(); String userName = session.getAttribute(appresource.getValueByKey(UtilConstants.USER_ID)).toString(); TbsTopicPostForm tbsTopicPostForm = (TbsTopicPostForm)form; TbsTopicPost tbsTopicPostModel = new TbsTopicPost(); // �ж��ǻظ��������� if(UtilConstants.TOPIC_FLAG.equals(tbsTopicPostForm.getSegment1())) { this.webFromToModel(tbsTopicPostForm,tbsTopicPostModel); } else if(UtilConstants.RESPON_FLAG.equals(tbsTopicPostForm.getSegment1())) { this.webFromToModel(tbsTopicPostForm,tbsTopicPostModel); } else { request.setAttribute("addfail", "addfail"); } tbsTopicPostModel.setCreatedBy(userId); tbsTopicPostModel.setCreatedByName(userName); tbsTopicPostModel.setLastUpdatedBy(userId); tbsTopicPostModel.setCreateDate(new Date()); tbsTopicPostModel.setLastUpdateDate(new Date()); tbsTopicPostModel.setLastUpdatedByName(userName); ITbsTopicPostDS iTbsTopicPostDS = this.getTbsTopicPostService(); iTbsTopicPostDS.insertObject(tbsTopicPostModel); if (log.isInfoEnabled()) { log.info(tbsTopicPostForm.getPosttopic()+"create success!" ); } request.setAttribute("addsuccess", "addsuccess"); return mapping.findForward("listTopic"); } /** *
- *
- �õ����� *
- �������ڣ�2007-11-5 *
- *
- formתʵ�� *
- �������ڣ�2007-11-5 *
- *
- ������ʼ�� *
- �������ڣ�2007-11-5 *