/* * (non-Javadoc) * * @see com.google.code.magja.service.product.ProductAttributeRemoteService# * listAllProductAttributeSet() */ @Override public List<ProductAttributeSet> listAllProductAttributeSet() throws ServiceException { List<ProductAttributeSet> resultList = new ArrayList<ProductAttributeSet>(); List<Map<String, Object>> attSetList; try { 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; for (Map<String, Object> att : attSetList) { ProductAttributeSet set = new ProductAttributeSet(); for (Map.Entry<String, Object> attribute : att.entrySet()) set.set(attribute.getKey(), attribute.getValue()); resultList.add(set); } return resultList; }
/* * (non-Javadoc) * * @see com.google.code.magja.service.product.ProductAttributeRemoteService# * listByAttributeSet * (com.google.code.magja.model.product.ProductAttributeSet) */ @Override public List<ProductAttribute> listByAttributeSet(ProductAttributeSet set) throws ServiceException { List<ProductAttribute> results = new ArrayList<ProductAttribute>(); List<Map<String, Object>> prd_attributes = null; try { 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; for (Map<String, Object> att : prd_attributes) { ProductAttribute prd_attribute = new ProductAttribute(); for (Map.Entry<String, Object> attribute : att.entrySet()) { if (!attribute.getKey().equals("scope")) prd_attribute.set(attribute.getKey(), attribute.getValue()); } prd_attribute.setScope(ProductAttribute.Scope.getByName((String) att.get("scope"))); results.add(prd_attribute); } return results; }