예제 #1
0
 public void onBookingComplete(
     @Observes(during = TransactionPhase.AFTER_SUCCESS) @Confirmed final Booking booking) {
   log.bookingConfirmed(booking.getHotel().getName(), booking.getUser().getName());
   messages
       .info(new DefaultBundleKey("booking_confirmed"))
       .defaults("You're booked to stay at the {0} {1}.")
       .params(
           booking.getHotel().getName(), new PrettyTime(locale).format(booking.getCheckinDate()));
 }
예제 #2
0
  public void bookHotel() {
    booking = new Booking(hotelSelection, user, 7, 2);
    hotelSelection = null;

    // for demo convenience
    booking.setCreditCardNumber("1111222233334444");
    log.bookingInitiated(user.getName(), booking.getHotel().getName());

    messages
        .info(new DefaultBundleKey("booking_initiated"))
        .defaults("You've initiated a booking at the {0}.")
        .params(booking.getHotel().getName());
  }
예제 #3
0
  @Begin
  public void selectHotel(final Long id) {
    conversation.setTimeout(600000); // 10 * 60 * 1000 (10 minutes)

    // NOTE get a fresh reference that's managed by the extended persistence context
    hotelSelection = em.find(Hotel.class, id);
    if (hotelSelection != null) {
      log.hotelSelected(
          user != null ? user.getName() : "Anonymous",
          hotelSelection.getName(),
          hotelSelection.getCity());
    }
  }
예제 #4
0
 public void validate() {
   log.hotelEntityInPersistenceContext(em.contains(booking.getHotel()));
   // if we got here, all validations passed
   bookingValid = true;
 }