Examples of JSONEscapeObject


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