21
21
import java .util .stream .Stream ;
22
22
23
23
import org .bson .Document ;
24
-
25
24
import org .springframework .data .domain .Pageable ;
26
25
import org .springframework .data .domain .SliceImpl ;
27
26
import org .springframework .data .mongodb .InvalidMongoDbApiUsageException ;
28
27
import org .springframework .data .mongodb .core .MongoOperations ;
29
28
import org .springframework .data .mongodb .core .aggregation .Aggregation ;
30
- import org .springframework .data .mongodb .core .aggregation .AggregationOperation ;
31
29
import org .springframework .data .mongodb .core .aggregation .AggregationOptions ;
32
30
import org .springframework .data .mongodb .core .aggregation .AggregationPipeline ;
33
- import org .springframework .data .mongodb .core .aggregation .AggregationOptions .Builder ;
34
31
import org .springframework .data .mongodb .core .aggregation .AggregationResults ;
35
32
import org .springframework .data .mongodb .core .aggregation .TypedAggregation ;
36
33
import org .springframework .data .mongodb .core .convert .MongoConverter ;
42
39
import org .springframework .expression .ExpressionParser ;
43
40
import org .springframework .lang .Nullable ;
44
41
import org .springframework .util .ClassUtils ;
45
- import org .springframework .util .CollectionUtils ;
46
- import org .springframework .util .ObjectUtils ;
47
42
48
43
/**
49
44
* {@link AbstractMongoQuery} implementation to run string-based aggregations using
@@ -66,8 +61,8 @@ public class StringBasedAggregation extends AbstractMongoQuery {
66
61
*
67
62
* @param method must not be {@literal null}.
68
63
* @param mongoOperations must not be {@literal null}.
69
- * @param expressionParser
70
- * @param evaluationContextProvider
64
+ * @param expressionParser must not be {@literal null}.
65
+ * @param evaluationContextProvider must not be {@literal null}.
71
66
*/
72
67
public StringBasedAggregation (MongoQueryMethod method , MongoOperations mongoOperations ,
73
68
ExpressionParser expressionParser , QueryMethodEvaluationContextProvider evaluationContextProvider ) {
@@ -85,10 +80,6 @@ public StringBasedAggregation(MongoQueryMethod method, MongoOperations mongoOper
85
80
this .evaluationContextProvider = evaluationContextProvider ;
86
81
}
87
82
88
- /*
89
- * (non-Javascript)
90
- * @see org.springframework.data.mongodb.repository.query.AbstractReactiveMongoQuery#doExecute(org.springframework.data.mongodb.repository.query.MongoQueryMethod, org.springframework.data.repository.query.ResultProcessor, org.springframework.data.mongodb.repository.query.ConvertingParameterAccessor, java.lang.Class)
91
- */
92
83
@ Override
93
84
@ Nullable
94
85
protected Object doExecute (MongoQueryMethod method , ResultProcessor resultProcessor ,
@@ -133,7 +124,7 @@ protected Object doExecute(MongoQueryMethod method, ResultProcessor resultProces
133
124
}
134
125
135
126
AggregationResults <Object > result = (AggregationResults <Object >) mongoOperations .aggregate (aggregation , targetType );
136
- if (ReflectionUtils .isVoid (typeToRead )) {
127
+ if (ReflectionUtils .isVoid (typeToRead )) {
137
128
return null ;
138
129
}
139
130
@@ -181,61 +172,42 @@ AggregationPipeline computePipeline(MongoQueryMethod method, ConvertingParameter
181
172
return new AggregationPipeline (parseAggregationPipeline (method .getAnnotatedAggregation (), accessor ));
182
173
}
183
174
184
- private AggregationOptions computeOptions (MongoQueryMethod method , ConvertingParameterAccessor accessor , AggregationPipeline pipeline ) {
175
+ private AggregationOptions computeOptions (MongoQueryMethod method , ConvertingParameterAccessor accessor ,
176
+ AggregationPipeline pipeline ) {
185
177
186
178
AggregationOptions .Builder builder = Aggregation .newAggregationOptions ();
187
179
188
180
AggregationUtils .applyCollation (builder , method .getAnnotatedCollation (), accessor , method .getParameters (),
189
181
expressionParser , evaluationContextProvider );
190
182
AggregationUtils .applyMeta (builder , method );
191
183
192
- if (ReflectionUtils .isVoid (method .getReturnType ().getType ()) && pipeline .isOutOrMerge ()) {
184
+ if (ReflectionUtils .isVoid (method .getReturnType ().getType ()) && pipeline .isOutOrMerge ()) {
193
185
builder .skipOutput ();
194
186
}
195
187
196
188
return builder .build ();
197
189
}
198
190
199
- /*
200
- * (non-Javascript)
201
- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#createQuery(org.springframework.data.mongodb.repository.query.ConvertingParameterAccessor)
202
- */
203
191
@ Override
204
192
protected Query createQuery (ConvertingParameterAccessor accessor ) {
205
193
throw new UnsupportedOperationException ("No query support for aggregation" );
206
194
}
207
195
208
- /*
209
- * (non-Javascript)
210
- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#isCountQuery()
211
- */
212
196
@ Override
213
197
protected boolean isCountQuery () {
214
198
return false ;
215
199
}
216
200
217
- /*
218
- * (non-Javascript)
219
- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#isExistsQuery()
220
- */
221
201
@ Override
222
202
protected boolean isExistsQuery () {
223
203
return false ;
224
204
}
225
205
226
- /*
227
- * (non-Javascript)
228
- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#isDeleteQuery()
229
- */
230
206
@ Override
231
207
protected boolean isDeleteQuery () {
232
208
return false ;
233
209
}
234
210
235
- /*
236
- * (non-Javascript)
237
- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#isLimiting()
238
- */
239
211
@ Override
240
212
protected boolean isLimiting () {
241
213
return false ;
0 commit comments