Removed redundant logical checks from MongoItemReaderBuilder and MongoItemReader

to prevent false alarm for not providing the limit for query or pagesize for the reader

Issue #3673
This commit is contained in:
Parikshit Dutta
2020-04-05 00:07:16 +05:30
committed by Mahmoud Ben Hassine
parent bd016a9444
commit 56fbc270e2
4 changed files with 84 additions and 10 deletions

View File

@@ -79,6 +79,7 @@ import org.springframework.util.StringUtils;
* @author Michael Minella
* @author Takaaki Iida
* @author Mahmoud Ben Hassine
* @author Parikshit Dutta
*/
public class MongoItemReader<T> extends AbstractPaginatedDataItemReader<T> implements InitializingBean {
@@ -241,10 +242,6 @@ public class MongoItemReader<T> extends AbstractPaginatedDataItemReader<T> imple
if (queryString != null) {
Assert.state(sort != null, "A sort is required.");
}
if (query != null && query.getLimit() != 0) {
log.warn("PageSize in Query object was ignored. Please set it by MongoItemReader.setPageSize().");
}
}
private String replacePlaceholders(String input, List<Object> values) {

View File

@@ -34,6 +34,7 @@ import org.springframework.util.StringUtils;
* @author Glenn Renfro
* @author Mahmoud Ben Hassine
* @author Drummond Dawson
* @author Parikshit Dutta
* @since 4.0
* @see MongoItemReader
*/
@@ -286,9 +287,6 @@ public class MongoItemReaderBuilder<T> {
if(StringUtils.hasText(this.jsonQuery)) {
Assert.notNull(this.sorts, "sorts map is required.");
}
else {
Assert.state(this.query.getLimit() != 0, "PageSize in Query object was ignored.");
}
MongoItemReader<T> reader = new MongoItemReader<>();
reader.setTemplate(this.template);