@Test public void testExecute() { final Long activityId = 6789L; final Long destinationEntityId = 98L; final List<Long> activites = new ArrayList<Long>(); activites.add(activityId); final PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>> results = sut.execute(activites); Assert.assertEquals(1, results.getResponse().size()); Assert.assertEquals(activityId, results.getResponse().get(0).getId()); Assert.assertEquals(destinationEntityId, results.getResponse().get(0).getDestinationEntityId()); Assert.assertTrue(results.getResponse().get(0).isDestinationStreamPublic()); context.assertIsSatisfied(); }
@SuppressWarnings("unchecked") public PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>> execute(final List<Long> inRequest) { String q = "select new org.eurekastreams.server.domain.stream.ActivitySecurityDTO " + "(id, recipientStreamScope.destinationEntityId, isDestinationStreamPublic) " + "from Activity where id in (:activityIds) ORDER BY id"; List<ActivitySecurityDTO> securityDTOs = getEntityManager().createQuery(q).setParameter("activityIds", inRequest).getResultList(); List<Long> missingActivity = new ArrayList<Long>(inRequest); for (ActivitySecurityDTO foundDTO : securityDTOs) { missingActivity.remove(foundDTO.getId()); } if (missingActivity.size() == 0) { return new PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>(securityDTOs); } else { return new PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>(securityDTOs, missingActivity); } }
BulkActivitySecurityDbMapper extends
        BaseArgDomainMapper<List<Long>, PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>> implements
        DomainMapper<List<Long>, PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>> { @SuppressWarnings("unchecked") public PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>> execute(final List<Long> inRequest) { String q = "select new org.eurekastreams.server.domain.stream.ActivitySecurityDTO " + "(id, recipientStreamScope.destinationEntityId, isDestinationStreamPublic) " + "from Activity where id in (:activityIds) ORDER BY id"; List<ActivitySecurityDTO> securityDTOs = getEntityManager().createQuery(q).setParameter("activityIds", inRequest).getResultList(); List<Long> missingActivity = new ArrayList<Long>(inRequest); for (ActivitySecurityDTO foundDTO : securityDTOs) { missingActivity.remove(foundDTO.getId()); } if (missingActivity.size() == 0) { return new PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>(securityDTOs); } else { return new PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>(securityDTOs, missingActivity); } } }
BulkActivitySecurityDbMapper extends
        BaseArgDomainMapper<List<Long>, PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>> implements
        DomainMapper<List<Long>, PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>> { @SuppressWarnings("unchecked") public PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>> execute(final List<Long> inRequest) { String q = "select new org.eurekastreams.server.domain.stream.ActivitySecurityDTO " + "(id, recipientStreamScope.destinationEntityId, isDestinationStreamPublic) " + "from Activity where id in (:activityIds) ORDER BY id"; List<ActivitySecurityDTO> securityDTOs = getEntityManager().createQuery(q).setParameter("activityIds", inRequest).getResultList(); List<Long> missingActivity = new ArrayList<Long>(inRequest); for (ActivitySecurityDTO foundDTO : securityDTOs) { missingActivity.remove(foundDTO.getId()); } if (missingActivity.size() == 0) { return new PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>(securityDTOs); } else { return new PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>(securityDTOs, missingActivity); } }  }
BulkActivitySecurityDbMapper extends
        BaseArgDomainMapper<List<Long>, PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>> implements
        DomainMapper<List<Long>, PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>> { @SuppressWarnings("unchecked") public PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>> execute(final List<Long> inRequest) { String q = "select new org.eurekastreams.server.domain.stream.ActivitySecurityDTO " + "(id, recipientStreamScope.destinationEntityId, isDestinationStreamPublic) " + "from Activity where id in (:activityIds) ORDER BY id"; List<ActivitySecurityDTO> securityDTOs = getEntityManager().createQuery(q).setParameter("activityIds", inRequest).getResultList(); List<Long> missingActivity = new ArrayList<Long>(inRequest); for (ActivitySecurityDTO foundDTO : securityDTOs) { missingActivity.remove(foundDTO.getId()); } if (missingActivity.size() == 0) { return new PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>(securityDTOs); } else { return new PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>(securityDTOs, missingActivity); } }  @SuppressWarnings("unchecked") PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>> execute(final List<Long> inRequest); }
BulkActivitySecurityDbMapper extends
        BaseArgDomainMapper<List<Long>, PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>> implements
        DomainMapper<List<Long>, PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>> { @SuppressWarnings("unchecked") public PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>> execute(final List<Long> inRequest) { String q = "select new org.eurekastreams.server.domain.stream.ActivitySecurityDTO " + "(id, recipientStreamScope.destinationEntityId, isDestinationStreamPublic) " + "from Activity where id in (:activityIds) ORDER BY id"; List<ActivitySecurityDTO> securityDTOs = getEntityManager().createQuery(q).setParameter("activityIds", inRequest).getResultList(); List<Long> missingActivity = new ArrayList<Long>(inRequest); for (ActivitySecurityDTO foundDTO : securityDTOs) { missingActivity.remove(foundDTO.getId()); } if (missingActivity.size() == 0) { return new PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>(securityDTOs); } else { return new PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>>(securityDTOs, missingActivity); } }  @SuppressWarnings("unchecked") PartialMapperResponse<List<Long>, List<ActivitySecurityDTO>> execute(final List<Long> inRequest);  }