-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FMWK-199 Refactor implementation of paginated queries #658
Conversation
@@ -1177,6 +1177,12 @@ private <T> Flux<T> findUsingQueryWithPostProcessing(String setName, Class<T> ta | |||
return results; | |||
} | |||
|
|||
public <T> Flux<T> findUsingQueryWithoutPostProcessing(Class<?> entityClass, Class<T> targetClass, Query query) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add @Override
@@ -868,6 +868,8 @@ <T, S> Flux<?> findByIdsUsingQuery(Collection<?> ids, Class<T> entityClass, Clas | |||
*/ | |||
<T, S> Flux<S> findInRange(long offset, long limit, Sort sort, Class<T> entityClass, Class<S> targetClass); | |||
|
|||
<T> Flux<T> findUsingQueryWithoutPostProcessing(Class<?> entityClass, Class<T> targetClass, Query query); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Javadoc is required
@@ -896,6 +896,8 @@ <T, S> List<?> findByIdsUsingQuery(Collection<?> ids, Class<T> entityClass, Clas | |||
*/ | |||
<T> Stream<T> findInRange(long offset, long limit, Sort sort, Class<T> targetClass, String setName); | |||
|
|||
<T> Stream<T> findUsingQueryWithoutPostProcessing(Class<?> entityClass, Class<T> targetClass, Query query); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Javadoc is required
@@ -944,6 +944,12 @@ private <T> Stream<T> findUsingQueryWithPostProcessing(String setName, Class<T> | |||
return applyPostProcessingOnResults(results, query); | |||
} | |||
|
|||
public <T> Stream<T> findUsingQueryWithoutPostProcessing(Class<?> entityClass, Class<T> targetClass, Query query) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add @Override
@@ -54,6 +54,7 @@ public class QueryEngine { | |||
* scans, set this property to true. | |||
*/ | |||
private boolean scansEnabled = false; | |||
private int queryMaxRecords = 100000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be taken from AerospikeDataSettings
?
@@ -128,6 +130,11 @@ public void setScansEnabled(boolean scansEnabled) { | |||
this.scansEnabled = scansEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Setter
?
@@ -128,6 +130,11 @@ public void setScansEnabled(boolean scansEnabled) { | |||
this.scansEnabled = scansEnabled; | |||
} | |||
|
|||
public void setQueryMaxRecords(int queryMaxRecords) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Setter
?
@@ -115,4 +117,8 @@ private Mono<KeyRecord> getRecord(Policy policy, Key key, String[] binNames) { | |||
public void setScansEnabled(boolean scansEnabled) { | |||
this.scansEnabled = scansEnabled; | |||
} | |||
|
|||
public void setQueryMaxRecords(int queryMaxRecords) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Setter
?
@@ -115,4 +117,8 @@ private Mono<KeyRecord> getRecord(Policy policy, Key key, String[] binNames) { | |||
public void setScansEnabled(boolean scansEnabled) { | |||
this.scansEnabled = scansEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Setter
?
* @return A Stream of all matching documents regardless of pagination/sorting, returned documents will be mapped to | ||
* targetClass's type. | ||
*/ | ||
<T> Stream<T> findUsingQueryWithoutPostProcessing(Class<?> entityClass, Class<T> targetClass, Query query); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does entityClass is wrapped with Class<?>
, usually when we have entity and target we use Class<T>
for entityClass and Class<S>
for targetClass, please align with rest of the methods
* @return A Flux of all matching documents regardless of pagination/sorting, returned documents will be mapped to | ||
* targetClass's type. | ||
*/ | ||
<T> Flux<T> findUsingQueryWithoutPostProcessing(Class<?> entityClass, Class<T> targetClass, Query query); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here Class<?>
.
@@ -40,15 +39,15 @@ | |||
*/ | |||
public class AerospikePartTreeQuery extends BaseAerospikePartTreeQuery { | |||
|
|||
private final AerospikeOperations operations; | |||
private final AerospikeTemplate template; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why template instead of operations?
@@ -35,14 +38,14 @@ | |||
*/ | |||
public class ReactiveAerospikePartTreeQuery extends BaseAerospikePartTreeQuery { | |||
|
|||
private final ReactiveAerospikeOperations operations; | |||
private final ReactiveAerospikeTemplate template; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same (why template?)
@@ -1322,8 +1322,8 @@ public void findPersonsByQuery() { | |||
.setFilterOperation(FilterOperation.EQ) | |||
.setValue1(Value.get(49)) | |||
.build(); | |||
result = repository.findUsingQuery(new Query(ageEq49)); | |||
assertThat(result).containsOnly(carter); | |||
// result = repository.findUsingQuery(new Query(ageEq49)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why commenting assertions? if its not relevant anymore remove
if (qualifier != null) { | ||
Qualifier idQualifier = getOneIdQualifier(qualifier); | ||
if (idQualifier != null) { | ||
// a special flow if there is id given |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds grammatically wrong, maybe:
// Dedicate flow when id is given
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, updated to a similar phrase
if (qualifier != null) { | ||
Qualifier idQualifier = getOneIdQualifier(qualifier); | ||
if (idQualifier != null) { | ||
// a special flow if there is id given |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
No description provided.