Package com.liusoft.dlog4j.formbean

Examples of com.liusoft.dlog4j.formbean.MessageForm


   */
  protected ActionForward doDeleteAll(ActionMapping mapping,
      ActionForm form, HttpServletRequest request,
      HttpServletResponse response, String s_status) throws Exception      
  {
    MessageForm msg = (MessageForm)form;
    UserBean loginUser = super.getLoginUser(request, response);
    if(loginUser!=null){
      try{
        int status = Integer.parseInt(s_status);
        MessageDAO.deleteMsgs(loginUser.getId(),status);
      }catch(Exception e){
        context().log("delete message where status is "+s_status+" failed.", e);
      }
    }
    return makeForward(mapping.findForward("msgs"), msg.getSid());
  }
View Full Code Here


   */
  protected ActionForward doDelete(ActionMapping mapping,
      ActionForm form, HttpServletRequest request,
      HttpServletResponse response, String s_msg_id) throws Exception      
  {
    MessageForm msg = (MessageForm)form;
    UserBean loginUser = super.getLoginUser(request, response);
    if(loginUser!=null){
      try{
        int msg_id = Integer.parseInt(s_msg_id);
        MessageDAO.deleteMsg(loginUser.getId(), msg_id);
      }catch(Exception e){
        context().log("delete message #"+s_msg_id+" failed.", e);
      }
    }
    String ext = null;
    int page = RequestUtils.getParam(request, "p", -1);
    if(page > 1){
      ext = "p="+page;
    }
    return makeForward(mapping.findForward("msgs"), msg.getSid(), ext);
  }
View Full Code Here

   */
  protected ActionForward doDeleteMessages(ActionMapping mapping,
      ActionForm form, HttpServletRequest request,
      HttpServletResponse response) throws Exception      
  {
    MessageForm msg = (MessageForm)form;
    UserBean loginUser = super.getLoginUser(request, response);
    if(loginUser!=null){
      String[] mids = request.getParameterValues("mid");
      MessageDAO.deleteMsgs(loginUser.getId(), mids);
    }
    return makeForward(mapping.findForward("msgs"), msg.getSid());
  }
View Full Code Here

   */
  protected ActionForward doSendMsg(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception
  {
    MessageForm msgform = (MessageForm)form;
    super.validateClientId(request, msgform);
    ActionMessages msgs = new ActionMessages();
    while(true){
      if(msgform.getExpiredTime()!=null && msgform.getExpiredTime().before(new Date())){
        msgs.add("message", new ActionMessage("error.expired_time_not_available"));
        break;
      }
      if(StringUtils.isEmpty(msgform.getContent())){
        msgs.add("content", new ActionMessage("error.empty_content"));
        break;
      }
      if(msgform.getReceiverId()==0 || msgform.getSid()==0){
        msgs.add("message", new ActionMessage("error.param"));
        break;
      }
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser==null){
        msgs.add("message", new ActionMessage("error.user_not_login"));
        break;
      }
      else if(loginUser.getStatus()!=UserBean.STATUS_NORMAL){
        msgs.add("message", new ActionMessage("error.user_not_available"));
        break;
      }
      else if(DLOGSecurityManager.IllegalGlossary.existIllegalWord(msgform.getContent())){
        msgs.add("message", new ActionMessage("error.illegal_glossary"));
        break;
      }
      UserBean receiver = UserDAO.getUserByID(msgform.getReceiverId());
      if(receiver==null || receiver.getStatus()!=UserBean.STATUS_NORMAL){
        msgs.add("message", new ActionMessage("error.user_not_available"));
        break;
      }
      //�жϽ������Ƿ��Ѿ��������߼�Ϊ������
      if(UserDAO.isUserInBlackList(receiver.getId(), loginUser.getId())){
        msgs.add("message", new ActionMessage("message.sent"));
        break;
      }
      MessageBean msgbean = new MessageBean();
      String content = StringUtils.abbreviate(super.autoFiltrate(null,
          msgform.getContent()), MAX_MESSAGE_LENGTH);
      msgbean.setContent(super.filterScriptAndStyle(content));
      msgbean.setExpiredTime(msgform.getExpiredTime());
      msgbean.setFromUser(loginUser);
      msgbean.setToUser(receiver);
      msgbean.setStatus(MessageBean.STATUS_NEW);
      msgbean.setSendTime(new Date());
      try{
View Full Code Here

   */
  protected ActionForward doReplyMsgAndDeleteOld(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception
  {
    MessageForm msgform = (MessageForm)form;
    super.validateClientId(request, msgform);
    ActionMessages msgs = new ActionMessages();
    while(true){
      if(msgform.getExpiredTime()!=null && msgform.getExpiredTime().before(new Date())){
        msgs.add("message", new ActionMessage("error.expired_time_not_available"));
        break;
      }
      if(StringUtils.isEmpty(msgform.getContent())){
        msgs.add("content", new ActionMessage("error.empty_content"));
        break;
      }
      if(msgform.getReceiverId()==0 || msgform.getSid()==0){
        msgs.add("message", new ActionMessage("error.param"));
        break;
      }
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser==null){
        msgs.add("message", new ActionMessage("error.user_not_login"));
        break;
      }
      else if(loginUser.getStatus()!=UserBean.STATUS_NORMAL){
        msgs.add("message", new ActionMessage("error.user_not_available"));
        break;
      }
      else if(DLOGSecurityManager.IllegalGlossary.existIllegalWord(msgform.getContent())){
        msgs.add("message", new ActionMessage("error.illegal_glossary"));
        break;
      }
      UserBean receiver = UserDAO.getUserByID(msgform.getReceiverId());
      if(receiver==null || receiver.getStatus()!=UserBean.STATUS_NORMAL){
        msgs.add("message", new ActionMessage("error.user_not_available"));
        break;
      }
      //�жϽ������Ƿ��Ѿ��������߼�Ϊ������
      if(UserDAO.isUserInBlackList(receiver.getId(), loginUser.getId())){
        msgs.add("message", new ActionMessage("message.sent"));
        break;
      }
      MessageBean msgbean = new MessageBean();
      String content = StringUtils.abbreviate(super.autoFiltrate(null,
          msgform.getContent()), MAX_MESSAGE_LENGTH);
      msgbean.setContent(super.filterScriptAndStyle(content));
      msgbean.setExpiredTime(msgform.getExpiredTime());
      msgbean.setFromUser(loginUser);
      msgbean.setToUser(receiver);
      msgbean.setStatus(MessageBean.STATUS_NEW);
      msgbean.setSendTime(new Date());
      try{
        MessageDAO.replyAndDeleteMessage(msgform.getMsgID(), msgbean);
        msgs.add("message", new ActionMessage("message.sent"));
      }catch(HibernateException e){
        context().log("undelete diary failed.", e);
        msgs.add("message", new ActionMessage("error.database", e.getMessage()));
      }
View Full Code Here

TOP

Related Classes of com.liusoft.dlog4j.formbean.MessageForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.