Examples of CustomAttribute


Examples of com.jada.jpa.entity.CustomAttribute

 
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    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) {
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

          query.setParameter("customAttribName", "%" + form.getSrCustomAttribName() + "%");
        }
        Iterator<?> iterator = query.getResultList().iterator();
        Vector<CustomAttributeDisplayForm> vector = new Vector<CustomAttributeDisplayForm>();
        while (iterator.hasNext()) {
          CustomAttribute customAttribute = (CustomAttribute) iterator.next();
        CustomAttributeDisplayForm customAttributeDisplay = new CustomAttributeDisplayForm();
        customAttributeDisplay.setCustomAttribId(Format.getLong(customAttribute.getCustomAttribId()));
        customAttributeDisplay.setCustomAttribName(customAttribute.getCustomAttribName());
        customAttributeDisplay.setCustomAttribTypeDesc(resources.getMessage("customAttrib.typeCode." + customAttribute.getCustomAttribTypeCode()));
        customAttributeDisplay.setSystemRecord(String.valueOf(customAttribute.getSystemRecord()));
        vector.add(customAttributeDisplay);
        }
        form.setCustomAttributes(vector);
       
        ActionForward actionForward = actionMapping.findForward("success");
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

        String customAttribIds[] = form.getCustomAttribIds();
       
        try {
          if (customAttribIds != null) {
            for (int i = 0; i < customAttribIds.length; i++) {
                CustomAttribute customAttribute = new CustomAttribute();
                customAttribute = CustomAttributeDAO.load(getAdminBean(request).getSite().getSiteId(), Format.getLong(customAttribIds[i]));
                if (customAttribute.getSystemRecord() == Constants.VALUE_YES) {
                  continue;
                }
                em.remove(customAttribute);
          for (CustomAttributeLanguage customAttributeLanguage : customAttribute.getCustomAttributeLanguages()) {
            em.remove(customAttributeLanguage);
          }
            }
            em.getTransaction().commit();
          }
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

      else {
        item.setCustomAttributeGroup(customAttributeGroup);
      }
     
      for (CustomAttributeDetail customAttributeDetail : customAttributeGroup.getCustomAttributeDetails()) {
        CustomAttribute customAttribute = customAttributeDetail.getCustomAttribute();
        ItemAttributeDetail itemAttributeDetailImport = null;
        boolean found = false;
        for (ItemAttributeDetail detail : this.getItemAttributeDetails()) {
          if (detail.getCustomAttribId() != null) {
            if (detail.getCustomAttribId().equals(customAttribute.getCustomAttribId())) {
              itemAttributeDetailImport = detail;
              found = true;
              break;
            }
          }
          else {
            if (detail.getCustomAttribName().equals(customAttribute.getCustomAttribName())) {
              itemAttributeDetailImport = detail;
              found = true;
              break;
            }
          }
        }
        if (!found) {
          throw new ItemSaveException(resources.getMessage("IE.ERROR.E113",
                                   customAttribute.getCustomAttribId(),
                                   customAttribute.getCustomAttribName()));
        }
        if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_CUST_SELECT_DROPDOWN) {
          if (itemAttributeDetailImport.getItemAttributeDetailLanguages().size() > 0) {
            throw new ItemSaveException(resources.getMessage("IE.ERROR.E121", customAttribute.getCustomAttribName()));
          }
        }
        else if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_CUST_INPUT) {
          if (itemAttributeDetailImport.getCustomAttribId() != null ||
            Format.isNullOrEmpty(itemAttributeDetailImport.getCustomAttribName())) {
            throw new ItemSaveException(resources.getMessage("IE.ERROR.E117", customAttribute.getCustomAttribName()));
          }
          if (itemAttributeDetailImport.getItemAttributeDetailLanguages().size() > 0) {
            throw new ItemSaveException(resources.getMessage("IE.ERROR.E121", customAttribute.getCustomAttribName()));
          }
        }
        else if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_USER_SELECT_DROPDOWN) {
          if (itemAttributeDetailImport.getCustomAttribOptionId() == null &&
            Format.isNullOrEmpty(itemAttributeDetailImport.getCustomAttribValue())) {
            throw new ItemSaveException(resources.getMessage("IE.ERROR.E115", customAttribute.getCustomAttribName()));
          }
          if (itemAttributeDetailImport.getItemAttributeDetailLanguages().size() > 0) {
            throw new ItemSaveException(resources.getMessage("IE.ERROR.E121", customAttribute.getCustomAttribName()));
          }
        }
        else if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_USER_INPUT) {
          if (itemAttributeDetailImport.getCustomAttribOptionId() != null ||
            !Format.isNullOrEmpty(itemAttributeDetailImport.getCustomAttribValue())) {
            throw new ItemSaveException(resources.getMessage("IE.ERROR.E117", customAttribute.getCustomAttribName()));
          }
          if (this.isDefaultProfile()) {
            boolean valueFound = false;
            for (ItemAttributeDetailLanguage itemAttributeDetailLanguage : itemAttributeDetailImport.getItemAttributeDetailLanguages()) {
              if (itemAttributeDetailLanguage.getSiteProfileClassId().equals(siteProfileClassDefault.getSiteProfileClassId())) {
                if (Format.isNullOrEmpty(itemAttributeDetailLanguage.getItemAttribDetailValue())) {
                  throw new ItemSaveException(resources.getMessage("IE.ERROR.E122", customAttribute.getCustomAttribName()));
                }
                valueFound = true;
              }
            }
            if (!valueFound) {
              throw new ItemSaveException(resources.getMessage("IE.ERROR.E122", customAttribute.getCustomAttribName()));
            }
          }
        }
        else if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_SKU_MAKEUP) {
          if (itemAttributeDetailImport.getCustomAttribOptionId() == null &&
            Format.isNullOrEmpty(itemAttributeDetailImport.getCustomAttribValue())) {
            throw new ItemSaveException(resources.getMessage("IE.ERROR.E115", customAttribute.getCustomAttribName()));
          }
        }
      }
     
      for (ItemAttributeDetail detail : this.getItemAttributeDetails()) {
        boolean found = false;
        for (CustomAttributeDetail customAttributeDetail : customAttributeGroup.getCustomAttributeDetails()) {
          CustomAttribute customAttribute = customAttributeDetail.getCustomAttribute();
          if (detail.getCustomAttribId() != null) {
            if (detail.getCustomAttribId().equals(customAttribute.getCustomAttribId())) {
              found = true;
              break;
            }
          }
          else {
            if (detail.getCustomAttribName().equals(customAttribute.getCustomAttribName())) {
              found = true;
              break;
            }
          }
        }
        if (!found) {
          throw new ItemSaveException(resources.getMessage("IE.ERROR.E119", detail.getCustomAttribId(), detail.getCustomAttribName()));
        }
      }
     
      for (ItemAttributeDetail itemAttributeDetailImport : this.getItemAttributeDetails()) {
        com.jada.jpa.entity.ItemAttributeDetail itemAttributeDetail = null;
        boolean foundDetail = false;
        for (com.jada.jpa.entity.ItemAttributeDetail detail : item.getItemAttributeDetails()) {
          CustomAttribute customAttribute = detail.getCustomAttributeDetail().getCustomAttribute();
          if (itemAttributeDetailImport.getCustomAttribId() != null) {
            if (itemAttributeDetailImport.getCustomAttribId().equals(customAttribute.getCustomAttribId())) {
              itemAttributeDetail = detail;
              foundDetail = true;
            }
          }
          else {
            if (itemAttributeDetailImport.getCustomAttribName().equals(customAttribute.getCustomAttribName())) {
              itemAttributeDetail = detail;
              foundDetail = true;
            }
          }
        }
        if (!foundDetail) {
          itemAttributeDetail = new com.jada.jpa.entity.ItemAttributeDetail();
          CustomAttributeDetail customAttributeDetail = null;
          for (CustomAttributeDetail d : customAttributeGroup.getCustomAttributeDetails()) {
            CustomAttribute customAttribute = d.getCustomAttribute();
            if (itemAttributeDetailImport.getCustomAttribOptionId() != null) {
              if (itemAttributeDetailImport.getCustomAttribId() == customAttribute.getCustomAttribId()) {
                customAttributeDetail = d;
                break;
              }
            }
            else {
              if (itemAttributeDetailImport.getCustomAttribName() == customAttribute.getCustomAttribName()) {
                customAttributeDetail = d;
                break;
              }
            }
          }
          itemAttributeDetail.setCustomAttributeDetail(customAttributeDetail);
          itemAttributeDetail.setRecCreateBy(Constants.USERNAME_IMPORT);
          itemAttributeDetail.setRecCreateDatetime(new Date());
          itemAttributeDetail.setItem(item);
        }
        if (itemAttributeDetailImport.getCustomAttribId() != null) {
          for (CustomAttributeDetail customAttributeDetail : customAttributeGroup.getCustomAttributeDetails()) {
            if (customAttributeDetail.getCustomAttribute().getCustomAttribId().equals(itemAttributeDetailImport.getCustomAttribId())) {
              itemAttributeDetail.setCustomAttributeDetail(customAttributeDetail);
              break;
            }
          }
        }
        if (!Format.isNullOrEmpty(itemAttributeDetailImport.getCustomAttribName())) {
          for (CustomAttributeDetail customAttributeDetail : customAttributeGroup.getCustomAttributeDetails()) {
            if (customAttributeDetail.getCustomAttribute().getCustomAttribName().equals(itemAttributeDetailImport.getCustomAttribName())) {
              itemAttributeDetail.setCustomAttributeDetail(customAttributeDetail);
              break;
            }
          }
        }
        CustomAttribute customAttribute = itemAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
        boolean optionFound = false;
        if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_USER_SELECT_DROPDOWN ||
          customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_SKU_MAKEUP) {
          if (itemAttributeDetailImport.getCustomAttribId() != null) {
            for (CustomAttributeOption customAttributeOption : customAttribute.getCustomAttributeOptions()) {
              if (customAttributeOption.getCustomAttribOptionId().equals(itemAttributeDetailImport.getCustomAttribOptionId())) {
                itemAttributeDetail.setCustomAttributeOption(customAttributeOption);
                optionFound = true;
                break;
              }
            }
          }
          else {
            if (customAttribute.getCustomAttribDataTypeCode() == Constants.CUSTOM_ATTRIBUTE_DATA_TYPE_CURRENCY) {
              for (CustomAttributeOption customAttributeOption : customAttribute.getCustomAttributeOptions()) {
                if (customAttributeOption.getCustomAttributeOptionCurrency().getCustomAttribValue().equals(itemAttributeDetailImport.getCustomAttribValue())) {
                  itemAttributeDetail.setCustomAttributeOption(customAttributeOption);
                  optionFound = true;
                  break;
                }
              }
            }
            else {
              for (CustomAttributeOption customAttributeOption : customAttribute.getCustomAttributeOptions()) {
                if (customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue().equals(itemAttributeDetailImport.getCustomAttribValue())) {
                  itemAttributeDetail.setCustomAttributeOption(customAttributeOption);
                  optionFound = true;
                  break;
                }
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

   
    static public String getSkuAttributeKey(Item item) throws JSONException {
      JSONEscapeObject JSONEscapeObject = new JSONEscapeObject();
      Vector<JSONEscapeObject> vector = new Vector<JSONEscapeObject>();
      for (ItemAttributeDetail itemAttributeDetail : item.getItemAttributeDetails()) {
        CustomAttribute customAttribute = itemAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
        if (customAttribute.getCustomAttribTypeCode() != Constants.CUSTOM_ATTRIBUTE_TYPE_SKU_MAKEUP) {
          continue;
        }
        JSONEscapeObject attribute = new JSONEscapeObject();
        attribute.put("customAttribDetailId", itemAttributeDetail.getCustomAttributeDetail().getCustomAttribDetailId().toString());
        attribute.put("customAttribOptionId", itemAttributeDetail.getCustomAttributeOption().getCustomAttribOptionId().toString());
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

      dform.setItemCreditQty(numberFormatter.formatNumber(itemCreditQty));
     
      Vector<OrderItemAttributeBean> orderItemAttributes = new Vector<OrderItemAttributeBean>();
        if (item != null && 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;
            }
            OrderItemAttributeBean orderItemAttributeBean = new OrderItemAttributeBean();
           
            orderItemAttributeBean.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
              if (!contentBean.getContentSessionKey().isSiteProfileClassDefault()) {
                for (CustomAttributeLanguage language : customAttribute.getCustomAttributeLanguages()) {
                  if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
                    if (language.getCustomAttribDesc() != null) {
                      orderItemAttributeBean.setCustomAttribDesc(language.getCustomAttribDesc());
                    }
                    break;
                  }
                }
              }

              CustomAttributeOption customAttributeOption = itemAttributeDetail.getCustomAttributeOption();
              orderItemAttributeBean.setCustomAttribValue(customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
              if (!contentBean.getContentSessionKey().isSiteProfileClassDefault()) {
                for (CustomAttributeOptionLanguage language : customAttributeOption.getCustomAttributeOptionLanguages()) {
                  if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
                    if (language.getCustomAttribValue() != null) {
                      orderItemAttributeBean.setCustomAttribValue(language.getCustomAttribValue());
                    }
                    break;
                  }
                }
              }
              orderItemAttributes.add(orderItemAttributeBean);
          }
        }
       
        for (OrderAttributeDetail orderAttributeDetail : detail.getOrderAttributeDetails()) {
          OrderItemAttributeBean orderItemAttributeBean = new OrderItemAttributeBean();
          CustomAttribute customAttribute = orderAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
          orderItemAttributeBean.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
            if (!contentBean.getContentSessionKey().isSiteProfileClassDefault()) {
              for (CustomAttributeLanguage language : customAttribute.getCustomAttributeLanguages()) {
                if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
                  if (language.getCustomAttribDesc() != null) {
                    orderItemAttributeBean.setCustomAttribDesc(language.getCustomAttribDesc());
                  }
                  break;
                }
              }
            }
           
            if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_CUST_INPUT) {
              orderItemAttributeBean.setCustomAttribValue(orderAttributeDetail.getOrderAttribValue());
            }
            else {
              CustomAttributeOption customAttributeOption = orderAttributeDetail.getCustomAttributeOption();
              orderItemAttributeBean.setCustomAttribValue(customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

    sql = "from CustomAttribute customAttribute where customAttribute.site.siteId = :siteId";
    query = em.createQuery(sql);
    query.setParameter("siteId", site.getSiteId());
    iterator = query.getResultList().iterator();
    while (iterator.hasNext()) {
      CustomAttribute customAttribute = (CustomAttribute) iterator.next();
        em.remove(customAttribute);
      CustomAttributeLanguage customAttributeLanguage = customAttribute.getCustomAttributeLanguage();
      customAttributeLanguage.setCustomAttribute(null);
       em.remove(customAttributeLanguage);
    }

    sql = "from SiteDomain siteDomain where siteDomain.site.siteId = :siteId";
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

      }
     
      Vector<OrderItemAttributeBean> orderItemAttributes = new Vector<OrderItemAttributeBean>();
      if (item != null && 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;
            }
            OrderItemAttributeBean orderItemAttributeBean = new OrderItemAttributeBean();
            orderItemAttributeBean.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
              CustomAttributeOption customAttributeOption = itemAttributeDetail.getCustomAttributeOption();
              orderItemAttributeBean.setCustomAttribValue(customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
              orderItemAttributes.add(orderItemAttributeBean);
          }
      }
        for (OrderAttributeDetail orderAttributeDetail : orderItemDetail.getOrderAttributeDetails()) {
          OrderItemAttributeBean orderItemAttributeBean = new OrderItemAttributeBean();
          CustomAttribute customAttribute = orderAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
          orderItemAttributeBean.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
           
            if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_CUST_INPUT) {
              orderItemAttributeBean.setCustomAttribValue(orderAttributeDetail.getOrderAttribValue());
            }
            else {
              CustomAttributeOption customAttributeOption = orderAttributeDetail.getCustomAttributeOption();
              orderItemAttributeBean.setCustomAttribValue(customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

    public Vector<OrderItemAttributeBean> getOrderItemAttributes(OrderItemDetail orderItemDetail) throws NumberFormatException, SecurityException, Exception {
    Vector<OrderItemAttributeBean> orderItemAttributes = new Vector<OrderItemAttributeBean>();
    Item item = orderItemDetail.getItem();
    if (item != null && 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;
        }
          OrderItemAttributeBean orderItemAttributeBean = new OrderItemAttributeBean();
          orderItemAttributeBean.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
            CustomAttributeOption customAttributeOption = itemAttributeDetail.getCustomAttributeOption();
            orderItemAttributeBean.setCustomAttribValue(customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
            orderItemAttributes.add(orderItemAttributeBean);
      }
    }
    for (OrderAttributeDetail orderAttributeDetail : orderItemDetail.getOrderAttributeDetails()) {
      OrderItemAttributeBean orderItemAttributeBean = new OrderItemAttributeBean();
      CustomAttribute customAttribute = orderAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
      orderItemAttributeBean.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
       
        if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_CUST_INPUT) {
          orderItemAttributeBean.setCustomAttribValue(orderAttributeDetail.getOrderAttribValue());
        }
        else {
            CustomAttributeOption customAttributeOption = orderAttributeDetail.getCustomAttributeOption();
            orderItemAttributeBean.setCustomAttribValue(customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

        String customAttribId = filter.substring(0, pos);
        String customAttribOptionId = filter.substring(pos + 1);
        ContentFilterBean bean = new ContentFilterBean();
        bean.setCustomAttribId(Long.valueOf(customAttribId));
        bean.setCustomAttribOptionId(Long.valueOf(customAttribOptionId));
        CustomAttribute  customAttribute = CustomAttributeDAO.load(siteDomain.getSite().getSiteId(), Long.valueOf(customAttribId));
        bean.setSystemRecord(customAttribute.getSystemRecord());
        vector.add(bean);
      }
    }
    ContentFilterBean contentFilterBeans[] = new ContentFilterBean[vector.size()];
    vector.copyInto(contentFilterBeans);
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.