Package com.google.code.magja.service

Examples of com.google.code.magja.service.ServiceException


   */
  @Override
  public void updateInventory(Product product) throws ServiceException {

    if (product.getId() == null && product.getSku() == null)
      throw new ServiceException(
          "The product must have the id or the sku seted for update inventory");

    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put("qty", product.getQty());

    if (product.getInStock() == null)
      product.setInStock(product.getQty() > 0);

    properties.put("is_in_stock", (product.getInStock() ? "1" : "0"));

    List<Object> param = new LinkedList<Object>();
    param.add((product.getId() != null ? product.getId() : product.getSku()));
    param.add(properties);

    try {
      soapClient.call(ResourcePath.ProductStockUpdate, param);
    } catch (AxisFault e) {
      if (debug)
        e.printStackTrace();
      throw new ServiceException(e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of com.google.code.magja.service.ServiceException

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.