Package com.liusoft.dlog4j.beans

Examples of com.liusoft.dlog4j.beans.PhotoReplyBean


      SiteBean site = super.getSiteByID(reply.getSid());
      if (site == null) {
        msg = getMessage(request, null, "error.site_not_available");
        break;
      }
      PhotoReplyBean rbean = (PhotoReplyBean) ReplyDAO.getReply(
          PhotoReplyBean.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


      HttpServletResponse response) throws Exception {
    ReplyForm reply = (ReplyForm) form;
    //��֤�ͻ��˰�ȫʶ����
    validateClientId(request, reply);
    ActionMessages msgs = new ActionMessages();
    PhotoReplyBean rbean = new PhotoReplyBean();
    do{
      if (StringUtils.isEmpty(reply.getContent())){
        msgs.add("reply", new ActionMessage("error.empty_not_allowed"));
        break;
      }
      if(reply.getContent().getBytes().length >= 3000){
        msgs.add("reply", new ActionMessage("error.reply_too_long"));
        break;
      }
      SiteBean site = super.getSiteByID(reply.getSid());
      if (site == null) {
        msgs.add("reply", new ActionMessage("error.site_not_available"));
        break;
      }
      UserBean loginUser = super.getLoginUser(request, response);
      //��������
      if(loginUser!=null && isUserInBlackList(site, loginUser)){
        msgs.add("photo", new ActionMessage("error.user_in_blacklist"));
        break;
      }
      PhotoOutlineBean photo = PhotoDAO.getPhotoOutlineByID(reply.getParentId());
      if (photo == null || photo.getSite().getId() != reply.getSid()) {
        msgs.add("reply", new ActionMessage("error.param"));
        break;
      }
      if(photo.getLock()==1) {
        msgs.add("reply", new ActionMessage("error.photo.locked"));
        break;
      }
      // ���������д������
      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.setPhoto(photo);
      rbean.setReplyTime(new Date());
      rbean.setSite(site);
      rbean.setStatus(DiaryReplyBean.STATUS_NORMAL);
      rbean.setOwnerOnly(reply.getOwnerOnly());
      PhotoDAO.createPhotoReply(rbean);
      break;
    }while(true);
    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
View Full Code Here

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

      TagDAO.deleteTagByRefId(photo.getId(), TagBean.TYPE_PHOTO);
     
      //���в������Ƭ�����ߵ������������һ
      List rpls = photo.getReplies();
      for(int i=0;rpls!=null&&i<rpls.size();i++){
        PhotoReplyBean prb = (PhotoReplyBean)rpls.get(i);
        if(prb.getUser()!=null){
          prb.getUser().getCount().incPhotoReplyCount(-1);
        }
      }
     
      //�޸����ø���ƬΪ������ಾ
      executeUpdate("UPDATE AlbumBean AS a SET a.cover = NULL WHERE a.cover.id=?", photo.getId());
View Full Code Here

TOP

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

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.