@Test public void testFindPeopleByOpenSocialIds() { ArrayList<String> openSocialIds = new ArrayList<String>(); openSocialIds.add("2d359911-0977-418a-9490-57e8252b1a42"); openSocialIds.add("2d359911-0977-418a-9490-57e8252b1142"); assertEquals("2 Person objects should have been returned", 2, jpaPersonMapper.findPeopleByOpenSocialIds( openSocialIds).size()); }
@SuppressWarnings("unchecked") public List<Person> findPeopleByOpenSocialIds(final List<String> openSocialIds) { String[] osIds = openSocialIds.toArray(new String[openSocialIds.size()]); String osIdSet = ""; for (int index = 0; index < osIds.length; index++) { osIdSet += "'" + osIds[index] + "'"; if (index < osIds.length - 1) { osIdSet += ", "; } } if (logger.isDebugEnabled()) { logger.debug("Finding people by openSocialIds: " + osIdSet); } Query q = getEntityManager().createQuery("From Person where openSocialId IN (:osIds)").setParameter("osIds", openSocialIds); List<Person> people = q.getResultList(); if (logger.isDebugEnabled()) { logger.debug("Retrieved " + people.size() + " results from opensocialids: " + osIdSet); } return people; }
PersonMapper extends DomainEntityMapper<Person> implements FollowMapper { @SuppressWarnings("unchecked") public List<Person> findPeopleByOpenSocialIds(final List<String> openSocialIds) { String[] osIds = openSocialIds.toArray(new String[openSocialIds.size()]); String osIdSet = ""; for (int index = 0; index < osIds.length; index++) { osIdSet += "'" + osIds[index] + "'"; if (index < osIds.length - 1) { osIdSet += ", "; } } if (logger.isDebugEnabled()) { logger.debug("Finding people by openSocialIds: " + osIdSet); } Query q = getEntityManager().createQuery("From Person where openSocialId IN (:osIds)").setParameter("osIds", openSocialIds); List<Person> people = q.getResultList(); if (logger.isDebugEnabled()) { logger.debug("Retrieved " + people.size() + " results from opensocialids: " + osIdSet); } return people; } }
PersonMapper extends DomainEntityMapper<Person> implements FollowMapper { @SuppressWarnings("unchecked") public List<Person> findPeopleByOpenSocialIds(final List<String> openSocialIds) { String[] osIds = openSocialIds.toArray(new String[openSocialIds.size()]); String osIdSet = ""; for (int index = 0; index < osIds.length; index++) { osIdSet += "'" + osIds[index] + "'"; if (index < osIds.length - 1) { osIdSet += ", "; } } if (logger.isDebugEnabled()) { logger.debug("Finding people by openSocialIds: " + osIdSet); } Query q = getEntityManager().createQuery("From Person where openSocialId IN (:osIds)").setParameter("osIds", openSocialIds); List<Person> people = q.getResultList(); if (logger.isDebugEnabled()) { logger.debug("Retrieved " + people.size() + " results from opensocialids: " + osIdSet); } return people; } PersonMapper(final QueryOptimizer inQueryOptimizer); }
PersonMapper extends DomainEntityMapper<Person> implements FollowMapper { @SuppressWarnings("unchecked") public List<Person> findPeopleByOpenSocialIds(final List<String> openSocialIds) { String[] osIds = openSocialIds.toArray(new String[openSocialIds.size()]); String osIdSet = ""; for (int index = 0; index < osIds.length; index++) { osIdSet += "'" + osIds[index] + "'"; if (index < osIds.length - 1) { osIdSet += ", "; } } if (logger.isDebugEnabled()) { logger.debug("Finding people by openSocialIds: " + osIdSet); } Query q = getEntityManager().createQuery("From Person where openSocialId IN (:osIds)").setParameter("osIds", openSocialIds); List<Person> people = q.getResultList(); if (logger.isDebugEnabled()) { logger.debug("Retrieved " + people.size() + " results from opensocialids: " + osIdSet); } return people; } 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 { @SuppressWarnings("unchecked") public List<Person> findPeopleByOpenSocialIds(final List<String> openSocialIds) { String[] osIds = openSocialIds.toArray(new String[openSocialIds.size()]); String osIdSet = ""; for (int index = 0; index < osIds.length; index++) { osIdSet += "'" + osIds[index] + "'"; if (index < osIds.length - 1) { osIdSet += ", "; } } if (logger.isDebugEnabled()) { logger.debug("Finding people by openSocialIds: " + osIdSet); } Query q = getEntityManager().createQuery("From Person where openSocialId IN (:osIds)").setParameter("osIds", openSocialIds); List<Person> people = q.getResultList(); if (logger.isDebugEnabled()) { logger.debug("Retrieved " + people.size() + " results from opensocialids: " + osIdSet); } return people; } 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);  }