Package com.jada.util

Examples of com.jada.util.JSONEscapeObject


    throws Throwable {
   
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    CustomAttributeMaintActionForm form = (CustomAttributeMaintActionForm) actionForm;
   
    String customAttribOptionIds[] = form.getCustomAttribOptionIds();
    if (customAttribOptionIds != null) {
      for (int i = 0; i < customAttribOptionIds.length; i++) {
        CustomAttributeOption customAttribOption = CustomAttributeOptionDAO.load(site.getSiteId(), Format.getLong(customAttribOptionIds[i]));
        String sql = "select count(*) " +
               "from   ItemAttributeDetail itemAttributeDetail " +
               "where  itemAttributeDetail.customAttributeOption = :customAttributeOption ";
        Query query = em.createQuery(sql);
        query.setParameter("customAttributeOption", customAttribOption);
        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;
        }
       
        for (CustomAttributeOptionLanguage customAttributeOptionLanguage : customAttribOption.getCustomAttributeOptionLanguages()) {
          em.remove(customAttributeOptionLanguage);
        }
        for (CustomAttributeOptionCurrency customAttributeOptionCurrency : customAttribOption.getCustomAttributeOptionCurrencies()) {
          em.remove(customAttributeOptionCurrency);
        }
        em.remove(customAttribOption);
      }
    }
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
    streamWebService(response, jsonResult.toHtmlString());
    return null;
  }
View Full Code Here


    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())
      }
      optionObject.put("customAttribSkuCode", option.getCustomAttribSkuCode());
      customAttributeOptions.add(optionObject);
    }
    jsonResult.put("customAttributeOptions", customAttributeOptions);
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
View Full Code Here

               "where    site.siteId = :siteId " +
               "order    by tax.taxLanguage.taxName ";
        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()) {
          Tax tax = (Tax) iterator.next();
          JSONEscapeObject jsonItem = new JSONEscapeObject();
          jsonItem.put("taxId", tax.getTaxId());
          jsonItem.put("taxName", tax.getTaxLanguage().getTaxName());
          jsonItem.put("taxRate", Format.getFloat(tax.getTaxRate()));
          vector.add(jsonItem);
        }
        jsonResult.put("taxes", vector);
        String jsonString = jsonResult.toHtmlString();
        response.setContentType("text/html");
View Full Code Here

            ActionForm actionForm,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
     
        String siteDomainId = request.getParameter("siteDomainId");
        JSONEscapeObject jsonCategory = Utility.makeJSONMenuTree(Format.getLong(siteDomainId), null, true);
        String jsonString = jsonCategory.toHtmlString();
        this.streamWebService(response, jsonString);
        return null;
    }
View Full Code Here

        query.setParameter("siteId", adminBean.getSite().getSiteId());
        if (contentTitle != null && contentTitle.length() > 0) {
          query.setParameter("contentTitle", "%" + contentTitle + "%");
        }
        Iterator<?> iterator = query.getResultList().iterator();
      JSONEscapeObject jsonResult = new JSONEscapeObject();
      jsonResult.put("contentTitle", contentTitle);
      int counter = 0;
      Vector<JSONEscapeObject> vector = new Vector<JSONEscapeObject>();
        while (iterator.hasNext()) {
          Content content = (Content) iterator.next();
      ContentLanguage contentLanguage = null;
      for (ContentLanguage language : content.getContentLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassDefaultId)) {
          contentLanguage = language;
        }
      }
          JSONEscapeObject jsonContent = new JSONEscapeObject();
          jsonContent.put("contentId", content.getContentId());
          jsonContent.put("contentTitle", contentLanguage.getContentTitle());
          vector.add(jsonContent);
          counter++;
          if (counter == Constants.ADMIN_SEARCH_MAXCOUNT) {
              MessageResources resources = this.getResources(request);
            jsonResult.put("message", resources.getMessage("error.lookup.tooManyRecord"));
View Full Code Here

    return mapping.findForward("success");
  }
 
  private String getJSONCountriesAndStatesList(ShippingRegion shippingRegion) throws Exception  {
      String result = null;
      JSONEscapeObject jsonResult = new JSONEscapeObject();
      jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
      Iterator<Country> iterator = shippingRegion.getCountries().iterator();
      Vector<JSONEscapeObject> countries = new Vector<JSONEscapeObject>();
      while (iterator.hasNext()) {
        Country country = (Country) iterator.next();
        JSONEscapeObject object = new JSONEscapeObject();
        object.put("countryId", country.getCountryId());
        object.put("countryCode", country.getCountryCode());
        object.put("countryName", country.getCountryName());
        countries.add(object);
      }
      jsonResult.put("countries", countries);
      Iterator<State> iterator1 = shippingRegion.getStates().iterator();
      Vector<JSONEscapeObject> states = new Vector<JSONEscapeObject>();
      while (iterator1.hasNext()) {
        State state = (State) iterator1.next();
        JSONEscapeObject object = new JSONEscapeObject();
        object.put("stateId", state.getStateId());
        object.put("stateCode", state.getStateCode());
        object.put("stateName", state.getStateName());
        states.add(object);
      }
      jsonResult.put("states", states);
      result = jsonResult.toHtmlString();
      return result;
View Full Code Here

      return result;
  }
 
  private String getJSONZipCodeList(ShippingRegion shippingRegion) throws Exception {
      String result = null;
      JSONEscapeObject jsonResult = new JSONEscapeObject();
      jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
      Iterator<ShippingRegionZip> iterator = shippingRegion.getZipCodes().iterator();
      Vector<JSONEscapeObject> zipCodes = new Vector<JSONEscapeObject>();
      while (iterator.hasNext()) {
        ShippingRegionZip shippingRegionZip = (ShippingRegionZip) iterator.next();
        JSONEscapeObject object = new JSONEscapeObject();
        object.put("shippingRegionZipId", shippingRegionZip.getShippingRegionZipId());
        object.put("zipCodeExpression", String.valueOf(shippingRegionZip.getZipCodeExpression()));
        object.put("zipCodeStart", shippingRegionZip.getZipCodeStart());
        object.put("zipCodeEnd", shippingRegionZip.getZipCodeEnd());
        zipCodes.add(object);
      }
      jsonResult.put("zipCodes", zipCodes);
      result = jsonResult.toHtmlString();
      return result;
View Full Code Here

        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 = getJSONCountriesAndStatesList(shippingRegion);
    this.streamWebService(response, result);
    return null;
  }
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());
    ShippingRegion shippingRegion = (ShippingRegion) em.find(ShippingRegion.class, shippingRegionId);

      String countryIds[] = form.getCountryIds();
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());
      ShippingRegion shippingRegion = (ShippingRegion) em.find(ShippingRegion.class, shippingRegionId);
     
      boolean modified = false;
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.