private Iterable<ProductItemPrice> getPrices(Template template) { Builder<ProductItemPrice> result = ImmutableSet.builder(); int imageId = Integer.parseInt(template.getImage().getId()); result.add(ProductItemPrice.builder().id(imageId).build()); Iterable<String> hardwareIds = Splitter.on(",").split(template.getHardware().getId()); for (String hardwareId : hardwareIds) { int id = Integer.parseInt(hardwareId); result.add(ProductItemPrice.builder().id(id).build()); } ProductItem uplinkItem = find(productPackageSupplier.get().getItems(), and(capacity(portSpeed), categoryCode("port_speed"))); result.add(get(uplinkItem.getPrices(), 0)); result.addAll(prices); return result.build(); }
private Iterable<ProductItemPrice> getPrices(Template template) { Builder<ProductItemPrice> result = ImmutableSet.builder(); int imageId = Integer.parseInt(template.getImage().getId()); result.add(ProductItemPrice.builder().id(imageId).build()); Iterable<String> hardwareIds = Splitter.on(",").split(template.getHardware().getId()); for (String hardwareId : hardwareIds) { int id = Integer.parseInt(hardwareId); result.add(ProductItemPrice.builder().id(id).build()); } ProductItem uplinkItem = find(productPackageSupplier.get().getItems(), and(capacity(portSpeed), categoryCode("port_speed"))); result.add(get(uplinkItem.getPrices(), 0)); result.addAll(prices); return result.build(); }
private void checkProductItem(ProductItem item) { assert item.getId() > 0 : item; assert item.getDescription() != null : item; checkCategories(item.getCategories()); // units and capacity may be null assertTrue(item.getPrices().size() >= 0); for (ProductItemPrice price : item.getPrices()) { // ProductItemPrice newDetails = // client.getProductItemPrice(prices.getId()); // assertEquals(item.getId(), newDetails.getId()); checkPrice(price); } }
public T fromProductItem(ProductItem in) { return this .id(in.getId()) .description(in.getDescription()) .units(in.getUnits()) .capacity(in.getCapacity()) .prices(in.getPrices()) .categories(in.getCategories()); } }
public T fromProductItem(ProductItem in) { return this .id(in.getId()) .description(in.getDescription()) .units(in.getUnits()) .capacity(in.getCapacity()) .prices(in.getPrices()) .categories(in.getCategories()); } }