Package org.richfaces.photoalbum.model

Examples of org.richfaces.photoalbum.model.User


     * @return List of images that are shared or belongs to user, that perform search
     */
    public Query getQuery(EntityManager em, Map<String, Object> params, String searchQuery) {
        Query query = em.createQuery(Constants.SEARCH_IMAGE_QUERY + Constants.SEARCH_IMAGE_BOTH_ADDON);
        query.setParameter(Constants.QUERY_PARAMETER, Constants.PERCENT + searchQuery.toLowerCase() + Constants.PERCENT);
        User user = (User) params.get(Constants.USER_PARAMETER);
        if (null == user) {
            return null;
        }
        query.setParameter(Constants.LOGIN_PARAMETER, user.getLogin());
        return query;
    }
View Full Code Here


     * @return List of shelves, that belongs to user, that perform search
     */
    public Query getQuery(EntityManager em, Map<String, Object> params, String searchQuery) {
        Query query = em.createQuery(Constants.SEARCH_SHELVES_QUERY + Constants.SEARCH_SHELF_MY_ADDON);
        query.setParameter(Constants.QUERY_PARAMETER, Constants.PERCENT + searchQuery.toLowerCase() + Constants.PERCENT);
        User user = (User) params.get(Constants.USER_PARAMETER);
        if (null == user) {
            return null;
        }
        query.setParameter(Constants.LOGIN_PARAMETER, user.getLogin());
        return query;
    }
View Full Code Here

     * @return List of albums that are shared or belongs to user, that perform search
     */
    public Query getQuery(EntityManager em, Map<String, Object> params, String searchQuery) {
        Query query = em.createQuery(Constants.SEARCH_ALBUM_QUERY + Constants.SEARCH_ALBUM_BOTH_ADDON);
        query.setParameter(Constants.QUERY_PARAMETER, Constants.PERCENT + searchQuery.toLowerCase() + Constants.PERCENT);
        User user = (User) params.get(Constants.USER_PARAMETER);
        if (null == user) {
            return null;
        }
        query.setParameter(Constants.LOGIN_PARAMETER, user.getLogin());
        return query;
    }
View Full Code Here

     * @return List of images, that belongs to user, that perform search
     */
    public Query getQuery(EntityManager em, Map<String, Object> params, String searchQuery) {
        Query query = em.createQuery(Constants.SEARCH_IMAGE_QUERY + Constants.SEARCH_IMAGE_MY_ADDON);
        query.setParameter(Constants.QUERY_PARAMETER, Constants.PERCENT + searchQuery.toLowerCase() + Constants.PERCENT);
        User user = (User) params.get(Constants.USER_PARAMETER);
        if (null == user) {
            return null;
        }
        query.setParameter(Constants.LOGIN_PARAMETER, user.getLogin());
        return query;
    }
View Full Code Here

     * @return List of albums, that belongs to user, that perform search
     */
    public Query getQuery(EntityManager em, Map<String, Object> params, String searchQuery) {
        Query query = em.createQuery(Constants.SEARCH_ALBUM_QUERY + Constants.SEARCH_ALBUM_MY_ADDON);
        query.setParameter(Constants.QUERY_PARAMETER, Constants.PERCENT + searchQuery.toLowerCase() + Constants.PERCENT);
        User user = (User) params.get(Constants.USER_PARAMETER);
        if (null == user) {
            return null;
        }
        query.setParameter(Constants.LOGIN_PARAMETER, user.getLogin());
        return query;
    }
View Full Code Here

                // This check is actual only on livedemo server to prevent hacks.
                // Check if pre-defined user login.
                if (Environment.isInProduction() && user.isPreDefined()) {
                    // If true assume that login failed
                    loginFailed();
                    user = new User();
                    return false;
                }
                addToTracker(user.getId());
                // Raise event to controller to update Model
                event.select(new EventTypeQualifier(Events.AUTHENTICATED_EVENT)).fire(new SimpleEvent());
View Full Code Here

                    addToTracker(user.getId());
                    return true;
                }

                // Facebook id was not found, creating new account
                User newUser = new User();

                newUser.setFbId(facebookId);
                newUser.setFirstName(userInfo.getString("first_name"));
                newUser.setSecondName(userInfo.getString("last_name"));
                newUser.setEmail(userInfo.getString("email"));

                String username = userInfo.has("username") ? userInfo.getString("username") : userInfo.getString("first_name");
                newUser.setLogin(username);

                String sex = userInfo.getString("gender");
                newUser.setSex(sex.equals("male") ? Sex.MALE : Sex.FEMALE);

                SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
                newUser.setBirthDate(sdf.parse(userInfo.getString("birthday")));

                // random password, the user will not be using this to log in
                newUser.setPasswordHash(HashUtils.hash("facebook" + System.currentTimeMillis()));

                userAction.register(newUser);

                userBean.facebookLogIn(facebookId);
            } else {
View Full Code Here

                if (user != null) {
                    addToTracker(user.getId());
                    return true;
                }

                User newUser = new User();

                newUser.setgPlusId(gPlusId);
                newUser.setFirstName(userInfo.getJSONObject("name").getString("givenName"));
                newUser.setSecondName(userInfo.getJSONObject("name").getString("familyName"));
                newUser.setEmail(userInfo.optString("email", "mail@mail.com"));

                String username = userInfo.optString("nickname", newUser.getFirstName());
                newUser.setLogin(username);

                String sex = userInfo.getString("gender");
                newUser.setSex(sex.equals("male") ? Sex.MALE : Sex.FEMALE);

                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                String birthday = userInfo.optString("birthday", "1900-01-01");
                newUser.setBirthDate(sdf.parse(birthday));

                // random password, the user will not be using this to log in
                newUser.setPasswordHash(HashUtils.hash("gPlus" + System.currentTimeMillis()));

                userAction.register(newUser);

                userBean.gPlusLogIn(gPlusId);
            } else {
View Full Code Here

     * Method, that invoked when user want to go to the registration screen
     *
     */
    public void goToRegister() {
        // create new User object
        user = new User();
        setLoginFailed(false);
        // raise event to controller to prepare Model.
        event.select(new EventTypeQualifier(Events.START_REGISTER_EVENT)).fire(new SimpleEvent());
    }
View Full Code Here

     * @return List of shelves that are shared or belongs to user, that perform search
     */
    public Query getQuery(EntityManager em, Map<String, Object> params, String searchQuery) {
        Query query = em.createQuery(Constants.SEARCH_SHELVES_QUERY + Constants.SEARCH_SHELF_BOTH_ADDON);
        query.setParameter(Constants.QUERY_PARAMETER, Constants.PERCENT + searchQuery.toLowerCase() + Constants.PERCENT);
        User user = (User) params.get(Constants.USER_PARAMETER);
        if (null == user) {
            return null;
        }
        query.setParameter(Constants.LOGIN_PARAMETER, user.getLogin());
        return query;
    }
View Full Code Here

TOP

Related Classes of org.richfaces.photoalbum.model.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.