diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-08-10 16:14:48 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-08-10 16:14:48 +0000 |
commit | 2a25d97953be52451c073f8abc22034283c6d8c9 (patch) | |
tree | 77132b7af9d104a019f38866a43594ad11a0266a /sandbox/travelsample/travel-contribution/src/scatours/travel/TravelImpl.java | |
parent | 569c99b45bb0b3e6408c3af066110f4212da0688 (diff) |
Start looking at a conversational interface on the Trip component
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@684543 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample/travel-contribution/src/scatours/travel/TravelImpl.java')
-rw-r--r-- | sandbox/travelsample/travel-contribution/src/scatours/travel/TravelImpl.java | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/sandbox/travelsample/travel-contribution/src/scatours/travel/TravelImpl.java b/sandbox/travelsample/travel-contribution/src/scatours/travel/TravelImpl.java index 9d3b9b94e9..e4a641e1e5 100644 --- a/sandbox/travelsample/travel-contribution/src/scatours/travel/TravelImpl.java +++ b/sandbox/travelsample/travel-contribution/src/scatours/travel/TravelImpl.java @@ -72,7 +72,7 @@ public class TravelImpl implements TravelSearch, SearchCallback, TravelBooking{ private int responsesReceived = 0; private List<TripItem> searchResults = new ArrayList<TripItem>(); - private Map<String,ServiceReference<Trip>> trips = new HashMap<String,ServiceReference<Trip>>(); + private Map<String,Trip> trips = new HashMap<String,Trip>(); // TravelSearch methods @@ -95,6 +95,7 @@ public class TravelImpl implements TravelSearch, SearchCallback, TravelBooking{ for (TripItem tripItem : searchResults){ tripItem.setId(UUID.randomUUID().toString()); + tripItem.setTripId(tripLeg.getId()); tripItem.setPrice(currencyConverter.convert(tripItem.getCurrency(), quoteCurrencyCode, tripItem.getPrice())); @@ -124,28 +125,32 @@ public class TravelImpl implements TravelSearch, SearchCallback, TravelBooking{ String tripId = UUID.randomUUID().toString(); ServiceReference<Trip> tripReference = componentContext.getServiceReference(Trip.class, "trip"); - //tripReference.setConversationID(tripId); - trips.put(tripId, tripReference); + tripReference.setConversationID(tripId); + trips.put(tripId, tripReference.getService()); return tripId; } - public void addTripItem(String id){ + public void addTripItem(String tripId, String id){ for (TripItem tripItem : searchResults) { if (tripItem.getId().equals(id)){ - trip.addTripItem(tripItem); + trips.get(tripId).addTripItem(tripItem); } } } - public void removeTripItem(String id){ - trip.removeTripItem(id); - } + public void removeTripItem(String tripId, String id){ + trips.get(tripId).removeTripItem(id); + } - public double getTotalPrice(){ - return trip.getTripPrice(); + public TripItem[] getTripItems(String tripId) { + return trips.get(tripId).getTripItems(); } - public void purchaseTrip() { - trip.purchaseTrip(); + public double getTotalPrice(String tripId){ + return trips.get(tripId).getTripPrice(); + } + + public void purchaseTrip(String tripId) { + trips.get(tripId).purchaseTrip(); } } |