Examples of BookTO


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

    public static BookTO convertBookEntityToTO(Book book) {
        if (book == null) {
            return null;
        }
        BookTO bookTO = new BookTO(book.getTitle(), book.getAuthor(), book.getGenre(), book.getPublicationYear(), book.getPublicationPlace(), book.getPublisher(), book.getISBN(), book.getState(), book.getAvailability());
        bookTO.setId(book.getId());
        return bookTO;
    }
View Full Code Here

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

    }

    private void parseBook(List<BookTO> list) {
        Iterator it = list.listIterator();
        while (it.hasNext()) {
            BookTO bookTO = (BookTO) it.next();
            Object[] bookRow = {
                bookTO.getId(), bookTO.getAuthor(), bookTO.getTitle(), bookTO.getISBN(), bookTO.getAvailability(), bookTO.getGenre(),
                bookTO.getPublicationPlace(), bookTO.getPublicationYear(), bookTO.getPublisher(), bookTO.getStatus()
            };
            model.addRow(bookRow);
        }
    }
View Full Code Here

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

    }

    private JPanel updateBook() {
        Long id = (Long) model.getValueAt(table.getSelectedRow(), 0);
        createPanel = new JPanel();
        book = new BookTO();
        try {
            book = bookWebService.findBookById(id);
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(bookPanel, "Cannot update book.\nServer connection problem.",
                    "Oops!", JOptionPane.ERROR_MESSAGE);
View Full Code Here

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

                if (publisherField.getText().equals("")) {
                    publisherField.setBackground(Color.getHSBColor(243, 102, 78));
                    check = false;
                }
                if (check) {
                    BookTO book = new BookTO();
                    book.setAuthor(authorField.getText());
                    book.setTitle(titleField.getText());
                    book.setISBN(isbnField.getText());
                    book.setAvailability(Available.AVAILABLE);
                    book.setGenre(Genre.valueOf(genreField.getSelectedItem().toString()));
                    book.setPublicationPlace(publicationPlaceField.getText());
                    book.setPublicationYear(publicationYearField.getText());
                    book.setPublisher(publisherField.getText());
                    book.setStatus(State.NEW);
                    try {
                        bookWebService.createBook(book);
                        Object[] arr = {
                            book.getId(), book.getAuthor(), book.getTitle(), book.getISBN(), book.getAvailability(), book.getGenre(),
                            book.getPublicationPlace(), book.getPublicationYear(), book.getPublisher(), book.getStatus()
                        };
                        model.addRow(arr);
                    } catch (Exception ex) {
                        JOptionPane.showMessageDialog(bookPanel, "Cannot create book.\nServer connection problem.",
                                "Oops!", JOptionPane.ERROR_MESSAGE);
View Full Code Here

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

    public EditBook(final PageParameters parameters) {
  super(parameters);
        BookService bookService = (BookService) ApplicationContextProvider.getApplicationContext().getBean("bookService");
        StringValue bookId = parameters.get("bookId");
        if (bookId.isEmpty()) {
           book = new BookTO();
           add(new Label("titleMessage", new Model("Create book")));
        } else {
            book = bookService.findBookById(bookId.toLong());
            add(new Label("titleMessage", new Model("Edit book")));
        }
View Full Code Here

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

                      @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
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.