Browse Source

SelectedCensusListControllerImpl

Andrew Grant 7 months ago
parent
commit
3ed86383d2

+ 0 - 1
src/main/java/scot/carricksoftware/grants/controllers/census/selectedcensus/SelectedCensusListControllerImpl.java

@@ -28,7 +28,6 @@ public class SelectedCensusListControllerImpl implements CensusEntryListControll
 
 
     private int currentPage = 0;
-    @SuppressWarnings({"unused", "FieldCanBeLocal"})
     private Census census;
 
     private final ControllerHelper controllerHelper;

+ 5 - 0
src/main/java/scot/carricksoftware/grants/repositories/census/CensusEntryRepository.java

@@ -5,8 +5,11 @@
 
 package scot.carricksoftware.grants.repositories.census;
 
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
 import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.stereotype.Repository;
+import scot.carricksoftware.grants.domains.census.Census;
 import scot.carricksoftware.grants.domains.census.CensusEntry;
 
 import java.util.Optional;
@@ -23,4 +26,6 @@ public interface CensusEntryRepository extends PagingAndSortingRepository<Census
     Optional<CensusEntry> findById(Long id);
 
     Iterable<CensusEntry> findAll();
+
+    Page<CensusEntry> findAllByCensus(Census census, Pageable paging);
 }

+ 5 - 5
src/main/java/scot/carricksoftware/grants/services/census/selectedcensus/SelectedCensusEntryServiceImpl.java

@@ -33,7 +33,7 @@ public class SelectedCensusEntryServiceImpl implements SelectedCensusEntryServic
 
     @Override
     public CensusEntry findById(Long id) {
-        logger.debug("censusEntryServiceImpl::findById");
+        logger.debug("SelectedCensusEntryServiceImpl::findById");
         Optional<CensusEntry> censusEntry = censusEntryRepository.findById(id);
         return censusEntry.orElse(null);
     }
@@ -41,16 +41,16 @@ public class SelectedCensusEntryServiceImpl implements SelectedCensusEntryServic
 
     @Override
     public void deleteById(Long id) {
-        logger.debug("censusEntryServiceImpl::deleteBy");
+        logger.debug("SelectedCensusEntryServiceImpl::deleteBy");
         censusEntryRepository.deleteById(id);
     }
 
 
     @Override
     public List<CensusEntry> getPagedCensusEntries(Census census, int pageNumber) {
-        logger.debug("censusEntryServiceImpl::getPagedCountries");
+        logger.debug("SelectedCensusEntryServiceImpl::getPagedCountries");
         Pageable paging = PageRequest.of(pageNumber, ApplicationConstants.DEFAULT_PAGE_SIZE, getSort());
-        Page<CensusEntry> pagedResult = censusEntryRepository.findAll(paging);
+        Page<CensusEntry> pagedResult = censusEntryRepository.findAllByCensus(census, paging);
         return pagedResult.getContent();
     }
 
@@ -60,7 +60,7 @@ public class SelectedCensusEntryServiceImpl implements SelectedCensusEntryServic
 
     @Override
     public long count() {
-        logger.debug("censusEntryServiceImpl::count");
+        logger.debug("SelectedCensusEntryServiceImpl::count");
         return censusEntryRepository.count();
     }
 

+ 1 - 1
src/main/resources/application.properties

@@ -2,7 +2,7 @@ spring.application.name=grants
 server.port=8086
 server.servlet.context-path=/grants
 spring.mvc.format.date=dd-MM-yyyy
-spring.profiles.active=uat
+spring.profiles.active=dev
 logging.level.scot.carricksoftware=trace