Package org.apache.webbeans.reservation.entity

Examples of org.apache.webbeans.reservation.entity.User


        this.entityManager.remove(res);
    }
   
    public List<Reservation> getReservations(int id)
    {
        User user = this.entityManager.find(User.class, id);
       
        Set<Reservation> res = user.getReservations();
       
        List<Reservation> l = new ArrayList<Reservation>();
        for(Reservation r : res)
        {
            l.add(r);
View Full Code Here


    public Set<Hotel> getReservationsWithUser(int userId)
    {
        Query query = this.entityManager.createQuery("select u from User u where u.id=:id");
        query.setParameter("id", userId);
       
        User user = (User)query.getSingleResult();
       
        Set<Hotel> hotels = new HashSet<Hotel>();
       
        Set<Reservation> reservations = user.getReservations();
       
        for(Reservation reserve : reservations)
        {
            hotels.add(reserve.getHotel());
        }
View Full Code Here

        {
            logger.debug("Registering is failed. User name and password can not be null");
            return null;
        }
       
        User user = new User();
       
        user.setUserName(userName);
        user.setPassword(password);
        user.setName(name);
        user.setSurname(surname);
        user.setAge(age);
        user.setRegisterDate(CalendarUtil.getCurrentDate());
        user.setAdmin(admin);
       
        entityManager.persist(user);
       
       
        return user;
View Full Code Here

                                            "p.password=:password");
       
        query.setParameter("userName", userName);
        query.setParameter("password", password);
       
        User value = null;
        try
        {
            value =(User)query.getSingleResult();
            value.setLastLoginDate(GregorianCalendar.getInstance().getTime());
        }
        catch(Exception e)
        {
            return null;
        }
View Full Code Here

            JSFUtility.addErrorMessage("User name and password fields can not be empty", "");
           
            return null;
        }
       
        User result = loginController.checkLogin(userName, password);
       
        if(result == null)
        {
            JSFUtility.addErrorMessage("Login failed!,User name or password is not correct. Try again!", "");
           
            return null;
        }
       
        User user = result;
       
        //Fire Event
        LoggedInEvent event = new LoggedInEvent(user);
        loggedInEvent.fire(event);
       
       
        if(user.isAdmin())
        {
            return "adminHome";
        }
       
        return "userHome";
View Full Code Here

        {
            logger.debug("Registering is failed. User name and password can not be null");
            return null;
        }
       
        User user = new User();
       
        user.setUserName(userName);
        user.setPassword(password);
        user.setName(name);
        user.setSurname(surname);
        user.setAge(age);
        user.setRegisterDate(CalendarUtil.getCurrentDate());
        user.setAdmin(admin);
       
        entityManager.persist(user);
       
       
        return user;
View Full Code Here

                                                "p.password=:password");
       
        query.setParameter("userName", userName);
        query.setParameter("password", password);
       
        User value = null;
        try
        {
            value =(User)query.getSingleResult();
            value.setLastLoginDate(GregorianCalendar.getInstance().getTime());
        }
        catch(Exception e)
        {
            return null;
        }
View Full Code Here

        String pathInfo = context.getExternalContext().getRequestServletPath();
       
        if(pathInfo.startsWith("/admin") || pathInfo.startsWith("/user"))
        {
            SessionTracker tracker = null;
            User user = null;
            try
            {
                tracker = (SessionTracker)context.getApplication().evaluateExpressionGet(context, "#{sessionTracker}", SessionTracker.class);
                user = tracker.getUser();
               
View Full Code Here

        System.out.println("Pre Destroy Construct Sample .... " + UserController.class.getName() + " is destroyed by the container");
    }
   
    public User getUser(int id)
    {
        User user = this.entityManager.find(User.class, id);
       
        return user;
    }
View Full Code Here

    @Transactional
    public void updateUserInfo(int userId, String name, String surname, int age, String userName, String password)
    {
        logger.debug("Updating user with id : " + userId);
       
        User user = this.entityManager.find(User.class, userId);
       
        user.setName(name);
        user.setSurname(surname);
        user.setAge(age);
        user.setUserName(userName);
        user.setPassword(password);
    }
View Full Code Here

TOP

Related Classes of org.apache.webbeans.reservation.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.