Package com.liusoft.dlog4j.beans

Examples of com.liusoft.dlog4j.beans.MessageBean


  protected static void upgradeMessages(Session old_ssn, Session new_ssn){
    Query q = old_ssn.createQuery("FROM MessageForm l ORDER BY l.id ASC");
    List msgs = q.list();   
    for(int i=0;i<msgs.size();i++){
      MessageForm msg = (MessageForm)msgs.get(i)
      MessageBean mbean = new MessageBean();
      mbean.setContent(msg.getContent());
      mbean.setReadTime(msg.getReadTime());
      mbean.setSendTime(msg.getSendTime());
      mbean.setStatus(msg.getStatus());
      mbean.setFromUser((UserBean)userids.get(new Integer(msg.getFromUserId())));
      mbean.setToUser((UserBean)userids.get(new Integer(msg.getToUserId())));
      new_ssn.save(mbean);
      System.out.println("MESSAGE: " + msg.getId() + " -> " + mbean.getId());
    }
  }
View Full Code Here


   * @param sender
   */
  public static void SendMsgs(List users, String content, UserBean sender){
    try{
      //������Ϣbean
      MessageBean msg = new MessageBean();
      msg.setContent(content);
      msg.setSendTime(new Date());
      msg.setFromUser(sender);
      msg.setStatus(MessageBean.STATUS_NEW);
      //����д�����ݿ�
      Session ssn = getSession();
      beginTransaction();
      for(int i=0;i<users.size();i++){
        UserBean user = (UserBean)users.get(i);
        msg.setToUser(user);
        ssn.save(msg);
        if(i % 20 == 0){
          ssn.flush();
          ssn.clear();
        }
View Full Code Here

      //�жϽ������Ƿ��Ѿ��������߼�Ϊ������
      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.save(msgbean);
        msgs.add("message", new ActionMessage("message.sent"));
      }catch(HibernateException e){
        context().log("undelete diary failed.", e);
View Full Code Here

      //�жϽ������Ƿ��Ѿ��������߼�Ϊ������
      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);
View Full Code Here

TOP

Related Classes of com.liusoft.dlog4j.beans.MessageBean

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.