@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> inCommentIds) { if (inCommentIds == null || inCommentIds.size() == 0) { return new ArrayList<CommentDTO>(0); } Map<String, CommentDTO> cachedComments = getCachedComments(inCommentIds); List<CommentDTO> commentDTOs = getCommentDTOsFromDataSource(getUncachedIds(inCommentIds, cachedComments)); commentDTOPopulator.execute(commentDTOs, getCache()); commentDTOs.addAll(cachedComments.values()); Collections.sort(commentDTOs, comparator); Date currentDate = new Date(); for (CommentDTO currentComment : commentDTOs) { currentComment.setServerDateTime(currentDate); } return commentDTOs; }
GetCommentsById extends CachedDomainMapper implements DomainMapper<List<Long>, List<CommentDTO>> { @Override public List<CommentDTO> execute(final List<Long> inCommentIds) { if (inCommentIds == null || inCommentIds.size() == 0) { return new ArrayList<CommentDTO>(0); } Map<String, CommentDTO> cachedComments = getCachedComments(inCommentIds); List<CommentDTO> commentDTOs = getCommentDTOsFromDataSource(getUncachedIds(inCommentIds, cachedComments)); commentDTOPopulator.execute(commentDTOs, getCache()); commentDTOs.addAll(cachedComments.values()); Collections.sort(commentDTOs, comparator); Date currentDate = new Date(); for (CommentDTO currentComment : commentDTOs) { currentComment.setServerDateTime(currentDate); } return commentDTOs; } }
GetCommentsById extends CachedDomainMapper implements DomainMapper<List<Long>, List<CommentDTO>> { @Override public List<CommentDTO> execute(final List<Long> inCommentIds) { if (inCommentIds == null || inCommentIds.size() == 0) { return new ArrayList<CommentDTO>(0); } Map<String, CommentDTO> cachedComments = getCachedComments(inCommentIds); List<CommentDTO> commentDTOs = getCommentDTOsFromDataSource(getUncachedIds(inCommentIds, cachedComments)); commentDTOPopulator.execute(commentDTOs, getCache()); commentDTOs.addAll(cachedComments.values()); Collections.sort(commentDTOs, comparator); Date currentDate = new Date(); for (CommentDTO currentComment : commentDTOs) { currentComment.setServerDateTime(currentDate); } return commentDTOs; } GetCommentsById(final CommentDTOPopulator inCommentDTOPopulator); }
GetCommentsById extends CachedDomainMapper implements DomainMapper<List<Long>, List<CommentDTO>> { @Override public List<CommentDTO> execute(final List<Long> inCommentIds) { if (inCommentIds == null || inCommentIds.size() == 0) { return new ArrayList<CommentDTO>(0); } Map<String, CommentDTO> cachedComments = getCachedComments(inCommentIds); List<CommentDTO> commentDTOs = getCommentDTOsFromDataSource(getUncachedIds(inCommentIds, cachedComments)); commentDTOPopulator.execute(commentDTOs, getCache()); commentDTOs.addAll(cachedComments.values()); Collections.sort(commentDTOs, comparator); Date currentDate = new Date(); for (CommentDTO currentComment : commentDTOs) { currentComment.setServerDateTime(currentDate); } return commentDTOs; } GetCommentsById(final CommentDTOPopulator inCommentDTOPopulator); @Override List<CommentDTO> execute(final List<Long> inCommentIds); }
GetCommentsById extends CachedDomainMapper implements DomainMapper<List<Long>, List<CommentDTO>> { @Override public List<CommentDTO> execute(final List<Long> inCommentIds) { if (inCommentIds == null || inCommentIds.size() == 0) { return new ArrayList<CommentDTO>(0); } Map<String, CommentDTO> cachedComments = getCachedComments(inCommentIds); List<CommentDTO> commentDTOs = getCommentDTOsFromDataSource(getUncachedIds(inCommentIds, cachedComments)); commentDTOPopulator.execute(commentDTOs, getCache()); commentDTOs.addAll(cachedComments.values()); Collections.sort(commentDTOs, comparator); Date currentDate = new Date(); for (CommentDTO currentComment : commentDTOs) { currentComment.setServerDateTime(currentDate); } return commentDTOs; } GetCommentsById(final CommentDTOPopulator inCommentDTOPopulator); @Override List<CommentDTO> execute(final List<Long> inCommentIds);  }