Package com.google.code.magja.service

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


      params.add(cart.getStoreId());

      Boolean success = (Boolean) soapClient.call(
          ResourcePath.ShoppingCartCustomerAddresses, params);
      if (!success) {
        throw new ServiceException(
            "Could not set cart address information");
      }
    } catch (AxisFault e) {
      if (debug) {
        e.printStackTrace();
      }
      throw new ServiceException(e.getMessage());
    }
  }
View Full Code Here


      params.add(cart.getStoreId());

      Boolean success = (Boolean) soapClient.call(
          ResourcePath.ShoppingCartProductAdd, params);
      if (!success) {
        throw new ServiceException("Could not add product");
      }
    } catch (AxisFault e) {
      if (debug) {
        e.printStackTrace();
      }
      throw new ServiceException(e.getMessage());
    }
  }
View Full Code Here

  public void delete(String attributeName) throws ServiceException {

    try {
      if (!(Boolean) soapClient.call(ResourcePath.ProductAttributeDelete,
          attributeName))
        throw new ServiceException("Error deleting product attribute.");
    } catch (AxisFault e) {
      if (debug)
        e.printStackTrace();
      throw new ServiceException(e.getMessage());
    }

  }
View Full Code Here

  public void getOptions(ProductAttribute productAttribute)
      throws ServiceException {

    if (productAttribute.getId() == null
        && productAttribute.getCode() == null)
      throw new ServiceException(
          "The id or the code of the attribute must have some value.");

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

    if (options != null) {
      for (Map<String, Object> option : options) {
        if (!"".equals((String) option.get("label"))) {
View Full Code Here

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

    if (attSetList == null)
      return resultList;
View Full Code Here

      prd_attributes = (List<Map<String, Object>>) soapClient.call(
          ResourcePath.ProductAttributeList, set.getId());
    } catch (AxisFault e) {
      if (debug)
        e.printStackTrace();
      throw new ServiceException(e.getMessage());
    }

    if (prd_attributes == null)
      return results;
View Full Code Here

        }
      }
    } catch (ServiceException e) {
      if (debug)
        e.printStackTrace();
      throw new ServiceException(e.getMessage());
    }

    return allProductAttributes;
  }
View Full Code Here

   */
  @Override
  public void save(ProductAttribute productAttribute) throws ServiceException {
    if (productAttribute.getId() != null
        || exists(productAttribute.getCode()))
      throw new ServiceException(
          productAttribute.getCode()
              + " exists already. Not allowed to update product attributes yet");

    Integer id = null;
    try {
      id = Integer.parseInt((String) soapClient.call(
          ResourcePath.ProductAttributeCreate,
          productAttribute.serializeToApi()));
    } catch (AxisFault e) {
      if (debug)
        e.printStackTrace();
      throw new ServiceException(e.getMessage());
    }

    if (id == null)
      throw new ServiceException("Error on save product attribute");

    productAttribute.setId(id);

    // if has options, include this too
    if (productAttribute.getOptions() != null) {
      if (!productAttribute.getOptions().isEmpty()) {
        String[] options = new String[productAttribute.getOptions()
            .size()];
        int i = 0;
        for (Map.Entry<Integer, String> option : productAttribute
            .getOptions().entrySet())
          options[i++] = option.getValue();

        List<Object> params = new LinkedList<Object>();
        params.add(productAttribute.getId());
        params.add(options);

        try {
          if (!(Boolean) soapClient.call(
              ResourcePath.ProductAttributeAddOptions, params))
            throw new ServiceException(
                "The product attribute was saved, but had error "
                    + "on save the options for that");
        } catch (AxisFault e) {
          if (debug)
            e.printStackTrace();
          throw new ServiceException(e.getMessage());
        }
      }
    }
  }
View Full Code Here

        params.add(options);

        try {
          if (!(Boolean) soapClient.call(
              ResourcePath.ProductAttributeAddOptions, params))
            throw new ServiceException(
                "The product attribute was saved, but had error "
                    + "on save the options for that");
        } catch (AxisFault e) {
          if (debug)
            e.printStackTrace();
          throw new ServiceException(e.getMessage());
        }
      }
    }
  }
View Full Code Here

          ResourcePath.ProductAttributeInfo, code);

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

    if (remote_result == 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.