Package com.liusoft.dlog4j.beans

Examples of com.liusoft.dlog4j.beans.TopicReplyBean


   * @return
   */
  public TopicReplyBean reply(SiteBean site, int reply_id) {
    if (site == null || reply_id < 1)
      return null;
    TopicReplyBean reply = BBSReplyDAO.getTopicReplyByID(reply_id);
    if (reply != null && reply.getSite().getId() == site.getId()
        && reply.getStatus() == TopicBean.STATUS_NORMAL)
      return reply;
    return null;
  }
View Full Code Here


    Session ssn = HibernateUtils.getSession();
    try{
      HibernateUtils.beginTransaction();
      List rpls = ssn.createQuery("FROM TopicReplyBean AS r ORDER BY r.id").list();
      for(int i=0;i<rpls.size();i++){
        TopicReplyBean rpl = (TopicReplyBean)rpls.get(i);
        CommentBean cb = new CommentBean();
        cb.setClient(rpl.getClient());
        AuthorInfo author = new AuthorInfo();
        author.setEmail(rpl.getAuthorEmail());
        author.setName(rpl.getAuthor());
        author.setUrl(rpl.getAuthorURL());
        if(rpl.getUser()!=null){
          author.setName(rpl.getUser().getNickname());
          author.setId(rpl.getUser().getId());
        }
        else
          author.setName("����");
        cb.setAuthor(author);
        cb.setContent(rpl.getContent());
        cb.setCreateTime(rpl.getReplyTime());
        cb.setEid(rpl.getTopic().getId());
        cb.setEtype(DiaryReplyBean.TYPE_BBS);
        cb.setSite(rpl.getSite());
        cb.setStatus(rpl.getStatus());
        cb.setTitle(rpl.getTitle());
        ssn.save(cb);
        System.out.println("TopicReplyBean: " + rpl.getId() + " -> " + cb.getId());
      }
      HibernateUtils.commit();
    }catch(Exception e){
      HibernateUtils.rollback();
      throw e;
View Full Code Here

      }
      topic.getUser().getCount().incTopicCount(-1);
     
      List rpls = topic.getReplies();
      for(int i=rpls.size()-1;i>=0;i--){
        TopicReplyBean rbean = (TopicReplyBean)rpls.get(i);
        if(rbean.getUser()!=null)
          rbean.getUser().getCount().incTopicReplyCount(-1);
      }
     
      ssn.delete(topic);

      //ɾ����ǩ
View Full Code Here

        msgs.add("log", new ActionMessage("error.topic_not_available",
            new Integer(rform.getTid())));
        break;
      }
      // ����TopicBean
      TopicReplyBean reply = new TopicReplyBean();
      reply.setClient(new ClientInfo(request, rform.getClientType()));
      String content = StringUtils.abbreviate(super.autoFiltrate(null,
          rform.getContent()), MAX_REPLY_LENGTH);
      reply.setContent(super.filterScriptAndStyle(content));
      reply.setReplyTime(new Date());
      reply.setSite(site);
      reply.setTitle(super.autoFiltrate(site, rform.getTitle()));
      reply.setTopic(topic);
      reply.setUser(loginUser);
      BBSReplyDAO.create(reply);
      break;
    }
    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
View Full Code Here

      SiteBean site = super.getSiteByID(rform.getSid());
      if (site == null) {
        msgs.add("reply", new ActionMessage("error.site_not_available"));
        break;
      }
      TopicReplyBean rbean = BBSReplyDAO.getTopicReplyByID(rform.getId());
      if (rbean != null
          && rbean.getStatus() == TopicReplyBean.STATUS_NORMAL) {
        String title = super.autoFiltrate(site, rform.getTitle());
        if (!StringUtils.equals(title, rbean.getTitle()))
          rbean.setTitle(title);
        String content = StringUtils.abbreviate(super.autoFiltrate(
            null, rform.getContent()), MAX_REPLY_LENGTH);
        if (!StringUtils.equals(content, rbean.getContent()))
          rbean.setContent(super.filterScriptAndStyle(content));
        BBSReplyDAO.flush();
      }
      break;
    }
    if (!msgs.isEmpty()) {
View Full Code Here

    while (true) {
      UserBean loginUser = super.getLoginUser(request, response);
      if (loginUser == null)
        break;
      TopicReplyBean trb = BBSReplyDAO.getTopicReplyByID(rform.getId());
      if (trb == null)
        break;
      if (trb.getUser().getId() != loginUser.getId()
          && loginUser.getOwnSiteId() != rform.getSid())
        break;
      BBSReplyDAO.delete(trb);
      break;
    }
View Full Code Here

            TopicBean tb = (TopicBean)obj;
            if(tb.getCreateTime().before(t))
              objs.remove();
          }
          else if(obj instanceof TopicReplyBean){
            TopicReplyBean trb = (TopicReplyBean)obj;
            if(trb.getReplyTime().before(t))
              objs.remove();
          }
        }
      }
      long lTime = System.currentTimeMillis() - start;
View Full Code Here

TOP

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

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.