Examples of CustomAttribute


Examples of com.jada.jpa.entity.CustomAttribute

          if (itemAttributeDetail.getCustomAttributeDetail().getCustomAttribute().getSystemRecord() == Constants.VALUE_YES) {
            continue;
          }
          ItemAttribDetailInfo itemAttribDetailInfo = new ItemAttribDetailInfo();
          itemAttribDetailInfo.setItemAttribDetailId(itemAttributeDetail.getItemAttribDetailId().toString());
          CustomAttribute customAttribute = itemAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
          itemAttribDetailInfo.setCustomAttribTypeCode(String.valueOf(customAttribute.getCustomAttribTypeCode()));
          itemAttribDetailInfo.setCustomAttribDetailId(String.valueOf(itemAttributeDetail.getCustomAttributeDetail().getCustomAttribDetailId()));
         
          String customAttribDesc = customAttribute.getCustomAttributeLanguage().getCustomAttribDesc();
          if (!contentBean.getContentSessionKey().isSiteProfileClassDefault()) {
            for (CustomAttributeLanguage language : customAttribute.getCustomAttributeLanguages()) {
              if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
                if (language.getCustomAttribDesc() != null) {
                  customAttribDesc = language.getCustomAttribDesc();
                }
                break;
              }
            }
          }
          itemAttribDetailInfo.setCustomAttribDesc(customAttribDesc);
         
          char customAttribTypeCode = itemAttributeDetail.getCustomAttributeDetail().getCustomAttribute().getCustomAttribTypeCode();
          String itemAttribDetailValue = null;
          switch (customAttribTypeCode) {
            case Constants.CUSTOM_ATTRIBUTE_TYPE_USER_INPUT:
              itemAttribDetailValue = itemAttributeDetail.getItemAttributeDetailLanguage().getItemAttribDetailValue();
              if (!contentBean.getContentSessionKey().isSiteProfileClassDefault()) {
                for (ItemAttributeDetailLanguage language : itemAttributeDetail.getItemAttributeDetailLanguages()) {
                  if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
                    if (language.getItemAttribDetailValue() != null) {
                      itemAttribDetailValue = language.getItemAttribDetailValue();
                    }
                    break;
                  }
                }
              }
              itemAttribDetailInfo.setItemAttribDetailValue(itemAttribDetailValue);
              break;
            case Constants.CUSTOM_ATTRIBUTE_TYPE_CUST_INPUT:
              itemAttribDetailInfo.setItemAttribDetailValue("");
              break;
            case Constants.CUSTOM_ATTRIBUTE_TYPE_USER_SELECT_DROPDOWN:
              CustomAttributeOption customAttributeOption = itemAttributeDetail.getCustomAttributeOption();
              itemAttribDetailValue = "";
              if (customAttributeOption != null) {
                itemAttribDetailValue = customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue();
                if (!contentBean.getContentSessionKey().isSiteProfileClassDefault()) {
                  for (CustomAttributeOptionLanguage language : itemAttributeDetail.getCustomAttributeOption().getCustomAttributeOptionLanguages()) {
                    if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
                      if (language.getCustomAttribValue() != null) {
                        itemAttribDetailValue = language.getCustomAttribValue();
                      }
                      break;
                    }
                  }
                }
              }
              itemAttribDetailInfo.setItemAttribDetailValue(itemAttribDetailValue);
              break;
            case Constants.CUSTOM_ATTRIBUTE_TYPE_CUST_SELECT_DROPDOWN:
            case Constants.CUSTOM_ATTRIBUTE_TYPE_SKU_MAKEUP:
              itemAttribDetailInfo.setCustomAttribOptionId("");
              if (itemAttributeDetail.getCustomAttributeOption() != null) {
                itemAttribDetailInfo.setCustomAttribOptionId(itemAttributeDetail.getCustomAttributeOption().getCustomAttribOptionId().toString());
              }
             
              Vector<LabelValueBean> customAttribOptions = new Vector<LabelValueBean>();
              for (CustomAttributeOption option : customAttribute.getCustomAttributeOptions()) {
                String customAttribOption = option.getCustomAttribOptionId().toString();
                String customAttribValue = option.getCustomAttributeOptionLanguage().getCustomAttribValue();
                  if (!contentBean.getContentSessionKey().isSiteProfileClassDefault()) {
                  for (CustomAttributeOptionLanguage language : option.getCustomAttributeOptionLanguages()) {
                    if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

    String filterCiteria = "";
    Double minPrice = Double.MIN_VALUE * -1;
    Double maxPrice = Double.MAX_VALUE;
    for (ContentFilterBean contentFilterBean : contentFilterBeans) {
      if (contentFilterBean.getSystemRecord() == Constants.VALUE_YES) {
        CustomAttribute customAttribute = CustomAttributeDAO.load(siteDomain.getSite().getSiteId(), contentFilterBean.getCustomAttribId());
        PriceRange priceRange = getAttributePriceRange(customAttribute, contentFilterBean.getCustomAttribOptionId());
        minPrice = Double.valueOf(priceRange.getMinPrice());
        maxPrice = Double.valueOf(priceRange.getMaxprice());
      }
      else {
        String categoryAttributeSubquery = NamedQuery.getInstance().getQuery("category.attribute.subquery");
        categoryAttributeSubquery = categoryAttributeSubquery.replaceFirst(":customAttribOptionId", contentFilterBean.getCustomAttribOptionId().toString());
        filterCiteria += " " + categoryAttributeSubquery;
      }
    }
   
    String sql = "";
    if (siteDomain.getSite().getShareInventory() == Constants.VALUE_YES) {
      sql = NamedQuery.getInstance().getQuery("category.item.language");
    }
    else {
      sql = NamedQuery.getInstance().getQuery("category.item.language.noshare");
    }
    sql += " and category.catId = :catId ";
    sql += " " + filterCiteria;
    sql += " " + NamedQuery.getInstance().getQuery("category.item.language.suffix");
      switch (sortByValue) {
      case Constants.SECTION_SORT_DESC_ASC:
        sql += " order by itemDescSearch.itemShortDesc";
        break;
      case Constants.SECTION_SORT_DESC_DSC:
        sql += " order by itemDescSearch.itemShortDesc desc";
        break;
      case Constants.SECTION_SORT_PRICE_ASC:
        sql += " order by sum(itemPriceSearch.itemPrice)";
        break;
      case Constants.SECTION_SORT_PRICE_DSC:
        sql += " order by sum(itemPriceSearch.itemPrice) desc";
        break;
      }
     
      Vector<DataInfo> dataVector = new Vector<DataInfo>();
      Query query = em.createQuery(sql);
      query.setParameter("siteId", siteDomain.getSite().getSiteId());
      if (siteDomain.getSite().getShareInventory() != Constants.VALUE_YES) {
        query.setParameter("siteDomainId", siteDomain.getSiteDomainId());
      }
      query.setParameter("catId", category.getCatId());
      query.setParameter("siteProfileClassId", contentBean.getContentSessionKey().getSiteProfileClassId());
      query.setParameter("siteCurrencyClassId", contentBean.getContentSessionKey().getSiteCurrencyClassId());
      query.setParameter("minPrice", minPrice);
      query.setParameter("maxPrice", maxPrice);
      query.setParameter("exchangeRate", contentBean.getContentSessionBean().getSiteCurrency().getExchangeRate() - 1);
     
      List<?> list = query.getResultList();
      int totalCount = 0;
      int itemSize = list.size();
      totalCount += itemSize;
      Iterator<?> sqlIterator = list.iterator();
      while (sqlIterator.hasNext()) {
        Long itemId = (Long) sqlIterator.next();
        if (index >= itemStart && index <= itemEnd) {
          Item item = ItemDAO.load(siteDomain.getSite().getSiteId(), itemId);
          ItemInfo itemInfo = formatItem(item);
          dataVector.add(itemInfo);
        }
        index++;
        if (index > itemEnd) {
          break;
        }
      }
      sql = NamedQuery.getInstance().getQuery("category.content.language");
      switch (sortByValue) {
      case Constants.SECTION_SORT_DESC_ASC:
        sql += " order by contentDescSearch.contentTitle";
        break;
      case Constants.SECTION_SORT_DESC_DSC:
        sql += " order by contentDescSearch.contentTitle desc";
        break;
      case Constants.SECTION_SORT_PRICE_ASC:
        sql += " order by contentDescSearch.contentTitle";
        break;
      case Constants.SECTION_SORT_PRICE_DSC:
        sql += " order by contentDescSearch.contentTitle";
        break;
      }
      query = em.createQuery(sql);
      query.setParameter("siteId", siteDomain.getSite().getSiteId());
      query.setParameter("catId", category.getCatId());
      query.setParameter("siteProfileClassId", contentBean.getContentSessionKey().getSiteProfileClassId());

      list = query.getResultList();
      totalCount += list.size();
      sqlIterator = list.iterator();
      while (sqlIterator.hasNext()) {
        Long contentId = (Long) sqlIterator.next();
        if (index >= itemStart && index <= itemEnd) {
          Content content = ContentDAO.load(siteDomain.getSite().getSiteId(), contentId);
          ContentInfo contentInfo = formatContent(content);
          dataVector.add(contentInfo);
        }
        index++;
        if (index > itemEnd) {
          break;
        }
      }
     
      int midpoint = pageNavCount / 2;
      int recordCount = totalCount;
      int pageTotal = recordCount / pageSize;
      if (recordCount % pageSize > 0) {
        pageTotal++;
      }
      categoryInfo.setPageTotal(pageTotal);
      categoryInfo.setPageNum(pageNum);
      int pageStart = pageNum - midpoint;
      if (pageStart < 1) {
        pageStart = 1;
      }
      int pageEnd = pageStart + pageNavCount - 1;
      if (pageEnd > pageTotal) {
        pageEnd = pageTotal;
        if (pageEnd - pageStart + 1 < pageNavCount) {
          pageStart = pageEnd - pageNavCount + 1;
          if (pageStart < 1) {
            pageStart = 1;
          }
        }
      }

      categoryInfo.setPageStart(pageStart);
      categoryInfo.setPageEnd(pageEnd);
     
      Object categoryDatas[] = new Object[dataVector.size()];
      dataVector.copyInto(categoryDatas);
      categoryInfo.setCategoryDatas(categoryDatas);
       
        /*
         * Extract filtering information
         */
        Vector<CategoryCustomAttributeInfo> categoryCustomAttributeVector = new Vector<CategoryCustomAttributeInfo>();
        for (CustomAttribute customAttribute : category.getCustomAttributes()) {
          boolean isFilterAttribute = false;
          ContentFilterBean contentFilterBean = null;
          for (ContentFilterBean bean : contentFilterBeans) {
            if (bean.getCustomAttribId().equals(customAttribute.getCustomAttribId())) {
              contentFilterBean = bean;
              isFilterAttribute = true;
              break;
            }
          }
         
          CategoryCustomAttributeInfo categoryCustomAttributeInfo = new CategoryCustomAttributeInfo();
          SiteProfileClass siteProfileClass = contentBean.getContentSessionBean().getSiteProfile().getSiteProfileClass();
          if (isFilterAttribute) {
            CategoryCustomAttributeOptionInfo optionInfo = new CategoryCustomAttributeOptionInfo();
            optionInfo.setCustomAttribOptionId(contentFilterBean.getCustomAttribOptionId().toString());
            CustomAttributeOption customAttribOption = CustomAttributeOptionDAO.load(siteDomain.getSite().getSiteId(), contentFilterBean.getCustomAttribOptionId());
            if (customAttribute.getSystemRecord() == Constants.VALUE_YES) {
              PriceRange priceRange = getAttributePriceRange(customAttribute, customAttribOption.getCustomAttribOptionId());
              String rangeValue = formatter.formatCurrency(priceRange.getMinPrice().floatValue()) +
                        " - " +
                        formatter.formatCurrency(priceRange.getMaxprice().floatValue());
              optionInfo.setCustomAttribValue(rangeValue);
            }
            else {
              optionInfo.setCustomAttribValue(customAttribOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
              if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
                for (CustomAttributeOptionLanguage customAttributeOptionLanguage : customAttribOption.getCustomAttributeOptionLanguages()) {
                  if (!customAttributeOptionLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClass.getSiteProfileClassId())) {
                        continue;
                      }
                  if (customAttributeOptionLanguage.getCustomAttribValue() != null) {
                    optionInfo.setCustomAttribValue(customAttributeOptionLanguage.getCustomAttribValue());
                    break;
                  }
                }
              }
            }
            String customAttribUrl = categoryUrl + "?sortBy" + sortBy;
                for (ContentFilterBean bean : contentFilterBeans) {
                  if (bean.getCustomAttribId().equals(customAttribute.getCustomAttribId())) {
                    continue;
                  }
                  customAttribUrl += "&filter=" + bean.getCustomAttribId() + "," + bean.getCustomAttribOptionId();
                }
                optionInfo.setCustomAttribUrl(customAttribUrl);
               
            categoryCustomAttributeInfo.setCustomAttribId(customAttribute.getCustomAttribId().toString());
            categoryCustomAttributeInfo.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
            categoryCustomAttributeInfo.setSelected(true);
            categoryCustomAttributeInfo.setSelectedCustomAttribOptionInfo(optionInfo);
            if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
              for (CustomAttributeLanguage customAttributeLanguage : customAttribute.getCustomAttributeLanguages()) {
                if (!customAttributeLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClass.getSiteProfileClassId())) {
                      continue;
                    }
                if (customAttributeLanguage.getCustomAttribDesc() != null) {
                  categoryCustomAttributeInfo.setCustomAttribDesc(customAttributeLanguage.getCustomAttribDesc());
                  break;
                }
              }
            }
          }
          else {
            Vector<CategoryCustomAttributeOptionInfo> categoryCustomAttributeOptionVector = new Vector<CategoryCustomAttributeOptionInfo>();
            if (customAttribute.getSystemRecord() == Constants.VALUE_YES) {
              for (CustomAttributeOption customAttributeOption : customAttribute.getCustomAttributeOptions()) {
                long count = getDataInAttributeOptionCount(category, customAttribute, customAttributeOption, contentFilterBeans);
                    CategoryCustomAttributeOptionInfo optionInfo = new CategoryCustomAttributeOptionInfo();
                    optionInfo.setCustomAttribOptionId(customAttributeOption.getCustomAttribOptionId().toString());
                    PriceRange priceRange = getAttributePriceRange(customAttribute, customAttributeOption.getCustomAttribOptionId());
                    String rangeValue = formatter.formatCurrency(priceRange.getMinPrice().floatValue()) +
                              " - " +
                              formatter.formatCurrency(priceRange.getMaxprice().floatValue());
                    optionInfo.setCustomAttribValue(rangeValue);
                    optionInfo.setDataCount((int) count);
                    String customAttribUrl = categoryUrl + "?sortBy=" + sortBy;
                    for (ContentFilterBean bean : contentFilterBeans) {
                      customAttribUrl += "&filter=" + bean.getCustomAttribId() + "," + bean.getCustomAttribOptionId();
                    }
                    customAttribUrl += "&filter=" + customAttribute.getCustomAttribId() + "," + customAttributeOption.getCustomAttribOptionId();
                    optionInfo.setCustomAttribUrl(customAttribUrl);
                    categoryCustomAttributeOptionVector.add(optionInfo);
              }
            }
            else {
              for (CustomAttributeOption customAttributeOption : customAttribute.getCustomAttributeOptions()) {
                long count = getDataInAttributeOptionCount(category, customAttribute, customAttributeOption, contentFilterBeans);
                    CategoryCustomAttributeOptionInfo optionInfo = new CategoryCustomAttributeOptionInfo();
                    optionInfo.setCustomAttribOptionId(customAttributeOption.getCustomAttribOptionId().toString());
                    optionInfo.setCustomAttribValue(customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
                    optionInfo.setDataCount((int) count);
                    if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
                      for (CustomAttributeOptionLanguage customAttributeOptionLanguage : customAttributeOption.getCustomAttributeOptionLanguages()) {
                        if (!customAttributeOptionLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClass.getSiteProfileClassId())) {
                              continue;
                            }
                        if (customAttributeOptionLanguage.getCustomAttribValue() != null) {
                          optionInfo.setCustomAttribValue(customAttributeOptionLanguage.getCustomAttribValue());
                          break;
                        }
                      }
                    }
                    String customAttribUrl = categoryUrl + "?sortBy=" + sortBy;
                    for (ContentFilterBean bean : contentFilterBeans) {
                      customAttribUrl += "&filter=" + bean.getCustomAttribId() + "," + bean.getCustomAttribOptionId();
                    }
                    customAttribUrl += "&filter=" + customAttribute.getCustomAttribId() + "," + customAttributeOption.getCustomAttribOptionId();
                    optionInfo.setCustomAttribUrl(customAttribUrl);
                    categoryCustomAttributeOptionVector.add(optionInfo);
              }
            }
            categoryCustomAttributeInfo.setCustomAttribId(customAttribute.getCustomAttribId().toString());
            categoryCustomAttributeInfo.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
            categoryCustomAttributeInfo.setSelected(false);
            if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
              for (CustomAttributeLanguage customAttributeLanguage : customAttribute.getCustomAttributeLanguages()) {
                if (!customAttributeLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClass.getSiteProfileClassId())) {
                      continue;
                    }
                if (customAttributeLanguage.getCustomAttribDesc() != null) {
                  categoryCustomAttributeInfo.setCustomAttribDesc(customAttributeLanguage.getCustomAttribDesc());
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

      subquery = " " + subquery.replace(":customAttribOptionId", customAttributeOption.getCustomAttribOptionId().toString());
    }
    String filterCiteria = subquery;
    for (ContentFilterBean contentFilterBean : contentFilterBeans) {
      if (contentFilterBean.getSystemRecord() == Constants.VALUE_YES) {
        CustomAttribute attribute = CustomAttributeDAO.load(siteDomain.getSite().getSiteId(), contentFilterBean.getCustomAttribId());
        PriceRange priceRange = getAttributePriceRange(attribute, contentFilterBean.getCustomAttribOptionId());
        minPrice = priceRange.getMinPrice();
        maxPrice = priceRange.getMaxprice();
      }
      else {
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

    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();
        if (customAttribute.getItemCompare() != Constants.VALUE_YES) {
          continue;
        }
        if (customAttribute.getSystemRecord() == Constants.VALUE_YES) {
          continue;
        }
        boolean found = false;
        for (CustomAttributeInfo customAttributeInfo: attributeVector) {
          if (customAttributeInfo.getCustomAttribId().equals(customAttribute.getCustomAttribId().toString())) {
            found = true;
            break;
          }
        }
        if (!found) {
          CustomAttributeInfo customAttributeInfo = new CustomAttributeInfo();
          customAttributeInfo.setCustomAttribId(customAttribute.getCustomAttribId().toString());
          customAttributeInfo.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
         
          for (CustomAttributeLanguage customAttributeLang: customAttribute.getCustomAttributeLanguages()) {
            if (customAttributeLang.getSiteProfileClass().getSiteProfileClassId().equals(siteProfile.getSiteProfileClass().getSiteProfileClassId())) {
              if (customAttributeLang.getCustomAttribDesc() != null) {
                customAttributeInfo.setCustomAttribDesc(customAttributeLang.getCustomAttribDesc());
              }
              break;
            }
          }
          attributeVector.add(customAttributeInfo);
        }
      }
    }
    CustomAttributeInfo customAttributeInfos[] = new CustomAttributeInfo[attributeVector.size()];
    attributeVector.copyInto(customAttributeInfos);
    itemComparePageInfo.setCustomAttributeInfos(customAttributeInfos);
   
    Vector<ItemCompareItemInfo> itemCompareItemVector = new Vector<ItemCompareItemInfo>();
    for (String itemId: ContentLookupDispatchAction.getItemCompareList(request)) {
      Item item = ItemDAO.load(siteDomain.getSite().getSiteId(), Format.getLong(itemId));
      ItemCompareItemInfo itemCompareItemInfo = new ItemCompareItemInfo();
      ItemInfo itemInfo = formatItem(item);
      itemCompareItemInfo.setItemInfo(itemInfo);
     
      String itemAttribValues[] = new String[customAttributeInfos.length];
      for (int i = 0; i < itemAttribValues.length; i++) {
        itemAttribValues[i] = "";
      }
      itemCompareItemInfo.setItemAttribValues(itemAttribValues);
     
      for (ItemAttributeDetail itemAttributeDetail: item.getItemAttributeDetails()) {
        CustomAttribute customAttribute = itemAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
        int pos = 0;
        boolean found = false;
        for (pos = 0; pos < customAttributeInfos.length; pos++) {
          if (customAttributeInfos[pos].getCustomAttribId().equals(customAttribute.getCustomAttribId().toString())) {
            found = true;
            break;
          }
        }
        if (!found) {
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

                  }
                }
              }
          if (item.getItemTypeCd().equals(Constants.ITEM_TYPE_SKU)) {
            for (ItemAttributeDetail itemAttributeDetail : item.getItemAttributeDetails()) {
              CustomAttribute customAttribute = itemAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
              if (customAttribute.getCustomAttribTypeCode() != Constants.CUSTOM_ATTRIBUTE_TYPE_SKU_MAKEUP) {
                continue;
              }
              com.jada.content.data.ItemAttributeInfo itemAttributeInfo = new com.jada.content.data.ItemAttributeInfo();
             
              itemAttributeInfo.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
                if (!siteProfileClassDefault) {
                  for (CustomAttributeLanguage language : customAttribute.getCustomAttributeLanguages()) {
                    if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfile.getSiteProfileClass().getSiteProfileClassId())) {
                      if (language.getCustomAttribDesc() != null) {
                        itemAttributeInfo.setCustomAttribDesc(language.getCustomAttribDesc());
                      }
                      break;
                    }
                  }
                }
 
                CustomAttributeOption customAttributeOption = itemAttributeDetail.getCustomAttributeOption();
                itemAttributeInfo.setCustomAttribValue(customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
                if (!siteProfileClassDefault) {
                  for (CustomAttributeOptionLanguage language : customAttributeOption.getCustomAttributeOptionLanguages()) {
                    if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfile.getSiteProfileClass().getSiteProfileClassId())) {
                      if (language.getCustomAttribValue() != null) {
                        itemAttributeInfo.setCustomAttribValue(language.getCustomAttribValue());
                      }
                      break;
                    }
                  }
                }
                v.add(itemAttributeInfo);
            }
          }
        }
       
        for (OrderAttributeDetail orderAttributeDetail : orderItemDetail.getOrderAttributeDetails()) {
          com.jada.content.data.ItemAttributeInfo itemAttributeInfo = new com.jada.content.data.ItemAttributeInfo();
          CustomAttribute customAttribute = orderAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
          itemAttributeInfo.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
              if (!siteProfileClassDefault) {
                for (CustomAttributeLanguage language : customAttribute.getCustomAttributeLanguages()) {
                  if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
                    if (language.getCustomAttribDesc() != null) {
                      itemAttributeInfo.setCustomAttribDesc(language.getCustomAttribDesc());
                    }
                      break;
                  }
                }
              }
              if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_CUST_INPUT) {
                itemAttributeInfo.setCustomAttribValue(orderAttributeDetail.getOrderAttribValue());
              }
              else {
            CustomAttributeOption customAttributeOption = orderAttributeDetail.getCustomAttributeOption();
            itemAttributeInfo.setCustomAttribValue(customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

     
      form.setItemAttribDetailValueLangFlag(true);
      ItemAttributeDetailDisplayForm attributeDetailDisplayForm[] = form.getItemAttributeDetails();
      for (int i = 0; i < attributeDetailDisplayForm.length; i++) {
        attributeDetailDisplayForm[i].setItemAttribDetailValueLangFlag(true);
        CustomAttribute customAttribute = CustomAttributeDAO.load(site.getSiteId(), Format.getLong(attributeDetailDisplayForm[i].getCustomAttribId()));
        if (customAttribute.getCustomAttribTypeCode() != Constants.CUSTOM_ATTRIBUTE_TYPE_USER_INPUT) {
          continue;
        }
        attributeDetailDisplayForm[i].setItemAttribDetailValueLang(translator.translate(attributeDetailDisplayForm[i].getItemAttribDetailValue()));
      }
    }
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

    }
    if (form.isItemAttribDetailValueLangFlag()) {
      ItemAttributeDetailDisplayForm itemAttributeDetails[] = form.getItemAttributeDetails();
      for (int i = 0; i < itemAttributeDetails.length; i++) {
        ItemAttributeDetailDisplayForm displayForm = itemAttributeDetails[i];
        CustomAttribute customAttribute = CustomAttributeDAO.load(adminBean.getSite().getSiteId(), Format.getLong(itemAttributeDetails[i].getCustomAttribId()));
        if (customAttribute.getCustomAttribTypeCode() != Constants.CUSTOM_ATTRIBUTE_TYPE_USER_INPUT) {
          continue;
        }
        ItemAttributeDetail itemAttributeDetail = null;
        if (Format.isNullOrEmpty(displayForm.getItemAttribDetailId())) {
          itemAttributeDetail = new ItemAttributeDetail();
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

      em.remove(itemAttributeDetail);
    }
    item.getItemAttributeDetails().clear();
    ItemAttributeDetailDisplayForm itemAttributeDetails[] = form.getItemAttributeDetails();
    for (int i = 0; i < itemAttributeDetails.length; i++) {
      CustomAttribute customAttribute = CustomAttributeDAO.load(site.getSiteId(), Format.getLong(itemAttributeDetails[i].getCustomAttribId()));
      ItemAttributeDetail itemAttributeDetail = new ItemAttributeDetail();
      Long customAttribDetailId = Format.getLong(itemAttributeDetails[i].getCustomAttribDetailId());
      CustomAttributeDetail customAttributeDetail = (CustomAttributeDetail) em.find(CustomAttributeDetail.class, customAttribDetailId);
      itemAttributeDetail.setCustomAttributeDetail(customAttributeDetail);
      itemAttributeDetail.setRecUpdateBy(adminBean.getUser().getUserId());
      itemAttributeDetail.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      itemAttributeDetail.setRecCreateBy(adminBean.getUser().getUserId());
      itemAttributeDetail.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      itemAttributeDetail.setItem(item);
     
      switch (customAttribute.getCustomAttribTypeCode()) {
      case Constants.CUSTOM_ATTRIBUTE_TYPE_USER_INPUT:
        ItemAttributeDetailLanguage itemAttributeDetailLanguage = new ItemAttributeDetailLanguage();
        itemAttributeDetailLanguage.setItemAttribDetailValue(itemAttributeDetails[i].getItemAttribDetailValue());
        itemAttributeDetailLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
        itemAttributeDetailLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
        itemAttributeDetailLanguage.setRecCreateBy(adminBean.getUser().getUserId());
        itemAttributeDetailLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        itemAttributeDetail.setItemAttributeDetailLanguage(itemAttributeDetailLanguage);
        itemAttributeDetail.getItemAttributeDetailLanguages().add(itemAttributeDetailLanguage);
        itemAttributeDetailLanguage.setSiteProfileClass(siteProfileClass);
        em.persist(itemAttributeDetailLanguage);
        break;
      case Constants.CUSTOM_ATTRIBUTE_TYPE_USER_SELECT_DROPDOWN:
        if (!insertMode) {
          CustomAttributeOption customAttributeOption = null;
          if (itemAttributeDetails[i].getCustomAttribOptionId() != null) {
            customAttributeOption = CustomAttributeOptionDAO.load(site.getSiteId(), Format.getLong(itemAttributeDetails[i].getCustomAttribOptionId()));
          }
          itemAttributeDetail.setCustomAttributeOption(customAttributeOption);
        }
        else {
          CustomAttributeOption customAttributeOption = null;
          for (CustomAttributeOption option : customAttribute.getCustomAttributeOptions()) {
            customAttributeOption = option;
          }
          if (customAttributeOption != null) {
            itemAttributeDetail.setCustomAttributeOption(customAttributeOption);
          }
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

   
    ItemAttributeDetailDisplayForm itemAttributeDetails[] = form.getItemAttributeDetails();
    if (itemAttributeDetails != null) {
      for (int i = 0; i < itemAttributeDetails.length; i++) {
        ItemAttributeDetailDisplayForm displayForm = itemAttributeDetails[i];
        CustomAttribute customAttribute = CustomAttributeDAO.load(site.getSiteId(), Format.getLong(displayForm.getCustomAttribId()));
        if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_USER_INPUT) {
          continue;
        }
        if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_CUST_SELECT_DROPDOWN) {
          continue;
        }
        Vector<LabelValueBean> options = new Vector<LabelValueBean>();
        for (CustomAttributeOption customAttributeOption : customAttribute.getCustomAttributeOptions()) {
          String value = "";
          if (customAttribute.getCustomAttribDataTypeCode() == Constants.CUSTOM_ATTRIBUTE_DATA_TYPE_CURRENCY) {
            value = customAttributeOption.getCustomAttributeOptionCurrency().getCustomAttribValue();
            if (!form.isSiteCurrencyClassDefault()) {
              for (CustomAttributeOptionCurrency optionCurrency : customAttributeOption.getCustomAttributeOptionCurrencies()) {
                if (optionCurrency.getSiteCurrencyClass().getSiteCurrencyClassId().equals(siteCurrencyClassId)) {
                  if (optionCurrency.getCustomAttribValue() != null) {
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

      query.setParameter("customAttribGroupId", item.getCustomAttributeGroup().getCustomAttribGroupId());
      iterator = query.getResultList().iterator();
      boolean itemAttributeLangFlag = false;
      while (iterator.hasNext()) {
        CustomAttributeDetail customAttributeDetail = (CustomAttributeDetail) iterator.next();
        CustomAttribute customAttribute = customAttributeDetail.getCustomAttribute();
        ItemAttributeDetailDisplayForm displayForm = new ItemAttributeDetailDisplayForm();
        displayForm.setCustomAttribId(customAttribute.getCustomAttribId().toString());
        displayForm.setCustomAttribDetailId(customAttributeDetail.getCustomAttribDetailId().toString());
        displayForm.setCustomAttribName(customAttribute.getCustomAttribName());
        displayForm.setCustomAttribTypeCode(String.valueOf(customAttribute.getCustomAttribTypeCode()));
        boolean attributeExist = false;
        Iterator<?> details = item.getItemAttributeDetails().iterator();
        ItemAttributeDetail itemAttributeDetail = null;
        while (details.hasNext()) {
          itemAttributeDetail = (ItemAttributeDetail) details.next();
          if (itemAttributeDetail.getCustomAttributeDetail().getCustomAttribDetailId().equals(customAttributeDetail.getCustomAttribDetailId())) {
            attributeExist = true;
            break;
          }
        }
        if (attributeExist) {
          displayForm.setItemAttribDetailId(itemAttributeDetail.getItemAttribDetailId().toString());
          if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_USER_INPUT) {
            displayForm.setItemAttribDetailValue(itemAttributeDetail.getItemAttributeDetailLanguage().getItemAttribDetailValue());
          }
          CustomAttributeOption customAttributeOption = itemAttributeDetail.getCustomAttributeOption();
          if (customAttributeOption != null) {
            displayForm.setCustomAttribOptionId(customAttributeOption.getCustomAttribOptionId().toString());
            if (customAttribute.getCustomAttribDataTypeCode() == Constants.CUSTOM_ATTRIBUTE_DATA_TYPE_CURRENCY) {
              displayForm.setItemAttribDetailValue(customAttributeOption.getCustomAttributeOptionCurrency().getCustomAttribValue());
            }
            else {
              displayForm.setItemAttribDetailValue(customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.