-
Notifications
You must be signed in to change notification settings - Fork 191
Scopes and collections for repositories #1149
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
Changes from all commits
c53378e
161d70c
39233d9
4f6b678
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,19 +77,17 @@ public TerminatingFindById<T> withOptions(final GetOptions options) { | |
|
||
@Override | ||
public FindByIdWithOptions<T> inCollection(final String collection) { | ||
Assert.hasText(collection, "Collection must not be null nor empty."); | ||
return new ExecutableFindByIdSupport<>(template, domainType, scope, collection, options, fields); | ||
} | ||
|
||
@Override | ||
public FindByIdInCollection<T> inScope(final String scope) { | ||
Assert.hasText(scope, "Scope must not be null nor empty."); | ||
return new ExecutableFindByIdSupport<>(template, domainType, scope, collection, options, fields); | ||
} | ||
|
||
@Override | ||
public FindByIdInScope<T> project(String... fields) { | ||
Assert.notEmpty(fields, "Fields must not be null nor empty."); | ||
Assert.notEmpty(fields, "Fields must not be null."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty list means do not use the project option. |
||
return new ExecutableFindByIdSupport<>(template, domainType, scope, collection, options, Arrays.asList(fields)); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,8 @@ static class ExecutableFindByQuerySupport<T> implements ExecutableFindByQuery<T> | |
this.returnType = returnType; | ||
this.query = query; | ||
this.reactiveSupport = new ReactiveFindByQuerySupport<T>(template.reactive(), domainType, returnType, query, | ||
scanConsistency, scope, collection, options, distinctFields, new NonReactiveSupportWrapper(template.support())); | ||
scanConsistency, scope, collection, options, distinctFields, | ||
new NonReactiveSupportWrapper(template.support())); | ||
this.scanConsistency = scanConsistency; | ||
this.scope = scope; | ||
this.collection = collection; | ||
|
@@ -126,8 +127,12 @@ public <R> FindByQueryWithConsistency<R> as(final Class<R> returnType) { | |
@Override | ||
public FindByQueryWithProjection<T> distinct(final String[] distinctFields) { | ||
Assert.notNull(distinctFields, "distinctFields must not be null!"); | ||
// Coming from an annotation, this cannot be null. | ||
// But a non-null but empty distinctFields means distinct on all fields | ||
// So to indicate do not use distinct, we use {"-"} from the annotation, and here we change it to null. | ||
String[] dFields = distinctFields.length == 1 && "-".equals(distinctFields[0]) ? null : distinctFields; | ||
return new ExecutableFindByQuerySupport<>(template, domainType, returnType, query, scanConsistency, scope, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coming from an annotation, this cannot be null. |
||
collection, options, distinctFields); | ||
collection, options, dFields); | ||
} | ||
|
||
@Override | ||
|
@@ -154,14 +159,12 @@ public TerminatingFindByQuery<T> withOptions(final QueryOptions options) { | |
|
||
@Override | ||
public FindByQueryInCollection<T> inScope(final String scope) { | ||
Assert.hasText(scope, "Scope must not be null nor empty."); | ||
return new ExecutableFindByQuerySupport<>(template, domainType, returnType, query, scanConsistency, scope, | ||
collection, options, distinctFields); | ||
} | ||
|
||
@Override | ||
public FindByQueryWithConsistency<T> inCollection(final String collection) { | ||
Assert.hasText(collection, "Collection must not be null nor empty."); | ||
return new ExecutableFindByQuerySupport<>(template, domainType, returnType, query, scanConsistency, scope, | ||
collection, options, distinctFields); | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.