Commit d0013079 authored by Matija Obreza's avatar Matija Obreza

Only list active PGR institutes on /wiews

parent d6db2fca
......@@ -64,4 +64,7 @@ public interface FaoInstituteRepository extends JpaRepository<FaoInstitute, Long
@Query("select distinct fi from FaoInstitute fi where lower(fi.code) like lower(?1) or lower(fi.fullName) like lower(?1) or lower(fi.acronym) like lower(?1) order by fi.accessionCount desc")
List<FaoInstitute> autocomplete(String string, Pageable pageable);
@Query("select fi from FaoInstitute fi where fi.maintainsCollection=true and fi.current=true order by fi.code")
Page<FaoInstitute> listPGRInstitutes(Pageable pageable);
}
......@@ -24,7 +24,6 @@ import java.util.Map;
import org.genesys2.server.model.impl.Country;
import org.genesys2.server.model.impl.FaoInstitute;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
......@@ -44,7 +43,7 @@ public interface InstituteService {
List<FaoInstitute> listByCountryActive(Country country);
Page<FaoInstitute> listActive(PageRequest pageRequest);
Page<FaoInstitute> listActive(Pageable pageable);
void update(Collection<FaoInstitute> institutes);
......@@ -68,4 +67,6 @@ public interface InstituteService {
List<FaoInstitute> autocomplete(String ac);
Page<FaoInstitute> listPGRInstitutes(Pageable pageable);
}
......@@ -83,8 +83,13 @@ public class InstituteServiceImpl implements InstituteService {
}
@Override
public Page<FaoInstitute> listActive(PageRequest pageRequest) {
return instituteRepository.listAllActive(pageRequest);
public Page<FaoInstitute> listActive(Pageable pageable) {
return instituteRepository.listAllActive(pageable);
}
@Override
public Page<FaoInstitute> listPGRInstitutes(Pageable pageable) {
return instituteRepository.listPGRInstitutes(pageable);
}
@Override
......
......@@ -79,7 +79,7 @@ public class WiewsController extends BaseController {
@RequestMapping("/")
public String view(ModelMap model, @RequestParam(value = "page", required = false, defaultValue = "1") int page) {
model.addAttribute("pagedData", instituteService.list(new PageRequest(page - 1, 50, new Sort("code"))));
model.addAttribute("pagedData", instituteService.listPGRInstitutes(new PageRequest(page - 1, 50, new Sort("code"))));
return "/wiews/index";
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment