@Test public void testExecute() { InAppNotificationEntity searchCriteria = new InAppNotificationEntity(); final Person recipient = context.mock(Person.class); context.checking(new Expectations() { { oneOf(recipient).getId(); will(returnValue(42L)); } }); searchCriteria.setRecipient(recipient); searchCriteria.setNotificationType(NotificationType.LIKE_ACTIVITY); searchCriteria.setUrl("#activity/6789"); InAppNotificationEntity result = sut.execute(searchCriteria); assertEquals(6L, result.getId()); }
@Override public InAppNotificationEntity execute(final InAppNotificationEntity inRequest) { String q = "from InAppNotification where recipient.id = :userId " + "and url = :url and isRead = false " + "and notificationType = :notificationType"; Query query = getEntityManager().createQuery(q).setParameter("userId", inRequest.getRecipient().getId()) .setParameter("url", inRequest.getUrl()) .setParameter("notificationType", inRequest.getNotificationType()); List results = query.getResultList(); if (results.size() < 1) { return null; } return (InAppNotificationEntity) results.get(0); }
GetExistingInAppNotificationForAggregation extends
        BaseArgDomainMapper<InAppNotificationEntity, InAppNotificationEntity> { @Override public InAppNotificationEntity execute(final InAppNotificationEntity inRequest) { String q = "from InAppNotification where recipient.id = :userId " + "and url = :url and isRead = false " + "and notificationType = :notificationType"; Query query = getEntityManager().createQuery(q).setParameter("userId", inRequest.getRecipient().getId()) .setParameter("url", inRequest.getUrl()) .setParameter("notificationType", inRequest.getNotificationType()); List results = query.getResultList(); if (results.size() < 1) { return null; } return (InAppNotificationEntity) results.get(0); } }
GetExistingInAppNotificationForAggregation extends
        BaseArgDomainMapper<InAppNotificationEntity, InAppNotificationEntity> { @Override public InAppNotificationEntity execute(final InAppNotificationEntity inRequest) { String q = "from InAppNotification where recipient.id = :userId " + "and url = :url and isRead = false " + "and notificationType = :notificationType"; Query query = getEntityManager().createQuery(q).setParameter("userId", inRequest.getRecipient().getId()) .setParameter("url", inRequest.getUrl()) .setParameter("notificationType", inRequest.getNotificationType()); List results = query.getResultList(); if (results.size() < 1) { return null; } return (InAppNotificationEntity) results.get(0); }  }
GetExistingInAppNotificationForAggregation extends
        BaseArgDomainMapper<InAppNotificationEntity, InAppNotificationEntity> { @Override public InAppNotificationEntity execute(final InAppNotificationEntity inRequest) { String q = "from InAppNotification where recipient.id = :userId " + "and url = :url and isRead = false " + "and notificationType = :notificationType"; Query query = getEntityManager().createQuery(q).setParameter("userId", inRequest.getRecipient().getId()) .setParameter("url", inRequest.getUrl()) .setParameter("notificationType", inRequest.getNotificationType()); List results = query.getResultList(); if (results.size() < 1) { return null; } return (InAppNotificationEntity) results.get(0); }  @Override InAppNotificationEntity execute(final InAppNotificationEntity inRequest); }
GetExistingInAppNotificationForAggregation extends
        BaseArgDomainMapper<InAppNotificationEntity, InAppNotificationEntity> { @Override public InAppNotificationEntity execute(final InAppNotificationEntity inRequest) { String q = "from InAppNotification where recipient.id = :userId " + "and url = :url and isRead = false " + "and notificationType = :notificationType"; Query query = getEntityManager().createQuery(q).setParameter("userId", inRequest.getRecipient().getId()) .setParameter("url", inRequest.getUrl()) .setParameter("notificationType", inRequest.getNotificationType()); List results = query.getResultList(); if (results.size() < 1) { return null; } return (InAppNotificationEntity) results.get(0); }  @Override InAppNotificationEntity execute(final InAppNotificationEntity inRequest);  }