Package org.openblend.fejstbuk.domain

Examples of org.openblend.fejstbuk.domain.User


            Set<Like> likes = post.getLikes();
            if (likes != null) {
                likes.remove(like);
            }
        }
        User user = like.getUser();
        if (user != null) {
            Set<Like> likes = user.getLikes();
            if (likes != null) {
                likes.remove(like);
            }
        }
    }
View Full Code Here


*/
@RequestScoped
@Named("profile")
public class Profile extends AbstractUI {
    public String addFriend(long friendId) {
        User friend = em.find(User.class, friendId);
        dao.addFriend(current, friend);
        return "home.xhtml";
    }
View Full Code Here

        dao.addFriend(current, friend);
        return "home.xhtml";
    }

    public String removeFriend(long friendId) {
        User friend = em.find(User.class, friendId);
        dao.removeFriend(current, friend);
        return "home.xhtml";
    }
View Full Code Here

    public void setPassword(String password) {
        this.password = password;
    }

    public String register() {
        User u = new User();
        u.setName(name);
        u.setSurname(lastName);
        u.setEmail(email);
        u.setAge(age);
        u.setGender(Gender.valueOf(gender));
        u.setLocation(country);
        String hashed = SecurityUtils.hash(email, password);
        u.setPassword(hashed);
        boolean created = dao.createUser(u);
        if (!created) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Email is registered already. Try choose another :)"));
        }
        System.out.println("user created");
View Full Code Here

    public boolean isLogged() {
        return (current != null);
    }

    public boolean login(String username, String password) {
        User user = dao.findUser(username);
        if (user != null) {
            String hashed = SecurityUtils.hash(username, password);
            if (hashed.equals(user.getPassword())) {
                current = user;
            }
        }
        return (current != null);
    }
View Full Code Here

    public Set<User> getFriends() {
        return current.getFriends();
    }

    public Set<User> getFriends(long userId) {
        User user = em.find(User.class, userId);
        return user.getFriends();
    }
View Full Code Here

TOP

Related Classes of org.openblend.fejstbuk.domain.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.