Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Category


          form.setItemId(item.getItemId().toString());
          form.setItemNum(item.getItemNum());
          form.setItemShortDesc(item.getItemLanguage().getItemShortDesc());
        }
        else if (menu.getMenuType().equals(Constants.MENU_SECTION) && menu.getCategory() != null) {
          Category category = menu.getCategory();
          form.setCatId(category.getCatId().toString());
          form.setCatShortTitle(category.getCategoryLanguage().getCatShortTitle());
        }
        if (!form.isSiteProfileClassDefault()) {
          initLanguageInfo(menu, form);
        }
        initListInfo(form, siteId);
View Full Code Here


            menu.setItem(item);
          }
        }
        if (form.getMenuType().equals(Constants.MENU_SECTION)) {
          if (!Format.isNullOrEmpty(form.getCatId())) {
            Category category = CategoryDAO.load(site.getSiteId(), Format.getLong(form.getCatId()));
            menu.setCategory(category);
          }
        }
        em.persist(menu);
    }
View Full Code Here

  }
 
  public PageHeaderInfo getPageCategoryInfo() throws Exception {
    PageHeaderInfo pageHeaderInfo = new PageHeaderInfo();
    String catNaturalKey = getCategoryParameter(request, 3);
    Category category = dataApi.getCategory(siteDomain.getSite().getSiteId(), catNaturalKey);
        if (category == null) {
          pageHeaderInfo.setPageTitle(siteName + " - " + getLanguageByValue("Page not found"));
          pageHeaderInfo.setMetaKeywords("");
          pageHeaderInfo.setMetaDescription("");
          return pageHeaderInfo;
        }
        pageHeaderInfo.setPageTitle(category.getCategoryLanguage().getCatShortTitle());
        if (Format.isNullOrEmpty(category.getCategoryLanguage().getMetaKeywords())) {
          pageHeaderInfo.setMetaKeywords(category.getCategoryLanguage().getCatShortTitle());
        }
        else {
          pageHeaderInfo.setMetaKeywords(category.getCategoryLanguage().getMetaKeywords());
        }
        if (Format.isNullOrEmpty(category.getCategoryLanguage().getMetaDescription())) {
          pageHeaderInfo.setMetaDescription(category.getCategoryLanguage().getCatShortTitle());
        }
        else {
          pageHeaderInfo.setMetaDescription(category.getCategoryLanguage().getMetaDescription());
        }
        ContentBean contentBean = ContentLookupDispatchAction.getContentBean(request);
        if (!contentBean.getContentSessionKey().isSiteProfileClassDefault()) {
          for (CategoryLanguage language : category.getCategoryLanguages()) {
            if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
              if (language.getCatShortTitle() != null) {
                pageHeaderInfo.setPageTitle(language.getCatShortTitle());
              }
              if (!Format.isNullOrEmpty(language.getMetaKeywords())) {
View Full Code Here

     * Calling method getPageTitle() is deprecated.
     */
    @Deprecated
  public String getPageCategoryTitle() throws Exception {
    String catNaturalKey = getCategoryParameter(request, 3);
    Category category = dataApi.getCategory(siteDomain.getSite().getSiteId(), catNaturalKey);
        if (category == null) {
          return siteName + " - " + getLanguageByValue("Page not found");
        }
        String catShortTitle = category.getCategoryLanguage().getCatShortTitle();
        ContentBean contentBean = ContentLookupDispatchAction.getContentBean(request);
        if (!contentBean.getContentSessionKey().isSiteProfileClassDefault()) {
          for (CategoryLanguage language : category.getCategoryLanguages()) {
            if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
              if (language.getCatShortTitle() != null) {
                catShortTitle = language.getCatShortTitle();
              }
              break;
View Full Code Here

  }

    static public String formatCategoryName(String siteId, Long catId, Long siteProfileClassId, Long siteProfileClassDefaultId) throws Exception {
      String categoryString = "";
        while (true) {
            Category category = CategoryDAO.load(siteId, catId);
            catId = category.getCategoryParent().getCatId();
            if (catId == null) {
              break;
            }
      CategoryLanguage categoryLanguage = null;
      for (CategoryLanguage language : category.getCategoryLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassDefaultId)) {
          categoryLanguage = language;
        }
      }
     
            if (categoryString.length() > 0) {
              categoryString = " - " + categoryString;
            }
            String catShortTitle = categoryLanguage.getCatShortTitle();
          boolean found = false;
          Iterator<?> iterator = category.getCategoryLanguages().iterator();
          while (iterator.hasNext()) {
            categoryLanguage = (CategoryLanguage) iterator.next();
            if (categoryLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
              found = true;
            }
View Full Code Here

             "and      category.categoryParent is null";
      Query query = em.createQuery(sql);
      query.setParameter("siteId", siteId);
      Iterator<?> iterator = query.getResultList().iterator();
      if (iterator.hasNext()) {
        Category category = (Category) iterator.next();
        return makeJSONCategoryTreeNode(siteId, category.getCatId(), siteProfileClassId, siteProfileClassDefault);
      }
     
      return object;
    }
View Full Code Here

    }
   
    static public JSONEscapeObject makeJSONCategoryTreeNode(String siteId, Long catId, Long siteProfileClassId, boolean siteProfileClassDefault) throws Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      JSONEscapeObject JSONEscapeObject = new JSONEscapeObject();
      Category category = CategoryDAO.load(siteId, catId);
      JSONEscapeObject.put("catId", category.getCatId());
      String catShortTitle = category.getCategoryLanguage().getCatShortTitle();
      if (!siteProfileClassDefault) {
        for (CategoryLanguage language : category.getCategoryLanguages()) {
          if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
            if (language.getCatShortTitle() != null) {
              catShortTitle = language.getCatShortTitle();
            }
          }
        }
      }
      JSONEscapeObject.put("catShortTitle", catShortTitle);
     
      Vector<JSONEscapeObject> vector = new Vector<JSONEscapeObject>();
      String sql = "from   Category category " +
             "where  category.categoryParent.catId = :catId " +
             "order  by category.seqNum";
      Query query = em.createQuery(sql);
      query.setParameter("catId", category.getCatId());
      Iterator<?> iterator = query.getResultList().iterator();
      while (iterator.hasNext()) {
        Category child = (Category) iterator.next();
        JSONEscapeObject object = makeJSONCategoryTreeNode(siteId, child.getCatId(), siteProfileClassId, siteProfileClassDefault);
        vector.add(object);
      }
/*
      for (Category child : category.getCategoryChildren()) {
        JSONEscapeObject object = makeJSONCategoryTreeNode(siteId, child.getCatId(), siteProfileClassId, siteProfileClassDefault);
View Full Code Here

                   "and    category.categoryParentId is null " +
                   "order  by category.seqNum";
      Query query = em.createQuery(sql);
      query.setParameter("siteId", siteId);
      Iterator<?> iterator = query.getResultList().iterator();
      Category category = null;
      if (iterator.hasNext()) {
        category = (Category) iterator.next();
      }
      Long siteProfileClassDefaultId = category.getSite().getSiteProfileClassDefault().getSiteProfileClassId();
    CategoryLanguage categoryLanguage = null;
    for (CategoryLanguage language : category.getCategoryLanguages()) {
      if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassDefaultId)) {
        categoryLanguage = language;
      }
    }
   
      DropDownMenu categories[] = null;
    categories = makeCategoryTreeItem(siteId, category.getCatId(), siteProfileClassId, siteProfileClassDefaultId);
   
      DropDownMenu ddm = new DropDownMenu();
      ddm.setMenuKey(category.getCatId().toString());
      ddm.setMenuName(categoryLanguage.getCatShortTitle());
      ddm.setMenuItems(categories);

      return ddm;
    }
View Full Code Here

      }
      return null;
  }
 
  public Category getCategory(String siteId, Long catId) throws Exception {
      Category category = CategoryDAO.load(siteId, catId);
      return category;
  }
View Full Code Here

      Query query = em.createQuery("from Category where siteId = :siteId and catNaturalKey = :catNaturalKey");
      query.setParameter("siteId", siteId);
      query.setParameter("catNaturalKey", catNaturalKey);
      Iterator<?> iterator = query.getResultList().iterator();
      if (iterator.hasNext()) {
        Category category = (Category) iterator.next();
        return category;
      }
      return null;
  }
View Full Code Here

TOP

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

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.