Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.CategoryLanguage


      form.setMetaDescriptionLang(category.getCategoryLanguage().getMetaDescription());
      form.setMetaKeywordsLang(category.getCategoryLanguage().getMetaKeywords());
   
      Iterator<?> iterator = category.getCategoryLanguages().iterator();
      Long siteProfileClassId = form.getSiteProfileClassId();
      CategoryLanguage categoryLanguage = null;
      while (iterator.hasNext()) {
        categoryLanguage = (CategoryLanguage) iterator.next();
        if (categoryLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
            if (categoryLanguage.getCatTitle() != null) {
              form.setCatTitleLangFlag(true);
              form.setCatTitleLang(categoryLanguage.getCatTitle());
            }
            if (categoryLanguage.getCatShortTitle() != null) {
              form.setCatShortTitleLangFlag(true);
              form.setCatShortTitleLang(categoryLanguage.getCatShortTitle());
            }
            if (categoryLanguage.getCatDesc() != null) {
              form.setCatDescLangFlag(true);
              form.setCatDescLang(categoryLanguage.getCatDesc());
            }
            if (categoryLanguage.getMetaDescription() != null) {
              form.setMetaDescriptionLangFlag(true);
              form.setMetaDescriptionLang(categoryLanguage.getMetaDescription());
            }
            if (categoryLanguage.getMetaKeywords() != null) {
              form.setMetaKeywordsLangFlag(true);
              form.setMetaKeywordsLang(categoryLanguage.getMetaKeywords());
            }
            break;
        }
      }
    }
View Full Code Here


        category.setRecCreateBy(adminBean.getUser().getUserId());
        category.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
        category.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        parent.getCategoryChildren().add(category);
       
        CategoryLanguage categoryLanguage = new CategoryLanguage();
        categoryLanguage.setCatShortTitle(catShortTitle);
        categoryLanguage.setCatTitle("");
        categoryLanguage.setCatDesc("");
        categoryLanguage.setMetaKeywords("");
        categoryLanguage.setMetaDescription("");
        categoryLanguage.setCategory(category);
        categoryLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
        categoryLanguage.setRecCreateBy(adminBean.getUser().getUserId());
        categoryLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
        categoryLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        categoryLanguage.setSiteProfileClass(site.getSiteProfileClassDefault());
        category.getCategoryLanguages().add(categoryLanguage);
        category.setCategoryLanguage(categoryLanguage);
        em.persist(categoryLanguage);

        String fullCategoryPath = getFullCategoryPath(category, site.getSiteId(), form.getSiteProfileClassDefaultId());
        category.setCatNaturalKey(Utility.encode(fullCategoryPath));
        em.persist(category);

        form.setCatId(Format.getLong(category.getCatId()));
        form.setCategoryParentId(category.getCategoryParent().getCatId().toString());
        form.setCatTitle("");
        form.setMetaKeywords("");
        form.setMetaDescription("");
        form.setCatShortTitle(categoryLanguage.getCatShortTitle());
        form.setCatDesc("");
        form.setPublished(category.getPublished() == Constants.PUBLISHED_YES ? true : false);
        form.setMode(Constants.MODE_UPDATE);
        String jsonCategoryTree = Utility.makeJSONCategoryTree(site.getSiteId(), form.getSiteProfileClassId(), form.isSiteProfileClassDefault()).toHtmlString();
        form.setJsonCategoryTree(jsonCategoryTree);
View Full Code Here

         EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Long siteProfileClassId = form.getSiteProfileClassId();
      User user = adminBean.getUser();
      Iterator<?> iterator = category.getCategoryLanguages().iterator();
      boolean found = false;
      CategoryLanguage categoryLanguage = null;
      while (iterator.hasNext()) {
        categoryLanguage = (CategoryLanguage) iterator.next();
        if (categoryLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
          found = true;
          break;
        }
      }
      if (!found) {
        categoryLanguage = new CategoryLanguage();
        categoryLanguage.setRecCreateBy(user.getUserId());
        categoryLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        SiteProfileClass siteProfileClass = em.find(SiteProfileClass.class, siteProfileClassId);
        categoryLanguage.setSiteProfileClass(siteProfileClass);
        categoryLanguage.setCategory(category);
      }
      if (form.isCatTitleLangFlag()) {
        categoryLanguage.setCatTitle(form.getCatTitleLang());
      }
      else {
        categoryLanguage.setCatTitle(null);
      }
      if (form.isCatShortTitleLangFlag()) {
        categoryLanguage.setCatShortTitle(form.getCatShortTitleLang());
      }
      else {
        categoryLanguage.setCatShortTitle(null);
      }
      if (form.isCatDescLangFlag()) {
        categoryLanguage.setCatDesc(form.getCatDescLang());
      }
      else {
        categoryLanguage.setCatDesc(null);
      }
      if (form.isMetaKeywordsLangFlag()) {
        categoryLanguage.setMetaKeywords(form.getMetaKeywordsLang());
      }
      else {
        categoryLanguage.setMetaKeywords(null);
      }
      if (form.isMetaDescriptionLangFlag()) {
        categoryLanguage.setMetaDescription(form.getMetaDescriptionLang());
      }
      else {
        categoryLanguage.setMetaDescription(null);
      }
      categoryLanguage.setRecUpdateBy(user.getUserId());
      categoryLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      em.persist(categoryLanguage);
    }
View Full Code Here

    }
   
    public void saveDefault(Category category, CategoryMaintActionForm form, AdminBean adminBean, String fullCategoryPath) throws Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
   
      CategoryLanguage categoryLanguage = category.getCategoryLanguage();
      categoryLanguage.setCatTitle(form.getCatTitle());
      categoryLanguage.setCatDesc(form.getCatDesc());
      categoryLanguage.setMetaKeywords(form.getMetaKeywords());
      categoryLanguage.setMetaDescription(form.getMetaDescription());
      categoryLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
      categoryLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
       
        category.setPublished(form.isPublished() ? Constants.PUBLISHED_YES : Constants.PUBLISHED_NO);
        category.setRecUpdateBy(adminBean.getUser().getUserId());
        category.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
       
View Full Code Here

      }
     
      if (form.isSiteProfileClassDefault()) {
        Category master = CategoryDAO.load(siteId, Format.getLong(form.getCatId()));
        for (Category category : master.getCategoryChildren()) {
        CategoryLanguage categoryLanguage = null;
        for (CategoryLanguage language : category.getCategoryLanguages()) {
          if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassDefaultId())) {
            categoryLanguage = language;
          }
        }
       
          if (categoryLanguage.getCatShortTitle().equals(form.getCatShortTitle())) {
              errors.add("catShortTitle", new ActionMessage("error.record.duplicate"));       
         
        }
      }
     
View Full Code Here

            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;
            }
          }
          if (found) {
            if (categoryLanguage.getCatShortTitle() != null) {
              catShortTitle = categoryLanguage.getCatShortTitle();
            }
          }
            categoryString = catShortTitle + categoryString;
        }
       return categoryString;
View Full Code Here

      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

      query.setParameter("siteId", siteId);
      query.setParameter("categoryParentId", categoryParentId.longValue());
      Iterator<?> iterator = query.getResultList().iterator();
      while (iterator.hasNext()) {
        Category category = (Category) iterator.next();
      CategoryLanguage categoryLanguage = null;
      for (CategoryLanguage language : category.getCategoryLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassDefaultId)) {
          categoryLanguage = language;
        }
      }
     
           DropDownMenu childMenus[] = makeDdmCategory(siteId, category.getCatId(), siteProfileClassId, siteProfileClassDefaultId);
           DropDownMenu ddm = new DropDownMenu();
           ddm.setMenuKey(Format.getLong(category.getCatId()));
           ddm.setMenuName(categoryLanguage.getCatShortTitle());
           if (siteProfileClassId != siteProfileClassDefaultId) {
             Iterator<?> categoryLanguages = category.getCategoryLanguages().iterator();
             boolean found = false;
             while (categoryLanguages.hasNext()) {
               categoryLanguage = (CategoryLanguage) categoryLanguages.next();
                   if (categoryLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
                     found = true;
                     break;
                   }
             }
             if (found) {
               if (categoryLanguage.getCatShortTitle() != null) {
                 ddm.setMenuName(categoryLanguage.getCatShortTitle());
               }
             }
           }
           ddm.setMenuItems(childMenus);
           categoryList.add(ddm);
View Full Code Here

      query.setParameter("siteId", siteId);
      query.setParameter("categoryParentId", categoryParentId.longValue());
      Iterator<?> iterator = query.getResultList().iterator();
      while (iterator.hasNext()) {
        Category category = (Category) iterator.next();
      CategoryLanguage categoryLanguage = null;
      for (CategoryLanguage language : category.getCategoryLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassDefaultId)) {
          categoryLanguage = language;
        }
      }
           DropDownMenu childMenus[] = makeDdmCategory(siteId, category.getCatId(), siteProfileClassId, siteProfileClassDefaultId);
           DropDownMenu ddm = new DropDownMenu();
           ddm.setMenuKey(Format.getLong(category.getCatId()));
           ddm.setMenuName(categoryLanguage.getCatShortTitle());
           if (siteProfileClassId != siteProfileClassDefaultId) {
             Iterator<?> categoryLanguages = category.getCategoryLanguages().iterator();
             boolean found = false;
             while (categoryLanguages.hasNext()) {
               categoryLanguage = (CategoryLanguage) categoryLanguages.next();
                   if (categoryLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
                     found = true;
                     break;
                   }
             }
             if (found) {
               if (categoryLanguage.getCatShortTitle() != null) {
                 ddm.setMenuName(categoryLanguage.getCatShortTitle());
               }
             }
           }
           ddm.setMenuItems(childMenus);
           categoryList.add(ddm);
View Full Code Here

      category.setRecUpdateBy(userId);
      category.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      category.setRecCreateBy(userId);
      category.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      category.setMenus(null);
      CategoryLanguage categoryLanguage = new CategoryLanguage();
      categoryLanguage.setCatTitle("Home");
      categoryLanguage.setCatShortTitle("Home");
      categoryLanguage.setCatDesc("");
      categoryLanguage.setRecUpdateBy(userId);
      categoryLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      categoryLanguage.setRecCreateBy(userId);
      categoryLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      categoryLanguage.setSiteProfileClass(siteProfileClass);
      categoryLanguage.setCategory(category);
      category.setCategoryLanguage(categoryLanguage);
      em.persist(categoryLanguage);

      category.setCategoryLanguages(null);
      em.persist(category);
View Full Code Here

TOP

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

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.