super(parameters);
RepeatingView repeating = new RepeatingView("repeating");
add(repeating);
ReaderService readerService = (ReaderService) ApplicationContextProvider.getApplicationContext().getBean("readerService");
for (ReaderTO reader : readerService.findAllReaders()) {
AbstractItem item = new AbstractItem(repeating.newChildId());
PageParameters pageParameters = new PageParameters();
pageParameters.add("readerId", reader.getId());
item.add(new BookmarkablePageLink<Void>("edit", EditReader.class, pageParameters));
item.add(new BookmarkablePageLink<Void>("delete", ShowAllReader.class, pageParameters));
item.add(new Label("firstName", reader.getFirstName()));
item.add(new Label("surname", reader.getSurname()));
item.add(new Label("birthNumber", reader.getBirthNumber()));
item.add(new Label("address", reader.getAddress()));
item.add(new Label("email", reader.getEmail()));
item.add(new Label("telephoneNumber", reader.getTelephoneNumber()));
item.add(new BookmarkablePageLink<Void>("reserve", EditReservation.class, pageParameters));
repeating.add(item);
}
StringValue readerId = parameters.get("readerId");
if (!readerId.isEmpty()) {
readerService.deleteReader(readerService.findReaderById(readerId.toLong()));
setResponsePage(ShowAllReader.class);
}
BookmarkablePageLink addReaderLink = new BookmarkablePageLink<>(
"addReader", EditReader.class);