@Test public void testExecuteWithNoData() { final long april12th2011 = 1302628002000L; Date date = new Date(april12th2011); Assert.assertNull(sut.execute(new UsageMetricDailyStreamInfoRequest(date, null))); }
@Override public DailyUsageSummary execute(final UsageMetricDailyStreamInfoRequest inRequest) { List<DailyUsageSummary> results; Query q; if (inRequest.getStreamRecipientStreamScopeId() == null) { q = getEntityManager().createQuery( "FROM DailyUsageSummary WHERE usageDate = :usageDate AND streamViewStreamScopeId IS NULL"); q.setParameter("usageDate", inRequest.getMetricsDate()); } else { q = getEntityManager().createQuery( "FROM DailyUsageSummary WHERE usageDate = :usageDate " + "AND streamViewStreamScopeId = :streamViewStreamScopeId"); q.setParameter("usageDate", inRequest.getMetricsDate()); q.setParameter("streamViewStreamScopeId", inRequest.getStreamRecipientStreamScopeId()); } results = q.getResultList(); if (results.size() > 0) { return results.get(0); } return null; }
GetDailyUsageSummaryByDateDbMapper extends
        BaseArgDomainMapper<UsageMetricDailyStreamInfoRequest, DailyUsageSummary> { @Override public DailyUsageSummary execute(final UsageMetricDailyStreamInfoRequest inRequest) { List<DailyUsageSummary> results; Query q; if (inRequest.getStreamRecipientStreamScopeId() == null) { q = getEntityManager().createQuery( "FROM DailyUsageSummary WHERE usageDate = :usageDate AND streamViewStreamScopeId IS NULL"); q.setParameter("usageDate", inRequest.getMetricsDate()); } else { q = getEntityManager().createQuery( "FROM DailyUsageSummary WHERE usageDate = :usageDate " + "AND streamViewStreamScopeId = :streamViewStreamScopeId"); q.setParameter("usageDate", inRequest.getMetricsDate()); q.setParameter("streamViewStreamScopeId", inRequest.getStreamRecipientStreamScopeId()); } results = q.getResultList(); if (results.size() > 0) { return results.get(0); } return null; } }
GetDailyUsageSummaryByDateDbMapper extends
        BaseArgDomainMapper<UsageMetricDailyStreamInfoRequest, DailyUsageSummary> { @Override public DailyUsageSummary execute(final UsageMetricDailyStreamInfoRequest inRequest) { List<DailyUsageSummary> results; Query q; if (inRequest.getStreamRecipientStreamScopeId() == null) { q = getEntityManager().createQuery( "FROM DailyUsageSummary WHERE usageDate = :usageDate AND streamViewStreamScopeId IS NULL"); q.setParameter("usageDate", inRequest.getMetricsDate()); } else { q = getEntityManager().createQuery( "FROM DailyUsageSummary WHERE usageDate = :usageDate " + "AND streamViewStreamScopeId = :streamViewStreamScopeId"); q.setParameter("usageDate", inRequest.getMetricsDate()); q.setParameter("streamViewStreamScopeId", inRequest.getStreamRecipientStreamScopeId()); } results = q.getResultList(); if (results.size() > 0) { return results.get(0); } return null; }  }
GetDailyUsageSummaryByDateDbMapper extends
        BaseArgDomainMapper<UsageMetricDailyStreamInfoRequest, DailyUsageSummary> { @Override public DailyUsageSummary execute(final UsageMetricDailyStreamInfoRequest inRequest) { List<DailyUsageSummary> results; Query q; if (inRequest.getStreamRecipientStreamScopeId() == null) { q = getEntityManager().createQuery( "FROM DailyUsageSummary WHERE usageDate = :usageDate AND streamViewStreamScopeId IS NULL"); q.setParameter("usageDate", inRequest.getMetricsDate()); } else { q = getEntityManager().createQuery( "FROM DailyUsageSummary WHERE usageDate = :usageDate " + "AND streamViewStreamScopeId = :streamViewStreamScopeId"); q.setParameter("usageDate", inRequest.getMetricsDate()); q.setParameter("streamViewStreamScopeId", inRequest.getStreamRecipientStreamScopeId()); } results = q.getResultList(); if (results.size() > 0) { return results.get(0); } return null; }  @Override DailyUsageSummary execute(final UsageMetricDailyStreamInfoRequest inRequest); }
GetDailyUsageSummaryByDateDbMapper extends
        BaseArgDomainMapper<UsageMetricDailyStreamInfoRequest, DailyUsageSummary> { @Override public DailyUsageSummary execute(final UsageMetricDailyStreamInfoRequest inRequest) { List<DailyUsageSummary> results; Query q; if (inRequest.getStreamRecipientStreamScopeId() == null) { q = getEntityManager().createQuery( "FROM DailyUsageSummary WHERE usageDate = :usageDate AND streamViewStreamScopeId IS NULL"); q.setParameter("usageDate", inRequest.getMetricsDate()); } else { q = getEntityManager().createQuery( "FROM DailyUsageSummary WHERE usageDate = :usageDate " + "AND streamViewStreamScopeId = :streamViewStreamScopeId"); q.setParameter("usageDate", inRequest.getMetricsDate()); q.setParameter("streamViewStreamScopeId", inRequest.getStreamRecipientStreamScopeId()); } results = q.getResultList(); if (results.size() > 0) { return results.get(0); } return null; }  @Override DailyUsageSummary execute(final UsageMetricDailyStreamInfoRequest inRequest);  }