Examples of Booking


Examples of it.hotel.model.booking.Booking

      UnconfirmedBooking unConfirmed= (UnconfirmedBooking) bookingManager.get(id);
    GregorianCalendar beginDate= unConfirmed.getBeginDate();
    GregorianCalendar finishDate=unConfirmed.getFinishDate();
    Room room=unConfirmed.getRoom();
         
            Booking booking=new Booking(unConfirmed);
            if(bookingManager.isRoomVacant(beginDate, finishDate, room)){
           
            bookingManager.add(booking);
           
            try {
              mail.sendMailEnable(booking);
        } catch (MailException e) {
          System.out.println(e.getMessage());
          bookingManager.remove(booking.getId());
          throw new Exception ();
        }
        bookingManager.remove(id);
       
            }
View Full Code Here

Examples of it.hotel.model.booking.Booking

 
 
  @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
  public boolean checkIn(int bookingId) {
    Booking booking = (Booking) get(bookingId);
    this.checkIn(booking);
    return true;
  }
View Full Code Here

Examples of it.hotel.model.booking.Booking

   * @return the booking which has been enabled
   */
  @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
  public Booking enableBooking(UnconfirmedBooking unconfirmedBooking) {

    Booking booking;
    booking = new Booking(unconfirmedBooking);
    getDAO().save(booking);
    unconfirmedBookingDAO.remove(unconfirmedBooking);

    return booking;
  }
View Full Code Here

Examples of it.hotel.model.booking.Booking

   * @return true if the specified rooms are available in the specified date range
   */
 
  @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
  public boolean checkAndEdit(Booking booking){
    Booking tempBooking = (Booking) this.get(booking.getId());
    this.remove(tempBooking);
   
    if(!this.isVacant(booking.getRoom(),booking.getBeginDate() , booking.getFinishDate())){
      this.add(tempBooking);
      return false;
View Full Code Here

Examples of it.hotel.model.booking.Booking

     */
  protected Map referenceData(HttpServletRequest req,
      Object command, Errors errors, int page) throws Exception {
    Map map = new HashMap();
    String id = req.getParameter("id");
    Booking booking = (Booking) bookingManager.get(Integer.parseInt(id));
    roomTemp = booking.getRoom();
    ArrayList<Structure> hotels = new ArrayList<Structure>();
    hotels.add(booking.getStructure());
   
    if(page==0){
     
   
    ArrayList<Room> rooms = new ArrayList<Room>();
   
    ArrayList<Typology> typologies = new ArrayList<Typology>();
    rooms = (ArrayList) roomManager.getRoomsFromStructure(booking.getStructure().getId());
   
    typologies = (ArrayList) typologyManager.getTypologiesFromStructure(booking.getStructure().getId());
    map.put("rooms", rooms);
    map.put("hotels", hotels);
    map.put("typologies", typologies);
    }
    if(page==1){
View Full Code Here

Examples of it.hotel.model.booking.Booking

  protected ModelAndView processFinish(HttpServletRequest arg0,
      HttpServletResponse arg1, Object command, BindException arg3)
  throws Exception {
    this.setProperties(command);
    BookingDTO booking = (BookingDTO) command;
    Booking tempBooking = (Booking) bookingManager.get(booking.getId());
    bookingManager.remove(tempBooking);
    GregorianCalendar begindateCalendar = booking.getBeginDate();
    GregorianCalendar finishdateCalendar = booking.getFinishDate();
    if(!bookingManager.isVacant(booking.getRoom(), begindateCalendar, finishdateCalendar)){
      tempBooking.setId(0);
      bookingManager.add(tempBooking);
      return new ModelAndView(getFailurePage(), "roomNumber", booking.getRoom().getNumber());
    }else{
      booking.setId(0);
            Booking newBooking = createBookingFromBookingDTO(booking);
     
      bookingManager.add(newBooking);
    }   
    return new ModelAndView(getSuccessView());
   
View Full Code Here

Examples of org.jboss.seam.example.booking.Booking

         {
            assert getValue("#{booking.user}")!=null;
            assert getValue("#{booking.hotel}")!=null;
            assert getValue("#{booking.creditCard}")==null;
            assert getValue("#{booking.creditCardName}")==null;
            Booking booking = (Booking) Contexts.getConversationContext().get("booking");
            assert booking.getHotel()==Contexts.getConversationContext().get("hotel");
            assert booking.getUser()==Contexts.getSessionContext().get("user");
            assert Manager.instance().isLongRunningConversation();
         }
        
      }.run();
     
           
      new FacesRequest("/book.xhtml", id) {
        
         @Override @SuppressWarnings("deprecation")
         protected void updateModelValues()
         { 
            Date now = new Date();
            setValue("#{booking.checkinDate}", now);
            setValue("#{booking.checkoutDate}", now);
         }

         @Override
         protected void invokeApplication()
         {
            assert invokeMethod("#{hotelBooking.setBookingDates}")==null;
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            FacesMessage message = (FacesMessage) messages.next();
            assert message.getSummary().equals("Check out date must be later than check in date");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {
        
         @Override @SuppressWarnings("deprecation")
         protected void updateModelValues()
         {
            Calendar cal = Calendar.getInstance();
            cal.add(Calendar.DAY_OF_MONTH, 2);
            setValue("#{booking.checkoutDate}", cal.getTime() );
         }

         @Override
         protected void invokeApplication()
         {
            assert "rooms".equals(invokeMethod("#{hotelBooking.setBookingDates}"));
         }

         @Override
         protected void renderResponse()
         {
             assert Manager.instance().isLongRunningConversation();
         }
        
      }.run();
     
      new FacesRequest("/rooms.xhtml", id)
      {

         @Override
         protected void renderResponse()
         {
            assert getValue("#{booking.user}")!=null;
            assert getValue("#{booking.hotel}")!=null;
            assert getValue("#{booking.checkinDate}")!=null;
            assert getValue("#{booking.checkoutDate}")!=null;
            assert getValue("#{booking.roomPreference}").equals(getValue("#{hotel.standardRoom}"));
            assert getValue("#{booking.creditCard}")==null;
            assert getValue("#{booking.creditCardName}")==null;
           
            assert getValue("#{availableRooms.rowCount}").equals(new Integer(2));
            DataModel availableRooms = (DataModel) getValue("#{availableRooms}");
            availableRooms.setRowIndex(0);
            assert "Cozy Room".equals(getValue("#{availableRooms.rowData.name}"));
            availableRooms.setRowIndex(1);
            assert "Spectacular Room".equals(getValue("#{availableRooms.rowData.name}"));
         }
        
      }.run();
     
      final String nestedId = new FacesRequest("/rooms.xhtml", id)
      {
        
         @Override
         protected void applyRequestValues()
         {
            DataModel availableRooms = (DataModel) getValue("#{availableRooms}");
            availableRooms.setRowIndex(0);
         }

         @Override
         protected void invokeApplication()
         {
            assert getValue("#{booking.roomPreference}")!=null;
            assert "Cozy Room".equals(getValue("#{booking.roomPreference.name}"));
            assert "payment".equals(invokeAction("#{roomPreference.selectPreference}"));
            System.out.println("here");
         }
        
         @Override
         protected void renderResponse()
         {
            assert Manager.instance().isLongRunningConversation();
            assert Manager.instance().isNestedConversation();
         }
        
      }.run();
     
      System.out.println(id + "/" + nestedId);
      // Hmm, need this to move to the new, nested, conversation
      // TODO This is probably a bug in SeamTest, not sure where
      new NonFacesRequest("/payment.xhtml", nestedId)
      {
        
         @Override
         protected void renderResponse()
         {
            System.out.println("here");
            assert Manager.instance().isLongRunningConversation();
            assert Manager.instance().isNestedConversation();
           
            assert getValue("#{booking.user}")!=null;
            assert getValue("#{booking.hotel}")!=null;
            assert getValue("#{booking.checkinDate}")!=null;
            assert getValue("#{booking.checkoutDate}")!=null;
            assert getValue("#{booking.roomPreference}")!=null;
            assert getValue("#{booking.creditCard}")==null;
            assert getValue("#{booking.creditCardName}")==null;
         }
        
      }.run();
     
      new FacesRequest("/payment.xhtml", nestedId)
      {

         @Override
         protected void processValidations()
         {
            validateValue("#{booking.creditCard}", "123");
            assert isValidationFailure();
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            assert ( (FacesMessage) messages.next() ).getSummary().equals("Credit card number must 16 digits long");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
            assert Manager.instance().isNestedConversation();
         }
        
      }.run();
     
      new FacesRequest("/payment.xhtml", nestedId)
      {

         @Override
         protected void processValidations()
         {
            validateValue("#{booking.creditCardName}", "");
            assert isValidationFailure();
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            assert ( (FacesMessage) messages.next() ).getSummary().equals("Credit card name is required");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
            assert Manager.instance().isNestedConversation();
         }
        
      }.run();

      new FacesRequest("/payment.xhtml", nestedId)
      {
         @Override
         protected void updateModelValues()
         {
            setValue("#{booking.creditCard}", "1234567891021234");
            setValue("#{booking.creditCardName}", "GAVIN KING");
         }
        
         @Override
         protected void invokeApplication()
         {
            assert "confirm".equals(invokeAction("#{roomPreference.requestConfirmation}"));
         }
        
         @Override
         protected void renderResponse()
         {
            assert Manager.instance().isLongRunningConversation();
            assert Manager.instance().isNestedConversation();
         }
        
      }.run();
     
      new FacesRequest("/confirm.xhtml", nestedId) {

         @Override
         protected void invokeApplication()
         {
            invokeMethod("#{hotelBooking.confirm}");
         }
        
      }.run();
     
      new NonFacesRequest("/main.xhtml") {

         @Override
         protected void renderResponse()
         {
            ListDataModel bookings = (ListDataModel) getInstance("bookings");
            assert bookings.getRowCount()==1;
            bookings.setRowIndex(0);
            Booking booking = (Booking) bookings.getRowData();
            assert booking.getHotel().getCity().equals("NY");
            assert booking.getUser().getUsername().equals("gavin");
            assert !Manager.instance().isLongRunningConversation();
         }
        
      }.run();
     
View Full Code Here

Examples of org.jboss.seam.example.booking.Booking

         {
            assert getValue("#{booking.user}")!=null;
            assert getValue("#{booking.hotel}")!=null;
            assert getValue("#{booking.creditCard}")==null;
            assert getValue("#{booking.creditCardName}")==null;
            Booking booking = (Booking) Contexts.getConversationContext().get("booking");
            assert booking.getHotel()==Contexts.getConversationContext().get("hotel");
            assert booking.getUser()==Contexts.getSessionContext().get("user");
            assert Manager.instance().isLongRunningConversation();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {

         @Override
         protected void processValidations() throws Exception
         {
            validateValue("#{booking.creditCard}", "123");
            assert isValidationFailure();
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            assert ( (FacesMessage) messages.next() ).getSummary().equals("Credit card number must 16 digits long");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert !isInvokeApplicationBegun();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {

         @Override
         protected void processValidations() throws Exception
         {
            validateValue("#{booking.creditCardName}", "");
            assert isValidationFailure();
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            assert ( (FacesMessage) messages.next() ).getSummary().equals("Credit card name is required");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert !isInvokeApplicationBegun();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {
        
         @Override @SuppressWarnings("deprecation")
         protected void updateModelValues() throws Exception
        
            setValue("#{booking.creditCard}", "1234567891021234");
            setValue("#{booking.creditCardName}", "GAVIN KING");
            setValue("#{booking.beds}", 2);
            Date now = new Date();
            setValue("#{booking.checkinDate}", now);
            setValue("#{booking.checkoutDate}", now);
         }

         @Override
         protected void invokeApplication()
         {
            assert invokeAction("#{hotelBooking.setBookingDetails}")==null;
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            FacesMessage message = (FacesMessage) messages.next();
            assert message.getSummary().equals("Check out date must be later than check in date");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert isInvokeApplicationComplete();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {
        
         @Override @SuppressWarnings("deprecation")
         protected void updateModelValues() throws Exception
         {
            Calendar cal = Calendar.getInstance();
            cal.add(Calendar.DAY_OF_MONTH, 2);
            setValue("#{booking.checkoutDate}", cal.getTime() );
         }

         @Override
         protected void invokeApplication()
         {
            invokeAction("#{hotelBooking.setBookingDetails}");
         }

         @Override
         protected void renderResponse()
         {
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert isInvokeApplicationComplete();
         }
        
      }.run();
     
      new FacesRequest("/confirm.xhtml", id) {

         @Override
         protected void invokeApplication()
         {
            invokeAction("#{hotelBooking.confirm}");
         }
        
         @Override
         protected void afterRequest()
         {
            assert isInvokeApplicationComplete();
         }
        
      }.run();
     
      new NonFacesRequest("/main.xhtml") {

         @Override
         protected void renderResponse()
         {
            ListDataModel bookings = (ListDataModel) getInstance("bookings");
            assert bookings.getRowCount()==1;
            bookings.setRowIndex(0);
            Booking booking = (Booking) bookings.getRowData();
            assert booking.getHotel().getCity().equals("NY");
            assert booking.getUser().getUsername().equals("gavin");
            assert !Manager.instance().isLongRunningConversation();
         }
        
      }.run();
     
View Full Code Here

Examples of org.jboss.seam.example.booking.Booking

         {
            assert getValue("#{booking.user}")!=null;
            assert getValue("#{booking.hotel}")!=null;
            assert getValue("#{booking.creditCard}")==null;
            assert getValue("#{booking.creditCardName}")==null;
            Booking booking = (Booking) Contexts.getConversationContext().get("booking");
            assert booking.getHotel()==Contexts.getConversationContext().get("hotel");
            assert booking.getUser()==Contexts.getSessionContext().get("user");
            assert Manager.instance().isLongRunningConversation();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {

         @Override
         protected void processValidations() throws Exception
         {
            validateValue("#{booking.creditCard}", "123");
            assert isValidationFailure();
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            assert ( (FacesMessage) messages.next() ).getSummary().equals("Credit card number must 16 digits long");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert !isInvokeApplicationBegun();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {

         @Override
         protected void processValidations() throws Exception
         {
            validateValue("#{booking.creditCardName}", "");
            assert isValidationFailure();
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            assert ( (FacesMessage) messages.next() ).getSummary().equals("Credit card name is required");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert !isInvokeApplicationBegun();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {
        
         @Override @SuppressWarnings("deprecation")
         protected void updateModelValues() throws Exception
        
            setValue("#{booking.creditCard}", "1234567891021234");
            setValue("#{booking.creditCardName}", "GAVIN KING");
            setValue("#{booking.beds}", 2);
            Date now = new Date();
            setValue("#{booking.checkinDate}", now);
            setValue("#{booking.checkoutDate}", now);
         }

         @Override
         protected void invokeApplication()
         {
            assert invokeAction("#{hotelBooking.setBookingDetails}")==null;
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            FacesMessage message = (FacesMessage) messages.next();
            assert message.getSummary().equals("Check out date must be later than check in date");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert isInvokeApplicationComplete();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {
        
         @Override @SuppressWarnings("deprecation")
         protected void updateModelValues() throws Exception
         {
            Calendar cal = Calendar.getInstance();
            cal.add(Calendar.DAY_OF_MONTH, 2);
            setValue("#{booking.checkoutDate}", cal.getTime() );
         }

         @Override
         protected void invokeApplication()
         {
            invokeAction("#{hotelBooking.setBookingDetails}");
         }

         @Override
         protected void renderResponse()
         {
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert isInvokeApplicationComplete();
         }
        
      }.run();
     
      new FacesRequest("/confirm.xhtml", id) {

         @Override
         protected void invokeApplication()
         {
            invokeAction("#{hotelBooking.confirm}");
         }
        
         @Override
         protected void afterRequest()
         {
            assert isInvokeApplicationComplete();
         }
        
      }.run();
     
      new NonFacesRequest("/main.xhtml") {

         @Override
         protected void renderResponse()
         {
            ListDataModel bookings = (ListDataModel) getInstance("bookings");
            assert bookings.getRowCount()==1;
            bookings.setRowIndex(0);
            Booking booking = (Booking) bookings.getRowData();
            assert booking.getHotel().getCity().equals("NY");
            assert booking.getUser().getUsername().equals("gavin");
            assert !Manager.instance().isLongRunningConversation();
         }
        
      }.run();
     
View Full Code Here

Examples of org.jboss.seam.example.hibernate.Booking

         {
            assert getValue("#{booking.user}")!=null;
            assert getValue("#{booking.hotel}")!=null;
            assert getValue("#{booking.creditCard}")==null;
            assert getValue("#{booking.creditCardName}")==null;
            Booking booking = (Booking) Contexts.getConversationContext().get("booking");
            assert booking.getHotel()==Contexts.getConversationContext().get("hotel");
            assert booking.getUser()==Contexts.getSessionContext().get("user");
            assert Manager.instance().isLongRunningConversation();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {

         @Override
         protected void processValidations() throws Exception
         {
            validateValue("#{booking.creditCard}", "123");
            assert isValidationFailure();
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            assert ( (FacesMessage) messages.next() ).getSummary().equals("Credit card number must 16 digits long");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert !isInvokeApplicationBegun();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {

         @Override
         protected void processValidations() throws Exception
         {
            validateValue("#{booking.creditCardName}", "");
            assert isValidationFailure();
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            assert ( (FacesMessage) messages.next() ).getSummary().equals("Credit card name is required");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert !isInvokeApplicationBegun();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {
        
         @Override @SuppressWarnings("deprecation")
         protected void updateModelValues() throws Exception
        
            setValue("#{booking.creditCard}", "1234567891021234");
            setValue("#{booking.creditCardName}", "GAVIN KING");
            setValue("#{booking.beds}", 2);
            Date now = new Date();
            setValue("#{booking.checkinDate}", now);
            setValue("#{booking.checkoutDate}", now);
         }

         @Override
         protected void invokeApplication()
         {
            assert invokeAction("#{hotelBooking.setBookingDetails}")==null;
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            FacesMessage message = (FacesMessage) messages.next();
            assert message.getSummary().equals("Check out date must be later than check in date");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert isInvokeApplicationComplete();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {
        
         @Override @SuppressWarnings("deprecation")
         protected void updateModelValues() throws Exception
         {
            Calendar cal = Calendar.getInstance();
            cal.add(Calendar.DAY_OF_MONTH, 2);
            setValue("#{booking.checkoutDate}", cal.getTime() );
         }

         @Override
         protected void invokeApplication()
         {
            invokeAction("#{hotelBooking.setBookingDetails}");
         }

         @Override
         protected void renderResponse()
         {
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert isInvokeApplicationComplete();
         }
        
      }.run();
     
      new FacesRequest("/confirm.xhtml", id) {

         @Override
         protected void invokeApplication()
         {
            invokeAction("#{hotelBooking.confirm}");
         }
        
         @Override
         protected void afterRequest()
         {
            assert isInvokeApplicationComplete();
         }
        
      }.run();
     
      new NonFacesRequest("/main.xhtml") {

         @Override
         protected void renderResponse()
         {
            ListDataModel bookings = (ListDataModel) getInstance("bookings");
            assert bookings.getRowCount()==1;
            bookings.setRowIndex(0);
            Booking booking = (Booking) bookings.getRowData();
            assert booking.getHotel().getCity().equals("NY");
            assert booking.getUser().getUsername().equals("gavin");
            assert !Manager.instance().isLongRunningConversation();
         }
        
      }.run();
     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.