Examples of ReservationService


Examples of cz.muni.fi.pa165.library.api.ReservationService

            pageParameters.add("bookId", book.getId());
            if (list.contains(book)){
                Link link = new Link("edit"){
                      @Override
                      public void onClick() {
                          ReservationService reservationService = (ReservationService) ApplicationContextProvider.getApplicationContext().getBean("reservationService");
                          AuthenticatedSession session = ((AuthenticatedSession)Session.get());
                          ReaderTO reader = session.getReader();
                          BookTO book2 = bookService.findBookById(book.getId());
                          java.util.Date date = new java.util.Date();
                          if (reader != null && book != null){
                              ReservationTO reservation = new ReservationTO(reader, book2,new Timestamp(date.getTime()));
                              reservationService.insertReservation(reservation);
                              setResponsePage(ShowAllBookReader.class);
                          }
                         
                    } 
                };
View Full Code Here

Examples of cz.muni.fi.pa165.library.api.ReservationService

    public BookReservation(final PageParameters parameters) {
  super(parameters);
       
        RepeatingView repeating = new RepeatingView("repeating");
        add(repeating);
        ReservationService reservationService = (ReservationService) ApplicationContextProvider.getApplicationContext().getBean("reservationService");
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
        AuthenticatedSession session = ((AuthenticatedSession)Session.get());
        List<ReservationTO> list = reservationService.findReservationsByReader(session.getReader());
        if(list != null){
            for (ReservationTO reservation : list) {
                AbstractItem item = new AbstractItem(repeating.newChildId());
                PageParameters pageParameters = new PageParameters();
                item.add(new BookmarkablePageLink<Void>("delete", ShowAllReservation.class, pageParameters));
                pageParameters.add("reservationid", reservation.getReservationID());
                item.add(new Label("author", reservation.getBookTO().getAuthor()));
                item.add(new Label("title", reservation.getBookTO().getTitle()));
                item.add(new Label("reservationDate", dateFormat.format(reservation.getReservationDate())));
                repeating.add(item);
            }
        }
       
        //delete reservation
        StringValue reservationId = parameters.get("reservationid");
        if (!reservationId.isEmpty()) {
            reservationService.deleteReservation(reservationService.findReservationByID(reservationId.toLong()));
            setResponsePage(BookReservation.class);
        }
    }
View Full Code Here

Examples of cz.muni.fi.pa165.library.api.ReservationService

                + readerService.findReaderById(readerId.toLong()).getFirstName())));

        Form<?> form = new Form("form") {
            @Override
            protected void onSubmit() {
                ReservationService reservationService = (ReservationService) ApplicationContextProvider.getApplicationContext().getBean("reservationService");
                ReaderService readerService = (ReaderService) ApplicationContextProvider.getApplicationContext().getBean("readerService");
                java.util.Date date = new java.util.Date();
                reservation.setReservationDate(new Timestamp(date.getTime()));
                reservation.setReaderTO(readerService.findReaderById(readerId.toLong()));
                reservationService.insertReservation(reservation);
                setResponsePage(ShowAllReservation.class);
            }
        };
        add(form);
        List<BookTO> books = bookService.findAllAvailableBooks();
View Full Code Here

Examples of cz.muni.fi.pa165.library.api.ReservationService

    public ShowAllReservation(final PageParameters parameters) {
        super(parameters);

        RepeatingView repeating = new RepeatingView("repeating");
        add(repeating);
        ReservationService reservationService = (ReservationService) ApplicationContextProvider.getApplicationContext().getBean("reservationService");
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
        for (ReservationTO reservation : reservationService.findAllReservations()) {
            AbstractItem item = new AbstractItem(repeating.newChildId());
            PageParameters pageParameters = new PageParameters();
            item.add(new BookmarkablePageLink<Void>("delete", ShowAllReservation.class, pageParameters));
            pageParameters.add("reservationid", reservation.getReservationID());
            item.add(new Label("readerTO", reservation.getReaderTO().toString()));
            item.add(new Label("bookTO", reservation.getBookTO().toString()));
            item.add(new Label("reservationDate", dateFormat.format(reservation.getReservationDate())));
            repeating.add(item);
        }

        //delete reservation
        StringValue reservationId = parameters.get("reservationid");
        if (!reservationId.isEmpty()) {
            reservationService.deleteReservation(reservationService.findReservationByID(reservationId.toLong()));
            setResponsePage(ShowAllReservation.class);
        }

        BookmarkablePageLink createLink = new BookmarkablePageLink<>(
                "create", ShowAllReader.class);
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.