@Test public void testExecute() { final long groupId = 8L; final int startIndex = 0; final int endIndex = 9; final long personId = 4507L; GetRequestForGroupMembershipRequest request = new GetRequestForGroupMembershipRequest(groupId, null, startIndex, endIndex); PagedSet<Long> results = sut.execute(request); assertEquals("Wrong From index", 0, results.getFromIndex()); assertEquals("Wrong To index", 0, results.getToIndex()); assertEquals("Wrong total", 1, results.getTotal()); assertEquals(1, results.getPagedSet().size()); assertEquals((Long) personId, results.getPagedSet().get(0)); }
@Override @SuppressWarnings("unchecked") public PagedSet<Long> execute(final GetRequestForGroupMembershipRequest inRequest) { final long groupId = inRequest.getGroupId(); final int startIndex = inRequest.getStartIndex(); final int numDesired = inRequest.getEndIndex() - startIndex + 1; Query q = buildQuery("pk.personId", groupId); q.setFirstResult(startIndex); q.setMaxResults(numDesired); List<Long> list = q.getResultList(); int totalCount; if (list.size() < numDesired) { totalCount = startIndex + list.size(); } else { totalCount = ((Long) buildQuery("count(*)", groupId).getSingleResult()).intValue(); } int endIndex = startIndex + list.size() - 1; if (log.isInfoEnabled()) { log.info("Request for membership requests for group " + groupId + " from " + startIndex + "-" + inRequest.getEndIndex() + " yielded " + list.size() + " results and a total count of " + totalCount + "."); } return new PagedSet<Long>(startIndex, endIndex, totalCount, list); }
GetRequestsForGroupMembershipByGroup extends
        BaseArgDomainMapper<GetRequestForGroupMembershipRequest, PagedSet<Long>> { @Override @SuppressWarnings("unchecked") public PagedSet<Long> execute(final GetRequestForGroupMembershipRequest inRequest) { final long groupId = inRequest.getGroupId(); final int startIndex = inRequest.getStartIndex(); final int numDesired = inRequest.getEndIndex() - startIndex + 1; Query q = buildQuery("pk.personId", groupId); q.setFirstResult(startIndex); q.setMaxResults(numDesired); List<Long> list = q.getResultList(); int totalCount; if (list.size() < numDesired) { totalCount = startIndex + list.size(); } else { totalCount = ((Long) buildQuery("count(*)", groupId).getSingleResult()).intValue(); } int endIndex = startIndex + list.size() - 1; if (log.isInfoEnabled()) { log.info("Request for membership requests for group " + groupId + " from " + startIndex + "-" + inRequest.getEndIndex() + " yielded " + list.size() + " results and a total count of " + totalCount + "."); } return new PagedSet<Long>(startIndex, endIndex, totalCount, list); } }
GetRequestsForGroupMembershipByGroup extends
        BaseArgDomainMapper<GetRequestForGroupMembershipRequest, PagedSet<Long>> { @Override @SuppressWarnings("unchecked") public PagedSet<Long> execute(final GetRequestForGroupMembershipRequest inRequest) { final long groupId = inRequest.getGroupId(); final int startIndex = inRequest.getStartIndex(); final int numDesired = inRequest.getEndIndex() - startIndex + 1; Query q = buildQuery("pk.personId", groupId); q.setFirstResult(startIndex); q.setMaxResults(numDesired); List<Long> list = q.getResultList(); int totalCount; if (list.size() < numDesired) { totalCount = startIndex + list.size(); } else { totalCount = ((Long) buildQuery("count(*)", groupId).getSingleResult()).intValue(); } int endIndex = startIndex + list.size() - 1; if (log.isInfoEnabled()) { log.info("Request for membership requests for group " + groupId + " from " + startIndex + "-" + inRequest.getEndIndex() + " yielded " + list.size() + " results and a total count of " + totalCount + "."); } return new PagedSet<Long>(startIndex, endIndex, totalCount, list); }  }
GetRequestsForGroupMembershipByGroup extends
        BaseArgDomainMapper<GetRequestForGroupMembershipRequest, PagedSet<Long>> { @Override @SuppressWarnings("unchecked") public PagedSet<Long> execute(final GetRequestForGroupMembershipRequest inRequest) { final long groupId = inRequest.getGroupId(); final int startIndex = inRequest.getStartIndex(); final int numDesired = inRequest.getEndIndex() - startIndex + 1; Query q = buildQuery("pk.personId", groupId); q.setFirstResult(startIndex); q.setMaxResults(numDesired); List<Long> list = q.getResultList(); int totalCount; if (list.size() < numDesired) { totalCount = startIndex + list.size(); } else { totalCount = ((Long) buildQuery("count(*)", groupId).getSingleResult()).intValue(); } int endIndex = startIndex + list.size() - 1; if (log.isInfoEnabled()) { log.info("Request for membership requests for group " + groupId + " from " + startIndex + "-" + inRequest.getEndIndex() + " yielded " + list.size() + " results and a total count of " + totalCount + "."); } return new PagedSet<Long>(startIndex, endIndex, totalCount, list); }  @Override @SuppressWarnings("unchecked") PagedSet<Long> execute(final GetRequestForGroupMembershipRequest inRequest); }
GetRequestsForGroupMembershipByGroup extends
        BaseArgDomainMapper<GetRequestForGroupMembershipRequest, PagedSet<Long>> { @Override @SuppressWarnings("unchecked") public PagedSet<Long> execute(final GetRequestForGroupMembershipRequest inRequest) { final long groupId = inRequest.getGroupId(); final int startIndex = inRequest.getStartIndex(); final int numDesired = inRequest.getEndIndex() - startIndex + 1; Query q = buildQuery("pk.personId", groupId); q.setFirstResult(startIndex); q.setMaxResults(numDesired); List<Long> list = q.getResultList(); int totalCount; if (list.size() < numDesired) { totalCount = startIndex + list.size(); } else { totalCount = ((Long) buildQuery("count(*)", groupId).getSingleResult()).intValue(); } int endIndex = startIndex + list.size() - 1; if (log.isInfoEnabled()) { log.info("Request for membership requests for group " + groupId + " from " + startIndex + "-" + inRequest.getEndIndex() + " yielded " + list.size() + " results and a total count of " + totalCount + "."); } return new PagedSet<Long>(startIndex, endIndex, totalCount, list); }  @Override @SuppressWarnings("unchecked") PagedSet<Long> execute(final GetRequestForGroupMembershipRequest inRequest);  }