Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Category


       
    CategoryDisplayForm childCategories[] = form.getChildrenCategories();
        for (int i = 0; i < childCategories.length; i++) {
          int seqNum = Format.getInt(childCategories[i].getSeqNum());
          Long catId = Format.getLong(childCategories[i].getCatId());
        Category category = new Category();
        category = CategoryDAO.load(siteId, catId);
        category.setSeqNum(seqNum);
        // em.update(category);
        }
        String jsonCategoryTree = Utility.makeJSONCategoryTree(site.getSiteId(), form.getSiteProfileClassId(), form.isSiteProfileClassDefault()).toHtmlString();
        form.setJsonCategoryTree(jsonCategoryTree);
      form.setSequence(true);
View Full Code Here


      }
      return errors;
    }

    protected void initListInfo(CategoryMaintActionForm form, String siteId) throws Exception {
      Category parent = CategoryDAO.load(siteId, Format.getLong(form.getCatId()));
    Vector<CategoryDisplayForm> vector = new Vector<CategoryDisplayForm>();
      for (Category childCategory : parent.getCategoryChildren()) {     
      CategoryDisplayForm display = new CategoryDisplayForm();
      display.setCatId(Format.getLong(childCategory.getCatId()));
      display.setSeqNum(Format.getInt(childCategory.getSeqNum()));
      display.setCatShortTitle(childCategory.getCategoryLanguage().getCatShortTitle());
      display.setCatTitle(childCategory.getCategoryLanguage().getCatTitle());
View Full Code Here

        HttpServletResponse response) throws Throwable {
    CategoryMaintActionForm form = (CategoryMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    Long catId = Format.getLong(form.getCatId());
    Category category = CategoryDAO.load(site.getSiteId(), catId);
    streamWebService(response, getJSONCustomAttributes(category));
    return null;
  }
View Full Code Here

   
      JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);

    Long catId = Format.getLong(form.getCatId());
    Category category = CategoryDAO.load(site.getSiteId(), catId);
    String customAttribIds[] = form.getCustomAttribIds();
    if (customAttribIds != null) {
      for (int i = 0; i < customAttribIds.length; i++) {
        CustomAttribute customAttribute = em.find(CustomAttribute.class, Format.getLong(customAttribIds[i]));
        category.getCustomAttributes().remove(customAttribute);
      }
    }
    streamWebService(response, jsonResult.toHtmlString());
    return null;
  }
View Full Code Here

    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
   
    Long customAttribId = Format.getLong(form.getCustomAttribId());
    CustomAttribute customAttribute = em.find(CustomAttribute.class, customAttribId);
    Long catId = Format.getLong(form.getCatId());
    Category category = em.find(Category.class, catId);
    Iterator<?> iterator = category.getCustomAttributes().iterator();
    boolean found = false;
    while (iterator.hasNext()) {
      CustomAttribute attribute = (CustomAttribute) iterator.next();
      if (attribute.getCustomAttribId().equals(customAttribute.getCustomAttribId())) {
        found = true;
      }
    }
   
    if (!found) {
      category.getCustomAttributes().add(customAttribute);
      em.persist(category);
    }

    streamWebService(response, jsonResult.toHtmlString());
    return null;
View Full Code Here

      if (Format.isNullOrEmpty(form.getCatShortTitle())) {
        errors.add("catShortTitle", new ActionMessage("error.string.required"));       
      }
     
      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;
          }
View Full Code Here

      Query query = em.createQuery(sql);
      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;
View Full Code Here

    }
   
    static public Long[] getCatIdTreeList(String siteId, Long parentId) throws Exception {
      // TODO performance - cache
      Vector<Long> list = new Vector<Long>();
      Category parent = CategoryDAO.load(siteId, parentId);
      getCatIdTreeListWorker(siteId, list, parent);
      Long catIdList[] = new Long[list.size()];
      list.copyInto(catIdList);
      return catIdList;
    }
View Full Code Here

      Query query = em.createQuery(sql);
      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;
View Full Code Here

              "/" + 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 +
            "/" + contentBean.getContentSessionBean().getSiteDomain().getSiteDomainPrefix() +
              "/" + contentBean.getContentSessionBean().getSiteProfile().getSiteProfileClass().getSiteProfileClassName() +
            "/" + Constants.FRONTEND_URL_SECTION +
              "/" + category.getCatNaturalKey() // topCategory
              "/" + category.getCatNaturalKey()// category
      }
      else if (menu.getMenuType().equals(Constants.MENU_CONTACTUS)) {
        url = "/" + ApplicationGlobal.getContextPath() +
              Constants.FRONTEND_URL_PREFIX +
            "/" + contentBean.getContentSessionBean().getSiteDomain().getSiteDomainPrefix() +
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.