Package com.liusoft.dlog4j.beans

Examples of com.liusoft.dlog4j.beans.DiaryReplyBean


      SiteBean site = super.getSiteByID(reply.getSid());
      if (site == null) {
        msg = getMessage(request, null, "error.site_not_available");
        break;
      }
      DiaryReplyBean rbean = (DiaryReplyBean) ReplyDAO.getReply(
          DiaryReplyBean.class, reply_id);
      if (rbean == null)
        break;
      if (rbean.getSite().getId() != reply.getSid()) {
        msg = getMessage(request, null, "error.param");
        break;
      }
      if (!site.isOwner(loginUser)
          && !isReplyBelongToUser(rbean, loginUser.getId())) {
View Full Code Here


      if(diary.getLock()==1) {
        msgs.add("reply", new ActionMessage("error.diary.locked"));
        break;
      }
      // ���������д������
      DiaryReplyBean rbean = new DiaryReplyBean();
      rbean.setUser(loginUser);     
      rbean.setAuthor(super.autoFiltrate(site,reply.getAuthor()));
      if (StringUtils.isNotEmpty(reply.getAuthorURL()))
        rbean.setAuthorURL(reply.getAuthorURL());
      if (StringUtils.isNotEmpty(reply.getAuthorEmail()))
        rbean.setAuthorEmail(reply.getAuthorEmail());
      rbean.setClient(new ClientInfo(request, reply
          .getClientType()));
      String content = StringUtils.abbreviate(super.autoFiltrate(null,
          reply.getContent()), MAX_REPLY_LENGTH);
      rbean.setContent(super.filterScriptAndStyle(content));
      rbean.setDiary(diary);
      rbean.setReplyTime(new Date());
      rbean.setSite(site);
      rbean.setStatus(DiaryReplyBean.STATUS_NORMAL);
      rbean.setOwnerOnly(reply.getOwnerOnly());
      DiaryDAO.createDiaryReply(rbean);
      // �ж��Ƿ���Ҫ�ʼ�����
      if (diary.getReplyNotify() == 1) {
        String email = diary.getOwner().getContactInfo()
            .getEmail();
        if (StringUtils.isEmail(email)) {
          this.sendReplyNotify(request, rbean.getSite().getId(), rbean);
        }
      }
      break;
    }while(true);
    if (!msgs.isEmpty()) {
View Full Code Here

      log.getOwner().getCount().incArticleCount(1);
     
      //���в�����ռ������ߵ��ռ���������һ
      List rpls = log.getReplies();
      for(int i=0;rpls!=null && i<rpls.size();i++){
        DiaryReplyBean prb = (DiaryReplyBean)rpls.get(i);
        if(prb.getUser()!=null)
          prb.getUser().getCount().incArticleReply(1);
      }     
     
      ssn.update(log);
      commit();     
    }catch(HibernateException e){
View Full Code Here

      log.getOwner().getCount().incArticleCount(-1);

      //���в�����ռ������ߵ��ռ���������һ
      List rpls = log.getReplies();
      for(int i=0;i<rpls.size();i++){
        DiaryReplyBean prb = (DiaryReplyBean)rpls.get(i);
        if(prb.getUser()!=null)
          prb.getUser().getCount().incArticleReply(-1);
      }     
     
      log.setStatus(DiaryBean.STATUS_DELETED);
      commit();
    }catch(HibernateException e){
View Full Code Here

    Query q = old_ssn.createQuery("FROM ReplyForm c ORDER BY c.id ASC");
    List replies = q.list();
   
    for(int i=0;i<replies.size();i++){
      ReplyForm rform = (ReplyForm)replies.get(i);
      DiaryReplyBean rbean = new DiaryReplyBean();
      rbean.getClient().setAddr("127.0.0.1");
     
      rbean.setDiary(new DiaryOutlineBean(((Integer)logids.get(new Integer(rform.getLogId()))).intValue()));
      rbean.setUser((UserBean)userids.get(new Integer(rform.getAuthor().getId())));
     
      rbean.getUser().getCount().incArticleReply(1);
     
      rbean.setAuthor(rform.getAuthor().getDisplayName());
      rbean.setAuthorEmail(rform.getAuthor().getEmail());
      rbean.setAuthorURL(StringUtils.abbreviate(rform.getAuthor().getHomePage(),100));
      if(rform.getContent().length()>10000)
        rbean.setContent(rform.getContent().substring(0, 10000));
      else
        rbean.setContent(rform.getContent());
      rbean.setReplyTime(rform.getWriteTime());
      rbean.setSite(site);
      new_ssn.save(rbean);
      System.out.println("Reply: " + rform.getId() + " -> " + rbean.getId());   
    }     
  }
View Full Code Here

    Session ssn = HibernateUtils.getSession();
    try{
      HibernateUtils.beginTransaction();
      List rpls = ssn.createQuery("FROM DiaryReplyBean AS r ORDER BY r.id").list();
      for(int i=0;i<rpls.size();i++){
        DiaryReplyBean rpl = (DiaryReplyBean)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.setId(rpl.getUser().getId());
        }
        cb.setAuthor(author);
        cb.setContent(rpl.getContent());
        cb.setCreateTime(rpl.getReplyTime());
        cb.setEid(rpl.getDiary().getId());
        cb.setEtype(DiaryReplyBean.TYPE_DIARY);
        cb.setSite(rpl.getSite());
        cb.setStatus(rpl.getStatus());
        cb.setTitle(StringUtils.abbreviate(rpl.getContent(), 20));
        ssn.save(cb);
        System.out.println("DiaryReplyBean: " + rpl.getId() + " -> " + cb.getId());
      }
      HibernateUtils.commit();
    }catch(Exception e){
      HibernateUtils.rollback();
      throw e;
View Full Code Here

TOP

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

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.