Examples of SgwtRestErrorResponse


Examples of com.swinarta.sunflower.server.model.SgwtRestErrorResponse

    Supplier savedSupp;
   
    try {
        savedSupp = coreManager.save(Supplier.class, s);
    }catch (DataIntegrityViolationException dive){
      SgwtRestErrorResponse resp = new SgwtRestErrorResponse(-4);
     
      String contraintMsg = dive.getCause().getCause().getMessage();
      if(StringUtils.indexOf(contraintMsg, "key 2") > 0){
        resp.addError("supplierCode", "Supplier Code Found");
      }       
      return resp;       

    }catch (Exception e) {
      e.printStackTrace();
      SgwtRestErrorResponse resp = new SgwtRestErrorResponse(-1);
      resp.addError("exeption", e.getMessage());
      return resp;
    }
   
    SgwtRestFetchResponseBase ret = new SgwtRestFetchResponseBase(savedSupp);
   
View Full Code Here

Examples of com.swinarta.sunflower.server.model.SgwtRestErrorResponse

        dispDet.getProduct().setProductMeasurement(mapper.map(productMeasurement, DisplayProductMeasurement.class));
      }
     
      resp = dispDet;
    } catch (Exception e) {
      SgwtRestErrorResponse resp1 = new SgwtRestErrorResponse(-1);
      resp1.addError("exception", e.getMessage());
      return resp1;       
    }
       
    SgwtRestFetchResponseBase ret = new SgwtRestFetchResponseBase(resp);   
    return ret;
View Full Code Here

Examples of com.swinarta.sunflower.server.model.SgwtRestErrorResponse

        transferResp = coreManager.save(TransferOrder.class, to);
      }
      DisplayTransferOrder dto = mapper.map(transferResp, DisplayTransferOrder.class);
      resp = dto;
    } catch (Exception e) {
      SgwtRestErrorResponse resp1 = new SgwtRestErrorResponse(-1);
      resp1.addError("exception", e.getMessage());
      return resp1;       
    }
   
    SgwtRestFetchResponseBase ret = new SgwtRestFetchResponseBase(resp);
    return ret;
View Full Code Here

Examples of com.swinarta.sunflower.server.model.SgwtRestErrorResponse

     
      DisplaySearchReturnToSupplier dret = mapper.map(retResp, DisplaySearchReturnToSupplier.class);
      resp = dret;
     
    } catch (Exception e) {
      SgwtRestErrorResponse resp1 = new SgwtRestErrorResponse(-1);
      resp1.addError("exception", e.getMessage());
      return resp1;       
    }
   
    SgwtRestFetchResponseBase ret = new SgwtRestFetchResponseBase(resp);
    return ret;
View Full Code Here

Examples of com.swinarta.sunflower.server.model.SgwtRestErrorResponse

      }
     
      try{
        respSelling = coreManager.save(Selling.class, s);
      }catch (Exception e) {
        SgwtRestErrorResponse resp = new SgwtRestErrorResponse(SgwtRestResponseBase.RESPONSE_FAILURE);
        resp.addError("exception", e.getMessage());
        return resp;
      }
     
    }else if(request.getOperationType() == OPERATION_TYPE.ADD){
                 
      Double sellingPrice = RequestUtil.getDouble(request.getData().get("sellingPrice"));
      Integer measurementSelectionId = RequestUtil.getInteger(request.getData().get("measurementSelectionId"));
     
      Selling s = new Selling();
      s.setSellingPrice(sellingPrice);
     
      Measurement selm = coreManager.get(Measurement.class, measurementSelectionId);
      s.setMeasurement(selm);
     
      Product prod = coreManager.get(Product.class, id);
      s.setProduct(prod);
   
      try{
        respSelling = coreManager.save(Selling.class, s);
      }catch (Exception e) {
        e.printStackTrace();
        SgwtRestErrorResponse resp = new SgwtRestErrorResponse(-1);
        resp.addError("exception", e.getMessage());
        return resp;
      }
    }
   
    DisplaySelling displaySelling = null;
View Full Code Here

Examples of com.swinarta.sunflower.server.model.SgwtRestErrorResponse

        }     
       
        resp = det;
       
      } catch (Exception e) {
        SgwtRestErrorResponse resp1 = new SgwtRestErrorResponse(-1);
        resp1.addError("exception", e.getMessage());
        return resp1;       
      }   
     
    }else if(request.getOperationType() == OPERATION_TYPE.REMOVE){
      TransferOrderDetail pod = coreManager.get(TransferOrderDetail.class, id);
View Full Code Here

Examples of com.swinarta.sunflower.server.model.SgwtRestErrorResponse

      }
           
      try{
        respBuying = coreManager.save(Buying.class, b);
      }catch (Exception e) {
        SgwtRestErrorResponse resp = new SgwtRestErrorResponse(SgwtRestResponseBase.RESPONSE_FAILURE);
        resp.addError("exception", e.getMessage());
        return resp;
      }
     
    }else if(request.getOperationType() == OPERATION_TYPE.ADD){
     
      Double buyingPrice = RequestUtil.getDouble(request.getData().get("buyingPrice"));
      Double disc1 = RequestUtil.getDouble(request.getData().get("disc1"));
      Double disc2 = RequestUtil.getDouble(request.getData().get("disc2"));
      Double disc3 = RequestUtil.getDouble(request.getData().get("disc3"));
      Double disc4 = RequestUtil.getDouble(request.getData().get("disc4"));     
      Boolean taxIncluded = RequestUtil.getBoolean(request.getData().get("taxIncluded"));     
      Double discPrice = RequestUtil.getDouble(request.getData().get("discPrice"));
     
      Integer measurementSelectionId = RequestUtil.getInteger(request.getData().get("measurementSelectionId"));
      Integer supplierId = RequestUtil.getInteger(request.getData().get("supplierId"));

      Buying b = new Buying();
      b.setId(id);
      b.setBuyingPrice(buyingPrice);
      b.setDisc1(disc1);
      b.setDisc2(disc2);
      b.setDisc3(disc3);
      b.setDisc4(disc4);
      b.setTaxIncluded(taxIncluded);
      b.setDiscPrice(discPrice);
     
      Measurement selm = coreManager.get(Measurement.class, measurementSelectionId);
      b.setMeasurement(selm);

      Supplier supp = coreManager.get(Supplier.class, supplierId);
      b.setSupplier(supp);
     
      Product prod = coreManager.get(Product.class, id);
      b.setProduct(prod);
           
      try{
        respBuying = coreManager.save(Buying.class, b);
      }catch (Exception e) {
        e.printStackTrace();
        SgwtRestErrorResponse resp = new SgwtRestErrorResponse(-1);
        resp.addError("exception", e.getMessage());
        return resp;               
      }
           
    }
   
View Full Code Here

Examples of com.swinarta.sunflower.server.model.SgwtRestErrorResponse

      }     
     
      resp = det;     
     
    }catch (Exception e) {
      SgwtRestErrorResponse resp1 = new SgwtRestErrorResponse(-1);
      resp1.addError("exception", e.getMessage());
      return resp1;       
    }

    SgwtRestFetchResponseBase ret = new SgwtRestFetchResponseBase(resp);
   
View Full Code Here

Examples of com.swinarta.sunflower.server.model.SgwtRestErrorResponse

        retStock = coreManager.save(Stock.class, s);
        dstock = mapper.map(retStock, DisplayStock.class);
        dstock.setProductId(retStock.getProduct().getId());
       
      } catch (Exception e) {
        SgwtRestErrorResponse resp = new SgwtRestErrorResponse(SgwtRestResponseBase.RESPONSE_FAILURE);
        resp.addError("exception", e.getMessage());
        return resp;
      }
     
      SgwtRestFetchResponseBase ret = new SgwtRestFetchResponseBase(dstock);
     
      return ret;
    }else if(request.getOperationType() == OPERATION_TYPE.UPDATE){

      Float current = RequestUtil.getFloat(request.getData().get("current"));
      Integer max = (Integer) request.getData().get("max");
      Integer min = (Integer) request.getData().get("min");
      Integer order = (Integer) request.getData().get("defaultOrder");
      Integer storeId = (Integer) request.getData().get("storeId");

      Stock s = coreManager.getStock(productId, storeId);
      s.setCurrent(current);
      s.setDefaultOrder(order);
      s.setMax(max);
      s.setMin(min);
      s.setLastUpdateReason(StockUpdateReason.WEB);
     
      Stock retStock;
      DisplayStock dstock = null;
      try {
        retStock = coreManager.save(Stock.class, s);
        dstock = mapper.map(retStock, DisplayStock.class);
        dstock.setProductId(retStock.getProduct().getId());       
      } catch (Exception e) {
        SgwtRestErrorResponse resp = new SgwtRestErrorResponse(SgwtRestResponseBase.RESPONSE_FAILURE);
        resp.addError("exception", e.getMessage());
        return resp;
      }
     
      SgwtRestFetchResponseBase ret = new SgwtRestFetchResponseBase(dstock);
     
View Full Code Here

Examples of com.swinarta.sunflower.server.model.SgwtRestErrorResponse

        poResp = coreManager.save(PurchasingOrder.class, po);
      }
      DisplaySearchPurchasingOrder dpo = mapper.map(poResp, DisplaySearchPurchasingOrder.class);
      resp = dpo;
    } catch (Exception e) {
      SgwtRestErrorResponse resp1 = new SgwtRestErrorResponse(-1);
      resp1.addError("exception", e.getMessage());
      return resp1;       
    }
   
    SgwtRestFetchResponseBase ret = new SgwtRestFetchResponseBase(resp);
    return ret;
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.