Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Comment


      streamWebService(response, jsonString);
      return null;
    }
   
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Comment comment = (Comment) em.find(Comment.class, Format.getLong(commentId));

      if (alertType.equals(Constants.ALERT_TYPE_MODERATOR)) {
        comment.setModeration(Constants.VALUE_YES);
        em.persist(comment);
      }
      else {
        Iterator<?> iterator = comment.getAgreeCustomers().iterator();
        while (iterator.hasNext()) {
          Customer c = (Customer) iterator.next();
          if (c.getCustId().equals(customer.getCustId())) {
            iterator.remove();
            break;
          }
        }
        iterator = comment.getDisagreeCustomers().iterator();
        while (iterator.hasNext()) {
          Customer c = (Customer) iterator.next();
          if (c.getCustId().equals(customer.getCustId())) {
            iterator.remove();
            break;
          }
        }
        if (alertType.equals(Constants.ALERT_TYPE_AGREE)) {
          comment.getAgreeCustomers().add(customer);
        }
        else {
          comment.getDisagreeCustomers().add(customer);
        }
      }
     
      JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
    jsonResult.put("agreeCount", comment.getAgreeCustomers().size());
    jsonResult.put("disagreeCount", comment.getDisagreeCustomers().size());
    jsonResult.put("moderation", String.valueOf(comment.getModeration()));
    streamWebService(response, jsonResult.toHtmlString());
      return null;
    }
View Full Code Here


    String commentLine = request.getParameter("comment");
    commentLine = Utility.escapeStrictHTML(commentLine);
    if (!Format.isNullOrEmpty(commentTitle) ||  !Format.isNullOrEmpty(commentLine)) {   
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Content content = ContentDAO.loadNatural(site.getSiteId(), Utility.encode(contentNaturalKey));
      Comment comment = new Comment();
      comment.setCommentTitle(commentTitle);
      comment.setComment(commentLine);
      comment.setActive(Constants.VALUE_YES);
      String custName = customer.getCustEmail();
      if (custName.length() > 20) {
        custName = custName.substring(0, 19);
      }
      comment.setRecCreateBy(custName);
      comment.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      comment.setRecUpdateBy(custName);
      comment.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      comment.setCustomer(customer);
      comment.setCommentRating(0);
      content.getComments().add(comment);
      em.persist(comment);
    }
   
        ActionForward forward = actionMapping.findForward("commentSuccess") ;
View Full Code Here

    JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
    Iterator<?> iterator = item.getComments().iterator();
    Vector<JSONEscapeObject> comments = new Vector<JSONEscapeObject>();
    while (iterator.hasNext()) {
      Comment comment = (Comment) iterator.next();
      JSONEscapeObject jsonComment = new JSONEscapeObject();
      jsonComment.put("commentId", comment.getCommentId());
      jsonComment.put("commentTitle", comment.getCommentTitle());
      jsonComment.put("comment", comment.getComment());
      jsonComment.put("moderation", comment.getModeration());
      jsonComment.put("commentApproved", comment.getCommentApproved());
      jsonComment.put("custEmail", comment.getCustomer().getCustEmail());
      jsonComment.put("custPublicName", comment.getCustomer().getCustPublicName());
      jsonComment.put("recCreateDatetime", Format.getFullDatetime(comment.getRecCreateDatetime()));
      jsonComment.put("agreeCount", comment.getAgreeCustomers().size());
      jsonComment.put("disagreeCount", comment.getDisagreeCustomers().size());
      comments.add(jsonComment);
    }
    jsonResult.put("comments", comments);
    String jsonString = jsonResult.toHtmlString();
    streamWebService(response, jsonString);
View Full Code Here

             "order  by comment.recUpdateDatetime desc";
    Query query = em.createQuery(sql);
    query.setParameter("itemNaturalKey", itemNaturalKey);
        Iterator<?> iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
           Comment comment = (Comment) iterator.next();
           if (comment.getCommentApproved() != null && comment.getCommentApproved().charValue() == Constants.VALUE_NO) {
             continue;
           }
           CommentInfo commentInfo = formatComment(comment);
           comments.add(commentInfo);
        }
View Full Code Here

             "order  by comment.recUpdateDatetime desc";
    Query query = em.createQuery(sql);
    query.setParameter("contentId", content.getContentId());
        Iterator<?> iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
           Comment comment = (Comment) iterator.next();
           if (comment.getCommentApproved() != null && comment.getCommentApproved().charValue() == Constants.VALUE_NO) {
             continue;
           }
           CommentInfo commentInfo = formatComment(comment);
           comments.add(commentInfo);
        }
View Full Code Here

        CommentDisplayForm comments[] = form.getComments();
        for (int i = 0; i < comments.length; i++) {
          if (comments[i].getSelect() == null) {
            continue;
          }
          Comment comment = (Comment) em.find(Comment.class, Format.getLong(comments[i].getCommentId()));
          comment.setCommentApproved('Y');
          comment.setRecUpdateBy(adminBean.getUser().getUserId());
          comment.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
          em.persist(comment);
        }
      }
        ActionForward forward = actionMapping.findForward("approved") ;
        forward = new ActionForward(forward.getPath() + "?process=list&srPageNo=" + form.getPageNo(), forward.getRedirect());
View Full Code Here

        CommentDisplayForm comments[] = form.getComments();
        for (int i = 0; i < comments.length; i++) {
          if (comments[i].getSelect() == null) {
            continue;
          }
          Comment comment = (Comment) em.find(Comment.class, Format.getLong(comments[i].getCommentId()));
          comment.setCommentApproved('N');
          comment.setRecUpdateBy(adminBean.getUser().getUserId());
          comment.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
          em.persist(comment);
        }
      }
        ActionForward forward = actionMapping.findForward("approved") ;
        forward = new ActionForward(forward.getPath() + "?process=list&srPageNo=" + form.getSrPageNo(), forward.getRedirect());
View Full Code Here

        json.put("contentDesc", contentLanguage.getContentDesc());
        iterator = content.getComments().iterator();
     
         Vector<JSONEscapeObject> comments = new Vector<JSONEscapeObject>();
         while (iterator.hasNext()) {
           Comment comment = (Comment) iterator.next();
           JSONEscapeObject jsonComment = new JSONEscapeObject();
           jsonComment.put("commentTitle", comment.getCommentTitle());
           jsonComment.put("comment", comment.getComment());
           jsonComment.put("agreeCount", comment.getAgreeCustomers().size());
           jsonComment.put("disagreeCount", comment.getDisagreeCustomers().size());
           jsonComment.put("moderation", String.valueOf(comment.getModeration()));
           jsonComment.put("commentApproved", String.valueOf(comment.getCommentApproved()));
           jsonComment.put("custEmail", comment.getCustomer().getCustEmail());
           jsonComment.put("custPublicName", comment.getCustomer().getCustPublicName());
           jsonComment.put("recCreateDatetime", Format.getFullDatetime(comment.getRecCreateDatetime()));
           comments.add(jsonComment);
         }
        json.put("comments", comments);
        String jsonString = json.toHtmlString();
        streamWebService(response, jsonString);
View Full Code Here

    json.put("itemShortDesc", itemLanguage.getItemShortDesc());
    json.put("itemDesc", itemLanguage.getItemDesc());
     
         Vector<JSONEscapeObject> comments = new Vector<JSONEscapeObject>();
         while (iterator.hasNext()) {
           Comment comment = (Comment) iterator.next();
           JSONEscapeObject jsonComment = new JSONEscapeObject();
           jsonComment.put("commentTitle", comment.getCommentTitle());
           jsonComment.put("comment", comment.getComment());
           jsonComment.put("agreeCount", comment.getAgreeCustomers().size());
           jsonComment.put("disagreeCount", comment.getDisagreeCustomers().size());
           jsonComment.put("moderation", String.valueOf(comment.getModeration()));
           jsonComment.put("commentApproved", String.valueOf(comment.getCommentApproved()));
           jsonComment.put("custEmail", comment.getCustomer().getCustEmail());
           jsonComment.put("custPublicName", comment.getCustomer().getCustPublicName());
           jsonComment.put("recCreateDatetime", Format.getFullDatetime(comment.getRecCreateDatetime()));
           comments.add(jsonComment);
         }
        json.put("comments", comments);
        String jsonString = json.toHtmlString();
        streamWebService(response, jsonString);
View Full Code Here

        calcPage(adminBean, form, list, pageNo);
        Vector<CommentDisplayForm> vector = new Vector<CommentDisplayForm>();
        int startRecord = (form.getPageNo() - 1) * adminBean.getListingPageSize();
        int endRecord = startRecord + adminBean.getListingPageSize();
        for (int i = startRecord; i < list.size() && i < endRecord; i++) {
          Comment comment = (Comment) list.get(i);
          CommentDisplayForm display = new CommentDisplayForm();
          display.setCommentId(Format.getLong(comment.getCommentId()));
          display.setCommentTitle(comment.getCommentTitle());
          display.setComment(comment.getComment());
          display.setCustEmail(comment.getCustomer().getCustEmail());
          display.setCustPublicName(comment.getCustomer().getCustPublicName());
          display.setAgreeCount(Format.getInt(comment.getAgreeCustomers().size()));
          display.setDisagreeCount(Format.getInt(comment.getDisagreeCustomers().size()));
          display.setRecUpdatedDatetime(Format.getFullDatetime(comment.getRecUpdateDatetime()));
          if (comment.getContent() != null) {
            display.setCommentSource("C");
            Content content = comment.getContent();
            display.setCommentSourceTitle(content.getContentLanguage().getContentTitle());
            display.setCommentSourceId(Format.getLong(content.getContentId()));
          }
          else {
            display.setCommentSource("I");
            Item item = comment.getItem();
            display.setCommentSourceTitle(item.getItemLanguage().getItemShortDesc());
            display.setCommentSourceId(Format.getLong(comment.getItem().getItemId()));
          }
          if (comment.getModeration() != null && comment.getModeration() == Constants.VALUE_YES) {
            display.setCommentModeration("Yes");
          }
          if (comment.getCommentApproved() != null && comment.getCommentApproved() == Constants.VALUE_YES) {
            display.setCommentApproved("Approved");
          }
          if (comment.getCommentApproved() != null && comment.getCommentApproved() == Constants.VALUE_NO) {
            display.setCommentApproved("Rejected");
          }
          vector.add(display);
        }
        CommentDisplayForm commentDisplayForms[] = new CommentDisplayForm[vector.size()];
View Full Code Here

TOP

Related Classes of com.jada.jpa.entity.Comment

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.