Package cz.muni.fi.pa165.library.web_layer.adminPages.Reader

Examples of cz.muni.fi.pa165.library.web_layer.adminPages.Reader.EditReader


    }
  
    public void testFindReservationByID() {     
        em.getTransaction().begin();
      
        Reservation reservation1 = new Reservation(em.find(Reader.class, new Long(1)),
                em.find(Book.class, new Long(8)), new Date(System.currentTimeMillis()));
        Reservation reservation2 = new Reservation(em.find(Reader.class, 1l),
                em.find(Book.class, new Long(9)), new Date(System.currentTimeMillis()));
        em.persist(reservation1);
        em.persist(reservation2);
      
        em.getTransaction().commit();
      
        reservation1.setReservationID(new Long(1));
        reservation2.setReservationID(new Long(2));
      
        assertEquals(reservation1, reservationDAOImpl.findReservationByID(new Long(1)));
        assertEquals(reservation2, reservationDAOImpl.findReservationByID(new Long(2)));
      
        if (em != null) {
View Full Code Here


    }
  
    public void testFindReservationsByReader() {     
        em.getTransaction().begin();
      
        Reservation reservation1 = new Reservation(em.find(Reader.class, new Long(1)),
                em.find(Book.class, new Long(8)), new Date(System.currentTimeMillis()));
        Reservation reservation2 = new Reservation(em.find(Reader.class, new Long(1)),
                em.find(Book.class, new Long(9)), new Date(System.currentTimeMillis()));
        em.persist(reservation1);
        em.persist(reservation2);
      
        em.getTransaction().commit();
View Full Code Here

    }
  
    public void testFindReservationByBook() {     
        em.getTransaction().begin();
      
        Reservation reservation1 = new Reservation(em.find(Reader.class, new Long(1)),
                em.find(Book.class, new Long(8)), new Date(System.currentTimeMillis()));
        Reservation reservation2 = new Reservation(em.find(Reader.class, new Long(1)),
                em.find(Book.class, new Long(9)), new Date(System.currentTimeMillis()));
        em.persist(reservation1);
        em.persist(reservation2);
      
        em.getTransaction().commit();
View Full Code Here

    }
  
    public void testDeleteReservation() {
        em.getTransaction().begin();
      
        Reservation reservation1 = new Reservation(em.find(Reader.class, new Long(1)),
                em.find(Book.class, new Long(8)), new Date(System.currentTimeMillis()));
        Reservation reservation2 = new Reservation(em.find(Reader.class, new Long(1)),
                em.find(Book.class, new Long(9)), new Date(System.currentTimeMillis()));
        em.persist(reservation1);
        em.persist(reservation2);
      
        em.getTransaction().commit();
View Full Code Here

        try {
            emf = Persistence.createEntityManagerFactory("testPU");
            em = emf.createEntityManager();
            readerDAOImpl = new ReaderDAOImpl();
            bookDAOImpl = new BookDAOImpl();
            reservationDAOImpl = new ReservationDAOImpl();
            reservationDAOImpl.setEntityManager(em);
          
            createReaderData();
            createBookData();
            book = new Book("Da Vinciho kod", "Dan Brown", Genre.DRAMA, "2005", "USA",
View Full Code Here

    public ShowBorrowReader(final PageParameters parameters) {
  super(parameters);
        BorrowService borrowService = (BorrowService) ApplicationContextProvider.getApplicationContext().getBean("borrowService");
        RepeatingView repeating = new RepeatingView("repeating");
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
        AuthenticatedSession session = ((AuthenticatedSession)Session.get());
        for (BorrowTO borrow : borrowService.findBorrowsByReader(session.getReader())) {
            for (BookTO book: borrow.getTitlesTO()){
                AbstractItem item = new AbstractItem(repeating.newChildId());
                item.add(new Label("title", book.getTitle()));     
                item.add(new Label("author", book.getAuthor()));
                item.add(new Label("borrowdate", dateFormat.format(borrow.getBorrowDate())));
View Full Code Here

            if (list.contains(book)){
                Link link = new Link("edit"){
                      @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);
View Full Code Here

       
        RepeatingView repeating = new RepeatingView("repeating");
        add(repeating);
        ReservationService reservationService = (ReservationService) ApplicationContextProvider.getApplicationContext().getBean("reservationService");
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
        AuthenticatedSession session = ((AuthenticatedSession)Session.get());
        List<ReservationTO> list = reservationService.findReservationsByReader(session.getReader());
        if(list != null){
            for (ReservationTO reservation : list) {
                AbstractItem item = new AbstractItem(repeating.newChildId());
                PageParameters pageParameters = new PageParameters();
                item.add(new BookmarkablePageLink<Void>("delete", ShowAllReservation.class, pageParameters));
View Full Code Here

        if (session.getUser()!=null){
            add(new Label("user",session.getUser()));
            add(new Label("login",new Model("")));
           add(new BookmarkablePageLink<>("logout", Logout.class));
           if (session.getCheckAdmin()){
                add(new MenuAdminPanel("menuPanel"));
            }else {
                add(new MenuReaderPanel("menuPanel"));
            }
        }else {
            add(new Label("user",""));
View Full Code Here

            add(new Label("login",new Model("")));
           add(new BookmarkablePageLink<>("logout", Logout.class));
           if (session.getCheckAdmin()){
                add(new MenuAdminPanel("menuPanel"));
            }else {
                add(new MenuReaderPanel("menuPanel"));
            }
        }else {
            add(new Label("user",""));
            add(new BookmarkablePageLink<>("login", Login.class));
            add(new Label("logout",new Model("")));
View Full Code Here

TOP

Related Classes of cz.muni.fi.pa165.library.web_layer.adminPages.Reader.EditReader

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.