You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2008/04/20 06:25:38 UTC
svn commit: r649883 -
/incubator/tuscany/java/sca/tutorial/assets/services/market/MarketCatalogImpl.java
Author: lresende
Date: Sat Apr 19 21:25:29 2008
New Revision: 649883
URL: http://svn.apache.org/viewvc?rev=649883&view=rev
Log:
TUSCANY-2224 - Patch from Mario Antolline with updates to marketplace catalog impl
Modified:
incubator/tuscany/java/sca/tutorial/assets/services/market/MarketCatalogImpl.java
Modified: incubator/tuscany/java/sca/tutorial/assets/services/market/MarketCatalogImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/assets/services/market/MarketCatalogImpl.java?rev=649883&r1=649882&r2=649883&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/assets/services/market/MarketCatalogImpl.java (original)
+++ incubator/tuscany/java/sca/tutorial/assets/services/market/MarketCatalogImpl.java Sat Apr 19 21:25:29 2008
@@ -1,24 +1,27 @@
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
package services.market;
+import java.util.Vector;
+
import org.osoa.sca.annotations.Property;
import org.osoa.sca.annotations.Reference;
@@ -40,28 +43,24 @@
public Item[] get() {
-
- String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode);
-
- int length = 0;
-
- for(Catalog goods: goodsCatalog) {
- length += goods.get().length;
+
+ String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode);
+ Vector<Item> catalog = new Vector<Item>();
+
+ for (int i = 0; i < goodsCatalog.length; i++) {
+ Item[] items = goodsCatalog[i].get();
+
+ for (Item item : items) {
+ double price = Double.valueOf(item.getPrice().substring(1));
+ price = currencyConverter.getConversion("USD", currencyCode, price);
+ catalog.addElement(new Item(item.getName(), currencySymbol + price));
+ }
}
-
- Item[] catalog = new Item[length];
-
- int i = 0;
- for (Catalog goods: goodsCatalog) {
- Item[] items = goods.get();
- for(Item item: items) {
- double price = Double.valueOf(item.getPrice().substring(1));
- price = currencyConverter.getConversion("USD", currencyCode, price);
- catalog[i++] = new Item(item.getName(), currencySymbol + price);
- }
- }
- return catalog;
+ Item[] catalogArray = new Item[catalog.size()];
+ catalog.copyInto(catalogArray);
+
+ return catalogArray;
}
-}
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org