Package monashbook.models

Examples of monashbook.models.Category


                + "finalist The Plague of Doves with The Round House, transporting readers to the Ojibwe reservation in North Dakota. ");
        book15.setImageUrl("/MonashBook-war/resources/img/book15.jpg");
        book15.setAvailability(true);
       
        // Create dummy Categories
        Category category1 = new Category();
        category1.setCategory("Social Sciences");
        Category category2 = new Category();
        category2.setCategory("History");
        Category category3 = new Category();
        category3.setCategory("Fiction");
        Category category4 = new Category();
        category4.setCategory("Love and Romance");
        Category category5 = new Category();
        category5.setCategory("Science");
       
        // Add the categories to the database
        bookService.addCategory(category1);
        bookService.addCategory(category2);
        bookService.addCategory(category3);
        bookService.addCategory(category4);
        bookService.addCategory(category5);
       
        // Get the categories from the database and add them to the category list of each book
        Category category1FromDb = bookService.getAllCategories().get(0);
        Category category2FromDb = bookService.getAllCategories().get(1);
        Category category3FromDb = bookService.getAllCategories().get(2);
        Category category4FromDb = bookService.getAllCategories().get(3);
        Category category5FromDb = bookService.getAllCategories().get(4);
       
        book1.getCategories().add(bookService.getAllCategories().get(1));
        book2.getCategories().add(bookService.getAllCategories().get(0));
        book3.getCategories().add(bookService.getAllCategories().get(2));
        book4.getCategories().add(bookService.getAllCategories().get(3));
        book4.getCategories().add(bookService.getAllCategories().get(4));
        book5.getCategories().add(bookService.getAllCategories().get(2));
        book6.getCategories().add(bookService.getAllCategories().get(3));
        book6.getCategories().add(bookService.getAllCategories().get(4));
        book7.getCategories().add(bookService.getAllCategories().get(4));
        book8.getCategories().add(bookService.getAllCategories().get(2));
        book8.getCategories().add(bookService.getAllCategories().get(3));
        book9.getCategories().add(bookService.getAllCategories().get(1));
        book9.getCategories().add(bookService.getAllCategories().get(2));
        book10.getCategories().add(bookService.getAllCategories().get(2));
        book11.getCategories().add(bookService.getAllCategories().get(3));
        book12.getCategories().add(bookService.getAllCategories().get(0));
        book13.getCategories().add(bookService.getAllCategories().get(2));
        book13.getCategories().add(bookService.getAllCategories().get(3));
        book14.getCategories().add(bookService.getAllCategories().get(1));
        book14.getCategories().add(bookService.getAllCategories().get(2));
        book14.getCategories().add(bookService.getAllCategories().get(3));
        book15.getCategories().add(bookService.getAllCategories().get(2));
       
       
        // Ensure entities are stored in each side of the relationship
       
        // Add books to the database
        bookService.addBook(book1);
        bookService.addBook(book2);
        bookService.addBook(book3);
        bookService.addBook(book4);
        bookService.addBook(book5);
        bookService.addBook(book6);
        bookService.addBook(book7);
        bookService.addBook(book8);
        bookService.addBook(book9);
        bookService.addBook(book10);
        bookService.addBook(book11);
        bookService.addBook(book12);
        bookService.addBook(book13);
        bookService.addBook(book14);
        bookService.addBook(book15);
       
        // Get the books from the database and add them to the book list of each category
        category1FromDb.getBooks().add(bookService.getAllBooks().get(1));
        category1FromDb.getBooks().add(bookService.getAllBooks().get(1));
       
        category2FromDb.getBooks().add(bookService.getAllBooks().get(0));
        category2FromDb.getBooks().add(bookService.getAllBooks().get(8));
        category2FromDb.getBooks().add(bookService.getAllBooks().get(13));
       
        category3FromDb.getBooks().add(bookService.getAllBooks().get(2));
        category3FromDb.getBooks().add(bookService.getAllBooks().get(4));
        category3FromDb.getBooks().add(bookService.getAllBooks().get(7));
        category3FromDb.getBooks().add(bookService.getAllBooks().get(8));
        category3FromDb.getBooks().add(bookService.getAllBooks().get(9));
        category3FromDb.getBooks().add(bookService.getAllBooks().get(12));
        category3FromDb.getBooks().add(bookService.getAllBooks().get(13));
        category3FromDb.getBooks().add(bookService.getAllBooks().get(14));
       
        category4FromDb.getBooks().add(bookService.getAllBooks().get(3));
        category4FromDb.getBooks().add(bookService.getAllBooks().get(5));
        category4FromDb.getBooks().add(bookService.getAllBooks().get(7));
        category4FromDb.getBooks().add(bookService.getAllBooks().get(10));
        category4FromDb.getBooks().add(bookService.getAllBooks().get(12));
        category4FromDb.getBooks().add(bookService.getAllBooks().get(13));

        category5FromDb.getBooks().add(bookService.getAllBooks().get(3));
        category5FromDb.getBooks().add(bookService.getAllBooks().get(5));
        category5FromDb.getBooks().add(bookService.getAllBooks().get(6));
       
        // Update the categories in the database
        bookService.addCategory(category1FromDb);
        bookService.addCategory(category2FromDb);
        bookService.addCategory(category3FromDb);
View Full Code Here


        Map<String, String> params = fc.getExternalContext().getRequestParameterMap();
         categories = new ArrayList<Category>();
         categories = bookService.getAllCategories();
         String category = params.get("category");
         categoryPageTitle = category;
         Category bookCategory = new Category();
         for(int i = 0; i < categories.size(); i++) {
             System.out.println(categories.get(i).getCategory());
            
             if(categories.get(i).getCategory().equals(category)) {
                 bookCategory = categories.get(i);
                 categoryBooks = bookCategory.getBooks();
             }
         }
         return "category.xhtml";
        
    }
View Full Code Here

TOP

Related Classes of monashbook.models.Category

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.