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

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


    }
  
    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

    public void load() {
        if (getContext().getRequest().getParameter("id") == null) {
            return;
        }
        Long id = Long.parseLong(getContext().getRequest().getParameter("id"));
        CustomerUserTO cuto = cuFacade.getByCustomerId(id);
        cto = cuto.getCustomer();
        uto = cuto.getUser();

        this.setCto(cto);
        this.setUto(uto);
        logger.debug("load() \ncuto={} \ncto={} \nuto={}", cuto, cto, uto);
    }
View Full Code Here

    public Resolution save() {
        logger.debug("save() cto={} \nuto={}", this.getCto(), this.getUto());
        logger.debug("save() cto={} \nuto={}", cto, uto);
        if (uto.getPassword().equals(password2)) {
            logger.debug("save() cto={} \nid={}", cto, cto.getUser());
            cuFacade.update(new CustomerUserTO(cto, uto));           
            return new RedirectResolution("/tyre/list");
        }
        passwordError = "true";
        return new RedirectResolution("/registration/edit.jsp").addParameter("passwordError", passwordError).flash(this);
    }
View Full Code Here

            d.setUsername(restUsername);
            d.setPassword(restPassword);
           
            return d;
        }
        CustomerUserTO cUser = cuFacade.getByUsername(string);
        if (cUser == null) {
            throw new UsernameNotFoundException(string + " not found");
        }
        d.setIsAdmin(cUser.getUser().getRoleAdmin());
        if (d.getIsAdmin()) {
            d.setAuthorities(Arrays.asList(createRole("ROLE_ADMIN")));
        } else {
            d.setAuthorities(Arrays.asList(createRole("ROLE_USER")));
        }
        d.setUsername(cUser.getUser().getUsername());
        d.setPassword(cUser.getUser().getPassword());
        d.setCustomer(cUser.getCustomer());

        return d;
    }
View Full Code Here

TOP

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

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.