diff options
Diffstat (limited to 'sandbox/sca-cloud-tutorial/store-appengine-webapp/src/services/CatalogAggregatorImpl.java')
-rw-r--r-- | sandbox/sca-cloud-tutorial/store-appengine-webapp/src/services/CatalogAggregatorImpl.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sandbox/sca-cloud-tutorial/store-appengine-webapp/src/services/CatalogAggregatorImpl.java b/sandbox/sca-cloud-tutorial/store-appengine-webapp/src/services/CatalogAggregatorImpl.java index 29c99bbcb5..09cae14100 100644 --- a/sandbox/sca-cloud-tutorial/store-appengine-webapp/src/services/CatalogAggregatorImpl.java +++ b/sandbox/sca-cloud-tutorial/store-appengine-webapp/src/services/CatalogAggregatorImpl.java @@ -36,19 +36,29 @@ public class CatalogAggregatorImpl implements Catalog { @Reference public Catalog fruitsCatalog; + + @Reference + public Catalog vegetablesCatalog; public Item[] get() { String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode); Item[] fruits = fruitsCatalog.get(); + Item[] vegetables = vegetablesCatalog.get(); - Item[] catalog = new Item[fruits.length]; + Item[] catalog = new Item[fruits.length + vegetables.length]; int i =0; for (Item item: fruits) { double price = Double.valueOf(item.getPrice().substring(1)); price = currencyConverter.getConversion("USD", currencyCode, price); catalog[i++] = new Item(item.getName(), currencySymbol + price); } + + for (Item item: vegetables) { + double price = Double.valueOf(item.getPrice().substring(1)); + price = currencyConverter.getConversion("USD", currencyCode, price); + catalog[i++] = new Item(item.getName(), currencySymbol + price); + } return catalog; } |