Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.TaxRegionProduct


    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
        TaxRegionMaintActionForm form = (TaxRegionMaintActionForm) actionForm;
      JSONEscapeObject jsonResult = new JSONEscapeObject();
      jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
        Long taxRegionProductId = Format.getLong(form.getTaxRegionProductId());
        TaxRegionProduct product = (TaxRegionProduct) em.find(TaxRegionProduct.class, taxRegionProductId);
/*
        Iterator<?> customers = product.getCustomerClasses().iterator();
        while (customers.hasNext()) {
          TaxRegionProductCust customer = (TaxRegionProductCust) customers.next();
          Iterator<?> taxes = customer.getTaxes().iterator();
View Full Code Here


        TaxRegion taxRegion = (TaxRegion) em.find(TaxRegion.class, taxRegionId);
        ProductClass productClass = (ProductClass) em.find(ProductClass.class, productClassId);
       
        Iterator<?> iterator = taxRegion.getProductClasses().iterator();
        while (iterator.hasNext()) {
          TaxRegionProduct p = (TaxRegionProduct) iterator.next();
          if (p.getProductClass().getProductClassId().equals(productClass.getProductClassId())) {
              jsonResult.put("status", Constants.WEBSERVICE_STATUS_FAILED);
              jsonResult.put("message", "Product class already exist");
              streamWebService(response, jsonResult.toHtmlString());
            return null;
          }
        }
       
        TaxRegionProduct trProduct = new TaxRegionProduct();
        trProduct.setTaxRegion(taxRegion);
        trProduct.setProductClass(productClass);
        trProduct.setRecUpdateBy(adminBean.getUser().getUserId());
    trProduct.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    trProduct.setRecCreateBy(adminBean.getUser().getUserId());
    trProduct.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    taxRegion.getProductClasses().add(trProduct);
   
    em.persist(trProduct);
   
    String result = getJSONProduct(request, trProduct);
View Full Code Here

        HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    TaxRegionMaintActionForm form = (TaxRegionMaintActionForm) actionForm;
        Long taxRegionProductId = Format.getLong(form.getTaxRegionProductId());
        TaxRegionProduct taxRegionProduct = (TaxRegionProduct) em.find(TaxRegionProduct.class, taxRegionProductId);
    String result = getJSONProduct(request, taxRegionProduct);
    streamWebService(response, result);
    return null;
  }
View Full Code Here

        AdminBean adminBean = getAdminBean(request);
      JSONEscapeObject jsonResult = new JSONEscapeObject();
      jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
        Long trProductId = Format.getLong(form.getTaxRegionProductId());
        Long custClassId = Format.getLong(form.getCustClassId());
        TaxRegionProduct taxRegionProduct = (TaxRegionProduct) em.find(TaxRegionProduct.class, trProductId);
        CustomerClass customerClass = (CustomerClass) em.find(CustomerClass.class, custClassId);
       
        Iterator<?> iterator = taxRegionProduct.getCustomerClasses().iterator();
        while (iterator.hasNext()) {
          TaxRegionProductCust c = (TaxRegionProductCust) iterator.next();
          if (c.getCustomerClass().getCustClassId().equals(customerClass.getCustClassId())) {
              jsonResult.put("status", Constants.WEBSERVICE_STATUS_FAILED);
              jsonResult.put("message", "Customer class already exist");
              streamWebService(response, jsonResult.toHtmlString());
            return null;
          }
        }
       
        TaxRegionProductCust trProductCust = new TaxRegionProductCust();
        trProductCust.setTaxRegionProduct(taxRegionProduct);
        trProductCust.setCustomerClass(customerClass);
        trProductCust.setRecUpdateBy(adminBean.getUser().getUserId());
        trProductCust.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
        trProductCust.setRecCreateBy(adminBean.getUser().getUserId());
        trProductCust.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        taxRegionProduct.getCustomerClasses().add(trProductCust);
   
    em.persist(trProductCust);
   
    String result = getJSONProduct(request, taxRegionProduct);
    streamWebService(response, result);
View Full Code Here

        query = em.createQuery(sql);
        query.setParameter("taxRegionId", taxRegion.getTaxRegionId());
      iterator = query.getResultList().iterator();
      Vector<JSONEscapeObject> jsonVector = new Vector<JSONEscapeObject>();
      while (iterator.hasNext()) {
        TaxRegionProduct trProduct = (TaxRegionProduct) iterator.next();
        JSONEscapeObject object = new JSONEscapeObject();
        object.put("taxRegionProductId", trProduct.getTaxRegionProductId());
        object.put("productClassId", trProduct.getProductClass().getProductClassId());
        object.put("productClassName", trProduct.getProductClass().getProductClassName());
        jsonVector.add(object);
      }
      jsonProductClasses.put("taxRegionProductClasses", jsonVector);
      // This string is to be converted into javascript variable via jstl
      form.setJsonProductClasses(URLEncoder.encode(jsonProductClasses.toHtmlString(), "UTF-8"));
View Full Code Here

    Vector<ItemTax> vector = new Vector<ItemTax>();
    for (TaxRegion taxRegion : trList) {
      boolean found = false;
      Iterator<?> iterator = null;
      iterator = taxRegion.getProductClasses().iterator();
      TaxRegionProduct txProduct = null;
      while (iterator.hasNext()) {
        txProduct = (TaxRegionProduct) iterator.next();
        if (txProduct.getProductClass().getProductClassId().equals(productClassId)) {
          found = true;
          break;
        }
      }
      if (!found) {
         continue;
      }
     
      found = false;
      iterator = txProduct.getCustomerClasses().iterator();
      TaxRegionProductCust txProductCust = null;
      while (iterator.hasNext()) {
        txProductCust = (TaxRegionProductCust) iterator.next();
        if (txProductCust.getCustomerClass().getCustClassId().equals(customerClass.getCustClassId())) {
          found = true;
View Full Code Here

TOP

Related Classes of com.jada.jpa.entity.TaxRegionProduct

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.