Package com.jada.content

Examples of com.jada.content.ContentSessionBean


    Customer customer = getCustomer(request);
    if (customer == null) {
      return null;
    }
   
    ContentSessionBean contentSessionBean = getContentBean(request).getContentSessionBean();
    Site site = contentSessionBean.getSiteDomain().getSite();
    String commentTitle = request.getParameter("commentTitle");
    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() +
                  contentSessionBean.getSiteDomain().getSiteDomainPrefix() + "/" +
                      contentSessionBean.getSiteProfile().getSiteProfileClass().getSiteProfileClassName() + "/" +
                      "contentComment/" +
                      contentNaturalKey,
                      forward.getRedirect());
        return forward;
    }
View Full Code Here


            HttpServletResponse response)
        throws Throwable {
     
    String contentNaturalKey = (String) request.getParameter("contentNaturalKey");
    String value = (String) request.getParameter("rate");
    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() + "/" +
                  contentSessionBean.getSiteProfile().getSiteProfileClass().getSiteProfileClassName() + "/" +
                      "/contentComment/" +
                  contentNaturalKey, forward.getRedirect());
        return forward;
    }
View Full Code Here

  }
 
  private Vector<?> getMenus(String menuSetName, Long menuParentId, boolean customerSession) throws Exception  {
    Vector<MenuInfo> vector = new Vector<MenuInfo>();
    Menu parent = MenuDAO.load(siteDomain.getSite().getSiteId(), menuParentId);
      ContentSessionBean emBean = contentBean.getContentSessionBean();
//    SiteDomain siteDomain = emBean.getSiteDomain();
//    String urlPrefix = SiteDomainDAO.getPublicURLPrefix(siteDomain);
      for (Menu menu : parent.getMenuChildren()) {
        if (!customerSession) {
          if (menu.getMenuType().equals(Constants.MENU_SIGNOUT)) {
            continue;
         
        }
        if (menu.getPublished() != Constants.VALUE_YES) {
          continue;
        }
       
        MenuInfo menuInfo = new MenuInfo();
        menuInfo.setMenuName(menu.getMenuLanguage().getMenuName());
        menuInfo.setSeqNo(menu.getSeqNum());
        menuInfo.setMenuWindowMode(menu.getMenuWindowMode());
        menuInfo.setMenuWindowTarget(menu.getMenuWindowTarget());
        menuInfo.setMenus(getMenus(menuSetName, menu.getMenuId(), customerSession));
        menuInfo.setMenuType(menu.getMenuType());
       
        if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
          Iterator<?> menuLanguages = menu.getMenuLanguages().iterator();
          while (menuLanguages.hasNext()) {
            MenuLanguage menuLanguage = (MenuLanguage) menuLanguages.next();
            if (menuLanguage.getSiteProfileClass().getSiteProfileClassId().equals(emBean.getSiteProfile().getSiteProfileClass().getSiteProfileClassId())) {
              if (menuLanguage.getMenuName() != null) {
                menuInfo.setMenuName(menuLanguage.getMenuName());
                break;
              }
            }
View Full Code Here

    return info;
  }
 
  public ItemComparePageInfo getItemComparePage() throws SecurityException, Exception {
    ItemComparePageInfo itemComparePageInfo = new ItemComparePageInfo();
    ContentSessionBean contentSessionBean = contentBean.getContentSessionBean();
    SiteProfile siteProfile = contentSessionBean.getSiteProfile();
    Vector<CustomAttributeInfo> attributeVector = new Vector<CustomAttributeInfo>();
    for (String itemId: ContentLookupDispatchAction.getItemCompareList(request)) {
      Item item = ItemDAO.load(siteDomain.getSite().getSiteId(), Format.getLong(itemId));
      for (ItemAttributeDetail itemAttributeDetail: item.getItemAttributeDetails()) {
        CustomAttribute customAttribute = itemAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
View Full Code Here

          break;
        }
      }
      SiteDomainParamBean siteDomainParamBean = SiteDomainDAO.getSiteDomainParamBean(contentBean.getContentSessionBean().getSiteDomain().getSiteDomainLanguage(), siteDomainLanguage);
        String mailFrom = siteDomainParamBean.getMailFromContactUs();
    ContentSessionBean contentSessionBean = contentBean.getContentSessionBean();
        if (email == null) {
          logger.error("email address value is null and email may not be sent");
            ActionForward forward = actionMapping.findForward("error") ;
            forward = new ActionForward(forward.getPath() +
                      contentSessionBean.getSiteDomain().getSiteDomainPrefix() + "/" +
                          contentSessionBean.getSiteProfile().getSiteProfileClass().getSiteProfileClassName() + "/" +
                          "contactus?message=content.text.contactUs.error",
                          forward.getRedirect());
            return forward;
        }
        String subject = resources.getMessage("content.text.contactUs");
logger.error("mailFrom > " + mailFrom);
logger.error("email > " + email);
logger.error("subject > " + subject);
logger.error("content > " + content);
        mailer.sendMail(mailFrom, email, subject, content);
       
        ActionForward forward = actionMapping.findForward("success") ;
        forward = new ActionForward(forward.getPath() +
                  contentSessionBean.getSiteDomain().getSiteDomainPrefix() + "/" +
                      contentSessionBean.getSiteProfile().getSiteProfileClass().getSiteProfileClassName() + "/" +
                      "contactus?message=content.text.contactUs.success",
                      forward.getRedirect());
        return forward;
    }
View Full Code Here

        else {
          return "/" + ApplicationGlobal.getContextPath() + url;
        }
      }
    }
    ContentSessionBean sessionBean = ContentLookupDispatchAction.getContentBean(request).getContentSessionBean();
    String result = "/" + ApplicationGlobal.getContextPath() +
            Constants.FRONTEND_URL_PREFIX +
            "/" + sessionBean.getSiteDomain().getSiteDomainPrefix() +
            "/" + sessionBean.getSiteProfile().getSiteProfileClass().getSiteProfileClassName() +
            "/home";
    return result;
  }
View Full Code Here

    return result;
  }
 
  public String parseRepostURL(String url) throws Exception {
    ContentBean contentBean = ContentLookupDispatchAction.getContentBean(request);
    ContentSessionBean sessionBean = contentBean.getContentSessionBean();
    url = url.replace("${siteDomainPrefix}", sessionBean.getSiteDomain().getSiteDomainPrefix());
    return url;
  }
View Full Code Here

            HttpServletResponse response)
        throws Throwable {
     
    String itemNaturalKey = (String) request.getParameter("itemNaturalKey");
    String value = (String) request.getParameter("rate");
    ContentSessionBean contentSessionBean = getContentBean(request).getContentSessionBean();
    Site site = contentSessionBean.getSiteDomain().getSite();
    String siteId = site.getSiteId();
    if (value != null) {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Item item = ItemDAO.loadNatural(siteId, itemNaturalKey);
      int itemRatingCount = item.getItemRatingCount().intValue();
      float itemRating = item.getItemRating().floatValue();
     
      int rate = Integer.parseInt(value);
      if (itemRatingCount != 0) {
        itemRating = ((itemRating * itemRatingCount) + rate) / (itemRatingCount + 1);
        itemRatingCount += 1;
      }
      else {
        itemRatingCount = 1;
        itemRating = rate;
      }
      item.setItemRating(new Float(itemRating));
      item.setItemRatingCount(new Integer(itemRatingCount));
      em.persist(item);
    }
        ActionForward forward = actionMapping.findForward("success") ;
        forward = new ActionForward(forward.getPath() +
                  contentSessionBean.getSiteDomain().getSiteDomainPrefix() +
                  "/" + contentSessionBean.getSiteProfile().getSiteProfileClass().getSiteProfileClassName() +
                  "/item/" +
                  itemNaturalKey, forward.getRedirect());
        return forward;
    }
View Full Code Here

TOP

Related Classes of com.jada.content.ContentSessionBean

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.