Package com.jada.util

Examples of com.jada.util.JSONEscapeObject


        HttpServletResponse response) throws Exception {
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    ShippingRegionMaintActionForm form = (ShippingRegionMaintActionForm) actionForm;
    Long shippingRegionId = Format.getLong(form.getShippingRegionId());
    ShippingRegion shippingRegion = (ShippingRegion) em.find(ShippingRegion.class, shippingRegionId);
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
    String result = getJSONZipCodeList(shippingRegion);
    streamWebService(response, result);
    return null;
  }
View Full Code Here


        HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    ShippingRegionMaintActionForm form = (ShippingRegionMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
   
    Long shippingRegionId = Format.getLong(form.getShippingRegionId());
    ShippingRegion shippingRegion = (ShippingRegion) em.find(ShippingRegion.class, shippingRegionId);
     
    ShippingRegionZip shippingRegionZip = new ShippingRegionZip();
View Full Code Here

        ActionForm actionForm,
        HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    ShippingRegionMaintActionForm form = (ShippingRegionMaintActionForm) actionForm;
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
   
    Long shippingRegionId = Format.getLong(form.getShippingRegionId());
    String shippingRegionZipIds[] = form.getShippingRegionZipIds();
    ShippingRegion shippingRegion = (ShippingRegion) em.find(ShippingRegion.class, shippingRegionId);
    if (shippingRegionZipIds != null) {
View Full Code Here

               "where    site.siteId = :siteId " +
               "order    by customerClass.custClassName ";
        Query query = em.createQuery(sql);
        query.setParameter("siteId", adminBean.getSite().getSiteId());
        Iterator<?> iterator = query.getResultList().iterator();
      JSONEscapeObject jsonResult = new JSONEscapeObject();
      Vector<JSONEscapeObject> vector = new Vector<JSONEscapeObject>();
        while (iterator.hasNext()) {
          CustomerClass customerClass = (CustomerClass) iterator.next();
          JSONEscapeObject jsonItem = new JSONEscapeObject();
          jsonItem.put("custClassId", customerClass.getCustClassId());
          jsonItem.put("custClassName", customerClass.getCustClassName());
          vector.add(jsonItem);
        }
        jsonResult.put("customerClasses", vector);
        String jsonString = jsonResult.toHtmlString();
        this.streamWebService(response, jsonString);
View Full Code Here

               "where    site.siteId = :siteId " +
               "order    by productClass.productClassName ";
        Query query = em.createQuery(sql);
        query.setParameter("siteId", adminBean.getSite().getSiteId());
        Iterator<?> iterator = query.getResultList().iterator();
      JSONEscapeObject jsonResult = new JSONEscapeObject();
      Vector<JSONEscapeObject> vector = new Vector<JSONEscapeObject>();
        while (iterator.hasNext()) {
          ProductClass productClass = (ProductClass) iterator.next();
          JSONEscapeObject jsonItem = new JSONEscapeObject();
          jsonItem.put("productClassId", productClass.getProductClassId());
          jsonItem.put("productClassName", productClass.getProductClassName());
          vector.add(jsonItem);
        }
        jsonResult.put("productClasses", vector);
        String jsonString = jsonResult.toHtmlString();
        this.streamWebService(response, jsonString);
View Full Code Here

        FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
    return mapping.findForward("success");
  }
 
  private String getJSONCustomAttributeDetails(CustomAttributeGroup customAttributeGroup) throws Exception {
      JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
    jsonResult.put("customAttributeGroupId", customAttributeGroup.getCustomAttribGroupId());
    jsonResult.put("customAttributeGroupName", customAttributeGroup.getCustomAttribGroupName());
   
    Vector<JSONEscapeObject> vector = new Vector<JSONEscapeObject>();
    Iterator<?> iterator = customAttributeGroup.getCustomAttributeDetails().iterator();
    while (iterator.hasNext()) {
      CustomAttributeDetail customAttributeDetail = (CustomAttributeDetail) iterator.next();
      JSONEscapeObject detail = new JSONEscapeObject();
      detail.put("customAttribDetailId", customAttributeDetail.getCustomAttribDetailId());
      detail.put("seqNum", customAttributeDetail.getSeqNum().toString());
      detail.put("customAttribName", customAttributeDetail.getCustomAttribute().getCustomAttribName());
      vector.add(detail);
    }
    jsonResult.put("customAttributeDetails", vector);
    return jsonResult.toHtmlString();
  }
View Full Code Here

      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    CustomAttributeGroupMaintActionForm form = (CustomAttributeGroupMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
   
      JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);

    Long customAttribGroupId = Format.getLong(form.getCustomAttribGroupId());
    CustomAttributeGroup customAttributeGroup = CustomAttributeGroupDAO.load(site.getSiteId(), customAttribGroupId);
    String customAttribDetailIds[] = form.getCustomAttribDetailIds();
    if (customAttribDetailIds != null) {
      for (int i = 0; i < customAttribDetailIds.length; i++) {
        CustomAttributeDetail customAttributeDetail = (CustomAttributeDetail) em.find(CustomAttributeDetail.class, Format.getLong(customAttribDetailIds[i]));
        if (customAttributeDetail.getCustomAttribute().getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_SKU_MAKEUP) {
          String sql = "select  count(*) " +
                 "from    ItemAttributeDetail itemAttributeDetail " +
                 "where    itemAttributeDetail.customAttributeDetail = :customAttributeDetail " +
                 "and     itemAttributeDetail.item.itemTypeCd = :itemTypeCd";
          Query query = em.createQuery(sql);
          query.setParameter("customAttributeDetail", customAttributeDetail);
          query.setParameter("itemTypeCd", Constants.ITEM_TYPE_SKU);
          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;
          }
        }

        String sql = "delete " +
               "from   ItemAttributeDetail itemAttributeDetail " +
               "where  itemAttributeDetail.customAttributeDetail = :customAttributeDetail ";
        Query query = em.createQuery(sql);
        query.setParameter("customAttributeDetail", customAttributeDetail);
        query.executeUpdate();

        customAttributeGroup.getCustomAttributeDetails().remove(customAttributeDetail);
        em.remove(customAttributeDetail);
      }
    }
    streamWebService(response, jsonResult.toHtmlString());
    return null;
  }
View Full Code Here

    vector.copyInto(childrenCategories);
    form.setChildrenCategories(childrenCategories);
    }
   
  private String getJSONCustomAttributes(Category category) throws Exception {
      JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
   
    Vector<JSONEscapeObject> vector = new Vector<JSONEscapeObject>();
    for (CustomAttribute customAttribute: category.getCustomAttributes()) {
      JSONEscapeObject detail = new JSONEscapeObject();
      detail.put("customAttribId", customAttribute.getCustomAttribId());
      detail.put("customAttribDesc", customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
      vector.add(detail);
    }
    jsonResult.put("customAttributes", vector);
    return jsonResult.toHtmlString();
  }
View Full Code Here

        HttpServletResponse response) throws Throwable {
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    CustomAttributeGroupMaintActionForm form = (CustomAttributeGroupMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
   
    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;
      }
    }
   
    if (!found) {
      CustomAttributeDetail customAttributeDetail = new CustomAttributeDetail();
      customAttributeDetail.setCustomAttribute(customAttribute);
      customAttributeDetail.setSeqNum(seqNum);
      customAttributeDetail.setRecUpdateBy(adminBean.getUser().getUserId());
      customAttributeDetail.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      customAttributeDetail.setRecCreateBy(adminBean.getUser().getUserId());
      customAttributeDetail.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      customAttributeGroup.getCustomAttributeDetails().add(customAttributeDetail);
      em.persist(customAttributeDetail);
    }

    streamWebService(response, jsonResult.toHtmlString());
    return null;
  }
View Full Code Here

        HttpServletRequest request,
        HttpServletResponse response) throws Throwable {
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    CustomAttributeGroupMaintActionForm form = (CustomAttributeGroupMaintActionForm) actionForm;
   
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
   
    MessageResources resources = this.getResources(request);
    Vector<JSONEscapeObject> errors = new Vector<JSONEscapeObject>();
    String seqNums[] = form.getSeqNums();
    if (seqNums != null) {
      String customAttribDetailIds[] = form.getCustomAttribDetailIds();
      for (int i = 0; i < seqNums.length; i++) {
        if (!Format.isInt(seqNums[i])) {
          JSONEscapeObject object = new JSONEscapeObject();
          object.put("customAttribDetailId", customAttribDetailIds[i]);
          object.put("error", resources.getMessage("error.int.invalid"));
          errors.add(object);
        }
      }
      if (errors.size() > 0) {
        jsonResult.put("validations", errors);
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.