Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.CustomAttributeOption


              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();
View Full Code Here


          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());
View Full Code Here

                      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());
            if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
                  for (CustomAttributeOptionLanguage language : customAttributeOption.getCustomAttributeOptionLanguages()) {
                    if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
                      if (language.getCustomAttribValue() != null) {
                        itemAttributeInfo.setCustomAttribValue(language.getCustomAttribValue());
                      }
                      break;
View Full Code Here

        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);
          }
        }
        break;
      case Constants.CUSTOM_ATTRIBUTE_TYPE_SKU_MAKEUP:
        if (!insertMode && !item.getItemTypeCd().equals(Constants.ITEM_TYPE_TEMPLATE)) {
          CustomAttributeOption customAttributeOption = CustomAttributeOptionDAO.load(site.getSiteId(), Format.getLong(itemAttributeDetails[i].getCustomAttribOptionId()));
          itemAttributeDetail.setCustomAttributeOption(customAttributeOption);
        }
        break;
      }
      item.getItemAttributeDetails().add(itemAttributeDetail);
View Full Code Here

        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());
            }
          }
          if (!form.isSiteProfileClassDefault()) {
            boolean found = false;
              Long siteProfileClassId = form.getSiteProfileClassId();
View Full Code Here

    customAttribute.setCustomAttribTypeCode(form.getCustomAttribTypeCode().charAt(0));
   
    SiteCurrencyClass siteCurrencyClass = (SiteCurrencyClass) em.find(SiteCurrencyClass.class, form.getSiteCurrencyClassId());   
    for (int i = 0; i < form.getCustomAttribOptions().length; i++) {
      CustomAttributeOptionDisplayForm optionForm = form.getCustomAttribOptions()[i];
      CustomAttributeOption customAttributeOption = null;
      boolean exist = false;
      if (Format.isNullOrEmpty(optionForm.getCustomAttribOptionId())) {
        customAttributeOption = new CustomAttributeOption();
        customAttributeOption.setCustomAttribute(customAttribute);
        customAttributeOption.setRecCreateBy(adminBean.getUser().getUserId());
        customAttributeOption.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      }
      else {
        Long customAttribOptionId = Format.getLong(optionForm.getCustomAttribOptionId());
        customAttributeOption = CustomAttributeOptionDAO.load(adminBean.getSite().getSiteId(), customAttribOptionId);
        exist = true;
      }
      customAttributeOption.setCustomAttribSkuCode(optionForm.getCustomAttribSkuCode());
      customAttributeOption.setRecUpdateBy(adminBean.getUser().getUserId());
      customAttributeOption.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      if (!exist) {
        em.persist(customAttributeOption);
      }
     
      if (customAttribute.getCustomAttribDataTypeCode() == Constants.CUSTOM_ATTRIBUTE_DATA_TYPE_CURRENCY) {
        exist = true;
        CustomAttributeOptionCurrency customAttribOptionCurrency = customAttributeOption.getCustomAttributeOptionCurrency();
        if (customAttribOptionCurrency == null) {
          customAttribOptionCurrency = new CustomAttributeOptionCurrency();
          exist = false;
          customAttribOptionCurrency.setSiteCurrencyClass(siteCurrencyClass);
          customAttribOptionCurrency.setCustomAttributeOption(customAttributeOption);
          customAttribOptionCurrency.setRecCreateBy(adminBean.getUser().getUserId());
          customAttribOptionCurrency.setRecCreateDatetime(new Date(System.currentTimeMillis()));
          customAttributeOption.setCustomAttributeOptionCurrency(customAttribOptionCurrency);
          customAttributeOption.getCustomAttributeOptionCurrencies().add(customAttribOptionCurrency);
        }
        customAttribOptionCurrency.setCustomAttribValue(optionForm.getCustomAttribValue());
        customAttribOptionCurrency.setRecUpdateBy(adminBean.getUser().getUserId());
        customAttribOptionCurrency.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
        if (!exist) {
          em.persist(customAttribOptionCurrency);
        }
      }
      else {
        exist = true;
        CustomAttributeOptionLanguage customAttribOptionLanguage = customAttributeOption.getCustomAttributeOptionLanguage();
        if (customAttribOptionLanguage == null) {
          SiteProfileClass siteProfileClass = SiteProfileClassDAO.load(form.getSiteProfileClassId());
          customAttribOptionLanguage = new CustomAttributeOptionLanguage();
          exist = false;
          customAttribOptionLanguage.setCustomAttributeOption(customAttributeOption);
          customAttribOptionLanguage.setSiteProfileClass(siteProfileClass);
          customAttribOptionLanguage.setRecCreateBy(adminBean.getUser().getUserId());
          customAttribOptionLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
          customAttributeOption.setCustomAttributeOptionLanguage(customAttribOptionLanguage);
          customAttributeOption.getCustomAttributeOptionLanguages().add(customAttribOptionLanguage);
        }
        customAttribOptionLanguage.setCustomAttribValue(optionForm.getCustomAttribValue());
        customAttribOptionLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
        customAttribOptionLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()))
        if (!exist) {
          em.persist(customAttribOptionLanguage);
        }
      }
      optionForm.setCustomAttribOptionId(customAttributeOption.getCustomAttribOptionId().toString());
    }
  }
View Full Code Here

    customAttribLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    em.persist(customAttribLanguage);
   
    for (int i = 0; i < form.getCustomAttribOptions().length; i++) {
      CustomAttributeOptionDisplayForm optionForm = form.getCustomAttribOptions()[i];
      CustomAttributeOption customAttributeOption = null;
      Long customAttribOptionId = Format.getLong(optionForm.getCustomAttribOptionId());
      customAttributeOption = CustomAttributeOptionDAO.load(adminBean.getSite().getSiteId(), customAttribOptionId);
      boolean exist = true;
      CustomAttributeOptionLanguage customAttributeOptionLanguage = null;
      for (CustomAttributeOptionLanguage optionLang : customAttributeOption.getCustomAttributeOptionLanguages()) {
        if (optionLang.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
          customAttributeOptionLanguage = optionLang;
        }
      }
      if (customAttributeOptionLanguage == null) {
        customAttributeOptionLanguage = new CustomAttributeOptionLanguage();
        exist = false;
        customAttributeOptionLanguage.setRecCreateBy(user.getUserId());
        customAttributeOptionLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
          SiteProfileClass siteProfileClass = (SiteProfileClass) em.find(SiteProfileClass.class, siteProfileClassId);
          customAttributeOptionLanguage.setSiteProfileClass(siteProfileClass);
          customAttributeOptionLanguage.setCustomAttributeOption(customAttributeOption);
          customAttributeOption.getCustomAttributeOptionLanguages().add(customAttributeOptionLanguage);
      }
     
      if (form.isCustomAttribOptionLangFlag()) {
        customAttributeOptionLanguage.setCustomAttribValue(optionForm.getCustomAttribValueLang());
      }
View Full Code Here

      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Long siteCurrencyClassId = form.getSiteCurrencyClassId();
    User user = adminBean.getUser();
    for (int i = 0; i < form.getCustomAttribOptions().length; i++) {
      CustomAttributeOptionDisplayForm optionForm = form.getCustomAttribOptions()[i];
      CustomAttributeOption customAttributeOption = null;
      Long customAttribOptionId = Format.getLong(optionForm.getCustomAttribOptionId());
      customAttributeOption = CustomAttributeOptionDAO.load(adminBean.getSite().getSiteId(), customAttribOptionId);       
      boolean exist = true;
      CustomAttributeOptionCurrency customAttributeOptionCurrency = null;
      for (CustomAttributeOptionCurrency optionCurr : customAttributeOption.getCustomAttributeOptionCurrencies()) {
        if (optionCurr.getSiteCurrencyClass().getSiteCurrencyClassId().equals(siteCurrencyClassId)) {
          customAttributeOptionCurrency = optionCurr;
        }
      }
      if (customAttributeOptionCurrency == null) {
        customAttributeOptionCurrency = new CustomAttributeOptionCurrency();
        exist = false;
        customAttributeOptionCurrency.setRecCreateBy(user.getUserId());
        customAttributeOptionCurrency.setRecCreateDatetime(new Date(System.currentTimeMillis()));
          SiteCurrencyClass siteCurrencyClass = (SiteCurrencyClass) em.find(SiteCurrencyClass.class, siteCurrencyClassId);
          customAttributeOptionCurrency.setSiteCurrencyClass(siteCurrencyClass);
          customAttributeOptionCurrency.setCustomAttributeOption(customAttributeOption);
          customAttributeOption.getCustomAttributeOptionCurrencies().add(customAttributeOptionCurrency);
      }
     
      if (form.isCustomAttribOptionCurrFlag()) {
        customAttributeOptionCurrency.setCustomAttribValue(optionForm.getCustomAttribValueCurr());
      }
View Full Code Here

    CustomAttributeMaintActionForm form = (CustomAttributeMaintActionForm) actionForm;
   
    String customAttribOptionIds[] = form.getCustomAttribOptionIds();
    if (customAttribOptionIds != null) {
      for (int i = 0; i < customAttribOptionIds.length; i++) {
        CustomAttributeOption customAttribOption = CustomAttributeOptionDAO.load(site.getSiteId(), Format.getLong(customAttribOptionIds[i]));
        String sql = "select count(*) " +
               "from   ItemAttributeDetail itemAttributeDetail " +
               "where  itemAttributeDetail.customAttributeOption = :customAttributeOption ";
        Query query = em.createQuery(sql);
        query.setParameter("customAttributeOption", customAttribOption);
        Long count = (Long) query.getSingleResult();
        if (count.intValue() > 0) { 
          jsonResult.put("status", Constants.WEBSERVICE_STATUS_FAILED);
          jsonResult.put("reason", Constants.WEBSERVICE_REASON_INUSE);
          streamWebService(response, jsonResult.toHtmlString());
          return null;
        }
       
        for (CustomAttributeOptionLanguage customAttributeOptionLanguage : customAttribOption.getCustomAttributeOptionLanguages()) {
          em.remove(customAttributeOptionLanguage);
        }
        for (CustomAttributeOptionCurrency customAttributeOptionCurrency : customAttribOption.getCustomAttributeOptionCurrencies()) {
          em.remove(customAttributeOptionCurrency);
        }
        em.remove(customAttribOption);
      }
    }
View Full Code Here

    CustomAttribute customAttribute = CustomAttributeDAO.load(site.getSiteId(), customAttribId);
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    Iterator<?> iterator = customAttribute.getCustomAttributeOptions().iterator();
    Vector<JSONEscapeObject> customAttributeOptions = new Vector<JSONEscapeObject>();
    while (iterator.hasNext()) {
      CustomAttributeOption option = (CustomAttributeOption) iterator.next();
      JSONEscapeObject optionObject = new JSONEscapeObject();
      optionObject.put("customAttribOptionId", option.getCustomAttribOptionId());
      if (customAttribute.getCustomAttribDataTypeCode() == Constants.CUSTOM_ATTRIBUTE_DATA_TYPE_CURRENCY) {
        optionObject.put("customAttribValue", option.getCustomAttributeOptionCurrency().getCustomAttribValue())
      }
      else {
        optionObject.put("customAttribValue", option.getCustomAttributeOptionLanguage().getCustomAttribValue())
      }
      optionObject.put("customAttribSkuCode", option.getCustomAttribSkuCode());
      customAttributeOptions.add(optionObject);
    }
    jsonResult.put("customAttributeOptions", customAttributeOptions);
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
View Full Code Here

TOP

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

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.