1
1
/*
2
- * Copyright 2012-2021 the original author or authors
2
+ * Copyright 2012-2022 the original author or authors
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
19
19
import java .util .Collection ;
20
20
21
21
import org .springframework .data .couchbase .core .ReactiveReplaceByIdOperationSupport .ReactiveReplaceByIdSupport ;
22
+ import org .springframework .data .couchbase .core .query .OptionsBuilder ;
22
23
import org .springframework .util .Assert ;
23
24
24
25
import com .couchbase .client .core .msg .kv .DurabilityLevel ;
@@ -37,8 +38,9 @@ public ExecutableReplaceByIdOperationSupport(final CouchbaseTemplate template) {
37
38
@ Override
38
39
public <T > ExecutableReplaceById <T > replaceById (final Class <T > domainType ) {
39
40
Assert .notNull (domainType , "DomainType must not be null!" );
40
- return new ExecutableReplaceByIdSupport <>(template , domainType , null , null , null , PersistTo .NONE , ReplicateTo .NONE ,
41
- DurabilityLevel .NONE , null );
41
+ return new ExecutableReplaceByIdSupport <>(template , domainType , OptionsBuilder .getScopeFrom (domainType ),
42
+ OptionsBuilder .getCollectionFrom (domainType ), null , PersistTo .NONE , ReplicateTo .NONE , DurabilityLevel .NONE ,
43
+ null );
42
44
}
43
45
44
46
static class ExecutableReplaceByIdSupport <T > implements ExecutableReplaceById <T > {
@@ -82,8 +84,8 @@ public Collection<? extends T> all(Collection<? extends T> objects) {
82
84
83
85
@ Override
84
86
public ReplaceByIdWithOptions <T > inCollection (final String collection ) {
85
- return new ExecutableReplaceByIdSupport <>(template , domainType , scope , collection , options , persistTo ,
86
- replicateTo , durabilityLevel , expiry );
87
+ return new ExecutableReplaceByIdSupport <>(template , domainType , scope ,
88
+ collection != null ? collection : this . collection , options , persistTo , replicateTo , durabilityLevel , expiry );
87
89
}
88
90
89
91
@ Override
@@ -117,8 +119,8 @@ public TerminatingReplaceById<T> withOptions(final ReplaceOptions options) {
117
119
118
120
@ Override
119
121
public ReplaceByIdInCollection <T > inScope (final String scope ) {
120
- return new ExecutableReplaceByIdSupport <>(template , domainType , scope , collection , options , persistTo ,
121
- replicateTo , durabilityLevel , expiry );
122
+ return new ExecutableReplaceByIdSupport <>(template , domainType , scope != null ? scope : this . scope , collection ,
123
+ options , persistTo , replicateTo , durabilityLevel , expiry );
122
124
}
123
125
124
126
}
0 commit comments