Package model

Examples of model.Book


public class testAddBookLoanCustomer {
  public static void main(String[] args)
  {
    BookManager linkController = new BookManager();
   
    Book book = new Book();
    book.setAuthor("John Casey");
    book.setTitle("Book1");
    book.setGenre("Technology");
   
    Customer customer = new Customer();
    customer.setName("Jacob");
   
    Loan loan = new Loan();
    loan.setBook(book);
    loan.setCustomer(customer);
   
    book = linkController.addBook(book);
    customer = linkController.addCustomer(customer);
    loan = linkController.addLoan(loan);

    Book bookTest = linkController.getBook(book.getBookId());
    List<Loan> associatedLoans = bookTest.getLoans();
   
    // iterate through the book -> loan -> customer mappings
    // these mappings have been pre-loaded inside the linkController.getBook() method
    for(Loan loanTest: associatedLoans)
    {
View Full Code Here


public class testAddBookLoanCustomerCascadeAdd {
  public static void main(String[] args)
  {
    BookManager linkController = new BookManager();

    Book book = new Book();
    book.setAuthor("John Casey");
    book.setTitle("Java Hibernate");
    book.setGenre("Fun");
   
    Customer customer = new Customer();
    customer.setName("Peter");
   
    Loan loan = new Loan();
View Full Code Here

public class testAddBookLoanCustomerCascadeAdd {
  public static void main(String[] args)
  {
    BookManager linkController = new BookManager();

    Book book = new Book();
    book.setAuthor("John Casey");
    book.setTitle("Java Hibernate");
    book.setGenre("Fun");
   
    Customer customer = new Customer();
    customer.setName("Peter");
   
    Loan loan = new Loan();
View Full Code Here

public class testAddBookLoanCustomerDelete {
  public static void main(String[] args)
  {
    BookManager linkController = new BookManager();
   
    Book book = new Book();
    book.setAuthor("John Casey");
    book.setTitle("Book1");
    book.setGenre("Technology");
   
    book = linkController.addBook(book);
   
    Customer customer = new Customer();
    customer.setName("Jacob");
   
    customer = linkController.addCustomer(customer);
   
    Loan loan = new Loan();
    loan.setBook(book);
    loan.setCustomer(customer);
   
    loan = linkController.addLoan(loan);
   
    Book bookTest = linkController.getBook(book.getBookId());
    List<Loan> associatedLoans = bookTest.getLoans();
   
    // iterate through the book -> loan -> customer mappings
    // these mappings have been pre-loaded inside the linkController.getBook() method
    for(Loan loanTest: associatedLoans)
    {
View Full Code Here

    //r�cup�ration de l'ID du book pass�e en param�tre de la requ�te
    String bookID = request.getParameter("bookId");
    //conversion du param String -> Long
    Long longBookID = Long.parseLong(bookID);
    //on retrouve le Book associ� � l'ID r�cup�r�
    Book book = em.find(Book.class, longBookID);
   
    //on set le type de r�ponse qui sera retourn�e par la servlet
    response.setContentType("image/jpeg");
    //on lie l'output stream avec la r�ponse de la servlet
    OutputStream outPS = new BufferedOutputStream(response.getOutputStream());
    //on �crit dans l'output stream le contenu d�sir�
    outPS.write(book.getPhoto());
    //on ferme l'outputStream une fois utilis�e
    outPS.close();
  }
View Full Code Here

      /*r�cup�ration de l'ID du book pass�e en param�tre de la requ�te
      conversion du param String -> Long*/
      String bookID = request.getParameter("bookId");
      Long longBookID = Long.parseLong(bookID);
      /*on retrouve le Book associ� � l'ID r�cup�r�*/
      Book book = em.find(Book.class, longBookID);
     
      /*si le param�tre addOne est sett� dans la requ�te...
       * on retrouve le panier dans le scope de session
       * et on ajoute l'ouvrage
       */
 
View Full Code Here

    Author author3 = new Author();
    author3.setFirstName("J-K");
    author3.setLastName("Rowling");
    entityManager.persist(author3);

    Book book = new Book();
    book.setTitle("HTML 5 et CSS 3");
    book.setCategory(category1);

    book.setPrice(new java.math.BigDecimal("10.50"));
    book.setDate(now);
    book.addAuthor(author1);
    File f = new File("WebContent/resources/images/html.jpg");
    byte[] photo = new byte[(int) (f.length())];
    FileInputStream fi = new FileInputStream(f);
    fi.read(photo);
    book.setPhoto(photo);
    entityManager.persist(book);

    book = new Book();
    book.setTitle("Hibernate in action");
    book.setCategory(category1);
    book.setPrice(new java.math.BigDecimal("30.50"));
    book.setDate(now);
    book.addAuthor(author1);
    book.addAuthor(author2);
    f = new File("WebContent/resources/images/hibernate.jpg");
    photo = new byte[(int) (f.length())];
    fi = new FileInputStream(f);
    fi.read(photo);
    book.setPhoto(photo);
    entityManager.persist(book);

    book = new Book();
    book.setTitle("Harry Potter");
    book.setCategory(category2);
    book.setPrice(new java.math.BigDecimal("20.50"));
    book.setDate(now);
    book.addAuthor(author3);
    f = new File("WebContent/resources/images/harry.jpg");
    photo = new byte[(int) (f.length())];
    fi = new FileInputStream(f);
    fi.read(photo);
    book.setPhoto(photo);
    entityManager.persist(book);

    Client user = new Client();
    user.setLogin("galland");
    user.setPassword("dauphine");
View Full Code Here

   
    /*r�cup�ration de l'ID du book pass�e en param�tre de la requ�te
    conversion du param String -> Long*/
    String bookID = request.getParameter("bookId");
    Long longBookID = Long.parseLong(bookID);
    Book book = em.find(Book.class, longBookID);
   
    /*
     * r�cup�ration du panier dans la session HTTP
     */
    Order panier = (Order)request.getSession().getAttribute("panier");
View Full Code Here

    @Test
    public void byTitle() {
        List<Book> books = service.findBooksByTitle("East of Eden");
        assertEquals(1, books.size());

        Book book = books.get(0);
        assertEquals("Steinbeck", book.getAuthor().getLastName());
    }
View Full Code Here

    @Test
    public void byAuthor() {
        List<Book> books = service.findBooksByAuthor("Mann");
        assertEquals(1, books.size());

        Book book = books.get(0);
        assertEquals("Buddenbrooks", book.getTitle());
    }
View Full Code Here

TOP

Related Classes of model.Book

Copyright © 2018 www.massapicom. 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.