Package fr.ippon.tatami.domain

Examples of fr.ippon.tatami.domain.User


    public Collection<UserGroupDTO> getMembersForGroup(String groupId, String login) {
        Map<String, String> membersMap = groupMembersRepository.findMembers(groupId);
        Collection<String> friendLogins = friendRepository.findFriendsForUser(login);
        Collection<UserGroupDTO> userGroupDTOs = new TreeSet<UserGroupDTO>();
        for (Map.Entry<String, String> member : membersMap.entrySet()) {
            User user = userRepository.findUserByLogin(member.getKey());
            if(user != null) { //User might be deleted
                UserGroupDTO dto = new UserGroupDTO();
                dto.setLogin(user.getLogin());
                dto.setUsername(user.getUsername());
                dto.setAvatar(user.getAvatar());
                dto.setFirstName(user.getFirstName());
                dto.setLastName(user.getLastName());
                dto.setRole(member.getValue());
                dto.setActivated(user.getActivated());
                if (friendLogins.contains(user.getLogin())) {
                    dto.setFriend(true);
                }
                if (login.equals(user.getLogin())) {
                    dto.setYou(true);
                }
                userGroupDTOs.add(dto);
            }
        }
View Full Code Here


        String login = "nuser_ippon.fr";
        String firstName = "eeee";
        String lastName = "12345678901234567";
        String avatar = "newAvatar";

        User user = new User();
        user.setLogin(login);
        user.setFirstName(firstName);
        user.setLastName(lastName);
        user.setAvatar(avatar);

        userRepository.updateUser(user);
    }
View Full Code Here

        String firstName = null;
        String lastName = "User";
        String email = "nuser_ippon.fr";
        String avatar = "newAvatar";

        User user = new User();
        user.setLogin(login);
        user.setFirstName(firstName);
        user.setLastName(lastName);
        user.setAvatar(avatar);

        userRepository.updateUser(user);
    }
View Full Code Here

        Preconditions.checkNotNull(userWanted);
        Preconditions.checkNotNull(userWanted.getLogin());

        Map<String, String> membersMap = groupMembersRepository.findMembers(groupId);
        for (Map.Entry<String, String> member : membersMap.entrySet()) {
            User user = userRepository.findUserByLogin(member.getKey());
            if (user != null && userWanted.getLogin().equals(user.getLogin())) {
                UserGroupDTO dto = new UserGroupDTO();
                dto.setLogin(user.getLogin());
                dto.setUsername(user.getUsername());
                dto.setAvatar(user.getAvatar());
                dto.setFirstName(user.getFirstName());
                dto.setLastName(user.getLastName());
                dto.setRole(member.getValue());
                return dto;
            }
        }
        return null;
View Full Code Here

    @Test
    public void shouldFollowUser() {

        mockAuthentication("userWhoWantToFollow@ippon.fr");

        User userWhoWillBeFollowed = new User();
        userWhoWillBeFollowed.setLogin("userWhoWillBeFollowed@ippon.fr");
        userService.createUser(userWhoWillBeFollowed);
        userWhoWillBeFollowed.setDailyDigestSubscription(false);
        userWhoWillBeFollowed.setWeeklyDigestSubscription(false);
        userService.updateUser(userWhoWillBeFollowed);

        User userWhoFollow = userService.getUserByUsername("userWhoWantToFollow");
        assertThat(userWhoFollow.getFriendsCount(), is(0L));

        assertTrue(friendshipService.followUser("userWhoWillBeFollowed"));

        /* verify */
        userWhoFollow = userService.getUserByUsername("userWhoWantToFollow");
        assertThat(userWhoFollow.getFriendsCount(), is(1L));

        User userWhoIsFollowed = userService.getUserByUsername("userWhoWillBeFollowed");
        assertThat(userWhoIsFollowed.getFollowersCount(), is(1L));

        // Clean up
        friendshipService.unfollowUser("userWhoWillBeFollowed");
    }
View Full Code Here

        String firstName = "";
        String lastName = "User";
        String email = "nuser_ippon.fr";
        String avatar = "newAvatar";

        User user = new User();
        user.setLogin(login);
        user.setFirstName(firstName);
        user.setLastName(lastName);
        user.setAvatar(avatar);

        userRepository.updateUser(user);
    }
View Full Code Here

        }
        return groups;
    }

    public Collection<Group> getGroupsWhereCurrentUserIsAdmin() {
        User currentUser = authenticationService.getCurrentUser();
        return getGroupsWhereUserIsAdmin(currentUser);
    }
View Full Code Here

        }
    }


    public Collection<Group> buildGroupList(Collection<Group> groups) {
        User currentUser = authenticationService.getCurrentUser();
        return buildGroupList(currentUser, groups);
    }
View Full Code Here

        return groups;
    }

    public Group buildGroup(Group group) {
        User currentUser = authenticationService.getCurrentUser();
        return buildGroup(currentUser, group);
    }
View Full Code Here

        mockAuthentication("userWhoWantToFollow@ippon.fr");

        assertFalse(friendshipService.followUser("unknownUser"));

        /* verify */
        User userWhoFollow = userService.getUserByUsername("userWhoWantToFollow");
        assertThat(userWhoFollow.getFriendsCount(), is(0L));
    }
View Full Code Here

TOP

Related Classes of fr.ippon.tatami.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.