Examples of CustomAttribute


Examples of com.jada.jpa.entity.CustomAttribute

   
    CustomAttributeGroup customAttributeGroup = item.getCustomAttributeGroup();
    if (customAttributeGroup != null) {
      Vector<AttributeDetailOption[]> attributeVector = new Vector<AttributeDetailOption[]>();
      for (CustomAttributeDetail customAttributeDetail : customAttributeGroup.getCustomAttributeDetails()) {
        CustomAttribute customAttribute = customAttributeDetail.getCustomAttribute();
        if (customAttribute.getCustomAttributeOptions().size() == 0) {
          continue;
        }
        if (customAttribute.getCustomAttribTypeCode() != Constants.CUSTOM_ATTRIBUTE_TYPE_SKU_MAKEUP) {
          continue;
        }
        Vector<AttributeDetailOption> optionVector = new Vector<AttributeDetailOption>();
        for (CustomAttributeOption customAttributeOption : customAttribute.getCustomAttributeOptions()) {
          AttributeDetailOption attributeDetailOption = new AttributeDetailOption();
          attributeDetailOption.setCustomAttributeOption(customAttributeOption);
          attributeDetailOption.setCustomAttributeDetail(customAttributeDetail);
          optionVector.add(attributeDetailOption);
        }
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

        query.setParameter("siteProfileClassId", adminBean.getSite().getSiteProfileClassDefault().getSiteProfileClassId());
        Iterator<?> iterator = query.getResultList().iterator();
      JSONEscapeObject jsonResult = new JSONEscapeObject();
      Vector<JSONEscapeObject> vector = new Vector<JSONEscapeObject>();
        while (iterator.hasNext()) {
          CustomAttribute customAttribute = (CustomAttribute) iterator.next();
          if (type != null && type.equals(LOOKUP_TYPE_FOR_CUSTOMATTRIBUTEGROUP)) {
/*
            if (customAttribute.getSystemRecord() == Constants.VALUE_YES) {
              continue;
            }
*/
          }
          if (type != null && type.equals(LOOKUP_TYPE_FOR_CUSTOMATTRIBUTECOMPARE)) {
/*
            if (customAttribute.getSystemRecord() == Constants.VALUE_YES) {
              continue;
            }
*/
            if (customAttribute.getCustomAttribTypeCode() != Constants.CUSTOM_ATTRIBUTE_TYPE_USER_SELECT_DROPDOWN) {
              continue;
            }
          }
          JSONEscapeObject jsonItem = new JSONEscapeObject();
          jsonItem.put("customAttribId", customAttribute.getCustomAttribId());
          jsonItem.put("customAttribName", customAttribute.getCustomAttribName());
          vector.add(jsonItem);
        }
        jsonResult.put("customAttributes", vector);
        String jsonString = jsonResult.toHtmlString();
        this.streamWebService(response, jsonString);
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

    }
   
    Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
   
    CustomAttribute customAttribute = (CustomAttribute) em.find(CustomAttribute.class, Format.getLong(form.getCustomAttribId()));
   
      GoogleTranslate translator = new GoogleTranslate(form.getFromLocale(), form.getToLocale());
    form.setCustomAttribDescLangFlag(true);
    form.setCustomAttribDescLang(translator.translate(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc()));
   
    if (customAttribute.getCustomAttribDataTypeCode() == Constants.CUSTOM_ATTRIBUTE_DATA_TYPE_STRING) {
      form.setCustomAttribOptionLangFlag(true);
      CustomAttributeOptionDisplayForm optionForms[] = form.getCustomAttribOptions();
      for (int i = 0; i < optionForms.length; i++) {
        CustomAttributeOptionDisplayForm optionForm = optionForms[i];
        optionForm.setCustomAttribValueLang(translator.translate(optionForm.getCustomAttribValue()));
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

    CustomAttributeMaintActionForm form = (CustomAttributeMaintActionForm) actionForm;
   
    Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
   
    CustomAttribute customAttribute = (CustomAttribute) em.find(CustomAttribute.class, Format.getLong(form.getCustomAttribId()));
        copyProperties(form, customAttribute, request);
    FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
    ActionForward actionForward = actionMapping.findForward("success");
    return actionForward;
  }
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

      Site site = getAdminBean(request).getSite();
        CustomAttributeMaintActionForm form = (CustomAttributeMaintActionForm) actionForm;
    initSiteProfiles(form, site);
    String customAttribId = request.getParameter("customAttribId");
        CustomAttribute customAttribute = new CustomAttribute();
        customAttribute = CustomAttributeDAO.load(site.getSiteId(), Format.getLong(customAttribId));
        form.setMode("U");
        copyProperties(form, customAttribute, request);
        FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
        ActionForward actionForward = actionMapping.findForward("success");
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

    CustomAttributeMaintActionForm form = (CustomAttributeMaintActionForm) actionForm;
      Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    try {
      CustomAttribute customAttribute = CustomAttributeDAO.load(site.getSiteId(), Format.getLong(form.getCustomAttribId()));
          copyProperties(form, customAttribute, request);
      em.remove(customAttribute);
      for (CustomAttributeLanguage customAttributeLanguage : customAttribute.getCustomAttributeLanguages()) {
        em.remove(customAttributeLanguage);
      }
      em.getTransaction().commit();
    }
    catch (Exception e) {
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

    }

    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    initSiteProfiles(form, site);
    CustomAttribute customAttribute = new CustomAttribute();
    if (!insertMode) {
      customAttribute = CustomAttributeDAO.load(site.getSiteId(), Format.getLong(form.getCustomAttribId()));
    }

    ActionMessages errors = validate(form, request);
    if (errors.size() != 0) {
      saveMessages(request, errors);
      return mapping.findForward("error");
    }

    if (insertMode) {
      customAttribute.setRecCreateBy(adminBean.getUser().getUserId());
      customAttribute.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      form.setCustomAttribDataTypeCodeDesc(resources.getMessage("customAttrib.dataTypeCode." + form.getCustomAttribDataTypeCode()));
      form.setCustomAttribTypeCodeDesc(resources.getMessage("customAttrib.typeCode." + form.getCustomAttribTypeCode()));
     
      CustomAttributeLanguage customAttribLanguage = new CustomAttributeLanguage();
      customAttribute.setSystemRecord(Constants.VALUE_NO);
      customAttribLanguage.setRecCreateBy(adminBean.getUser().getUserId());
      customAttribLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        SiteProfileClass siteProfileClass = (SiteProfileClass) em.find(SiteProfileClass.class, form.getSiteProfileClassDefaultId());
        customAttribLanguage.setSiteProfileClass(siteProfileClass);
        customAttribLanguage.setCustomAttribute(customAttribute);
        customAttribute.setCustomAttributeLanguage(customAttribLanguage);
        customAttribute.getCustomAttributeLanguages().add(customAttribLanguage);
    }
    customAttribute.setSite(site);
    customAttribute.setCustomAttribName(form.getCustomAttribName());
    customAttribute.setRecUpdateBy(adminBean.getUser().getUserId());
    customAttribute.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
   
    if (form.isSiteProfileClassDefault() && form.isSiteCurrencyClassDefault()) {
      saveDefault(customAttribute, form, adminBean);
    }
    else {
      if (!form.isSiteProfileClassDefault()) {
        saveLanguage(customAttribute, form, adminBean);
      }
      if (!form.isSiteCurrencyClassDefault()) {
        saveCurrency(customAttribute, form, adminBean);
      }
    }
   
    if (insertMode) {
      em.persist(customAttribute);
    }
    else {
      // em.update(customAttribute);
    }
        form.setMode("U");
        form.setCustomAttribId(customAttribute.getCustomAttribId().toString());
        FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
    return mapping.findForward("success");
  }
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    initSiteProfiles(form, site);
 
    Long customAttribId = Format.getLong(form.getCustomAttribId());
    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())
      }
View Full Code Here

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 = (CustomAttribute) em.find(CustomAttribute.class, customAttribId);
    Long customAttribGroupId = Format.getLong(form.getCustomAttribGroupId());
    CustomAttributeGroup customAttributeGroup = (CustomAttributeGroup) em.find(CustomAttributeGroup.class, customAttribGroupId);
    int seqNum = 0;
    Iterator<?> iterator = customAttributeGroup.getCustomAttributeDetails().iterator();
    boolean found = false;
    while (iterator.hasNext()) {
      CustomAttributeDetail customAttributeDetail = (CustomAttributeDetail) iterator.next();
      if (customAttributeDetail.getCustomAttribute().getCustomAttribId().equals(customAttribute.getCustomAttribId())) {
        found = true;
      }
      if (customAttributeDetail.getSeqNum().intValue() >= seqNum) {
        seqNum = customAttributeDetail.getSeqNum() + 1;
      }
View Full Code Here

Examples of com.jada.jpa.entity.CustomAttribute

    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
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.