Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Content


    commentTitle = Utility.escapeStrictHTML(commentTitle);
    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") ;
        forward = new ActionForward(forward.getPath() +
View Full Code Here


    ContentSessionBean contentSessionBean = getContentBean(request).getContentSessionBean();
    Site site = contentSessionBean.getSiteDomain().getSite();
    String siteId = site.getSiteId();
    if (value != null) {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Content content = ContentDAO.loadNatural(siteId, contentNaturalKey);
      int contentRatingCount = content.getContentRatingCount().intValue();
      float contentRating = content.getContentRating().floatValue();
     
      int rate = Integer.parseInt(value);
      if (contentRatingCount != 0) {
        contentRating = ((contentRating * contentRatingCount) + rate) / (contentRatingCount + 1);
        contentRatingCount += 1;
      }
      else {
        contentRatingCount = 1;
        contentRating = rate;
      }
      content.setContentRating(new Float(contentRating));
      content.setContentRatingCount(new Integer(contentRatingCount));
      em.persist(content);
    }
        ActionForward forward = actionMapping.findForward("success") ;
        forward = new ActionForward(forward.getPath() +
                  contentSessionBean.getSiteDomain().getSiteDomainPrefix() + "/" +
View Full Code Here

      JSONEscapeObject jsonResult = new JSONEscapeObject();
      jsonResult.put("contentTitle", contentTitle);
      int counter = 0;
      Vector<JSONEscapeObject> vector = new Vector<JSONEscapeObject>();
        while (iterator.hasNext()) {
          Content content = (Content) iterator.next();
      ContentLanguage contentLanguage = null;
      for (ContentLanguage language : content.getContentLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassDefaultId)) {
          contentLanguage = language;
        }
      }
          JSONEscapeObject jsonContent = new JSONEscapeObject();
          jsonContent.put("contentId", content.getContentId());
          jsonContent.put("contentTitle", contentLanguage.getContentTitle());
          vector.add(jsonContent);
          counter++;
          if (counter == Constants.ADMIN_SEARCH_MAXCOUNT) {
              MessageResources resources = this.getResources(request);
View Full Code Here

      for (Category childCategory : parent.getCategoryChildren()) {
        cascadeRemoveCategory(childCategory.getCatId(), siteId);
      }
      Iterator<?> iterator = parent.getContents().iterator();
      while (iterator.hasNext()) {
        Content content = (Content) iterator.next();
        content.getCategories().remove(parent);
      }
     
      iterator = parent.getItems().iterator();
      while (iterator.hasNext()) {
        Item item = (Item) iterator.next();
View Full Code Here

              "/" + contentBean.getContentSessionBean().getSiteProfile().getSiteProfileClass().getSiteProfileClassName() +
            "/" + Constants.FRONTEND_URL_ITEM +
            "/" + item.getItemNaturalKey();
      }
      else if (menu.getMenuType().equals(Constants.MENU_CONTENT) && menu.getContent() != null && ContentDAO.isPublished(menu.getContent())) {
        Content content = menu.getContent();
        url = "/" + ApplicationGlobal.getContextPath() +
            Constants.FRONTEND_URL_PREFIX +
            "/" + contentBean.getContentSessionBean().getSiteDomain().getSiteDomainPrefix() +
              "/" + contentBean.getContentSessionBean().getSiteProfile().getSiteProfileClass().getSiteProfileClassName() +
            "/" + Constants.FRONTEND_URL_CONTENT +
            "/" + content.getContentNaturalKey();
      }
      else if (menu.getMenuType().equals(Constants.MENU_SECTION) && menu.getCategory() != null && CategoryDAO.isPublished(menu.getCategory())) {
        Category category = menu.getCategory();
        url = "/" + ApplicationGlobal.getContextPath() +
            Constants.FRONTEND_URL_PREFIX +
View Full Code Here

  }
 
  /******************************************************************************************************/

  public ContentInfo getContent(String contentNaturalKey, boolean updateStatistics) throws Exception {
        Content content = dataApi.getContent(siteDomain.getSite().getSiteId(), contentNaturalKey);
      if (!isValidContent(content)) {
        return null;
      }
        if (updateStatistics) {
          content.setContentHitCounter(new Integer(content.getContentHitCounter().intValue() + 1));
        }
        return formatContent(content);
  }
View Full Code Here

        }
        return true;
  }
 
  public ContentInfo[] getRelatedContent(String contentNaturalKey) throws Exception {
        Content content = dataApi.getContent(siteDomain.getSite().getSiteId(), contentNaturalKey);
        if (content == null) {
          return null;
        }
        Iterator<?> contentIterator = content.getContentsRelated().iterator();
        Vector<ContentInfo> relatedContents = new Vector<ContentInfo>();
        while (contentIterator.hasNext()) {
          Content relatedContent = (Content) contentIterator.next();
          if (!ContentDAO.isPublished(relatedContent)) {
            continue;
          }
          ContentInfo relatedContentInfo = formatContent(relatedContent);
          relatedContents.add(relatedContentInfo);
View Full Code Here

        relatedContents.copyInto(contentInfos);
        return contentInfos;
  }
 
  public CommentInfo[] getContentComment(String contentNaturalKey) throws Exception {
        Content content = dataApi.getContent(siteDomain.getSite().getSiteId(), contentNaturalKey);
        if (content == null) {
          return null;
        }
        Vector<CommentInfo> comments = new Vector<CommentInfo>();
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
        String sql = "from   Comment comment " +
             "where  comment.content.contentId = :contentId " +
             "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;
View Full Code Here

    query.setParameter("siteDomainId", siteDomain.getSiteDomainId());
    Vector<ContentInfo> contents = new Vector<ContentInfo>();
    Iterator<?> iterator = query.getResultList().iterator();
    while (iterator.hasNext()) {
      Long contentId = (Long) iterator.next();
       Content content = ContentDAO.load(siteDomain.getSite().getSiteId(), contentId);
        ContentInfo contentInfo = formatContent(content);
        contents.add(contentInfo);
    }
    ContentInfo contentInfos[] = new ContentInfo[contents.size()];
    contents.copyInto(contentInfos);
View Full Code Here

    query.setParameter("siteDomainId", siteDomain.getSiteDomainId());
    Vector<ContentInfo> contents = new Vector<ContentInfo>();
    Iterator<?> iterator = query.getResultList().iterator();
    while (iterator.hasNext()) {
      Long contentId = (Long) iterator.next();
       Content content = ContentDAO.load(siteDomain.getSite().getSiteId(), contentId);
        ContentInfo contentInfo = formatContent(content);
        contents.add(contentInfo);
    }
    ContentInfo contentInfos[] = new ContentInfo[contents.size()];
    contents.copyInto(contentInfos);
View Full Code Here

TOP

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

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.