@Test public void testExecute2() { final Long fordId = 99L; final Long activity1 = 6789L; final Long activity2 = 6793L; List<Long> expected = new ArrayList<Long>(); expected.add(activity1); expected.add(activity2); List<Long> actual = sut.execute(fordId); Collections.sort(actual); assertEquals(expected, actual); }
@SuppressWarnings("unchecked") public List<Long> execute(final Long inPersonId) { String query = "SELECT DISTINCT target.id FROM Comment WHERE author.id=:authorId " + "AND (id IN (SELECT MIN(id) FROM Comment Group BY target.id) " + "OR id IN (SELECT MAX(id) FROM Comment Group BY target.id))"; return getEntityManager().createQuery(query).setParameter("authorId", inPersonId).getResultList(); }
GetActivityIdsWithFirstOrLastCommentsAuthoredByPersonId extends
        ReadMapper<Long, List<Long>> { @SuppressWarnings("unchecked") public List<Long> execute(final Long inPersonId) { String query = "SELECT DISTINCT target.id FROM Comment WHERE author.id=:authorId " + "AND (id IN (SELECT MIN(id) FROM Comment Group BY target.id) " + "OR id IN (SELECT MAX(id) FROM Comment Group BY target.id))"; return getEntityManager().createQuery(query).setParameter("authorId", inPersonId).getResultList(); } }
GetActivityIdsWithFirstOrLastCommentsAuthoredByPersonId extends
        ReadMapper<Long, List<Long>> { @SuppressWarnings("unchecked") public List<Long> execute(final Long inPersonId) { String query = "SELECT DISTINCT target.id FROM Comment WHERE author.id=:authorId " + "AND (id IN (SELECT MIN(id) FROM Comment Group BY target.id) " + "OR id IN (SELECT MAX(id) FROM Comment Group BY target.id))"; return getEntityManager().createQuery(query).setParameter("authorId", inPersonId).getResultList(); }  }
GetActivityIdsWithFirstOrLastCommentsAuthoredByPersonId extends
        ReadMapper<Long, List<Long>> { @SuppressWarnings("unchecked") public List<Long> execute(final Long inPersonId) { String query = "SELECT DISTINCT target.id FROM Comment WHERE author.id=:authorId " + "AND (id IN (SELECT MIN(id) FROM Comment Group BY target.id) " + "OR id IN (SELECT MAX(id) FROM Comment Group BY target.id))"; return getEntityManager().createQuery(query).setParameter("authorId", inPersonId).getResultList(); }  @SuppressWarnings("unchecked") List<Long> execute(final Long inPersonId); }
GetActivityIdsWithFirstOrLastCommentsAuthoredByPersonId extends
        ReadMapper<Long, List<Long>> { @SuppressWarnings("unchecked") public List<Long> execute(final Long inPersonId) { String query = "SELECT DISTINCT target.id FROM Comment WHERE author.id=:authorId " + "AND (id IN (SELECT MIN(id) FROM Comment Group BY target.id) " + "OR id IN (SELECT MAX(id) FROM Comment Group BY target.id))"; return getEntityManager().createQuery(query).setParameter("authorId", inPersonId).getResultList(); }  @SuppressWarnings("unchecked") List<Long> execute(final Long inPersonId);  }