add(repeating);
List<BookTO> list = bookService.findAllAvailableBooks();
for (final BookTO book : bookService.findAllBooks()) {
AbstractItem item = new AbstractItem(repeating.newChildId());
PageParameters pageParameters = new PageParameters();
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);
}
}
};
item.add(link);
//item.add(new BookmarkablePageLink<Void>("edit", BookReservation.class, pageParameters));
}else {
item.add(new Label("edit", new Model("")));
}
item.add(new Label("title", book.getTitle()));
item.add(new Label("author", book.getAuthor()));
item.add(new Label("genre", String.valueOf(book.getGenre())));
item.add(new Label("publicationYear", String.valueOf(book.getPublicationYear())));
item.add(new Label("publicationPlace", book.getPublicationPlace()));
item.add(new Label("publisher", book.getPublisher()));
item.add(new Label("ISBN", book.getISBN()));
item.add(new Label("status", String.valueOf(book.getStatus())));
item.add(new Label("availability", String.valueOf(book.getAvailability())));
repeating.add(item);
}
BookmarkablePageLink homeLink = new BookmarkablePageLink<>(
"home", HomePage.class);