Package cz.muni.fi.pa165.stis.dto

Examples of cz.muni.fi.pa165.stis.dto.OrderTO


        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

    @Test
    public void testGet() {
        order.setId(1L);
        orderTO.setId(1L);
        when(dao.get(1L)).thenReturn(order);
        OrderTO ot = orderService.get(1L);
       
        assertEquals(ot, orderTO);
    }
View Full Code Here

        return new RedirectResolution(this.getClass(), "list");
    }
   
    public Resolution delete() {
        Long id = Long.parseLong(getContext().getRequest().getParameter("order.id"));
        OrderTO ot = service.get(id);
        logger.debug("delete() {}", ot);
        //
        service.remove(ot);
        //
        return new RedirectResolution(OrderActionBean.class, "list");
View Full Code Here

    }
   
    public Resolution done() {
        Date date = new Date();
        Long id = Long.parseLong(getContext().getRequest().getParameter("order.id"));
        OrderTO ot = service.get(id);
        ot.setOrderServicedDate(date);
        logger.debug("done() {}", ot);
        service.update(ot);
        //
        return new RedirectResolution(OrderActionBean.class, "list");
    }
View Full Code Here

    }

    public Resolution paid() {
        Date date = new Date();
        Long id = Long.parseLong(getContext().getRequest().getParameter("order.id"));
        OrderTO ot = service.get(id);
        ot.setOrderPaidDate(date);
        logger.debug("paid() {}", ot);
        service.update(ot);
        //
        return new RedirectResolution(OrderActionBean.class, "list");
    }
View Full Code Here

TOP

Related Classes of cz.muni.fi.pa165.stis.dto.OrderTO

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.