Package net.sourceforge.myreserve.ejb

Examples of net.sourceforge.myreserve.ejb.Reservation


        // create reservation
        em.getTransaction().begin();
        Date now = new Date();
        Integer nights = new Integer(3);
        Integer guests = new Integer(2);
        Reservation r1 = new Reservation(guests, now, nights, "A", "Guest");
        Hotel h = em.find(Hotel.class, h2.getHotelId());
        r1.setHotel(h);
        em.persist(r1);
        em.getTransaction().commit();
        Reservation r = (Reservation) em.find(Reservation.class, r1.getReservationId());
        Assert.assertNotNull(r);

        // remove reservation
        em.getTransaction().begin();
        r = (Reservation) em.find(Reservation.class, r1.getReservationId());
View Full Code Here


  public String makeReservation() {
    try {
      SimpleDateFormat format =
              new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
      Date arrivalDate = format.parse(this.arrivalDate);     
      Reservation res = hm.newReservation(this.hotelId, this.numGuests,
          arrivalDate, this.numNights, this.firstname,
          this.lastname);
      if (res != null) {
        ReservationIDHelper ridHelper = new ReservationIDHelper();
        this.resId = ridHelper.idToFormatted(res.getReservationId());
        return "make_reservation_success";
      } else {
        return "make_reservation_error";
      }
    }  catch (ParseException pe) {
View Full Code Here

    public String retrieveReservation() {
        //System.out.println("Resid: " + this.resId);
        ReservationIDHelper ridHelper = new ReservationIDHelper();
        Integer tempRes = ridHelper.formattedtoId(this.resId);
        Reservation res = hm.getReservation(tempRes);
        if (res != null) {
            this.firstname = res.getFirstname();
            this.lastname = res.getLastname();
            SimpleDateFormat format =
              new SimpleDateFormat("MM/dd/yy");
            this.arrivalDate = format.format(res.getArrivalDate());
            this.numGuests = res.getNumGuests();
            this.numNights = res.getNumNights();
            Hotel h = res.getHotel();
            this.hotelId = h.getHotelId();
            this.hotelName = h.getName();
            return "retrieve_reservation_success";
        } else {
            return "retrieve_reservation_error";
View Full Code Here

            ReservationIDHelper ridHelper = new ReservationIDHelper();
            Integer tempRes = ridHelper.formattedtoId(this.resId);
            SimpleDateFormat format =
              new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
        Date arrivalDate = format.parse(this.arrivalDate);
            Reservation res = hm.updateReservation(tempRes, arrivalDate,
                    this.numNights, this.numGuests);
            if (res != null) {
                return "update_reservation_success";
            } else {
                return "update_reservation_error";
View Full Code Here

TOP

Related Classes of net.sourceforge.myreserve.ejb.Reservation

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.