@Test public void testExecute() { List<Long> results = mapper.execute(USER_ID); assertEquals(1, results.size()); assertEquals(new Long(ACTIVITY_ID), results.get(0)); results = mapper.execute(USER_ID); assertEquals(1, results.size()); }
@SuppressWarnings("unchecked") public List<Long> execute(final Long userId) { String key = CacheKeys.STARRED_BY_PERSON_ID + userId; List<Long> keys = getCache().getList(key); if (keys == null) { Query q = getEntityManager().createQuery( "from StarredActivity where personId = :id ORDER BY activityId DESC").setParameter("id", userId); List<StarredActivity> results = q.getResultList(); keys = new ArrayList<Long>(); for (StarredActivity f : results) { keys.add(f.getActivityId()); } getCache().setList(key, keys); } return keys; }
GetStarredActivityIds extends CachedDomainMapper implements DomainMapper<Long, List<Long>> { @SuppressWarnings("unchecked") public List<Long> execute(final Long userId) { String key = CacheKeys.STARRED_BY_PERSON_ID + userId; List<Long> keys = getCache().getList(key); if (keys == null) { Query q = getEntityManager().createQuery( "from StarredActivity where personId = :id ORDER BY activityId DESC").setParameter("id", userId); List<StarredActivity> results = q.getResultList(); keys = new ArrayList<Long>(); for (StarredActivity f : results) { keys.add(f.getActivityId()); } getCache().setList(key, keys); } return keys; } }
GetStarredActivityIds extends CachedDomainMapper implements DomainMapper<Long, List<Long>> { @SuppressWarnings("unchecked") public List<Long> execute(final Long userId) { String key = CacheKeys.STARRED_BY_PERSON_ID + userId; List<Long> keys = getCache().getList(key); if (keys == null) { Query q = getEntityManager().createQuery( "from StarredActivity where personId = :id ORDER BY activityId DESC").setParameter("id", userId); List<StarredActivity> results = q.getResultList(); keys = new ArrayList<Long>(); for (StarredActivity f : results) { keys.add(f.getActivityId()); } getCache().setList(key, keys); } return keys; }  }
GetStarredActivityIds extends CachedDomainMapper implements DomainMapper<Long, List<Long>> { @SuppressWarnings("unchecked") public List<Long> execute(final Long userId) { String key = CacheKeys.STARRED_BY_PERSON_ID + userId; List<Long> keys = getCache().getList(key); if (keys == null) { Query q = getEntityManager().createQuery( "from StarredActivity where personId = :id ORDER BY activityId DESC").setParameter("id", userId); List<StarredActivity> results = q.getResultList(); keys = new ArrayList<Long>(); for (StarredActivity f : results) { keys.add(f.getActivityId()); } getCache().setList(key, keys); } return keys; }  @SuppressWarnings("unchecked") List<Long> execute(final Long userId); }
GetStarredActivityIds extends CachedDomainMapper implements DomainMapper<Long, List<Long>> { @SuppressWarnings("unchecked") public List<Long> execute(final Long userId) { String key = CacheKeys.STARRED_BY_PERSON_ID + userId; List<Long> keys = getCache().getList(key); if (keys == null) { Query q = getEntityManager().createQuery( "from StarredActivity where personId = :id ORDER BY activityId DESC").setParameter("id", userId); List<StarredActivity> results = q.getResultList(); keys = new ArrayList<Long>(); for (StarredActivity f : results) { keys.add(f.getActivityId()); } getCache().setList(key, keys); } return keys; }  @SuppressWarnings("unchecked") List<Long> execute(final Long userId);  }