Procházet zdrojové kódy

Census added to SelectedCensusEntryService::getListPage

Andrew Grant před 7 měsíci
rodič
revize
d8c428f507

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

@@ -55,7 +55,7 @@ public class SelectedCensusListControllerImpl implements CensusEntryListControll
 
     @SuppressWarnings("SameReturnValue")
     private String sendAttributesAndReturn(Model model) {
-        model.addAttribute(AttributeConstants.CENSUS_ENTRIES, selectedCensusEntryService.getPagedCensusEntries(currentPage));
+        model.addAttribute(AttributeConstants.CENSUS_ENTRIES, selectedCensusEntryService.getPagedCensusEntries(census, currentPage));
         controllerHelper.addAttributes(model);
         return ViewConstants.SELECTED_CENSUS_LIST;
     }
@@ -113,7 +113,7 @@ public class SelectedCensusListControllerImpl implements CensusEntryListControll
         logger.debug("");
         census = censusService.findById(Long.valueOf(id));
         model.addAttribute(AttributeConstants.CENSUS,  selectedCensusEntryService.findById(Long.valueOf(id)));
-        model.addAttribute(AttributeConstants.CENSUS_ENTRIES, selectedCensusEntryService.getPagedCensusEntries(currentPage));
+        model.addAttribute(AttributeConstants.CENSUS_ENTRIES, selectedCensusEntryService.getPagedCensusEntries(census, currentPage));
         return ViewConstants.SELECTED_CENSUS_LIST;
     }
 

+ 2 - 1
src/main/java/scot/carricksoftware/grants/services/census/selectedcensus/SelectedCensusEntryService.java

@@ -6,6 +6,7 @@
 package scot.carricksoftware.grants.services.census.selectedcensus;
 
 import org.springframework.stereotype.Service;
+import scot.carricksoftware.grants.domains.census.Census;
 import scot.carricksoftware.grants.domains.census.CensusEntry;
 
 import java.util.List;
@@ -17,7 +18,7 @@ public interface SelectedCensusEntryService {
 
     void deleteById(Long id);
 
-    List<CensusEntry> getPagedCensusEntries(int pageNumber);
+    List<CensusEntry> getPagedCensusEntries(Census census, int pageNumber);
 
 
     long count();

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

@@ -13,6 +13,7 @@ import org.springframework.data.domain.Pageable;
 import org.springframework.data.domain.Sort;
 import org.springframework.stereotype.Service;
 import scot.carricksoftware.grants.constants.ApplicationConstants;
+import scot.carricksoftware.grants.domains.census.Census;
 import scot.carricksoftware.grants.domains.census.CensusEntry;
 import scot.carricksoftware.grants.repositories.census.CensusEntryRepository;
 
@@ -46,7 +47,7 @@ public class SelectedCensusEntryServiceImpl implements SelectedCensusEntryServic
 
 
     @Override
-    public List<CensusEntry> getPagedCensusEntries(int pageNumber) {
+    public List<CensusEntry> getPagedCensusEntries(Census census, int pageNumber) {
         logger.debug("censusEntryServiceImpl::getPagedCountries");
         Pageable paging = PageRequest.of(pageNumber, ApplicationConstants.DEFAULT_PAGE_SIZE, getSort());
         Page<CensusEntry> pagedResult = censusEntryRepository.findAll(paging);