23
23
24
24
import com .couchbase .client .java .kv .MutationState ;
25
25
import com .couchbase .client .java .kv .ScanOptions ;
26
- import com .couchbase .client .java .kv .ScanSort ;
27
26
28
27
public class ExecutableRangeScanOperationSupport implements ExecutableRangeScanOperation {
29
28
@@ -36,7 +35,7 @@ public class ExecutableRangeScanOperationSupport implements ExecutableRangeScanO
36
35
@ Override
37
36
public <T > ExecutableRangeScan <T > rangeScan (Class <T > domainType ) {
38
37
return new ExecutableRangeScanSupport <>(template , domainType , OptionsBuilder .getScopeFrom (domainType ),
39
- OptionsBuilder .getCollectionFrom (domainType ), null , null , null , null , null , null , null , null , null );
38
+ OptionsBuilder .getCollectionFrom (domainType ), null , null , null , false , null , null );
40
39
}
41
40
42
41
static class ExecutableRangeScanSupport <T > implements ExecutableRangeScan <T > {
@@ -46,121 +45,101 @@ static class ExecutableRangeScanSupport<T> implements ExecutableRangeScan<T> {
46
45
private final String scope ;
47
46
private final String collection ;
48
47
private final ScanOptions options ;
49
- private final Boolean isSamplingScan ;
50
- private final ScanSort sort ;
48
+ private final Object sort ;
51
49
private final MutationState mutationState ;
52
- private final Boolean withContent ;
53
- private final Long limit ;
54
- private final Long seed ;
50
+ private final Boolean idsOnly ;
55
51
private final Integer batchItemLimit ;
56
52
private final Integer batchByteLimit ;
57
53
private final ReactiveRangeScanSupport <T > reactiveSupport ;
58
54
59
55
ExecutableRangeScanSupport (CouchbaseTemplate template , Class <T > domainType , String scope , String collection ,
60
- ScanOptions options , Boolean isSamplingScan , ScanSort sort , MutationState mutationState , Boolean withContent ,
61
- Long seed , Long limit , Integer batchItemLimit , Integer batchByteLimit ) {
56
+ ScanOptions options , Object sort , MutationState mutationState , Boolean idsOnly ,
57
+ Integer batchItemLimit , Integer batchByteLimit ) {
62
58
this .template = template ;
63
59
this .domainType = domainType ;
64
60
this .scope = scope ;
65
61
this .collection = collection ;
66
62
this .options = options ;
67
- this .isSamplingScan = isSamplingScan ;
68
63
this .sort = sort ;
69
64
this .mutationState = mutationState ;
70
- this .withContent = withContent ;
71
- this .limit = limit ;
72
- this .seed = seed ;
65
+ this .idsOnly = idsOnly ;
73
66
this .batchItemLimit = batchItemLimit ;
74
67
this .batchByteLimit = batchByteLimit ;
75
68
this .reactiveSupport = new ReactiveRangeScanSupport <>(template .reactive (), domainType , scope , collection , options ,
76
- isSamplingScan , sort , mutationState , withContent , limit , seed , batchItemLimit , batchByteLimit ,
69
+ sort , mutationState , batchItemLimit , batchByteLimit ,
77
70
new NonReactiveSupportWrapper (template .support ()));
78
71
}
79
72
80
73
@ Override
81
74
public TerminatingRangeScan <T > withOptions (final ScanOptions options ) {
82
75
Assert .notNull (options , "Options must not be null." );
83
- return new ExecutableRangeScanSupport <>(template , domainType , scope , collection , options , isSamplingScan , sort ,
84
- mutationState , withContent , limit , seed , batchItemLimit , batchByteLimit );
76
+ return new ExecutableRangeScanSupport <>(template , domainType , scope , collection , options , sort ,
77
+ mutationState , idsOnly , batchItemLimit , batchByteLimit );
85
78
}
86
79
87
80
@ Override
88
81
public RangeScanWithOptions <T > inCollection (final String collection ) {
89
82
return new ExecutableRangeScanSupport <>(template , domainType , scope ,
90
- collection != null ? collection : this .collection , options , isSamplingScan , sort , mutationState , withContent ,
91
- limit , seed , batchItemLimit , batchByteLimit );
83
+ collection != null ? collection : this .collection , options , sort , mutationState , idsOnly ,
84
+ batchItemLimit , batchByteLimit );
92
85
}
93
86
94
87
@ Override
95
88
public RangeScanInCollection <T > inScope (final String scope ) {
96
89
return new ExecutableRangeScanSupport <>(template , domainType , scope != null ? scope : this .scope , collection ,
97
- options , isSamplingScan , sort , mutationState , withContent , limit , seed , batchItemLimit , batchByteLimit );
90
+ options , sort , mutationState , idsOnly , batchItemLimit , batchByteLimit );
98
91
}
99
92
100
93
@ Override
101
- public RangeScanInScope <T > withSampling (Boolean isSamplingScan ) {
102
- return new ExecutableRangeScanSupport <>(template , domainType , scope , collection , options , isSamplingScan , sort ,
103
- mutationState , withContent , limit , seed , batchItemLimit , batchByteLimit );
104
- }
105
-
106
- @ Override
107
- public RangeScanWithSampling <T > withSort (ScanSort sort ) {
108
- return new ExecutableRangeScanSupport <>(template , domainType , scope , collection , options , isSamplingScan , sort ,
109
- mutationState , withContent , limit , seed , batchItemLimit , batchByteLimit );
94
+ public RangeScanInScope <T > withSort (Object sort ) {
95
+ return new ExecutableRangeScanSupport <>(template , domainType , scope , collection , options , sort ,
96
+ mutationState , idsOnly , batchItemLimit , batchByteLimit );
110
97
}
111
98
112
99
@ Override
113
100
public RangeScanWithSort <T > consistentWith (MutationState mutationState ) {
114
- return new ExecutableRangeScanSupport <>(template , domainType , scope , collection , options , isSamplingScan , sort ,
115
- mutationState , withContent , limit , seed , batchItemLimit , batchByteLimit );
101
+ return new ExecutableRangeScanSupport <>(template , domainType , scope , collection , options , sort ,
102
+ mutationState , idsOnly , batchItemLimit , batchByteLimit );
116
103
}
117
104
118
105
@ Override
119
106
public <R > RangeScanConsistentWith <R > as (Class <R > returnType ) {
120
- return new ExecutableRangeScanSupport <>(template , returnType , scope , collection , options , isSamplingScan , sort ,
121
- mutationState , withContent , limit , seed , batchItemLimit , batchByteLimit );
122
- }
123
-
124
- @ Override
125
- public RangeScanWithProjection <T > idsOnly (Boolean withContent ) {
126
- return new ExecutableRangeScanSupport <>(template , domainType , scope , collection , options , isSamplingScan , sort ,
127
- mutationState , withContent , limit , seed , batchItemLimit , batchByteLimit );
128
- }
129
-
130
- @ Override
131
- public RangeScanIdsOnly <T > withLimit (Long limit ) {
132
- return new ExecutableRangeScanSupport <>(template , domainType , scope , collection , options , isSamplingScan , sort ,
133
- mutationState , withContent , limit , seed , batchItemLimit , batchByteLimit );
107
+ return new ExecutableRangeScanSupport <>(template , returnType , scope , collection , options , sort ,
108
+ mutationState , idsOnly , batchItemLimit , batchByteLimit );
134
109
}
135
110
136
111
@ Override
137
- public RangeScanWithLimit <T > withSeed ( Long seed ) {
138
- return new ExecutableRangeScanSupport <>(template , domainType , scope , collection , options , isSamplingScan , sort ,
139
- mutationState , withContent , limit , seed , batchItemLimit , batchByteLimit );
112
+ public RangeScanWithProjection <T > withBatchItemLimit ( Integer batchItemLimit ) {
113
+ return new ExecutableRangeScanSupport <>(template , domainType , scope , collection , options , sort ,
114
+ mutationState , idsOnly , batchItemLimit , batchByteLimit );
140
115
}
141
116
142
117
@ Override
143
- public RangeScanWithSeed <T > withBatchItemLimit (Integer batchItemLimit ) {
144
- return new ExecutableRangeScanSupport <>(template , domainType , scope , collection , options , isSamplingScan , sort ,
145
- mutationState , withContent , limit , seed , batchItemLimit , batchByteLimit );
146
- }
147
-
148
- @ Override
149
- public RangeScanWithBatchByteLimit <T > withBatchByteLimit (Integer batchByteLimit ) {
150
- return new ExecutableRangeScanSupport <>(template , domainType , scope , collection , options , isSamplingScan , sort ,
151
- mutationState , withContent , limit , seed , batchItemLimit , batchByteLimit );
118
+ public RangeScanWithBatchItemLimit <T > withBatchByteLimit (Integer batchByteLimit ) {
119
+ return new ExecutableRangeScanSupport <>(template , domainType , scope , collection , options , sort ,
120
+ mutationState , idsOnly , batchItemLimit , batchByteLimit );
152
121
}
153
122
154
123
@ Override
155
124
public Stream <T > rangeScan (String lower , String upper ) {
156
- return reactiveSupport .rangeScan (lower , upper ).toStream ();
125
+ return reactiveSupport .rangeScan (lower , upper , false , null , null ).toStream ();
157
126
}
158
127
159
128
@ Override
160
129
public Stream <String > rangeScanIds (String lower , String upper ) {
161
- return reactiveSupport .rangeScanIds (lower , upper ).toStream ();
130
+ return reactiveSupport .rangeScanIds (lower , upper , false , null , null ).toStream ();
162
131
}
163
132
133
+ @ Override
134
+ public Stream <T > samplingScan (Long limit , Long ... seed ) {
135
+ return reactiveSupport .sampleScan (limit , seed ).toStream ();
136
+ }
137
+
138
+ @ Override
139
+ public Stream <String > samplingScanIds (Long limit , Long ... seed ) {
140
+ return reactiveSupport .sampleScanIds (limit , seed ).toStream ();
141
+ }
142
+
164
143
}
165
144
166
145
}
0 commit comments