Package cz.muni.fi.pa165.stis.entity

Examples of cz.muni.fi.pa165.stis.entity.User


    public static ReservationTO convertReservationEntityToTO(Reservation reservation) {
        if (reservation == null) {
            return null;
        }
        ReservationTO reservationTO = new ReservationTO(DTOConvertor.convertReaderEntityToTO(reservation.getReader()),
                DTOConvertor.convertBookEntityToTO(reservation.getBook()), reservation.getReservationDate());
        reservationTO.setReservationID(reservation.getReservationID());
        return reservationTO;
    }
View Full Code Here


                          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);
                              setResponsePage(ShowAllBookReader.class);
                          }
                         
                    } 
View Full Code Here

    private ReaderTO reader;

    
    @Override
    public boolean authenticate(String email, String password) {
        UserService userService = (UserService) ApplicationContextProvider.getApplicationContext().getBean("userService");
        ReaderService readerService = (ReaderService) ApplicationContextProvider.getApplicationContext().getBean("readerService");
       
        UserTO user = userService.findUserByEmail(email);
        ReaderTO reader =readerService.findReaderByEmail(email);
        if (user != null) {
            if ((user.getEmail().equals(email)) && (user.getPassword().equals(password))){
                this.checkAdmin = true;
                this.user = "Admin: " + user.getFirstName() + " " + user.getLastName();
View Full Code Here

   
    public static UserTO convertUserEntityToTO(User user) {
        if (user == null) {
            return null;
        }
        UserTO userTO = new UserTO(user.getEmail(), user.getPassword(), user.getFirstName(), user.getLastName());
        userTO.setUserID(user.getUserID());
        return userTO;
    }
View Full Code Here

    @Override
    public boolean authenticate(String email, String password) {
        UserService userService = (UserService) ApplicationContextProvider.getApplicationContext().getBean("userService");
        ReaderService readerService = (ReaderService) ApplicationContextProvider.getApplicationContext().getBean("readerService");
       
        UserTO user = userService.findUserByEmail(email);
        ReaderTO reader =readerService.findReaderByEmail(email);
        if (user != null) {
            if ((user.getEmail().equals(email)) && (user.getPassword().equals(password))){
                this.checkAdmin = true;
                this.user = "Admin: " + user.getFirstName() + " " + user.getLastName();
                return true;
            }               
        }else if (reader!=null){
            if ((reader.getEmail().equals(email)) && (reader.getPassword().equals(password))){
                this.checkAdmin = false;
View Full Code Here

public class RegistrationLibrarianForm extends Template {
    private UserTO user;
   
    public RegistrationLibrarianForm(final PageParameters parameters){
        super(parameters);
        user = new UserTO();
       
        Form<?> form = new Form("form") {
            UserService userService = (UserService)ApplicationContextProvider.getApplicationContext().getBean("userService");
            @Override
            protected void onSubmit() {
View Full Code Here

            reservationDAOImpl = new ReservationDAOImpl();
            reservationDAOImpl.setEntityManager(em);
          
            createReaderData();
            createBookData();
            book = new Book("Da Vinciho kod", "Dan Brown", Genre.DRAMA, "2005", "USA",
                "Foursick", "95860948503", State.NEW, Available.AVAILABLE);
          
        } catch (Exception ex) {
            ex.printStackTrace();
            fail("Exception during JPA EntityManager instantiation.");
View Full Code Here

    public void createBookData() {
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
      
        // ID 1
        em.persist(new Book("Da Vinciho kod", "Dan Brown", Genre.DRAMA, "2005", "USA",
                "Foursick", "95860948503", State.NEW, Available.AVAILABLE));
        // ID 2
        em.persist(new Book("Cesta", "Brandon Boys", Genre.DRAMA, "2007", "Great Britain",
                "Eminent", "8072813001", State.NEW, Available.AVAILABLE));
        // ID 3
        em.persist(new Book("Peniaze", "Arnold Doughty", Genre.NOVEL, "2000", "USA",
                "Mackpublishing", "43543459834", State.USED, Available.BORROWED));
        // ID 4
        em.persist(new Book("Smely zajko v Afrike", "Ludmila Podjavorinska", Genre.ADVENTURE, "1993", "Slovakia",
                "Ikar", "49684586044", State.USED, Available.AVAILABLE));
        // ID 5
        em.persist(new Book("Kazisvet Jurko", "Lubomir Feldek", Genre.ADVENTURE, "1992", "Slovakia",
                "Mlade leta", "548684030023", State.USED, Available.RESERVED));
        // ID 6
        em.persist(new Book("Mierny vanok", "Juraj Lauko", Genre.CHILDREN, "2001", "Slovakia",
                "Ikar", "9788055151191", State.USED, Available.BORROWED));
        // ID 7
        em.persist(new Book("Neposlusny Janko", "Peter Konecny", Genre.CHILDREN, "2012", "Slovakia",
                "Mlade leta", "9788055161191", State.DAMAGED, Available.BORROWED));
        // ID 8
        em.persist(new Book("Cap zahradnik", "Anton Maly", Genre.ADVENTURE, "2011", "Slovakia",
                "Ikar", "9788055171191", State.USED, Available.RESERVED));
        // ID 9
        em.persist(new Book("Snehuliak", "Jo Nesbo", Genre.ADVENTURE, "2010", "Slovakia",
                "Mlade leta", "9788055181191", State.USED, Available.RESERVED));
      
        em.getTransaction().commit();
        em.close();
    }
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();
View Full Code Here

  
    private void createReaderData() {
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
      
        em.persist(new Reader("Anton", "Bernolak", "10.4.1875", "Bernolakovo 453, SR",
                "anton.bernolak@gmail.com", "0903 560 987", "aaa"));
        em.persist(new Reader("Martin", "Skrecok", "5.10.1990", "Jurkovicova 16, SR",
                "martin.skrecok@gmail.com", "903 875 349", "bbb"));
        em.persist(new Reader("Leon", "Powe", "20.5.1950", "Golden Street, Boston, USA",
                "leon.powe@gmail.com", "740 320 853", "ccc"));
      
        em.getTransaction().commit();
        if (em != null) {
            em.close();
View Full Code Here

TOP

Related Classes of cz.muni.fi.pa165.stis.entity.User

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.