Package com.google.code.magja.service

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


    try {
      remote_list = (List<Map<String, Object>>) soapClient.call(
          ResourcePath.CountryList, "");
    } catch (AxisFault e) {
      if(debug) e.printStackTrace();
      throw new ServiceException(e.getMessage());
    }

    if (remote_list == null)
      return countries;
View Full Code Here


        return country;
      }
    }

    // Country not found
    throw new ServiceException(countryName + " not found");
  }
View Full Code Here

   * .google.magja.model.product.ProductMedia)
   */
  @Override
  public void delete(ProductMedia productMedia) throws ServiceException {
    if (!ProductServiceUtil.validateProduct(productMedia.getProduct()))
      throw new ServiceException(
          "the product attribute for the media must be setted.");

    List<Object> params = new LinkedList<Object>();
    params.add((productMedia.getProduct().getId() != null ? productMedia
        .getProduct().getId() : productMedia.getProduct().getSku()));
    params.add(productMedia.getFile());

    Boolean success = false;
    try {
      success = (Boolean) soapClient.call(
          ResourcePath.ProductAttributeMediaRemove, params);
    } catch (AxisFault e) {
      if(debug) e.printStackTrace();
      throw new ServiceException(e.getMessage());
    }

    if (!success)
      throw new ServiceException("Error deleting the Product Media");
  }
View Full Code Here

  @Override
  public ProductMedia getByProductAndFile(Product product, String file)
      throws ServiceException {

    if (!ProductServiceUtil.validateProduct(product))
      throw new ServiceException(
          "the product for the media must be setted.");

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

    Map<String, Object> media = null;
    try {
      media = (Map<String, Object>) soapClient.call(
          ResourcePath.ProductAttributeMediaInfo, params);
    } catch (AxisFault e) {
      if(debug) e.printStackTrace();
      throw new ServiceException(e.getMessage());
    }

    return buildProductMedia(media);
  }
View Full Code Here

    try {
      media = (String) soapClient.call(
          ResourcePath.ProductAttributeMediaMd5, params);
    } catch (AxisFault e) {
      if(debug) e.printStackTrace();
      throw new ServiceException(e.getMessage());
    }

    return media;
  }
View Full Code Here

  @Override
  public List<ProductMedia> listByProduct(Product product)
      throws ServiceException {

    if (!ProductServiceUtil.validateProduct(product))
      throw new ServiceException(
          "The product must have the id or the sku seted for list medias");

    List<ProductMedia> result = new ArrayList<ProductMedia>();

    List<Map<String, Object>> medias = null;
    try {
      medias = (List<Map<String, Object>>) soapClient.call(
          ResourcePath.ProductAttributeMediaList,
          (product.getId() != null ? product.getId() : product
              .getSku()));
    } catch (AxisFault e) {
      if(debug) e.printStackTrace();
      throw new ServiceException(e.getMessage());
    }

    if (medias == null)
      return null;
View Full Code Here

   * .google.magja.model.product.ProductMedia)
   */
  @Override
  public void save(ProductMedia productMedia) throws ServiceException {
    if (!ProductServiceUtil.validateProduct(productMedia.getProduct()))
      throw new ServiceException(
          "the product attribute for the media must be setted.");

    if (productMedia.getImage() == null)
      throw new ServiceException("the image is null.");

    if (productMedia.getImage().getData() == null)
      throw new ServiceException("invalid binary data for the image.");

    try {
      String result = (String) soapClient.call(
          ResourcePath.ProductAttributeMediaCreate, productMedia
              .serializeToApi());

      productMedia.setFile(result);

    } catch (AxisFault e) {
      if(debug) e.printStackTrace();
      throw new ServiceException(e.getMessage());
    }
  }
View Full Code Here

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

    try {
      soapClient.call(ResourcePath.SalesOrderCancel, order.getId());
    } catch (AxisFault e) {
      if(debug) e.printStackTrace();
      throw new ServiceException(e.getMessage());
    }

  }
View Full Code Here

    try {
      order_remote = (Map<String, Object>) soapClient.call(
          ResourcePath.SalesOrderInfo, id);
    } catch (AxisFault e) {
      if(debug) e.printStackTrace();
      throw new ServiceException(e.getMessage());
    }

    if (order_remote == null)
      return null;
    else
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.