Package com.gwtplatform.carstore.server.dao.domain

Examples of com.gwtplatform.carstore.server.dao.domain.UserSession


        this.userDao = userDao;
    }

    public String createSessionCookie(UserDto userDto) {
        String cookie = UUID.randomUUID().toString();
        UserSession userSession = new UserSession(userDto.getId(), cookie);
        put(userSession);

        logger.info("UserSessionDao.createLoggedInCookie(user) user=" + userDto + " userSessionCookie="
                + userSession.getCookie());

        return userSession.getCookie();
    }
View Full Code Here


        return userSession.getCookie();
    }

    public void removeLoggedInCookie(UserDto userDto) {
        UserSession userSession = findUserSession(userDto.getId());
        if (userSession != null) {
            delete(userSession);
        }

        logger.info("UserSessionDao.removeLoggedInCookie(user): Cookie is removed from database.");
View Full Code Here

    }

    public UserDto getUserFromCookie(String loggedInCookie) {
        Date twoWeeksAgo = getTwoWeeksAgo();

        UserSession userSession = ofy().query(UserSession.class)
                .filter("cookie", loggedInCookie)
                .filter("dateCreated > ", twoWeeksAgo)
                .first().now();
       
        if (userSession == null) {
            return null;
        }
       
        Long userId = userSession.getUserId();

        UserDto userDto = null;
        if (userId != null) {
            userDto = User.createDto(userDao.get(userId));
        }
View Full Code Here

TOP

Related Classes of com.gwtplatform.carstore.server.dao.domain.UserSession

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.