diff options
Diffstat (limited to '')
-rw-r--r-- | sandbox/lresende/sca/samples/store-secure-webapp/src/main/java/services/FruitsCatalogImpl.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sandbox/lresende/sca/samples/store-secure-webapp/src/main/java/services/FruitsCatalogImpl.java b/sandbox/lresende/sca/samples/store-secure-webapp/src/main/java/services/FruitsCatalogImpl.java new file mode 100644 index 0000000000..4cac4ac21d --- /dev/null +++ b/sandbox/lresende/sca/samples/store-secure-webapp/src/main/java/services/FruitsCatalogImpl.java @@ -0,0 +1,35 @@ +package services; + +import java.util.ArrayList; +import java.util.List; + +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; + +public class FruitsCatalogImpl implements Catalog { + @Property + public String currencyCode = "USD"; + @Reference + public CurrencyConverter currencyConverter; + + private List<Item> catalog = new ArrayList<Item>(); + + @Init + public void init() { + String currencySymbol = currencyConverter + .getCurrencySymbol(currencyCode); + catalog.add(new Item("Apple", currencySymbol + + currencyConverter.getConversion("USD", currencyCode, 2.99))); + catalog.add(new Item("Orange", currencySymbol + + currencyConverter.getConversion("USD", currencyCode, 3.55))); + catalog.add(new Item("Pear", currencySymbol + + currencyConverter.getConversion("USD", currencyCode, 1.55))); + } + + public Item[] get() { + Item[] catalogArray = new Item[catalog.size()]; + catalog.toArray(catalogArray); + return catalogArray; + } +} |