@Test public void testExecuteWithNoFollowedGroups() { final long fordId = 42L; getEntityManager().clear(); getEntityManager().createQuery("UPDATE GroupFollower SET receiveNewActivityNotifications = :trueOrFalse") .setParameter("trueOrFalse", false).executeUpdate(); getEntityManager().clear(); ArrayList<String> groups = sut.execute(fordId); assertEquals(0, groups.size()); }
@Override public ArrayList<String> execute(final Long inPersonId) { String q = "SELECT shortName FROM DomainGroup WHERE id IN " + "(SELECT pk.followingId FROM GroupFollower WHERE pk.followerId = :personId " + "AND receiveNewActivityNotifications = :isSubscribed)"; Query query = getEntityManager().createQuery(q).setParameter("personId", inPersonId).setParameter( "isSubscribed", true); ArrayList<String> results = new ArrayList<String>(query.getResultList()); return results; }
GetSubscribedGroupsDbMapper extends BaseArgDomainMapper<Long, ArrayList<String>> { @Override public ArrayList<String> execute(final Long inPersonId) { String q = "SELECT shortName FROM DomainGroup WHERE id IN " + "(SELECT pk.followingId FROM GroupFollower WHERE pk.followerId = :personId " + "AND receiveNewActivityNotifications = :isSubscribed)"; Query query = getEntityManager().createQuery(q).setParameter("personId", inPersonId).setParameter( "isSubscribed", true); ArrayList<String> results = new ArrayList<String>(query.getResultList()); return results; } }
GetSubscribedGroupsDbMapper extends BaseArgDomainMapper<Long, ArrayList<String>> { @Override public ArrayList<String> execute(final Long inPersonId) { String q = "SELECT shortName FROM DomainGroup WHERE id IN " + "(SELECT pk.followingId FROM GroupFollower WHERE pk.followerId = :personId " + "AND receiveNewActivityNotifications = :isSubscribed)"; Query query = getEntityManager().createQuery(q).setParameter("personId", inPersonId).setParameter( "isSubscribed", true); ArrayList<String> results = new ArrayList<String>(query.getResultList()); return results; }  }
GetSubscribedGroupsDbMapper extends BaseArgDomainMapper<Long, ArrayList<String>> { @Override public ArrayList<String> execute(final Long inPersonId) { String q = "SELECT shortName FROM DomainGroup WHERE id IN " + "(SELECT pk.followingId FROM GroupFollower WHERE pk.followerId = :personId " + "AND receiveNewActivityNotifications = :isSubscribed)"; Query query = getEntityManager().createQuery(q).setParameter("personId", inPersonId).setParameter( "isSubscribed", true); ArrayList<String> results = new ArrayList<String>(query.getResultList()); return results; }  @Override ArrayList<String> execute(final Long inPersonId); }
GetSubscribedGroupsDbMapper extends BaseArgDomainMapper<Long, ArrayList<String>> { @Override public ArrayList<String> execute(final Long inPersonId) { String q = "SELECT shortName FROM DomainGroup WHERE id IN " + "(SELECT pk.followingId FROM GroupFollower WHERE pk.followerId = :personId " + "AND receiveNewActivityNotifications = :isSubscribed)"; Query query = getEntityManager().createQuery(q).setParameter("personId", inPersonId).setParameter( "isSubscribed", true); ArrayList<String> results = new ArrayList<String>(query.getResultList()); return results; }  @Override ArrayList<String> execute(final Long inPersonId);  }