@Test public void testWithoutResults() { final int expectedSize = 0; final List<Long> request = new ArrayList<Long>(); request.add(0L); List<List<Long>> results = sut.execute(request); Assert.assertEquals(expectedSize, results.get(0).size()); }
@SuppressWarnings("unchecked") public List<List<Long>> execute(final List<Long> inRequest) { List<List<Long>> results = new ArrayList<List<Long>>(); for (Long id : inRequest) { String query = "SELECT a.id FROM Activity a LEFT OUTER JOIN a.sharedLink, StreamScope actorss " + "WHERE a.actorId = actorss.uniqueKey AND a.actorType = actorss.scopeType " + "AND (a.recipientStreamScope.id = :streamId " + "OR (a.recipientStreamScope.scopeType = :resourceScopeType AND " + "actorss.id = :streamId AND a.showInStream = :showInStreamFlag) " + "OR (a.sharedLink != NULL AND a.sharedLink.streamScope.id = :streamId)) ORDER BY a.id DESC"; results.add(getEntityManager().createQuery(query).setParameter("streamId", id).setParameter( "resourceScopeType", ScopeType.RESOURCE).setParameter("showInStreamFlag", true).setMaxResults( maxItems).getResultList()); } return results; }
BulkActivityStreamsDbMapper extends BaseArgDomainMapper<List<Long>, List<List<Long>>> implements
        DomainMapper<List<Long>, List<List<Long>>> { @SuppressWarnings("unchecked") public List<List<Long>> execute(final List<Long> inRequest) { List<List<Long>> results = new ArrayList<List<Long>>(); for (Long id : inRequest) { String query = "SELECT a.id FROM Activity a LEFT OUTER JOIN a.sharedLink, StreamScope actorss " + "WHERE a.actorId = actorss.uniqueKey AND a.actorType = actorss.scopeType " + "AND (a.recipientStreamScope.id = :streamId " + "OR (a.recipientStreamScope.scopeType = :resourceScopeType AND " + "actorss.id = :streamId AND a.showInStream = :showInStreamFlag) " + "OR (a.sharedLink != NULL AND a.sharedLink.streamScope.id = :streamId)) ORDER BY a.id DESC"; results.add(getEntityManager().createQuery(query).setParameter("streamId", id).setParameter( "resourceScopeType", ScopeType.RESOURCE).setParameter("showInStreamFlag", true).setMaxResults( maxItems).getResultList()); } return results; } }
BulkActivityStreamsDbMapper extends BaseArgDomainMapper<List<Long>, List<List<Long>>> implements
        DomainMapper<List<Long>, List<List<Long>>> { @SuppressWarnings("unchecked") public List<List<Long>> execute(final List<Long> inRequest) { List<List<Long>> results = new ArrayList<List<Long>>(); for (Long id : inRequest) { String query = "SELECT a.id FROM Activity a LEFT OUTER JOIN a.sharedLink, StreamScope actorss " + "WHERE a.actorId = actorss.uniqueKey AND a.actorType = actorss.scopeType " + "AND (a.recipientStreamScope.id = :streamId " + "OR (a.recipientStreamScope.scopeType = :resourceScopeType AND " + "actorss.id = :streamId AND a.showInStream = :showInStreamFlag) " + "OR (a.sharedLink != NULL AND a.sharedLink.streamScope.id = :streamId)) ORDER BY a.id DESC"; results.add(getEntityManager().createQuery(query).setParameter("streamId", id).setParameter( "resourceScopeType", ScopeType.RESOURCE).setParameter("showInStreamFlag", true).setMaxResults( maxItems).getResultList()); } return results; }  }
BulkActivityStreamsDbMapper extends BaseArgDomainMapper<List<Long>, List<List<Long>>> implements
        DomainMapper<List<Long>, List<List<Long>>> { @SuppressWarnings("unchecked") public List<List<Long>> execute(final List<Long> inRequest) { List<List<Long>> results = new ArrayList<List<Long>>(); for (Long id : inRequest) { String query = "SELECT a.id FROM Activity a LEFT OUTER JOIN a.sharedLink, StreamScope actorss " + "WHERE a.actorId = actorss.uniqueKey AND a.actorType = actorss.scopeType " + "AND (a.recipientStreamScope.id = :streamId " + "OR (a.recipientStreamScope.scopeType = :resourceScopeType AND " + "actorss.id = :streamId AND a.showInStream = :showInStreamFlag) " + "OR (a.sharedLink != NULL AND a.sharedLink.streamScope.id = :streamId)) ORDER BY a.id DESC"; results.add(getEntityManager().createQuery(query).setParameter("streamId", id).setParameter( "resourceScopeType", ScopeType.RESOURCE).setParameter("showInStreamFlag", true).setMaxResults( maxItems).getResultList()); } return results; }  void setMaxItems(final int inMaxItems); @SuppressWarnings("unchecked") List<List<Long>> execute(final List<Long> inRequest); }
BulkActivityStreamsDbMapper extends BaseArgDomainMapper<List<Long>, List<List<Long>>> implements
        DomainMapper<List<Long>, List<List<Long>>> { @SuppressWarnings("unchecked") public List<List<Long>> execute(final List<Long> inRequest) { List<List<Long>> results = new ArrayList<List<Long>>(); for (Long id : inRequest) { String query = "SELECT a.id FROM Activity a LEFT OUTER JOIN a.sharedLink, StreamScope actorss " + "WHERE a.actorId = actorss.uniqueKey AND a.actorType = actorss.scopeType " + "AND (a.recipientStreamScope.id = :streamId " + "OR (a.recipientStreamScope.scopeType = :resourceScopeType AND " + "actorss.id = :streamId AND a.showInStream = :showInStreamFlag) " + "OR (a.sharedLink != NULL AND a.sharedLink.streamScope.id = :streamId)) ORDER BY a.id DESC"; results.add(getEntityManager().createQuery(query).setParameter("streamId", id).setParameter( "resourceScopeType", ScopeType.RESOURCE).setParameter("showInStreamFlag", true).setMaxResults( maxItems).getResultList()); } return results; }  void setMaxItems(final int inMaxItems); @SuppressWarnings("unchecked") List<List<Long>> execute(final List<Long> inRequest);  }