.listByProduct(product)) {
productMediaRemoteService.delete(media);
}
}
} else {
throw new ServiceException("Error updating Product");
}
} catch (NumberFormatException e) {
if (debug)
e.printStackTrace();
throw new ServiceException(e.getMessage());
} catch (AxisFault e) {
if (debug)
e.printStackTrace();
throw new ServiceException(e.getMessage());
}
} else {
// means its a new product
// if is a configurable product, call the proper handle
if (product.getType().equals(ProductTypeEnum.CONFIGURABLE.getProductType()))
handleConfigurableForNewProducts(product);
try {
List<Object> newProduct = (LinkedList<Object>) product
.serializeToApi();
id = Integer.parseInt((String) soapClient.call(
ResourcePath.ProductCreate, newProduct));
if (id > 0)
product.setId(id);
else
throw new ServiceException("Error inserting new Product");
} catch (NumberFormatException e) {
if (debug)
e.printStackTrace();
throw new ServiceException(e.getMessage());
} catch (AxisFault e) {
if (debug)
e.printStackTrace();
throw new ServiceException(e.getMessage());
}
}
// inventory
if (product.getQty() != null)