This is an automated email from the ASF dual-hosted git repository.
pawan pushed a commit to branch trunk
in repository
https://gitbox.apache.org/repos/asf/ofbiz-framework.gitThe following commit(s) were added to refs/heads/trunk by this push:
new 12ef222 Improved: Add support for Limit and offset in EntityQuery (OFBIZ-11670)
12ef222 is described below
commit 12ef22228dc443b936c9dbd407b16c3de65cf6a9
Author: Pawan Verma <
[hidden email]>
AuthorDate: Sun May 10 14:03:55 2020 +0530
Improved: Add support for Limit and offset in EntityQuery
(OFBIZ-11670)
Thanks: Jacques and Suraj for the review.
---
.../org/apache/ofbiz/entity/util/EntityQuery.java | 27 +++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java
index b7159cd..26f351d 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java
@@ -70,7 +70,8 @@ public class EntityQuery {
private List<String> filterByFieldNames = null;
private boolean searchPkOnly = false;
private Map<String, Object> fieldMap = null;
-
+ private Integer offset;
+ private Integer limit;
/** Construct an EntityQuery object for use against the specified Delegator
@@ -270,6 +271,24 @@ public class EntityQuery {
return this;
}
+ public EntityQuery offset(int offset) {
+ this.offset = offset;
+ return this;
+ }
+
+ public Integer getOffset() {
+ return this.offset;
+ }
+
+ public EntityQuery limit(int limit) {
+ this.limit = limit;
+ return this;
+ }
+
+ public Integer getLimit() {
+ return this.limit;
+ }
+
/** Specifies that the values returned should be filtered to remove duplicate values.
*
* @return this EntityQuery object, to enable chaining
@@ -471,6 +490,12 @@ public class EntityQuery {
if (maxRows != null) {
findOptions.setMaxRows(maxRows);
}
+ if (limit != null) {
+ findOptions.setLimit(limit);
+ }
+ if (offset != null) {
+ findOptions.setOffset(offset);
+ }
findOptions.setDistinct(distinct);
return findOptions;
}