added skip also
This commit is contained in:
@@ -24,6 +24,10 @@ public class BasicQuery implements QueryDefinition {
|
|||||||
|
|
||||||
private DBObject fieldsObject = null;
|
private DBObject fieldsObject = null;
|
||||||
|
|
||||||
|
private DBObject sortObject = null;
|
||||||
|
|
||||||
|
private int skip;
|
||||||
|
|
||||||
private int limit;
|
private int limit;
|
||||||
|
|
||||||
public BasicQuery(String query) {
|
public BasicQuery(String query) {
|
||||||
@@ -54,6 +58,22 @@ public class BasicQuery implements QueryDefinition {
|
|||||||
return fieldsObject;
|
return fieldsObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DBObject getSortObject() {
|
||||||
|
return sortObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSortObject(DBObject sortObject) {
|
||||||
|
this.sortObject = sortObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSkip() {
|
||||||
|
return skip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSkip(int skip) {
|
||||||
|
this.skip = skip;
|
||||||
|
}
|
||||||
|
|
||||||
public int getLimit() {
|
public int getLimit() {
|
||||||
return this.limit;
|
return this.limit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ public class Query implements QueryDefinition {
|
|||||||
|
|
||||||
private Field fieldSpec;
|
private Field fieldSpec;
|
||||||
|
|
||||||
|
private Sort sort;
|
||||||
|
|
||||||
|
private int skip;
|
||||||
|
|
||||||
private int limit;
|
private int limit;
|
||||||
|
|
||||||
public static Criteria newQuery(String key) {
|
public static Criteria newQuery(String key) {
|
||||||
@@ -57,6 +61,15 @@ public class Query implements QueryDefinition {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Sort sort() {
|
||||||
|
synchronized (this) {
|
||||||
|
if (this.sort == null) {
|
||||||
|
this.sort = new Sort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.sort;
|
||||||
|
}
|
||||||
|
|
||||||
public QueryDefinition build() {
|
public QueryDefinition build() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -78,8 +91,18 @@ public class Query implements QueryDefinition {
|
|||||||
return fieldSpec.getFieldsObject();
|
return fieldSpec.getFieldsObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DBObject getSortObject() {
|
||||||
|
if (this.sort == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.sort.getSortObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSkip() {
|
||||||
|
return this.skip;
|
||||||
|
}
|
||||||
|
|
||||||
public int getLimit() {
|
public int getLimit() {
|
||||||
return this.limit;
|
return this.limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,5 +24,9 @@ public interface QueryDefinition {
|
|||||||
|
|
||||||
DBObject getFieldsObject();
|
DBObject getFieldsObject();
|
||||||
|
|
||||||
|
DBObject getSortObject();
|
||||||
|
|
||||||
|
int getSkip();
|
||||||
|
|
||||||
int getLimit();
|
int getLimit();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user