tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r682175 - in /tuscany/sandbox/travelsample: trip-contribution/src/scatours/trip/TripContents.java trip-contribution/src/scatours/trip/TripImpl.java ui-contribution/scatours.html
Date Sun, 03 Aug 2008 13:59:39 GMT
Author: slaws
Date: Sun Aug  3 06:59:39 2008
New Revision: 682175

URL: http://svn.apache.org/viewvc?rev=682175&view=rev
Log:
Allow trip items to be removed

Modified:
    tuscany/sandbox/travelsample/trip-contribution/src/scatours/trip/TripContents.java
    tuscany/sandbox/travelsample/trip-contribution/src/scatours/trip/TripImpl.java
    tuscany/sandbox/travelsample/ui-contribution/scatours.html

Modified: tuscany/sandbox/travelsample/trip-contribution/src/scatours/trip/TripContents.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/trip-contribution/src/scatours/trip/TripContents.java?rev=682175&r1=682174&r2=682175&view=diff
==============================================================================
--- tuscany/sandbox/travelsample/trip-contribution/src/scatours/trip/TripContents.java (original)
+++ tuscany/sandbox/travelsample/trip-contribution/src/scatours/trip/TripContents.java Sun
Aug  3 06:59:39 2008
@@ -30,5 +30,6 @@
 public interface TripContents extends Collection<String, TripItem> {
     
     void addTripItem(String id);
+    void removeTripItem(String id);
     double getTotalPrice();
 }

Modified: tuscany/sandbox/travelsample/trip-contribution/src/scatours/trip/TripImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/trip-contribution/src/scatours/trip/TripImpl.java?rev=682175&r1=682174&r2=682175&view=diff
==============================================================================
--- tuscany/sandbox/travelsample/trip-contribution/src/scatours/trip/TripImpl.java (original)
+++ tuscany/sandbox/travelsample/trip-contribution/src/scatours/trip/TripImpl.java Sun Aug
 3 06:59:39 2008
@@ -59,6 +59,8 @@
     @Property
     public String quoteCurrencyCode = "USD";
     
+    private int responsesReceived = 0;
+    
     private List<TripItem> searchResults = new ArrayList<TripItem>();
     private Map<String, TripItem> tripItems = new HashMap<String, TripItem>();
     
@@ -67,15 +69,22 @@
     public TripItem[] search(TripLeg tripLeg) {
         
         searchResults.clear();
+        responsesReceived = 0;
         
         hotelSearch.searchAsynch(tripLeg);
         flightSearch.searchAsynch(tripLeg);
         carSearch.searchAsynch(tripLeg);
         
-        // TODO - wait for searches to complete
+        while (responsesReceived < 3){
+            try {
+                this.wait();
+            } catch (InterruptedException ex){
+                // do nothing
+            }
+        }
         
         for (TripItem tripItem : searchResults){
-            tripItem.setId(String.valueOf(searchResults.indexOf(tripItem)));
+            tripItem.setId(UUID.randomUUID().toString());
             tripItem.setPrice(currencyConverter.convert(tripItem.getCurrency(), 
                                                         quoteCurrencyCode, 
                                                         tripItem.getPrice()));
@@ -91,6 +100,12 @@
         for(int i = 0; i < items.length; i++ ){
             searchResults.add(items[i]);
         }
+        
+        responsesReceived++;
+        try {
+            this.notifyAll();
+        } catch (Exception ex) {
+        }
     }    
 
     // TripContents methods
@@ -102,6 +117,9 @@
         }
     }
     
+    public void removeTripItem(String id){
+        tripItems.remove(id);
+    }     
     
     // Not using the DataCollection iface yet as it seems like a 
     // likely attach vector to be passing complete tripItem records in

Modified: tuscany/sandbox/travelsample/ui-contribution/scatours.html
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/ui-contribution/scatours.html?rev=682175&r1=682174&r2=682175&view=diff
==============================================================================
--- tuscany/sandbox/travelsample/ui-contribution/scatours.html (original)
+++ tuscany/sandbox/travelsample/ui-contribution/scatours.html Sun Aug  3 06:59:39 2008
@@ -128,6 +128,8 @@
         for (var i=0; i<items.length; i++) {
             if (items[i].checked == true) {
                 tripContents.addTripItem(items[i].value);
+            } else {
+                tripContents.removeTripItem(items[i].value);
             }
         }
         



Mime
View raw message