@Test public void testExecuteNullEmptyParamList() { List<CommentDTO> results = sut.execute(null); assertEquals(0, results.size()); results = sut.execute(new ArrayList<Long>(0)); assertEquals(0, results.size()); }
@Override public List<CommentDTO> execute(final List<Long> inRequest) { if (inRequest == null || inRequest.size() == 0) { return new ArrayList<CommentDTO>(0); } Criteria criteria = getHibernateSession().createCriteria(Comment.class); ProjectionList fields = Projections.projectionList(); fields.add(getColumn("id")); fields.add(getColumn("body")); fields.add(getColumn("timeSent")); fields.add(Projections.property("author.id").as("authorId")); fields.add(Projections.property("target.id").as("activityId")); criteria.setProjection(fields); criteria.setResultTransformer(resultTransformer); criteria.add(Restrictions.in("this.id", inRequest)); List<CommentDTO> commentDTOs = criteria.list(); commentDTOPopulator.execute(commentDTOs, null); return orderResults(inRequest, commentDTOs); }
GetCommentsByIdsDbMapper extends BaseArgDomainMapper<List<Long>, List<CommentDTO>> { @Override public List<CommentDTO> execute(final List<Long> inRequest) { if (inRequest == null || inRequest.size() == 0) { return new ArrayList<CommentDTO>(0); } Criteria criteria = getHibernateSession().createCriteria(Comment.class); ProjectionList fields = Projections.projectionList(); fields.add(getColumn("id")); fields.add(getColumn("body")); fields.add(getColumn("timeSent")); fields.add(Projections.property("author.id").as("authorId")); fields.add(Projections.property("target.id").as("activityId")); criteria.setProjection(fields); criteria.setResultTransformer(resultTransformer); criteria.add(Restrictions.in("this.id", inRequest)); List<CommentDTO> commentDTOs = criteria.list(); commentDTOPopulator.execute(commentDTOs, null); return orderResults(inRequest, commentDTOs); } }
GetCommentsByIdsDbMapper extends BaseArgDomainMapper<List<Long>, List<CommentDTO>> { @Override public List<CommentDTO> execute(final List<Long> inRequest) { if (inRequest == null || inRequest.size() == 0) { return new ArrayList<CommentDTO>(0); } Criteria criteria = getHibernateSession().createCriteria(Comment.class); ProjectionList fields = Projections.projectionList(); fields.add(getColumn("id")); fields.add(getColumn("body")); fields.add(getColumn("timeSent")); fields.add(Projections.property("author.id").as("authorId")); fields.add(Projections.property("target.id").as("activityId")); criteria.setProjection(fields); criteria.setResultTransformer(resultTransformer); criteria.add(Restrictions.in("this.id", inRequest)); List<CommentDTO> commentDTOs = criteria.list(); commentDTOPopulator.execute(commentDTOs, null); return orderResults(inRequest, commentDTOs); } GetCommentsByIdsDbMapper(final CommentDTOPopulator inCommentDTOPopulator); }
GetCommentsByIdsDbMapper extends BaseArgDomainMapper<List<Long>, List<CommentDTO>> { @Override public List<CommentDTO> execute(final List<Long> inRequest) { if (inRequest == null || inRequest.size() == 0) { return new ArrayList<CommentDTO>(0); } Criteria criteria = getHibernateSession().createCriteria(Comment.class); ProjectionList fields = Projections.projectionList(); fields.add(getColumn("id")); fields.add(getColumn("body")); fields.add(getColumn("timeSent")); fields.add(Projections.property("author.id").as("authorId")); fields.add(Projections.property("target.id").as("activityId")); criteria.setProjection(fields); criteria.setResultTransformer(resultTransformer); criteria.add(Restrictions.in("this.id", inRequest)); List<CommentDTO> commentDTOs = criteria.list(); commentDTOPopulator.execute(commentDTOs, null); return orderResults(inRequest, commentDTOs); } GetCommentsByIdsDbMapper(final CommentDTOPopulator inCommentDTOPopulator); @Override List<CommentDTO> execute(final List<Long> inRequest); }
GetCommentsByIdsDbMapper extends BaseArgDomainMapper<List<Long>, List<CommentDTO>> { @Override public List<CommentDTO> execute(final List<Long> inRequest) { if (inRequest == null || inRequest.size() == 0) { return new ArrayList<CommentDTO>(0); } Criteria criteria = getHibernateSession().createCriteria(Comment.class); ProjectionList fields = Projections.projectionList(); fields.add(getColumn("id")); fields.add(getColumn("body")); fields.add(getColumn("timeSent")); fields.add(Projections.property("author.id").as("authorId")); fields.add(Projections.property("target.id").as("activityId")); criteria.setProjection(fields); criteria.setResultTransformer(resultTransformer); criteria.add(Restrictions.in("this.id", inRequest)); List<CommentDTO> commentDTOs = criteria.list(); commentDTOPopulator.execute(commentDTOs, null); return orderResults(inRequest, commentDTOs); } GetCommentsByIdsDbMapper(final CommentDTOPopulator inCommentDTOPopulator); @Override List<CommentDTO> execute(final List<Long> inRequest);  }