Examples of JSONEscapeObject


Examples of com.jada.util.JSONEscapeObject

    throws Throwable {
   
        String stateId = (String) request.getParameter("stateId");
         
        State state = StateDAO.load(getAdminBean(request).getSite().getSiteId(), Format.getLong(stateId));
      JSONEscapeObject jsonResult = new JSONEscapeObject();
      jsonResult.put("stateId", state.getStateId());
      jsonResult.put("stateCode", state.getStateCode());
      jsonResult.put("stateName", state.getStateName());
        String jsonString = jsonResult.toHtmlString();
    streamWebService(response, jsonString);
        return null;
  }
View Full Code Here

Examples of com.jada.util.JSONEscapeObject

    String stateId = (String) request.getParameter("stateId");
    String countryId = (String) request.getParameter("countryId");
        String stateCode = (String) request.getParameter("stateCode");
        String stateName = (String) request.getParameter("stateName");
      MessageResources resources = this.getResources(request);
      JSONEscapeObject jsonResult = new JSONEscapeObject();
     
      Vector<JSONEscapeObject> vector = new Vector<JSONEscapeObject>();

      boolean error = false;
      if (Format.isNullOrEmpty(stateCode)) {
        JSONEscapeObject object = new JSONEscapeObject();
           object.put("message", resources.getMessage("error.stateCode.required"))
           vector.add(object);
           error = true;
      }
      if (Format.isNullOrEmpty(stateName)) {
        JSONEscapeObject object = new JSONEscapeObject();
           object.put("message", resources.getMessage("error.stateName.required"))
           vector.add(object);
           error = true;
      }
    if (!Format.isNullOrEmpty(stateId)) {
          String sql = "from  State state " +
                 "left  outer join state.country country " +
                 "where  country.site.siteId = :siteId " +
                 "and   state.stateCode = :stateCode " +
                 "and  state.stateId != :stateId ";
          Query query = em.createQuery(sql);
          query.setParameter("siteId", site.getSiteId());
          query.setParameter("stateCode", stateCode);
          query.setParameter("stateId", Format.getLong(stateId));
          Iterator<?> iterator = query.getResultList().iterator();
          if (iterator.hasNext()) {
            error = true;
          JSONEscapeObject object = new JSONEscapeObject();
             object.put("message", resources.getMessage("error.stateCode.duplicate"))
             vector.add(object);
          }
    }
    jsonResult.put("messages", vector);
    if (!error) {
View Full Code Here

Examples of com.jada.util.JSONEscapeObject

    ItemMaintActionForm form = (ItemMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    initSiteProfiles(form, site);
 
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
       EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Item item = ItemDAO.load(site.getSiteId(), Format.getLong(form.getItemId()));
       String itemCrossSellIds[] = form.getItemCrossSellIds();
       if (itemCrossSellIds != null) {
         for (int i = 0; i < itemCrossSellIds.length; i++) {
        Item itemCrossSell = ItemDAO.load(site.getSiteId(), Format.getLong(itemCrossSellIds[i]));
        item.getItemsCrossSell().remove(itemCrossSell);
         }
      item.setRecUpdateBy(adminBean.getUser().getUserId());
      item.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      em.persist(item);
       }

    jsonResult.put("recUpdateBy", item.getRecUpdateBy());
    jsonResult.put("recUpdateDatetime", Format.getFullDatetime(item.getRecUpdateDatetime()));
    streamWebService(response, jsonResult.toHtmlString());

    return null;
  }
View Full Code Here

Examples of com.jada.util.JSONEscapeObject

  }
 
    /*******************************************************************************/
 
  public JSONEscapeObject createJsonItemSkus(Item item) throws Exception {
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    Vector<JSONEscapeObject> items = new Vector<JSONEscapeObject>();
    for (Item itemChild : item.getItemSkus()) {
      JSONEscapeObject itemObject = new JSONEscapeObject();
      itemObject.put("itemId", itemChild.getItemId());
      itemObject.put("itemSkuCd", itemChild.getItemSkuCd());
      items.add(itemObject);
    }
    jsonResult.put("items", items);
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);

View Full Code Here

Examples of com.jada.util.JSONEscapeObject

    ItemMaintActionForm form = (ItemMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    initSiteProfiles(form, site);
   
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    Item item = ItemDAO.load(site.getSiteId(), Format.getLong(form.getItemId()));
      String sql = "from  Item " +
           "where siteId = :siteId " +
           "and   itemNum = :itemNum " +
           "and   itemId != :itemId";

      Query query = em.createQuery(sql);
      query.setParameter("siteId", site.getSiteId());
      query.setParameter("itemNum",  form.getItemNum());
      query.setParameter("itemId", Format.getLong(form.getItemId()));
    Iterator<?> iterator = query.getResultList().iterator();
    if (iterator.hasNext()) {
      jsonResult.put("status", Constants.WEBSERVICE_STATUS_FAILED);
      jsonResult.put("message", resources.getMessage("error.item.itemNum.duplicate"));
      streamWebService(response, jsonResult.toHtmlString());
      return null;
    }
   
    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);
        }
        AttributeDetailOption options[] = new AttributeDetailOption[optionVector.size()];
        optionVector.copyInto(options);
        attributeVector.add(options);
      }
      AttributeDetailOption[] attributes[] = new AttributeDetailOption[attributeVector.size()][];
      attributeVector.copyInto(attributes);

      if (attributes.length > 0) {
        Vector<Item> items = new Vector<Item>();
        generateSkus(items, attributes, item.getItemNum(), 0, new Vector<Object>());
       
        iterator = items.iterator();
        while (iterator.hasNext()) {
          Item itemSku = (Item) iterator.next();
          cloneSku(itemSku, item, adminBean);
        }
      }
    }

    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
    jsonResult.put("recUpdateBy", item.getRecUpdateBy());
    jsonResult.put("recUpdateDatetime", Format.getFullDatetime(item.getRecUpdateDatetime()));
   
    form.setStream(true);
    form.setStreamData(jsonResult.toHtmlString());
    return null;
  }
View Full Code Here

Examples of com.jada.util.JSONEscapeObject

     
      return errors;
    }
   
    public String getInputSkuAttributeKey(ItemMaintActionForm form) throws JSONException {
      JSONEscapeObject JSONEscapeObject = new JSONEscapeObject();
      Vector<JSONEscapeObject> vector = new Vector<JSONEscapeObject>();
     
      ItemAttributeDetailDisplayForm displayForms[] = form.getItemAttributeDetails();
      /* Ensure it is ordered by itemAttributeDetailId */
      Vector<Long> idList = new Vector<Long>();
      for (ItemAttributeDetailDisplayForm displayForm : displayForms) {
        if (!displayForm.getCustomAttribTypeCode().equals(String.valueOf(Constants.CUSTOM_ATTRIBUTE_TYPE_SKU_MAKEUP))) {
          continue;
        }
        idList.add(Format.getLong(displayForm.getItemAttribDetailId()));
      }
      Long ids[] = new Long[idList.size()];
      idList.copyInto(ids);

      Arrays.sort(ids);
     
      for (long id : ids) {
        for (ItemAttributeDetailDisplayForm displayForm : displayForms) {
          long itemAttribDetailId = Format.getLong(displayForm.getItemAttribDetailId());
          if (id == itemAttribDetailId) {
              JSONEscapeObject attribute = new JSONEscapeObject();
              attribute.put("customAttribDetailId", displayForm.getCustomAttribDetailId());
              attribute.put("customAttribOptionId", displayForm.getCustomAttribOptionId());
              vector.add(attribute);
            break;
          }
        }
      }
View Full Code Here

Examples of com.jada.util.JSONEscapeObject

    Site site = adminBean.getSite();
    ItemMaintActionForm form = (ItemMaintActionForm) actionForm;
    initSiteProfiles(form, adminBean.getSite());
    Item item = new Item();
    item = ItemDAO.load(site.getSiteId(), Format.getLong(form.getItemId()));
    JSONEscapeObject jsonResult = createJsonSelectedCategories(site.getSiteId(), item);
    String jsonString = jsonResult.toHtmlString();
    streamWebService(response, jsonString);
        return null;
  }
View Full Code Here

Examples of com.jada.util.JSONEscapeObject

    }

    item.setRecUpdateBy(adminBean.getUser().getUserId());
    item.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
   
      JSONEscapeObject jsonResult = createJsonSelectedCategories(site.getSiteId(), item);
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
    jsonResult.put("recUpdateBy", item.getRecUpdateBy());
    jsonResult.put("recUpdateDatetime", Format.getFullDatetime(item.getRecUpdateDatetime()));
    String jsonString = jsonResult.toHtmlString();
    streamWebService(response, jsonString);
    em.getTransaction().commit();
    return null;
  }
View Full Code Here

Examples of com.jada.util.JSONEscapeObject

        item.setRecUpdateBy(adminBean.getUser().getUserId());
        item.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      }
    }
   
    JSONEscapeObject jsonResult = createJsonSelectedCategories(site.getSiteId(), item);
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
    jsonResult.put("recUpdateBy", item.getRecUpdateBy());
    jsonResult.put("recUpdateDatetime", Format.getFullDatetime(item.getRecUpdateDatetime()));
    String jsonString = jsonResult.toHtmlString();
    streamWebService(response, jsonString);
    em.getTransaction().commit();
      return null;
  }
View Full Code Here

Examples of com.jada.util.JSONEscapeObject

    em.getTransaction().commit();
      return null;
  }
 
  public JSONEscapeObject createJsonSelectedCategories(String siteId, Item item) throws Exception {
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    Vector<JSONEscapeObject> categories = new Vector<JSONEscapeObject>();
    for (Category category : item.getCategories()) {
      JSONEscapeObject categoryObject = new JSONEscapeObject();
      categoryObject.put("catId", category.getCatId());
      categoryObject.put("catTitle", category.getCategoryLanguage().getCatTitle());
      categoryObject.put("catShortTitle", category.getCategoryLanguage().getCatShortTitle());
      categories.add(categoryObject);
    }
    jsonResult.put("categories", categories);
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
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.