@Test public void testGetFollowers() { final int maxFollowers = 10; DomainGroup group = jpaGroupMapper.findByShortName("group1"); Person fordp2 = jpaPersonMapper.findByAccountId("fordp2"); Person csagan = jpaPersonMapper.findByAccountId("csagan"); PagedSet<Person> followers = jpaGroupMapper.getFollowers("group1", 0, maxFollowers); assertEquals(3, followers.getTotal()); jpaGroupMapper.addFollower(fordp2.getId(), group.getId()); jpaGroupMapper.addFollower(csagan.getId(), group.getId()); followers = jpaGroupMapper.getFollowers("group1", 0, maxFollowers); assertEquals(5, followers.getTotal()); }
public PagedSet<Person> getFollowers(final String shortName, final int start, final int end) { HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("shortName", shortName.toLowerCase()); String query = "select g.followers from DomainGroup g where g.shortName = :shortName"; PagedSet<Person> results = getTypedPagedResults(start, end, query, parameters); return results; }
DomainGroupMapper extends DomainEntityMapper<DomainGroup> implements FollowMapper, CompositeEntityMapper { public PagedSet<Person> getFollowers(final String shortName, final int start, final int end) { HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("shortName", shortName.toLowerCase()); String query = "select g.followers from DomainGroup g where g.shortName = :shortName"; PagedSet<Person> results = getTypedPagedResults(start, end, query, parameters); return results; } }
DomainGroupMapper extends DomainEntityMapper<DomainGroup> implements FollowMapper, CompositeEntityMapper { public PagedSet<Person> getFollowers(final String shortName, final int start, final int end) { HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("shortName", shortName.toLowerCase()); String query = "select g.followers from DomainGroup g where g.shortName = :shortName"; PagedSet<Person> results = getTypedPagedResults(start, end, query, parameters); return results; } DomainGroupMapper(final QueryOptimizer inQueryOptimizer); }
DomainGroupMapper extends DomainEntityMapper<DomainGroup> implements FollowMapper, CompositeEntityMapper { public PagedSet<Person> getFollowers(final String shortName, final int start, final int end) { HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("shortName", shortName.toLowerCase()); String query = "select g.followers from DomainGroup g where g.shortName = :shortName"; PagedSet<Person> results = getTypedPagedResults(start, end, query, parameters); return results; } DomainGroupMapper(final QueryOptimizer inQueryOptimizer); @SuppressWarnings("unchecked") DomainGroup findByShortName(final String groupShortName); void addFollower(final long followerId, final long followingId); PagedSet<Person> getFollowers(final String shortName, final int start, final int end); PagedSet<Followable> getFollowing(final String accountId, final int start, final int end); @SuppressWarnings("unchecked") boolean isFollowing(final String followerAccountId, final String shortName); void removeFollower(final long followerId, final long followingId); void removeGroupCoordinator(final long followerId, final long followingId); @SuppressWarnings("unchecked") Long[] getFollowerAndCoordinatorPersonIds(final DomainGroup domainGroup); void deleteById(final long id); boolean isInputUserGroupCoordinator(final long followerId, final long followingId); boolean isGroupPrivate(final long followingId); int getGroupCoordinatorCount(final long followingId); }
DomainGroupMapper extends DomainEntityMapper<DomainGroup> implements FollowMapper, CompositeEntityMapper { public PagedSet<Person> getFollowers(final String shortName, final int start, final int end) { HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("shortName", shortName.toLowerCase()); String query = "select g.followers from DomainGroup g where g.shortName = :shortName"; PagedSet<Person> results = getTypedPagedResults(start, end, query, parameters); return results; } DomainGroupMapper(final QueryOptimizer inQueryOptimizer); @SuppressWarnings("unchecked") DomainGroup findByShortName(final String groupShortName); void addFollower(final long followerId, final long followingId); PagedSet<Person> getFollowers(final String shortName, final int start, final int end); PagedSet<Followable> getFollowing(final String accountId, final int start, final int end); @SuppressWarnings("unchecked") boolean isFollowing(final String followerAccountId, final String shortName); void removeFollower(final long followerId, final long followingId); void removeGroupCoordinator(final long followerId, final long followingId); @SuppressWarnings("unchecked") Long[] getFollowerAndCoordinatorPersonIds(final DomainGroup domainGroup); void deleteById(final long id); boolean isInputUserGroupCoordinator(final long followerId, final long followingId); boolean isGroupPrivate(final long followingId); int getGroupCoordinatorCount(final long followingId);  }