Accomodate changes to springframework repository interfaces. (#1347)

Closes #1346.
This commit is contained in:
Michael Reiche
2022-02-16 12:33:10 -08:00
committed by GitHub
parent dae04813d2
commit 8e02981752
10 changed files with 39 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2021 the original author or authors.
* Copyright 2013-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import java.util.List;
import org.springframework.data.couchbase.core.CouchbaseOperations;
import org.springframework.data.couchbase.repository.query.CouchbaseEntityInformation;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.Repository;
@@ -34,7 +35,7 @@ import com.couchbase.client.java.query.QueryScanConsistency;
* @author Michael Reiche
*/
@NoRepositoryBean
public interface CouchbaseRepository<T, ID> extends PagingAndSortingRepository<T, ID> {
public interface CouchbaseRepository<T, ID> extends PagingAndSortingRepository<T, ID>, CrudRepository<T, ID> {
@Override
List<T> findAll(Sort sort);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2021 the original author or authors.
* Copyright 2017-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.springframework.data.couchbase.repository;
import org.springframework.data.couchbase.core.ReactiveCouchbaseOperations;
import org.springframework.data.couchbase.repository.query.CouchbaseEntityInformation;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import org.springframework.data.repository.reactive.ReactiveSortingRepository;
/**
@@ -28,7 +29,8 @@ import org.springframework.data.repository.reactive.ReactiveSortingRepository;
* @since 3.0
*/
@NoRepositoryBean
public interface ReactiveCouchbaseRepository<T, ID> extends ReactiveSortingRepository<T, ID> {
public interface ReactiveCouchbaseRepository<T, ID>
extends ReactiveSortingRepository<T, ID>, ReactiveCrudRepository<T, ID> {
ReactiveCouchbaseOperations getOperations();
CouchbaseEntityInformation<T, String> getEntityInformation();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2019 the original author or authors.
* Copyright 2017-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,17 +16,17 @@
package org.springframework.data.couchbase.domain;
import java.util.List;
import org.springframework.data.couchbase.repository.CouchbaseRepository;
import org.springframework.data.couchbase.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface AirlineRepository extends PagingAndSortingRepository<Airline, String> {
public interface AirlineRepository extends CouchbaseRepository<Airline, String> {
@Query("#{#n1ql.selectEntity} where #{#n1ql.filter} and (name = $1)")
List<User> getByName(@Param("airline_name")String airlineName);
List<User> getByName(@Param("airline_name") String airlineName);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors
* Copyright 2012-2022 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
package org.springframework.data.couchbase.domain;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.couchbase.repository.CouchbaseRepository;
import org.springframework.stereotype.Repository;
/**
@@ -25,6 +25,6 @@ import org.springframework.stereotype.Repository;
* @author Andrea Torlaschi
*/
@Repository
public interface LibraryRepository extends PagingAndSortingRepository<Library, String> {
public interface LibraryRepository extends CouchbaseRepository<Library, String> {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors
* Copyright 2012-2022 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,22 +16,20 @@
package org.springframework.data.couchbase.domain;
import org.springframework.data.couchbase.repository.Query;
import org.springframework.data.repository.query.Param;
import reactor.core.publisher.Flux;
import org.springframework.data.repository.reactive.ReactiveSortingRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import org.springframework.data.couchbase.repository.Query;
import org.springframework.data.couchbase.repository.ReactiveCouchbaseRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
/**
* @author Michael Reiche
*/
@Repository
public interface ReactiveAirlineRepository extends ReactiveSortingRepository<Airline, String> {
public interface ReactiveAirlineRepository extends ReactiveCouchbaseRepository<Airline, String> {
@Query("#{#n1ql.selectEntity} where #{#n1ql.filter} and (name = $1)")
List<User> getByName(@Param("airline_name")String airlineName);
List<User> getByName(@Param("airline_name") String airlineName);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors
* Copyright 2012-2022 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,11 +18,11 @@ package org.springframework.data.couchbase.domain;
import reactor.core.publisher.Flux;
import org.springframework.data.repository.reactive.ReactiveSortingRepository;
import org.springframework.data.couchbase.repository.ReactiveCouchbaseRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ReactiveUserRepository extends ReactiveSortingRepository<User, String> {
public interface ReactiveUserRepository extends ReactiveCouchbaseRepository<User, String> {
Flux<User> findByFirstname(String firstname);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020 the original author or authors
* Copyright 2020-2022 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
package org.springframework.data.couchbase.domain;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.couchbase.repository.CouchbaseRepository;
import org.springframework.stereotype.Repository;
/**
@@ -25,5 +25,4 @@ import org.springframework.stereotype.Repository;
* @author Michael Reiche
*/
@Repository
public interface SubscriptionTokenRepository extends PagingAndSortingRepository<SubscriptionToken, String> {
}
public interface SubscriptionTokenRepository extends CouchbaseRepository<SubscriptionToken, String> {}

View File

@@ -18,8 +18,8 @@ package org.springframework.data.couchbase.domain;
import java.util.List;
import org.springframework.data.couchbase.repository.CouchbaseRepository;
import org.springframework.data.couchbase.repository.ScanConsistency;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import com.couchbase.client.java.query.QueryScanConsistency;
@@ -30,8 +30,8 @@ import com.couchbase.client.java.query.QueryScanConsistency;
* @author Michael Reiche
*/
@Repository
public interface UserSubmissionAnnotatedRepository extends PagingAndSortingRepository<UserSubmissionAnnotated, String> {
public interface UserSubmissionAnnotatedRepository extends CouchbaseRepository<UserSubmissionAnnotated, String> {
@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)
List<UserSubmissionAnnotated> findByUsername(String username);
@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)
List<UserSubmissionAnnotated> findByUsername(String username);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors
* Copyright 2020-2022 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,8 @@ package org.springframework.data.couchbase.domain;
import java.util.List;
import org.springframework.data.couchbase.repository.CouchbaseRepository;
import org.springframework.data.couchbase.repository.ScanConsistency;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import com.couchbase.client.java.query.QueryScanConsistency;
@@ -30,7 +30,7 @@ import com.couchbase.client.java.query.QueryScanConsistency;
* @author Michael Reiche
*/
@Repository
public interface UserSubmissionRepository extends PagingAndSortingRepository<UserSubmission, String> {
public interface UserSubmissionRepository extends CouchbaseRepository<UserSubmission, String> {
@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)
List<UserSubmission> findByUsername(String username);

View File

@@ -18,8 +18,8 @@ package org.springframework.data.couchbase.domain;
import java.util.List;
import org.springframework.data.couchbase.repository.CouchbaseRepository;
import org.springframework.data.couchbase.repository.ScanConsistency;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import com.couchbase.client.java.query.QueryScanConsistency;
@@ -30,8 +30,7 @@ import com.couchbase.client.java.query.QueryScanConsistency;
* @author Michael Reiche
*/
@Repository
public interface UserSubmissionUnannotatedRepository
extends PagingAndSortingRepository<UserSubmissionUnannotated, String> {
public interface UserSubmissionUnannotatedRepository extends CouchbaseRepository<UserSubmissionUnannotated, String> {
@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)
List<UserSubmissionUnannotated> findByUsername(String username);