@Test public void testExecuteWithSystemAdmin() { final List<Long> adminIds = new ArrayList<Long>(); adminIds.add(TEST_PARENT_ORG_COORDINATOR_USER_ID); context.checking(new Expectations() { { oneOf(adminIdsMapper).execute(null); will(returnValue(adminIds)); } }); Set<Long> results = sut.execute(TEST_PARENT_ORG_COORDINATOR_USER_ID); assertNotNull(results); assertTrue(results.contains(TEST_PRIVATE_GROUP_ID)); }
@Override public Set<Long> execute(final Long inUserId) { Set<Long> groupIds = new HashSet<Long>(); List<Long> adminPersonIds = systemAdminIdsMapper.execute(null); if (adminPersonIds.contains(inUserId)) { groupIds.addAll(allPrivateGroupsMapper.execute(null)); } else { groupIds.addAll(privateGroupIdsMapper.execute(inUserId)); } return groupIds; }
GetPrivateGroupsByUserId extends ReadMapper<Long, Set<Long>> { @Override public Set<Long> execute(final Long inUserId) { Set<Long> groupIds = new HashSet<Long>(); List<Long> adminPersonIds = systemAdminIdsMapper.execute(null); if (adminPersonIds.contains(inUserId)) { groupIds.addAll(allPrivateGroupsMapper.execute(null)); } else { groupIds.addAll(privateGroupIdsMapper.execute(inUserId)); } return groupIds; } }
GetPrivateGroupsByUserId extends ReadMapper<Long, Set<Long>> { @Override public Set<Long> execute(final Long inUserId) { Set<Long> groupIds = new HashSet<Long>(); List<Long> adminPersonIds = systemAdminIdsMapper.execute(null); if (adminPersonIds.contains(inUserId)) { groupIds.addAll(allPrivateGroupsMapper.execute(null)); } else { groupIds.addAll(privateGroupIdsMapper.execute(inUserId)); } return groupIds; } GetPrivateGroupsByUserId(final GetPrivateGroupIdsCoordinatedByPerson inPrivateGroupIdsMapper,
            final DomainMapper<Serializable, List<Long>> inAllPrivateGroupIdsMapper,
            final DomainMapper<Serializable, List<Long>> inSystemAdminIdsMapper); }
GetPrivateGroupsByUserId extends ReadMapper<Long, Set<Long>> { @Override public Set<Long> execute(final Long inUserId) { Set<Long> groupIds = new HashSet<Long>(); List<Long> adminPersonIds = systemAdminIdsMapper.execute(null); if (adminPersonIds.contains(inUserId)) { groupIds.addAll(allPrivateGroupsMapper.execute(null)); } else { groupIds.addAll(privateGroupIdsMapper.execute(inUserId)); } return groupIds; } GetPrivateGroupsByUserId(final GetPrivateGroupIdsCoordinatedByPerson inPrivateGroupIdsMapper,
            final DomainMapper<Serializable, List<Long>> inAllPrivateGroupIdsMapper,
            final DomainMapper<Serializable, List<Long>> inSystemAdminIdsMapper); @Override Set<Long> execute(final Long inUserId); }
GetPrivateGroupsByUserId extends ReadMapper<Long, Set<Long>> { @Override public Set<Long> execute(final Long inUserId) { Set<Long> groupIds = new HashSet<Long>(); List<Long> adminPersonIds = systemAdminIdsMapper.execute(null); if (adminPersonIds.contains(inUserId)) { groupIds.addAll(allPrivateGroupsMapper.execute(null)); } else { groupIds.addAll(privateGroupIdsMapper.execute(inUserId)); } return groupIds; } GetPrivateGroupsByUserId(final GetPrivateGroupIdsCoordinatedByPerson inPrivateGroupIdsMapper,
            final DomainMapper<Serializable, List<Long>> inAllPrivateGroupIdsMapper,
            final DomainMapper<Serializable, List<Long>> inSystemAdminIdsMapper); @Override Set<Long> execute(final Long inUserId);  }