Ver código fonte

Convert to read only repositories

Andrew Grant 4 meses atrás
pai
commit
e5c0fb257c
15 arquivos alterados com 48 adições e 27 exclusões
  1. 20 0
      src/main/java/scot/carricksoftware/grantswriter/repositories/ReadOnlyRepository.java
  2. 2 2
      src/main/java/scot/carricksoftware/grantswriter/repositories/census/CensusEntryRepository.java
  3. 2 2
      src/main/java/scot/carricksoftware/grantswriter/repositories/census/CensusRepository.java
  4. 2 2
      src/main/java/scot/carricksoftware/grantswriter/repositories/certificates/BirthCertificateRepository.java
  5. 2 2
      src/main/java/scot/carricksoftware/grantswriter/repositories/certificates/DeathCertificateRepository.java
  6. 2 2
      src/main/java/scot/carricksoftware/grantswriter/repositories/certificates/DivorceCertificateRepository.java
  7. 2 2
      src/main/java/scot/carricksoftware/grantswriter/repositories/certificates/MarriageCertificateRepository.java
  8. 2 2
      src/main/java/scot/carricksoftware/grantswriter/repositories/images/ImageRepository.java
  9. 2 2
      src/main/java/scot/carricksoftware/grantswriter/repositories/images/PersonImageRepository.java
  10. 2 2
      src/main/java/scot/carricksoftware/grantswriter/repositories/images/PlaceImageRepository.java
  11. 3 2
      src/main/java/scot/carricksoftware/grantswriter/repositories/people/PersonRepository.java
  12. 2 2
      src/main/java/scot/carricksoftware/grantswriter/repositories/places/CountryRepository.java
  13. 2 2
      src/main/java/scot/carricksoftware/grantswriter/repositories/places/PlaceRepository.java
  14. 2 2
      src/main/java/scot/carricksoftware/grantswriter/repositories/places/RegionRepository.java
  15. 1 1
      src/test/java/scot/carricksoftware/grantswriter/writer/latex/parts/WritePartsTest.java

+ 20 - 0
src/main/java/scot/carricksoftware/grantswriter/repositories/ReadOnlyRepository.java

@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grantswriter.repositories;
+
+import org.springframework.data.repository.Repository;
+
+import java.util.List;
+import java.util.Optional;
+
+public interface ReadOnlyRepository<T, ID> extends Repository<T, ID> {
+
+    @SuppressWarnings("unused")
+    Optional<T> findById(ID id);
+    @SuppressWarnings("unused")
+    List<T> findAll();
+
+}

+ 2 - 2
src/main/java/scot/carricksoftware/grantswriter/repositories/census/CensusEntryRepository.java

@@ -5,12 +5,12 @@
 
 package scot.carricksoftware.grantswriter.repositories.census;
 
-import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.stereotype.Repository;
 import scot.carricksoftware.grantswriter.domains.census.CensusEntry;
+import scot.carricksoftware.grantswriter.repositories.ReadOnlyRepository;
 
 @SuppressWarnings("unused")
 @Repository
-public interface CensusEntryRepository extends PagingAndSortingRepository<CensusEntry, Long> {
+public interface CensusEntryRepository extends ReadOnlyRepository<CensusEntry, Long> {
 
 }

+ 2 - 2
src/main/java/scot/carricksoftware/grantswriter/repositories/census/CensusRepository.java

@@ -5,12 +5,12 @@
 
 package scot.carricksoftware.grantswriter.repositories.census;
 
-import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.stereotype.Repository;
 import scot.carricksoftware.grantswriter.domains.census.Census;
+import scot.carricksoftware.grantswriter.repositories.ReadOnlyRepository;
 
 @SuppressWarnings("unused")
 @Repository
-public interface CensusRepository extends PagingAndSortingRepository<Census, Long> {
+public interface CensusRepository extends ReadOnlyRepository<Census, Long> {
 
 }

+ 2 - 2
src/main/java/scot/carricksoftware/grantswriter/repositories/certificates/BirthCertificateRepository.java

@@ -5,13 +5,13 @@
 
 package scot.carricksoftware.grantswriter.repositories.certificates;
 
-import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.stereotype.Repository;
 import scot.carricksoftware.grantswriter.domains.certificates.BirthCertificate;
+import scot.carricksoftware.grantswriter.repositories.ReadOnlyRepository;
 
 @SuppressWarnings("unused")
 @Repository
-public interface BirthCertificateRepository extends PagingAndSortingRepository<BirthCertificate, Long> {
+public interface BirthCertificateRepository extends ReadOnlyRepository<BirthCertificate, Long> {
 
 
 }

+ 2 - 2
src/main/java/scot/carricksoftware/grantswriter/repositories/certificates/DeathCertificateRepository.java

@@ -5,13 +5,13 @@
 
 package scot.carricksoftware.grantswriter.repositories.certificates;
 
-import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.stereotype.Repository;
 import scot.carricksoftware.grantswriter.domains.certificates.DeathCertificate;
+import scot.carricksoftware.grantswriter.repositories.ReadOnlyRepository;
 
 @SuppressWarnings("unused")
 @Repository
-public interface DeathCertificateRepository extends PagingAndSortingRepository<DeathCertificate, Long> {
+public interface DeathCertificateRepository extends ReadOnlyRepository<DeathCertificate, Long> {
 
 
 }

+ 2 - 2
src/main/java/scot/carricksoftware/grantswriter/repositories/certificates/DivorceCertificateRepository.java

@@ -5,13 +5,13 @@
 
 package scot.carricksoftware.grantswriter.repositories.certificates;
 
-import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.stereotype.Repository;
 import scot.carricksoftware.grantswriter.domains.certificates.DivorceCertificate;
+import scot.carricksoftware.grantswriter.repositories.ReadOnlyRepository;
 
 @SuppressWarnings("unused")
 @Repository
-public interface DivorceCertificateRepository extends PagingAndSortingRepository<DivorceCertificate, Long> {
+public interface DivorceCertificateRepository extends ReadOnlyRepository<DivorceCertificate, Long> {
 
 
 }

+ 2 - 2
src/main/java/scot/carricksoftware/grantswriter/repositories/certificates/MarriageCertificateRepository.java

@@ -5,13 +5,13 @@
 
 package scot.carricksoftware.grantswriter.repositories.certificates;
 
-import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.stereotype.Repository;
 import scot.carricksoftware.grantswriter.domains.certificates.MarriageCertificate;
+import scot.carricksoftware.grantswriter.repositories.ReadOnlyRepository;
 
 @SuppressWarnings("unused")
 @Repository
-public interface MarriageCertificateRepository extends PagingAndSortingRepository<MarriageCertificate, Long> {
+public interface MarriageCertificateRepository extends ReadOnlyRepository<MarriageCertificate, Long> {
 
 
 }

+ 2 - 2
src/main/java/scot/carricksoftware/grantswriter/repositories/images/ImageRepository.java

@@ -5,10 +5,10 @@
 
 package scot.carricksoftware.grantswriter.repositories.images;
 
-import org.springframework.data.repository.PagingAndSortingRepository;
 import scot.carricksoftware.grantswriter.domains.images.Image;
+import scot.carricksoftware.grantswriter.repositories.ReadOnlyRepository;
 
 @SuppressWarnings("unused")
-public interface ImageRepository extends PagingAndSortingRepository<Image, Long> {
+public interface ImageRepository extends ReadOnlyRepository<Image, Long> {
 
 }

+ 2 - 2
src/main/java/scot/carricksoftware/grantswriter/repositories/images/PersonImageRepository.java

@@ -5,10 +5,10 @@
 
 package scot.carricksoftware.grantswriter.repositories.images;
 
-import org.springframework.data.repository.PagingAndSortingRepository;
 import scot.carricksoftware.grantswriter.domains.images.PersonImage;
+import scot.carricksoftware.grantswriter.repositories.ReadOnlyRepository;
 
 @SuppressWarnings("unused")
-public interface PersonImageRepository extends PagingAndSortingRepository<PersonImage, Long> {
+public interface PersonImageRepository extends ReadOnlyRepository<PersonImage, Long> {
 
 }

+ 2 - 2
src/main/java/scot/carricksoftware/grantswriter/repositories/images/PlaceImageRepository.java

@@ -5,10 +5,10 @@
 
 package scot.carricksoftware.grantswriter.repositories.images;
 
-import org.springframework.data.repository.PagingAndSortingRepository;
 import scot.carricksoftware.grantswriter.domains.images.PlaceImage;
+import scot.carricksoftware.grantswriter.repositories.ReadOnlyRepository;
 
 @SuppressWarnings("unused")
-public interface PlaceImageRepository extends PagingAndSortingRepository<PlaceImage, Long> {
+public interface PlaceImageRepository extends ReadOnlyRepository<PlaceImage, Long> {
 
 }

+ 3 - 2
src/main/java/scot/carricksoftware/grantswriter/repositories/people/PersonRepository.java

@@ -5,13 +5,14 @@
 
 package scot.carricksoftware.grantswriter.repositories.people;
 
-import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.stereotype.Repository;
 import scot.carricksoftware.grantswriter.domains.people.Person;
+import scot.carricksoftware.grantswriter.repositories.ReadOnlyRepository;
 
 @SuppressWarnings("unused")
 @Repository
-public interface PersonRepository extends PagingAndSortingRepository<Person, Long> {
+public interface PersonRepository extends ReadOnlyRepository<Person, Long> {
+
 
 
 }

+ 2 - 2
src/main/java/scot/carricksoftware/grantswriter/repositories/places/CountryRepository.java

@@ -5,13 +5,13 @@
 
 package scot.carricksoftware.grantswriter.repositories.places;
 
-import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.stereotype.Repository;
 import scot.carricksoftware.grantswriter.domains.places.Country;
+import scot.carricksoftware.grantswriter.repositories.ReadOnlyRepository;
 
 @SuppressWarnings("unused")
 @Repository
-public interface CountryRepository extends PagingAndSortingRepository<Country, Long> {
+public interface CountryRepository extends ReadOnlyRepository<Country, Long> {
 
 
 }

+ 2 - 2
src/main/java/scot/carricksoftware/grantswriter/repositories/places/PlaceRepository.java

@@ -5,13 +5,13 @@
 
 package scot.carricksoftware.grantswriter.repositories.places;
 
-import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.stereotype.Repository;
 import scot.carricksoftware.grantswriter.domains.places.Place;
+import scot.carricksoftware.grantswriter.repositories.ReadOnlyRepository;
 
 @SuppressWarnings("unused")
 @Repository
-public interface PlaceRepository extends PagingAndSortingRepository<Place, Long> {
+public interface PlaceRepository extends ReadOnlyRepository<Place, Long> {
 
 
 }

+ 2 - 2
src/main/java/scot/carricksoftware/grantswriter/repositories/places/RegionRepository.java

@@ -5,13 +5,13 @@
 
 package scot.carricksoftware.grantswriter.repositories.places;
 
-import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.stereotype.Repository;
 import scot.carricksoftware.grantswriter.domains.places.Region;
+import scot.carricksoftware.grantswriter.repositories.ReadOnlyRepository;
 
 @SuppressWarnings("unused")
 @Repository
-public interface RegionRepository extends PagingAndSortingRepository<Region, Long> {
+public interface RegionRepository extends ReadOnlyRepository<Region, Long> {
 
 
 }

+ 1 - 1
src/test/java/scot/carricksoftware/grantswriter/writer/latex/parts/WritePartsTest.java

@@ -37,4 +37,4 @@ class WritePartsTest {
         writeParts.write();
         verify(peoplePartsMock).write();
     }
-}
+}