Skip to content

Commit 8e02981

Browse files
authored
Accomodate changes to springframework repository interfaces. (#1347)
Closes #1346.
1 parent dae0481 commit 8e02981

10 files changed

+37
-38
lines changed

src/main/java/org/springframework/data/couchbase/repository/CouchbaseRepository.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2021 the original author or authors.
2+
* Copyright 2013-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
2121
import org.springframework.data.couchbase.core.CouchbaseOperations;
2222
import org.springframework.data.couchbase.repository.query.CouchbaseEntityInformation;
2323
import org.springframework.data.domain.Sort;
24+
import org.springframework.data.repository.CrudRepository;
2425
import org.springframework.data.repository.NoRepositoryBean;
2526
import org.springframework.data.repository.PagingAndSortingRepository;
2627
import org.springframework.data.repository.Repository;
@@ -34,7 +35,7 @@
3435
* @author Michael Reiche
3536
*/
3637
@NoRepositoryBean
37-
public interface CouchbaseRepository<T, ID> extends PagingAndSortingRepository<T, ID> {
38+
public interface CouchbaseRepository<T, ID> extends PagingAndSortingRepository<T, ID>, CrudRepository<T, ID> {
3839

3940
@Override
4041
List<T> findAll(Sort sort);

src/main/java/org/springframework/data/couchbase/repository/ReactiveCouchbaseRepository.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2021 the original author or authors.
2+
* Copyright 2017-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
1818
import org.springframework.data.couchbase.core.ReactiveCouchbaseOperations;
1919
import org.springframework.data.couchbase.repository.query.CouchbaseEntityInformation;
2020
import org.springframework.data.repository.NoRepositoryBean;
21+
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
2122
import org.springframework.data.repository.reactive.ReactiveSortingRepository;
2223

2324
/**
@@ -28,7 +29,8 @@
2829
* @since 3.0
2930
*/
3031
@NoRepositoryBean
31-
public interface ReactiveCouchbaseRepository<T, ID> extends ReactiveSortingRepository<T, ID> {
32+
public interface ReactiveCouchbaseRepository<T, ID>
33+
extends ReactiveSortingRepository<T, ID>, ReactiveCrudRepository<T, ID> {
3234
ReactiveCouchbaseOperations getOperations();
3335

3436
CouchbaseEntityInformation<T, String> getEntityInformation();

src/test/java/org/springframework/data/couchbase/domain/AirlineRepository.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2019 the original author or authors.
2+
* Copyright 2017-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,17 +16,17 @@
1616

1717
package org.springframework.data.couchbase.domain;
1818

19+
import java.util.List;
20+
21+
import org.springframework.data.couchbase.repository.CouchbaseRepository;
1922
import org.springframework.data.couchbase.repository.Query;
20-
import org.springframework.data.repository.PagingAndSortingRepository;
2123
import org.springframework.data.repository.query.Param;
2224
import org.springframework.stereotype.Repository;
2325

24-
import java.util.List;
25-
2626
@Repository
27-
public interface AirlineRepository extends PagingAndSortingRepository<Airline, String> {
27+
public interface AirlineRepository extends CouchbaseRepository<Airline, String> {
2828

2929
@Query("#{#n1ql.selectEntity} where #{#n1ql.filter} and (name = $1)")
30-
List<User> getByName(@Param("airline_name")String airlineName);
30+
List<User> getByName(@Param("airline_name") String airlineName);
3131

3232
}

src/test/java/org/springframework/data/couchbase/domain/LibraryRepository.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors
2+
* Copyright 2012-2022 the original author or authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.data.couchbase.domain;
1818

19-
import org.springframework.data.repository.PagingAndSortingRepository;
19+
import org.springframework.data.couchbase.repository.CouchbaseRepository;
2020
import org.springframework.stereotype.Repository;
2121

2222
/**
@@ -25,6 +25,6 @@
2525
* @author Andrea Torlaschi
2626
*/
2727
@Repository
28-
public interface LibraryRepository extends PagingAndSortingRepository<Library, String> {
28+
public interface LibraryRepository extends CouchbaseRepository<Library, String> {
2929

3030
}

src/test/java/org/springframework/data/couchbase/domain/ReactiveAirlineRepository.java

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors
2+
* Copyright 2012-2022 the original author or authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,22 +16,20 @@
1616

1717
package org.springframework.data.couchbase.domain;
1818

19+
import java.util.List;
20+
1921
import org.springframework.data.couchbase.repository.Query;
22+
import org.springframework.data.couchbase.repository.ReactiveCouchbaseRepository;
2023
import org.springframework.data.repository.query.Param;
21-
import reactor.core.publisher.Flux;
22-
23-
import org.springframework.data.repository.reactive.ReactiveSortingRepository;
2424
import org.springframework.stereotype.Repository;
2525

26-
import java.util.List;
27-
2826
/**
2927
* @author Michael Reiche
3028
*/
3129
@Repository
32-
public interface ReactiveAirlineRepository extends ReactiveSortingRepository<Airline, String> {
30+
public interface ReactiveAirlineRepository extends ReactiveCouchbaseRepository<Airline, String> {
3331

3432
@Query("#{#n1ql.selectEntity} where #{#n1ql.filter} and (name = $1)")
35-
List<User> getByName(@Param("airline_name")String airlineName);
33+
List<User> getByName(@Param("airline_name") String airlineName);
3634

3735
}

src/test/java/org/springframework/data/couchbase/domain/ReactiveUserRepository.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors
2+
* Copyright 2012-2022 the original author or authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,11 +18,11 @@
1818

1919
import reactor.core.publisher.Flux;
2020

21-
import org.springframework.data.repository.reactive.ReactiveSortingRepository;
21+
import org.springframework.data.couchbase.repository.ReactiveCouchbaseRepository;
2222
import org.springframework.stereotype.Repository;
2323

2424
@Repository
25-
public interface ReactiveUserRepository extends ReactiveSortingRepository<User, String> {
25+
public interface ReactiveUserRepository extends ReactiveCouchbaseRepository<User, String> {
2626

2727
Flux<User> findByFirstname(String firstname);
2828

src/test/java/org/springframework/data/couchbase/domain/SubscriptionTokenRepository.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 the original author or authors
2+
* Copyright 2020-2022 the original author or authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.data.couchbase.domain;
1818

19-
import org.springframework.data.repository.PagingAndSortingRepository;
19+
import org.springframework.data.couchbase.repository.CouchbaseRepository;
2020
import org.springframework.stereotype.Repository;
2121

2222
/**
@@ -25,5 +25,4 @@
2525
* @author Michael Reiche
2626
*/
2727
@Repository
28-
public interface SubscriptionTokenRepository extends PagingAndSortingRepository<SubscriptionToken, String> {
29-
}
28+
public interface SubscriptionTokenRepository extends CouchbaseRepository<SubscriptionToken, String> {}

src/test/java/org/springframework/data/couchbase/domain/UserSubmissionAnnotatedRepository.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
import java.util.List;
2020

21+
import org.springframework.data.couchbase.repository.CouchbaseRepository;
2122
import org.springframework.data.couchbase.repository.ScanConsistency;
22-
import org.springframework.data.repository.PagingAndSortingRepository;
2323
import org.springframework.stereotype.Repository;
2424

2525
import com.couchbase.client.java.query.QueryScanConsistency;
@@ -30,8 +30,8 @@
3030
* @author Michael Reiche
3131
*/
3232
@Repository
33-
public interface UserSubmissionAnnotatedRepository extends PagingAndSortingRepository<UserSubmissionAnnotated, String> {
33+
public interface UserSubmissionAnnotatedRepository extends CouchbaseRepository<UserSubmissionAnnotated, String> {
3434

35-
@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)
36-
List<UserSubmissionAnnotated> findByUsername(String username);
35+
@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)
36+
List<UserSubmissionAnnotated> findByUsername(String username);
3737
}

src/test/java/org/springframework/data/couchbase/domain/UserSubmissionRepository.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 the original author or authors
2+
* Copyright 2020-2022 the original author or authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,8 +18,8 @@
1818

1919
import java.util.List;
2020

21+
import org.springframework.data.couchbase.repository.CouchbaseRepository;
2122
import org.springframework.data.couchbase.repository.ScanConsistency;
22-
import org.springframework.data.repository.PagingAndSortingRepository;
2323
import org.springframework.stereotype.Repository;
2424

2525
import com.couchbase.client.java.query.QueryScanConsistency;
@@ -30,7 +30,7 @@
3030
* @author Michael Reiche
3131
*/
3232
@Repository
33-
public interface UserSubmissionRepository extends PagingAndSortingRepository<UserSubmission, String> {
33+
public interface UserSubmissionRepository extends CouchbaseRepository<UserSubmission, String> {
3434

3535
@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)
3636
List<UserSubmission> findByUsername(String username);

src/test/java/org/springframework/data/couchbase/domain/UserSubmissionUnannotatedRepository.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
import java.util.List;
2020

21+
import org.springframework.data.couchbase.repository.CouchbaseRepository;
2122
import org.springframework.data.couchbase.repository.ScanConsistency;
22-
import org.springframework.data.repository.PagingAndSortingRepository;
2323
import org.springframework.stereotype.Repository;
2424

2525
import com.couchbase.client.java.query.QueryScanConsistency;
@@ -30,8 +30,7 @@
3030
* @author Michael Reiche
3131
*/
3232
@Repository
33-
public interface UserSubmissionUnannotatedRepository
34-
extends PagingAndSortingRepository<UserSubmissionUnannotated, String> {
33+
public interface UserSubmissionUnannotatedRepository extends CouchbaseRepository<UserSubmissionUnannotated, String> {
3534

3635
@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)
3736
List<UserSubmissionUnannotated> findByUsername(String username);

0 commit comments

Comments
 (0)