@Test public void testGetFollowers() { Person ford = jpaPersonMapper.findByAccountId("fordp"); Person sagan = jpaPersonMapper.findByAccountId("csagan"); assertEquals("followers/followings should be 0 initially", 0, ford.getFollowersCount()); assertEquals("followers/followings should be 0 initially", 0, ford.getFollowingCount()); assertEquals("followers/followings should be 0 initially", 0, sagan.getFollowersCount()); assertEquals("followers/followings should be 0 initially", 0, sagan.getFollowingCount()); jpaPersonMapper.addFollower(ford.getId(), sagan.getId()); getEntityManager().clear(); ford = jpaPersonMapper.findByAccountId("fordp"); sagan = jpaPersonMapper.findByAccountId("csagan"); assertEquals("sagan should have 1 follower", 1, sagan.getFollowersCount()); assertEquals("sagan follows no one", 0, sagan.getFollowingCount()); PagedSet<Person> connections = jpaPersonMapper.getFollowers(sagan.getAccountId(), 0, 6); assertNotNull(connections); assertEquals("sagan is followed by ford", "fordp", connections.getPagedSet().get(0).getAccountId()); }
public PagedSet<Person> getFollowers(final String accountId, final int start, final int end) { return getConnectionsMinusSelf(accountId, start, end, "followers"); }
PersonMapper extends DomainEntityMapper<Person> implements FollowMapper { public PagedSet<Person> getFollowers(final String accountId, final int start, final int end) { return getConnectionsMinusSelf(accountId, start, end, "followers"); } }
PersonMapper extends DomainEntityMapper<Person> implements FollowMapper { public PagedSet<Person> getFollowers(final String accountId, final int start, final int end) { return getConnectionsMinusSelf(accountId, start, end, "followers"); } PersonMapper(final QueryOptimizer inQueryOptimizer); }
PersonMapper extends DomainEntityMapper<Person> implements FollowMapper { public PagedSet<Person> getFollowers(final String accountId, final int start, final int end) { return getConnectionsMinusSelf(accountId, start, end, "followers"); } PersonMapper(final QueryOptimizer inQueryOptimizer); @SuppressWarnings("unchecked") Person findByAccountId(final String accountId); @SuppressWarnings("unchecked") Person findByOpenSocialId(final String openSocialId); void addFollower(final long followerId, final long followingId); void removeFollower(final long followerId, final long followingId); PagedSet<Person> getFollowers(final String accountId, 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 followingAccountId); @SuppressWarnings("unchecked") List<Person> findPeopleByPrefix(final String prefix); @SuppressWarnings("unchecked") List<Person> findPeopleByOpenSocialIds(final List<String> openSocialIds); @SuppressWarnings("unchecked") List<Person> findPeopleFollowedUsingFollowerOpenSocialIds(final List<String> openSocialIds); }
PersonMapper extends DomainEntityMapper<Person> implements FollowMapper { public PagedSet<Person> getFollowers(final String accountId, final int start, final int end) { return getConnectionsMinusSelf(accountId, start, end, "followers"); } PersonMapper(final QueryOptimizer inQueryOptimizer); @SuppressWarnings("unchecked") Person findByAccountId(final String accountId); @SuppressWarnings("unchecked") Person findByOpenSocialId(final String openSocialId); void addFollower(final long followerId, final long followingId); void removeFollower(final long followerId, final long followingId); PagedSet<Person> getFollowers(final String accountId, 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 followingAccountId); @SuppressWarnings("unchecked") List<Person> findPeopleByPrefix(final String prefix); @SuppressWarnings("unchecked") List<Person> findPeopleByOpenSocialIds(final List<String> openSocialIds); @SuppressWarnings("unchecked") List<Person> findPeopleFollowedUsingFollowerOpenSocialIds(final List<String> openSocialIds);  }