Beispiel #1
0
  @Action
  public Response processConfirmBooking(
      String confirm,
      String id,
      String checkinDate,
      String checkoutDate,
      String beds,
      String smoking,
      String creditCard,
      String creditCardName,
      String creditCardExpiryMonth,
      String creditCardExpiryYear) {
    Hotel hotel = Hotel.findById(id);
    User user = User.find(login.getUserName(), null);
    Booking booking = new Booking(hotel, user);
    booking.checkinDate = checkinDate;
    booking.checkoutDate = checkoutDate;
    booking.beds = Integer.parseInt(beds);
    booking.smoking = Boolean.valueOf(smoking);
    booking.creditCard = creditCard;
    booking.creditCardName = creditCardName;
    booking.creditCardExpiryMonth = Integer.parseInt(creditCardExpiryMonth);
    booking.creditCardExpiryYear = Integer.parseInt(creditCardExpiryYear);

    //      validation.valid(booking);

    /*
           // Errors or revise
           if(validation.hasErrors() || params.get("revise") != null) {
               render("@book", hotel, booking);
           }

           // Confirm
    */
    if (confirm != null) {
      booking.create();
      flash.setSuccess(
          "Thank you, "
              + login.getUserName()
              + ", your confimation number for "
              + hotel.name
              + " is "
              + booking.id);
      return Hotels_.index();
    } else {
      // Display booking
      return Hotels_.confirmBooking(
          id,
          checkinDate,
          checkoutDate,
          beds,
          smoking,
          creditCard,
          creditCardName,
          creditCardExpiryMonth,
          creditCardExpiryYear);
    }
  }
Beispiel #2
0
 @Test
 public void testUpdate() {
   Login login = LoginFactory.createLogin("Jarryd", "Deane");
   Login logincopy =
       new Login.Builder(login.getUserName(), login.getPassword())
           .copy(login)
           .password("12345")
           .build();
   Assert.assertEquals(logincopy.getUserName(), "Jarryd");
   Assert.assertEquals(logincopy.getPassword(), "12345");
 }
Beispiel #3
0
  public static void main(String[] args) {
    System.out.println("hello client");
    init();
    System.out.println("Connecting to server...");
    connect();
    if (serverPortal == null) {
      System.out.println("did not find active server");
      System.exit(1);
    }

    boolean connected = false;
    do {
      try {
        userSession = new Login(serverPortal);
        connected = userSession.login();
      } catch (RemoteException ex) {
        reconnect(ex);
      }
    } while (!connected);

    String localPath = userSession.getSyncPath();
    String tempPath = userSession.getMetaPath();
    String userName = userSession.getUserName();
    String device = userSession.getDeviceID();
    String dataPath = tempPath + "filelist.obj";

    try {
      boolean recursive = false;
      watchService = new WatchDir(localPath, recursive, userName, device, dataPath);

    } catch (IOException ex) {
      System.out.println("HI IO");
      System.out.println(ex.getMessage());
    }
    new Thread(watchService).start();
    sync = new Sync(userName, device, serverPortal, localPath, tempPath, dataPath);
    sync.setClientFileList(watchService.loadFileList());
    startSync();
  }
Beispiel #4
0
 @Test
 public void testCreate() {
   Login login = LoginFactory.createLogin("Jarryd", "Deane");
   Assert.assertEquals(login.getUserName(), "Jarryd");
   Assert.assertEquals(login.getPassword(), "Deane");
 }
Beispiel #5
0
 @View
 public void index() {
   String username = login.getUserName();
   List<Booking> bookings = Booking.findByUser(username);
   index.with().bookings(bookings).render();
 }