Package com.jada.util

Examples of com.jada.util.JSONEscapeObject


    }
   
    /*******************************************************************************/
   
  public JSONEscapeObject createJsonItemsBundle(Item item, ItemMaintActionForm form) throws Exception {
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    Vector<JSONEscapeObject> items = new Vector<JSONEscapeObject>();
    for (Item child : item.getChildren()) {
      ItemLanguage itemLanguage = null;
      for (ItemLanguage language : child.getItemLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassDefaultId())) {
          itemLanguage = language;
          break;
        }
      }
      JSONEscapeObject itemObject = new JSONEscapeObject();
      itemObject.put("itemId", child.getItemId());
      itemObject.put("itemNum", child.getItemNum());
      itemObject.put("itemSkuCd", child.getItemSkuCd());
      itemObject.put("itemUpcCd", child.getItemUpcCd());
      itemObject.put("itemShortDesc", itemLanguage.getItemShortDesc());
      items.add(itemObject);
    }
    jsonResult.put("items", items);
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);

View Full Code Here


    initSiteProfiles(form, site);
   
    Item item = ItemDAO.load(site.getSiteId(), Format.getLong(form.getItemId()));
    Item itemChild = ItemDAO.load(site.getSiteId(), Format.getLong(form.getItemChildId()));
   
      JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
       EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Iterator<?> iterator = item.getChildren().iterator();
    while (iterator.hasNext()) {
      Item i = (Item) iterator.next();
      if (i.getItemId().equals(itemChild.getItemId())) {
        MessageResources resources = this.getResources(request);
        jsonResult.put("status", Constants.WEBSERVICE_STATUS_FAILED);
        jsonResult.put("message", resources.getMessage("error.item.exist"));
        streamWebService(response, jsonResult.toHtmlString());
        return null;
      }
    }
    item.getChildren().add(itemChild);
    item.setRecUpdateBy(adminBean.getUser().getUserId());
    item.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    em.persist(item);
    CategorySearchUtil.itemPriceSearchUpdate(item, site, adminBean);

    jsonResult.put("recUpdateBy", item.getRecUpdateBy());
    jsonResult.put("recUpdateDatetime", Format.getFullDatetime(item.getRecUpdateDatetime()));
    streamWebService(response, jsonResult.toHtmlString());
    return null;
 
View Full Code Here

    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 itemChildIds[] = form.getItemChildIds();
       if (itemChildIds != null) {
         for (int i = 0; i < itemChildIds.length; i++) {
        Item itemChild = ItemDAO.load(site.getSiteId(), Format.getLong(itemChildIds[i]));
        item.getChildren().remove(itemChild);
         }
      item.setRecUpdateBy(adminBean.getUser().getUserId());
      item.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      em.persist(item);
      CategorySearchUtil.itemPriceSearchUpdate(item, site, adminBean);
       }

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

    return null;
  }
View Full Code Here

  }

  /*******************************************************************************/
   
  public JSONEscapeObject createJsonItemsRelated(Item item, ItemMaintActionForm form) throws Exception {
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    Iterator<?> iterator = item.getItemsRelated().iterator();
    Vector<JSONEscapeObject> items = new Vector<JSONEscapeObject>();
    while (iterator.hasNext()) {
      Item itemRelated = (Item) iterator.next();
      ItemLanguage itemLanguage = null;
      for (ItemLanguage language : itemRelated.getItemLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassDefaultId())) {
          itemLanguage = language;
          break;
        }
      }     
      JSONEscapeObject itemObject = new JSONEscapeObject();
      itemObject.put("itemId", itemRelated.getItemId());
      itemObject.put("itemNum", itemRelated.getItemNum());
      itemObject.put("itemUpcCd", itemRelated.getItemUpcCd());
      itemObject.put("itemShortDesc", itemLanguage.getItemShortDesc());
      items.add(itemObject);
    }
    jsonResult.put("items", items);
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);

View Full Code Here

    initSiteProfiles(form, site);
   
    Item item = ItemDAO.load(site.getSiteId(), Format.getLong(form.getItemId()));
    Item itemRelated = ItemDAO.load(site.getSiteId(), Format.getLong(form.getItemRelatedId()));
   
      JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
       EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Iterator<?> iterator = item.getItemsRelated().iterator();
    while (iterator.hasNext()) {
      Item i = (Item) iterator.next();
      if (i.getItemId().equals(itemRelated.getItemId())) {
        MessageResources resources = this.getResources(request);
        jsonResult.put("status", Constants.WEBSERVICE_STATUS_FAILED);
        jsonResult.put("message", resources.getMessage("error.item.exist"));
        streamWebService(response, jsonResult.toHtmlString());
        return null;
      }
    }
    item.getItemsRelated().add(itemRelated);
    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

    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 itemRelatedIds[] = form.getItemRelatedIds();
       if (itemRelatedIds != null) {
         for (int i = 0; i < itemRelatedIds.length; i++) {
        Item itemRelated = ItemDAO.load(site.getSiteId(), Format.getLong(itemRelatedIds[i]));
        item.getItemsRelated().remove(itemRelated);
         }
      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

  }

    /*******************************************************************************/
 
  public JSONEscapeObject createJsonItemsUpSell(Item item, ItemMaintActionForm form) throws Exception {
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    Iterator<?> iterator = item.getItemsUpSell().iterator();
    Vector<JSONEscapeObject> items = new Vector<JSONEscapeObject>();
    while (iterator.hasNext()) {
      Item itemRelated = (Item) iterator.next();
      ItemLanguage itemLanguage = null;
      for (ItemLanguage language : itemRelated.getItemLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassDefaultId())) {
          itemLanguage = language;
          break;
        }
      }     
      JSONEscapeObject itemObject = new JSONEscapeObject();
      itemObject.put("itemId", itemRelated.getItemId());
      itemObject.put("itemNum", itemRelated.getItemNum());
      itemObject.put("itemUpcCd", itemRelated.getItemUpcCd());
      itemObject.put("itemShortDesc", itemLanguage.getItemShortDesc());
      items.add(itemObject);
    }
    jsonResult.put("items", items);
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);

View Full Code Here

    initSiteProfiles(form, site);
   
    Item item = ItemDAO.load(site.getSiteId(), Format.getLong(form.getItemId()));
    Item itemUpSell = ItemDAO.load(site.getSiteId(), Format.getLong(form.getItemUpSellId()));
   
      JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
       EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Iterator<?> iterator = item.getItemsUpSell().iterator();
    while (iterator.hasNext()) {
      Item i = (Item) iterator.next();
      if (i.getItemId().equals(itemUpSell.getItemId())) {
        MessageResources resources = this.getResources(request);
        jsonResult.put("status", Constants.WEBSERVICE_STATUS_FAILED);
        jsonResult.put("message", resources.getMessage("error.item.exist"));
        streamWebService(response, jsonResult.toHtmlString());
        return null;
      }
    }
    item.getItemsUpSell().add(itemUpSell);
    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

    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 itemUpSellIds[] = form.getItemUpSellIds();
       if (itemUpSellIds != null) {
         for (int i = 0; i < itemUpSellIds.length; i++) {
        Item itemUpSell = ItemDAO.load(site.getSiteId(), Format.getLong(itemUpSellIds[i]));
        item.getItemsUpSell().remove(itemUpSell);
         }
      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

  }
 
    /*******************************************************************************/
 
  public JSONEscapeObject createJsonItemsCrossSell(Item item, ItemMaintActionForm form) throws Exception {
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    Iterator<?> iterator = item.getItemsCrossSell().iterator();
    Vector<JSONEscapeObject> items = new Vector<JSONEscapeObject>();
    while (iterator.hasNext()) {
      Item itemRelated = (Item) iterator.next();
      ItemLanguage itemLanguage = null;
      for (ItemLanguage language : itemRelated.getItemLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassDefaultId())) {
          itemLanguage = language;
          break;
        }
      }
      JSONEscapeObject itemObject = new JSONEscapeObject();
      itemObject.put("itemId", itemRelated.getItemId());
      itemObject.put("itemNum", itemRelated.getItemNum());
      itemObject.put("itemUpcCd", itemRelated.getItemUpcCd());
      itemObject.put("itemShortDesc", itemLanguage.getItemShortDesc());
      items.add(itemObject);
    }
    jsonResult.put("items", items);
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);

View Full Code Here

TOP

Related Classes of com.jada.util.JSONEscapeObject

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.