Package fr.ippon.tatami.domain

Examples of fr.ippon.tatami.domain.Group


        Status status = (Status) abstractStatus;
        // Group check
        boolean hiddenStatus = false;
        if (status.getGroupId() != null) {
            statusDTO.setGroupId(status.getGroupId());
            Group group = groupService.getGroupById(statusUser.getDomain(), statusDTO.getGroupId());
            // if this is a private group and the user is not part of it, he cannot see the status
            if (!group.isPublicGroup() && !usergroups.contains(group)) {
                hiddenStatus = true;
            } else {
                statusDTO.setPublicGroup(group.isPublicGroup());
                statusDTO.setGroupName(group.getName());
            }
        }

        if (!hiddenStatus) {
            if (status.getHasAttachments() != null && status.getHasAttachments()) {
View Full Code Here


        String groupId = groupRepository.createGroup(domain);
        groupDetailsRepository.createGroupDetails(groupId, name, description, publicGroup);
        groupMembersRepository.addAdmin(groupId, currentUser.getLogin());
        groupCounterRepository.incrementGroupCounter(domain, groupId);
        userGroupRepository.addGroupAsAdmin(currentUser.getLogin(), groupId);
        Group group = getGroupById(domain, groupId);
        searchService.addGroup(group);
    }
View Full Code Here

    private Collection<Group> getGroupDetails(User currentUser, Collection<String> groupIds) {
        String domain = DomainUtil.getDomainFromLogin(currentUser.getLogin());
        Collection<Group> groups = new TreeSet<Group>();
        for (String groupId : groupIds) {
            Group group = internalGetGroupById(domain, groupId);
            groups.add(group);
        }
        return groups;
    }
View Full Code Here

        User currentUser = authenticationService.getCurrentUser();
        return getGroupsWhereUserIsAdmin(currentUser);
    }

    private Group internalGetGroupById(String domain, String groupId) {
        Group group = groupRepository.getGroupById(domain, groupId);
        Group groupDetails = groupDetailsRepository.getGroupDetails(groupId);
        group.setName(groupDetails.getName());
        group.setPublicGroup(groupDetails.isPublicGroup());
        group.setArchivedGroup(groupDetails.isArchivedGroup());
        group.setDescription(groupDetails.getDescription());
        long counter = groupCounterRepository.getGroupCounter(domain, groupId);
        group.setCounter(counter);
        return group;
    }
View Full Code Here

            if (isGroupManagedByCurrentUser(group)) {
                group.setAdministrator(true);
                group.setMember(true);
            }
            else if(group.isPublicGroup()) {
                Group result = getGroupFromUser(user, group.getGroupId());
                if (result != null) {
                    group.setMember(true);
                }
            }
            else {
                Group result = getGroupFromUser(user, group.getGroupId());
                if (result == null) {
                    log.info("Permission denied! User {} tried to access group ID = {} ", user.getLogin(), group.getGroupId());
                    return null;
                } else {
                    group.setMember(true);
View Full Code Here

        return buildGroupIds(currentUser, groupId);
    }

    public Group buildGroupIds(User user, String groupId) {
        String domain = DomainUtil.getDomainFromLogin(user.getLogin());
        Group group = getGroupById(domain, groupId);
        return buildGroup(group);
    }
View Full Code Here

        Collection<Group> groups = groupService.getGroupsForUser(user);
        assertEquals(1, groups.size());

        String groupId = groups.iterator().next().getGroupId();

        Group group = groupService.getGroupById("ippon.fr", groupId);
        assertEquals(groupName, group.getName());
        assertEquals(groupDescription, group.getDescription());
        assertTrue(group.isPublicGroup());
        assertFalse(group.isArchivedGroup());
    }
View Full Code Here

        boolean publicGroup = true;
        groupService.createGroup(groupName, groupDescription, publicGroup);
        Collection<Group> groups = groupService.getGroupsForUser(user);
        assertEquals(1, groups.size());

        Group group = groups.iterator().next();
        assertEquals(groupName, group.getName());
        assertEquals(groupDescription, group.getDescription());
        assertTrue(group.isPublicGroup());
        assertFalse(group.isArchivedGroup());
    }
View Full Code Here

        String groupDescription = "Group description";
        boolean publicGroup = true;
        groupService.createGroup(groupName, groupDescription, publicGroup);
        Collection<Group> groups = groupService.getGroupsForUser(user);
        assertEquals(1, groups.size());
        Group group = groups.iterator().next();
        String groupId = group.getGroupId();

        User member = userService.getUserByLogin("userWhoPostStatus@ippon.fr");

        assertEquals(1, groupService.getGroupsForUser(user).size());
        assertEquals(0, groupService.getGroupsForUser(member).size());
View Full Code Here

        boolean publicGroup = true;
        groupService.createGroup(groupName, groupDescription, publicGroup);
        Collection<Group> groups = groupService.getGroupsForUser(user);
        assertEquals(userGroupSize + 1, groups.size());

        Group group = groups.iterator().next();

        Collection<StatusDTO> groupStatuses = timelineService.getGroupline(group.getGroupId(), 10, null, null);
        assertEquals(0, groupStatuses.size());

        for (int i = 0; i < 12; i++) {
            String content = "temporary status " + i;
            statusUpdateService.postStatusToGroup(content, group, new ArrayList<String>(), "1,2");
        }

        groupStatuses = timelineService.getGroupline(group.getGroupId(), 10, null, null);
        assertEquals(10, groupStatuses.size());
        Iterator<StatusDTO> iterator = groupStatuses.iterator();
        for (int i = 11; i >= 2; i--) {
            StatusDTO temporaryStatus = iterator.next();
            assertEquals("temporary status " + i, temporaryStatus.getContent());
            timelineService.removeStatus(temporaryStatus.getStatusId());
        }

        groupStatuses = timelineService.getGroupline(group.getGroupId(), 10, null, null);
        assertEquals(2, groupStatuses.size());

        // Clean up
        groupService.removeMemberFromGroup(user, group);
        assertEquals(userGroupSize, groupService.getGroupsForUser(user).size());
View Full Code Here

TOP

Related Classes of fr.ippon.tatami.domain.Group

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.