Package controller

Examples of controller.BookManager



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)
    {
      Customer cus = loanTest.getCustomer();
      System.out.println(loanTest.getBook().getTitle()+""+cus.getName());
    }
   
   
    loan = linkController.deleteLoan(loan);
    book = linkController.deleteBook(book);
    customer = linkController.deleteCustomer(customer);
   
  }
View Full Code Here



public class testAddBookLoanCustomerUpdate {
  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)
    {
      Customer cus = loanTest.getCustomer();
      System.out.println(loanTest.getBook().getTitle()+""+cus.getName());
    }
   
    customer.setName("Francis");
   
    linkController.updateCustomer(customer);
  }
View Full Code Here


public class testAddBookLoanCustomerUpdate {
  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)
    {
      Customer cus = loanTest.getCustomer();
      System.out.println(loanTest.getBook().getTitle()+""+cus.getName());
    }
   
    customer.setName("Francis");
   
    linkController.updateCustomer(customer);
  }
View Full Code Here


public class test {
  public static void main(String[] args)
  {
    BookManager linkController = new BookManager();
   
    // setup new book with some simple sample data and add to the database
    Book book = new Book();
    book.setAuthor("Margaret Mitchell");
    book.setTitle("Gone wyth the wind");

    // link the book with a new genre record
    Genre genre = new Genre();
    genre.setGenre("Clssic");
    genre.setBook(book); // create book genre link
   
    // add book and genre to the database
    book = linkController.add(book);
    genre = linkController.add(genre);
   
    // update the title of the book to correct spelling error
    book.setTitle("Gone with the wind");   
    book = linkController.update(book);

    genre.setGenre("Classic");
    genre = linkController.update(genre);
   
   
    linkController.delete(genre); // delete dependent child genre data first
    linkController.delete(book); // delete parent book record
   
    List <Object[]> bookRevisions = linkController.getHistoricalBook(book.getBookId());

    for(Object[] revisionData: bookRevisions)
    {   
      Book temp = (Book) revisionData[0]; // note use of array notation to retrieve historical records
      DefaultRevisionEntity rev = (DefaultRevisionEntity) revisionData[1];
View Full Code Here


public class testAddBookLoanCustomerCascadeDelete {
  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();
   
    loan.setBook(book);
    loan.setCustomer(customer);
   
    loan = linkController.addLoan(loan);
    loan = linkController.deleteLoan(loan);

  }
View Full Code Here


public class testAddBookLoanCustomerCascadeDelete {
  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();
   
    loan.setBook(book);
    loan.setCustomer(customer);
   
    loan = linkController.addLoan(loan);
    loan = linkController.deleteLoan(loan);

  }
View Full Code Here


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 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();
   
    loan.setBook(book);
    loan.setCustomer(customer);
   
    loan = linkController.addLoan(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)
    {
      Customer cus = loanTest.getCustomer();
      System.out.println(loanTest.getBook().getTitle()+""+cus.getName());
    }
   
   
    loan = linkController.deleteLoan(loan);
    book = linkController.deleteBook(book);
    customer = linkController.deleteCustomer(customer);
   
  }
View Full Code Here

TOP

Related Classes of controller.BookManager

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.