Package com.tuscanyscatours.common

Examples of com.tuscanyscatours.common.TripItem


        // find the pre-package trip
        for (TripInfo trip : trips) {
            if ((trip.getFromLocation().equals(tripLeg.getFromLocation())) && (trip.getToLocation().equals(tripLeg
                .getToLocation()))
                && (trip.getFromDate().equals(tripLeg.getFromDate()))) {
                TripItem item =
                    new TripItem("", "", TripItem.TRIP, trip.getName(), trip.getDescription(),
                                 trip.getFromLocation() + " - " + trip.getToLocation(), trip.getFromDate(), trip
                                     .getToDate(), trip.getPricePerPerson(), trip.getCurrency(), trip.getLink());
                items.add(item);
            }
        }
View Full Code Here


        // find outbound leg
        for (FlightInfo flight : flights) {
            if ((flight.getFromLocation().equals(tripLeg.getFromLocation())) && (flight.getToLocation().equals(tripLeg
                .getToLocation()))
                && (flight.getFromDate().equals(tripLeg.getFromDate()))) {
                TripItem item =
                    new TripItem("", "", TripItem.FLIGHT, flight.getName(), flight.getDescription(), flight
                        .getFromLocation() + " - "
                        + flight.getToLocation(), flight.getFromDate(), flight.getToDate(), flight.getPricePerSeat(),
                                 flight.getCurrency(), flight.getLink());
                items.add(item);
            }
        }

        // find return leg
        for (FlightInfo flight : flights) {
            if ((flight.getFromLocation().equals(tripLeg.getToLocation())) && (flight.getToLocation().equals(tripLeg
                .getFromLocation()))
                && (flight.getFromDate().equals(tripLeg.getToDate()))) {
                TripItem item =
                    new TripItem("", "", TripItem.FLIGHT, flight.getName(), flight.getDescription(), flight
                        .getFromLocation() + " - "
                        + flight.getToLocation(), flight.getFromDate(), tripLeg.getToDate(), flight.getPricePerSeat(),
                                 flight.getCurrency(), flight.getLink());
                items.add(item);
            }
View Full Code Here

        // book any nested items
        TripItem[] nestedItems = trip.getTripItems();
        if (nestedItems != null) {
            for (int i = 0; i < nestedItems.length; i++) {
                TripItem tripItem = nestedItems[i];
                if (tripItem.getType().equals(TripItem.CAR)) {
                    tripItem.setBookingCode(carBook.book(tripItem));
                } else if (tripItem.getType().equals(TripItem.FLIGHT)) {
                    tripItem.setBookingCode(flightBook.book(tripItem));
                } else if (tripItem.getType().equals(TripItem.HOTEL)) {
                    tripItem.setBookingCode(hotelBook.book(tripItem));
                } else {
                    tripItem.setBookingCode(tripItem.getType() + " is invalid");
                }
            }
        }

        // book the top level item if it's a packaged trip
View Full Code Here

        List<TripItem> items = new ArrayList<TripItem>();

        // find available hotels
        for (HotelInfo hotel : hotels) {
            if (hotel.getLocation().equals(tripLeg.getToLocation())) {
                TripItem item =
                    new TripItem("", "", TripItem.HOTEL, hotel.getName(), hotel.getDescription(), hotel.getLocation(),
                                 tripLeg.getFromDate(), tripLeg.getToDate(), hotel.getPricePerBed(), hotel
                                     .getCurrency(), hotel.getLink());
                items.add(item);
            }
        }
View Full Code Here

    }

    public void run() {
      System.out.println("===============================================");
      System.out.println("Test the loggin policy by calling the trip component");
        TripItem tripItem =
            new TripItem("1234", "5678", TripItem.TRIP, "FS1DEC06", "Florence and Siena pre-packaged tour", "FLR",
                         "06/12/09", "13/12/09", 450, "EUR", "http://localhost:8085/tbd");
        System.out.println("Result = " + tripBooking.book(tripItem));
        System.out.println("===============================================");
      System.out.println("Test the basic authentication policy by calling the payment component");
        System.out.println("TestClient - Successful Payment - Status = " + payment.makePaymentMember("c-0", 100.00f));
View Full Code Here

        List<TripItem> items = new ArrayList<TripItem>();

        // find available hotels
        for (CarInfo car : cars) {
            if (car.getLocation().equals(tripLeg.getToLocation())) {
                TripItem item =
                    new TripItem("", "", TripItem.CAR, car.getName(), car.getDescription(), car.getLocation(), tripLeg
                        .getFromDate(), tripLeg.getToDate(), car.getPricePerDay(), car.getCurrency(), car.getLink());
                items.add(item);
            }
        }
View Full Code Here

    @Test
    public void testPayment() {
        SCAClient client = (SCAClient)tripNode;
        Book booking = client.getService(Book.class, "Trip/Book");
        TripItem tripItem =
            new TripItem("1234", "5678", TripItem.TRIP, "FS1DEC06", "Florence and Siena pre-packaged tour", "FLR",
                         "06/12/09", "13/12/09", 450, "EUR", "http://localhost:8085/tbd");
        System.out.println("Result = " + booking.book(tripItem) + "\n");
    }
View Full Code Here

    public void run() {
        System.out.println("\nCalling cart store using the conversational interaction pattern");

        // add some trip items to the cart store
        TripItem tripItem = getTestTripItem();
        cartStoreConversation.addTrip(tripItem);

        tripItem.setDescription("2nd trip item");
        cartStoreConversation.addTrip(tripItem);

        tripItem.setDescription("3rd trip item");
        cartStoreConversation.addTrip(tripItem);

        System.out.println("Trip items now in cart");
        TripItem[] tripItems = cartStoreConversation.getTrips();
        for (TripItem item : tripItems) {
View Full Code Here

            System.out.println("Item - " + item.getDescription());
        }
    }

    private TripItem getTestTripItem() {
        TripItem tripItem = new TripItem();
        tripItem.setLocation("FLR");
        tripItem.setFromDate("06/12/09 00:00");
        tripItem.setToDate("13/12/09 00:00");
        tripItem.setDescription("1st trip item");
        return tripItem;
    }
View Full Code Here

    }

    // SCAToursBooking methods

    public String bookTrip(String cartId, TripItem trip) {
        TripItem bookedTrip = tripBooking.bookTrip(cartId, trip);
        return bookedTrip.getBookingCode();
    }
View Full Code Here

TOP

Related Classes of com.tuscanyscatours.common.TripItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.