@Test public void testExecuteGroup() { final long groupId = 1L; DomainMapper<Long, List<Long>> sut = new GetSubscribedPersonIdsForStreamDbMapper(EntityType.GROUP); ((BaseDomainMapper) sut).setEntityManager(getEntityManager()); List<Long> results = sut.execute(groupId); assertEquals(2, results.size()); TestHelper.containsExactly(results, 98L, 42L); getEntityManager().createQuery("Update GroupFollower set receiveNewActivityNotifications = :boolean") .setParameter("boolean", false).executeUpdate(); getEntityManager().flush(); getEntityManager().clear(); results = sut.execute(groupId); assertEquals(0, results.size()); }
@SuppressWarnings("unchecked") @Override public List<Long> execute(final Long inRequest) { return getEntityManager() .createQuery( "SELECT gf.pk.followerId FROM " + entityName + " gf WHERE gf.pk.followingId = :id" + " AND gf.receiveNewActivityNotifications = true").setParameter("id", inRequest) .getResultList(); }
GetSubscribedPersonIdsForStreamDbMapper extends BaseArgDomainMapper<Long, List<Long>> { @SuppressWarnings("unchecked") @Override public List<Long> execute(final Long inRequest) { return getEntityManager() .createQuery( "SELECT gf.pk.followerId FROM " + entityName + " gf WHERE gf.pk.followingId = :id" + " AND gf.receiveNewActivityNotifications = true").setParameter("id", inRequest) .getResultList(); } }
GetSubscribedPersonIdsForStreamDbMapper extends BaseArgDomainMapper<Long, List<Long>> { @SuppressWarnings("unchecked") @Override public List<Long> execute(final Long inRequest) { return getEntityManager() .createQuery( "SELECT gf.pk.followerId FROM " + entityName + " gf WHERE gf.pk.followingId = :id" + " AND gf.receiveNewActivityNotifications = true").setParameter("id", inRequest) .getResultList(); } GetSubscribedPersonIdsForStreamDbMapper(final EntityType entityType); }
GetSubscribedPersonIdsForStreamDbMapper extends BaseArgDomainMapper<Long, List<Long>> { @SuppressWarnings("unchecked") @Override public List<Long> execute(final Long inRequest) { return getEntityManager() .createQuery( "SELECT gf.pk.followerId FROM " + entityName + " gf WHERE gf.pk.followingId = :id" + " AND gf.receiveNewActivityNotifications = true").setParameter("id", inRequest) .getResultList(); } GetSubscribedPersonIdsForStreamDbMapper(final EntityType entityType); @SuppressWarnings("unchecked") @Override List<Long> execute(final Long inRequest); }
GetSubscribedPersonIdsForStreamDbMapper extends BaseArgDomainMapper<Long, List<Long>> { @SuppressWarnings("unchecked") @Override public List<Long> execute(final Long inRequest) { return getEntityManager() .createQuery( "SELECT gf.pk.followerId FROM " + entityName + " gf WHERE gf.pk.followingId = :id" + " AND gf.receiveNewActivityNotifications = true").setParameter("id", inRequest) .getResultList(); } GetSubscribedPersonIdsForStreamDbMapper(final EntityType entityType); @SuppressWarnings("unchecked") @Override List<Long> execute(final Long inRequest);  }