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,7 +172,8 @@ 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
@@ -190,53 +182,33 @@ private AggregationOptions computeOptions(MongoQueryMethod method, ConvertingPar
190
182
AggregationUtils .applyMeta (builder , method );
191
183
AggregationUtils .applyHint (builder , method );
192
184
193
- if (ReflectionUtils .isVoid (method .getReturnType ().getType ()) && pipeline .isOutOrMerge ()) {
185
+ if (ReflectionUtils .isVoid (method .getReturnType ().getType ()) && pipeline .isOutOrMerge ()) {
194
186
builder .skipOutput ();
195
187
}
196
188
197
189
return builder .build ();
198
190
}
199
191
200
- /*
201
- * (non-Javascript)
202
- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#createQuery(org.springframework.data.mongodb.repository.query.ConvertingParameterAccessor)
203
- */
204
192
@ Override
205
193
protected Query createQuery (ConvertingParameterAccessor accessor ) {
206
194
throw new UnsupportedOperationException ("No query support for aggregation" );
207
195
}
208
196
209
- /*
210
- * (non-Javascript)
211
- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#isCountQuery()
212
- */
213
197
@ Override
214
198
protected boolean isCountQuery () {
215
199
return false ;
216
200
}
217
201
218
- /*
219
- * (non-Javascript)
220
- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#isExistsQuery()
221
- */
222
202
@ Override
223
203
protected boolean isExistsQuery () {
224
204
return false ;
225
205
}
226
206
227
- /*
228
- * (non-Javascript)
229
- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#isDeleteQuery()
230
- */
231
207
@ Override
232
208
protected boolean isDeleteQuery () {
233
209
return false ;
234
210
}
235
211
236
- /*
237
- * (non-Javascript)
238
- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#isLimiting()
239
- */
240
212
@ Override
241
213
protected boolean isLimiting () {
242
214
return false ;
0 commit comments