Commit f63964c6 authored by Artem Hrybeniuk's avatar Artem Hrybeniuk
Browse files

Pageable default page size

parent 7f3aa83e
......@@ -61,7 +61,7 @@ public abstract class FilteredCRUDController<E extends EmptyModel, S extends Fil
public FilteredPage<E> list(@Parameter(hidden = true) final Pagination page, @RequestBody(required = false) final F filter) throws SearchException, IOException {
F normalizedFilter = shortFilterProcessor.normalizeFilter(filter, filterType());
Pageable pageable = ArrayUtils.isEmpty(page.getS()) ? page.toPageRequest(maxPageSize, defaultSort()) : page.toPageRequest(maxPageSize);
Pageable pageable = ArrayUtils.isEmpty(page.getS()) ? page.toPageRequest(maxPageSize, maxPageSize, defaultSort()) : page.toPageRequest(maxPageSize, maxPageSize);
return new FilteredPage<>(normalizedFilter, crudService.list(filter, pageable));
}
......@@ -83,7 +83,7 @@ public abstract class FilteredCRUDController<E extends EmptyModel, S extends Fil
@RequestBody(required = false) final F filter) throws IOException, SearchException {
ShortFilterService.FilterInfo<F> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, filterType());
Pageable pageable = ArrayUtils.isEmpty(page.getS()) ? page.toPageRequest(maxPageSize, defaultSort()) : page.toPageRequest(maxPageSize);
Pageable pageable = ArrayUtils.isEmpty(page.getS()) ? page.toPageRequest(maxPageSize, maxPageSize, defaultSort()) : page.toPageRequest(maxPageSize, maxPageSize);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, crudService.list(filterInfo.filter, pageable));
}
......
......@@ -178,8 +178,8 @@ public class Pagination {
* @param maxPageSize the max page size
* @return the pageable
*/
public Pageable toPageRequest(int maxPageSize) {
return PageRequest.of(p == null ? 0 : p, Integer.min(l == null ? maxPageSize : l, maxPageSize), Sort.by(getSortOrders(getDirections(DEFAULT_SORT_DIRECTION),
public Pageable toPageRequest(int maxPageSize, int defaultPageSize) {
return PageRequest.of(p == null ? 0 : p, Integer.min(l == null ? defaultPageSize : l, maxPageSize), Sort.by(getSortOrders(getDirections(DEFAULT_SORT_DIRECTION),
getSortProperties(DEFAULT_SORT_PROPERTIES))));
}
......@@ -191,8 +191,8 @@ public class Pagination {
* @param defaultSort the default sort
* @return the pageable
*/
public Pageable toPageRequest(int maxPageSize, Direction defaultDir, String... defaultSort) {
return PageRequest.of(p == null ? 0 : p, Integer.min(l == null ? maxPageSize : l, maxPageSize), Sort.by(getSortOrders(getDirections(defaultDir),
public Pageable toPageRequest(int maxPageSize, int defaultPageSize, Direction defaultDir, String... defaultSort) {
return PageRequest.of(p == null ? 0 : p, Integer.min(l == null ? defaultPageSize : l, maxPageSize), Sort.by(getSortOrders(getDirections(defaultDir),
getSortProperties(defaultSort))));
}
......@@ -204,8 +204,8 @@ public class Pagination {
* @param defaultSort the default sort
* @return the pageable
*/
public Pageable toPageRequest(final int maxPageSize, final Direction[] defaultDirs, final String... defaultSort) {
return PageRequest.of(p == null ? 0 : p, Integer.min(l == null ? maxPageSize : l, maxPageSize), Sort.by(getSortOrders(getDirections(defaultDirs),
public Pageable toPageRequest(final int maxPageSize, final int defaultPageSize, final Direction[] defaultDirs, final String... defaultSort) {
return PageRequest.of(p == null ? 0 : p, Integer.min(l == null ? defaultPageSize : l, maxPageSize), Sort.by(getSortOrders(getDirections(defaultDirs),
getSortProperties(defaultSort))));
}
......@@ -227,14 +227,14 @@ public class Pagination {
* @param orders Using QDSL order specifiers
* @return
*/
public Pageable toPageRequest(int maxPageSize, OrderSpecifier<?>... orders) {
public Pageable toPageRequest(int maxPageSize, int defaultPageSize, OrderSpecifier<?>... orders) {
if (orders == null || orders.length == 0) {
return toPageRequest(maxPageSize);
return toPageRequest(maxPageSize, defaultPageSize);
}
Direction[] sortDirs = Arrays.stream(orders).map(o -> o.isAscending() ? Direction.ASC : Direction.DESC).toArray(Direction[]::new);
String[] sortProps = Arrays.stream(orders).map(OrderSpecifier::getTarget)
.map(t -> t.toString().replace(((Path<?>)t).getRoot().toString() + ".", "")).toArray(String[]::new);
return toPageRequest(maxPageSize, sortDirs, sortProps);
return toPageRequest(maxPageSize, defaultPageSize, sortDirs, sortProps);
}
}
......@@ -74,7 +74,7 @@ public class KPIController extends ApiBaseController {
public @ResponseBody Map<String, String> listParameters(final Pagination page) {
LOG.info("Listing KPI parameters");
HashMap<String, String> m = new HashMap<>();
for (KPIParameter kpip : kpiService.listParameters(page.toPageRequest(100))) {
for (KPIParameter kpip : kpiService.listParameters(page.toPageRequest(100, 100))) {
m.put(kpip.getName(), kpip.getTitle() + "\n" + kpip.getDescription());
}
return m;
......@@ -131,7 +131,7 @@ public class KPIController extends ApiBaseController {
public @ResponseBody HashMap<Long, String> listDimensions(final Pagination page) {
LOG.info("Listing KPI dimensions");
HashMap<Long, String> m = new HashMap<>();
for (Dimension<?> dim : kpiService.listDimensions(page.toPageRequest(100))) {
for (Dimension<?> dim : kpiService.listDimensions(page.toPageRequest(100, 100))) {
m.put(dim.getId(), dim.getName() + " " + dim.getTitle());
}
return m;
......
......@@ -210,7 +210,7 @@ public class AccessionController {
@RequestBody(required = false) AccessionFilter filter) throws IOException, SearchException {
FilterInfo<AccessionFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, AccessionFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, accessionService.list(filterInfo.filter, page.toPageRequest(500, Sort.Direction.ASC, "seqNo")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, accessionService.list(filterInfo.filter, page.toPageRequest(500, 500, Sort.Direction.ASC, "seqNo")));
}
......@@ -246,7 +246,7 @@ public class AccessionController {
FilterInfo<AccessionFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, AccessionFilter.class);
FilteredPage<AccessionService.AccessionDetails> pageRes = new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, accessionService.withImages(filterInfo.filter, page.toPageRequest(20, Sort.Direction.ASC, "seqNo")));
FilteredPage<AccessionService.AccessionDetails> pageRes = new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, accessionService.withImages(filterInfo.filter, page.toPageRequest(20, 20, Sort.Direction.ASC, "seqNo")));
filterInfo.filter.images = true;
Map<String, TermResult> suggestionRes = accessionService.getSuggestions(filterInfo.filter);
......@@ -317,7 +317,7 @@ public class AccessionController {
FilterInfo<AccessionFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, AccessionFilter.class);
FilteredPage<Accession> pageRes = new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, accessionService.list(filterInfo.filter, page.toPageRequest(50, Sort.Direction.ASC, "seqNo")));
FilteredPage<Accession> pageRes = new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, accessionService.list(filterInfo.filter, page.toPageRequest(50, 50, Sort.Direction.ASC, "seqNo")));
Map<String, TermResult> suggestionRes = accessionService.getSuggestions(filterInfo.filter);
return new AccessionSuggestionPage<Accession>(pageRes, suggestionRes);
......
......@@ -131,7 +131,7 @@ public class CMSController {
*/
@GetMapping(value = "/all-news")
public Page<ActivityPost> getAllNews(final Pagination page) {
return contentService.allNews(page.toPageRequest(50, Sort.Direction.DESC, "publishDate"));
return contentService.allNews(page.toPageRequest(50, 50, Sort.Direction.DESC, "publishDate"));
}
/**
......@@ -220,7 +220,7 @@ public class CMSController {
@RequestBody(required = false) ArticleFilter filter) throws IOException, SearchException {
FilterInfo<ArticleFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, ArticleFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, contentService.listArticles(filterInfo.filter, page.toPageRequest(100, Sort.Direction.ASC, "id")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, contentService.listArticles(filterInfo.filter, page.toPageRequest(100, 100, Sort.Direction.ASC, "id")));
}
/**
......@@ -256,7 +256,7 @@ public class CMSController {
@RequestBody(required = false) ActivityPostFilter filter) throws IOException {
FilterInfo<ActivityPostFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, ActivityPostFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, contentService.listActivityPosts(filterInfo.filter, page.toPageRequest(100, Sort.Direction.ASC, "id")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, contentService.listActivityPosts(filterInfo.filter, page.toPageRequest(100, 100, Sort.Direction.ASC, "id")));
}
/**
......
......@@ -340,7 +340,7 @@ public class DatasetController extends ApiBaseController {
@RequestBody(required = false) DatasetFilter filter) throws IOException, SearchException {
FilterInfo<DatasetFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, DatasetFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, datasetService.listDatasetsForCurrentUser(filterInfo.filter, page.toPageRequest(10, Sort.Direction.DESC, "lastModifiedDate")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, datasetService.listDatasetsForCurrentUser(filterInfo.filter, page.toPageRequest(50, 20, Sort.Direction.DESC, "lastModifiedDate")));
}
/**
......@@ -355,7 +355,7 @@ public class DatasetController extends ApiBaseController {
@RequestBody(required = false) DatasetFilter filter) throws IOException, SearchException {
FilterInfo<DatasetFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, DatasetFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, datasetService.listDatasets(filterInfo.filter, page.toPageRequest(10, Sort.Direction.ASC, "id")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, datasetService.listDatasets(filterInfo.filter, page.toPageRequest(50, 20, Sort.Direction.ASC, "id")));
}
/**
......@@ -371,7 +371,7 @@ public class DatasetController extends ApiBaseController {
FilterInfo<DatasetFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, DatasetFilter.class);
FilteredPage<Dataset> pageRes = new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, datasetService.listDatasets(filterInfo.filter, page.toPageRequest(10, Sort.Direction.ASC, "id")));
FilteredPage<Dataset> pageRes = new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, datasetService.listDatasets(filterInfo.filter, page.toPageRequest(50, 20, Sort.Direction.ASC, "id")));
Map<String, ElasticsearchService.TermResult> suggestionRes = datasetService.getSuggestions(filterInfo.filter);
return DatasetSuggestionPage.from(pageRes, suggestionRes);
......@@ -447,7 +447,7 @@ public class DatasetController extends ApiBaseController {
@JsonView({ JsonViews.Public.class })
@GetMapping(value = "/accessions/{uuid}", produces = { MediaType.APPLICATION_JSON_VALUE, CSVMessageConverter.TEXT_CSV_VALUE })
public Page<DatasetAccessionRef> listAccessions(@PathVariable("uuid") final UUID uuid, final Pagination page) throws NotFoundElement {
return datasetService.listAccessions(datasetService.getDataset(uuid, null), page.toPageRequest(50));
return datasetService.listAccessions(datasetService.getDataset(uuid, null), page.toPageRequest(50, 20));
}
/**
......@@ -463,7 +463,7 @@ public class DatasetController extends ApiBaseController {
public Page<Accession> listFullAccessions(@PathVariable("uuid") final UUID uuid, final Pagination page) throws NotFoundElement, SearchException {
AccessionFilter filter = new AccessionFilter();
filter.datasets = Sets.newHashSet(uuid);
return accessionService.list(filter, page.toPageRequest(50));
return accessionService.list(filter, page.toPageRequest(50, 20));
}
/**
......@@ -581,7 +581,7 @@ public class DatasetController extends ApiBaseController {
*/
@GetMapping(value = CREATOR_URL + "/list")
public Page<DatasetCreator> listDatasetCreators(@PathVariable("uuid") final UUID uuid, final Pagination page) {
return datasetService.listDatasetCreators(uuid, page.toPageRequest(100, Sort.Direction.ASC, "id"));
return datasetService.listDatasetCreators(uuid, page.toPageRequest(50, 20, Sort.Direction.ASC, "id"));
}
/**
......@@ -716,7 +716,7 @@ public class DatasetController extends ApiBaseController {
*/
@GetMapping(value = LOCATION_URL + "/list")
public Page<DatasetLocation> listLocation(@PathVariable("uuid") final UUID uuid, final Pagination page) {
return datasetService.listLocation(uuid, page.toPageRequest(100, Sort.Direction.ASC, "id"));
return datasetService.listLocation(uuid, page.toPageRequest(50, 20, Sort.Direction.ASC, "id"));
}
/**
......
......@@ -255,7 +255,7 @@ public class DescriptorController extends ApiBaseController {
@RequestBody(required = false) DescriptorFilter filter) throws IOException, SearchException {
FilterInfo<DescriptorFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, DescriptorFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, descriptorService.listDescriptors(filterInfo.filter, page.toPageRequest(100, Sort.Direction.ASC, "id")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, descriptorService.listDescriptors(filterInfo.filter, page.toPageRequest(100, 100, Sort.Direction.ASC, "id")));
}
......@@ -272,7 +272,7 @@ public class DescriptorController extends ApiBaseController {
@RequestBody(required = false) DescriptorFilter filter) throws IOException, SearchException {
FilterInfo<DescriptorFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, DescriptorFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, descriptorService.listAccessibleDescriptors(filterInfo.filter, page.toPageRequest(100, Sort.Direction.ASC, "id")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, descriptorService.listAccessibleDescriptors(filterInfo.filter, page.toPageRequest(100, 100, Sort.Direction.ASC, "id")));
}
/**
......@@ -288,7 +288,7 @@ public class DescriptorController extends ApiBaseController {
@RequestBody(required = false) DescriptorFilter filter) throws IOException, SearchException {
FilterInfo<DescriptorFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, DescriptorFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, descriptorService.listDescriptorsForCurrentUser(filterInfo.filter, page.toPageRequest(100, Sort.Direction.DESC, "lastModifiedDate")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, descriptorService.listDescriptorsForCurrentUser(filterInfo.filter, page.toPageRequest(100, 100, Sort.Direction.DESC, "lastModifiedDate")));
}
/**
......@@ -304,7 +304,7 @@ public class DescriptorController extends ApiBaseController {
public FilteredPage<Descriptor> listDescriptorsByShort(final Pagination page, @PathVariable("filterCode") final String filterCode) throws IOException, SearchException {
final DescriptorFilter filter = shortFilterProcessor.filterByCode(filterCode, DescriptorFilter.class);
FilterInfo<DescriptorFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, DescriptorFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, descriptorService.listDescriptors(filterInfo.filter, page.toPageRequest(100, Sort.Direction.ASC, "id")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, descriptorService.listDescriptors(filterInfo.filter, page.toPageRequest(100, 100, Sort.Direction.ASC, "id")));
}
/**
......
......@@ -229,7 +229,7 @@ public class DescriptorListController {
@RequestBody(required = false) DescriptorListFilter filter) throws IOException, SearchException {
FilterInfo<DescriptorListFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, DescriptorListFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, descriptorListService.listDescriptorLists(filterInfo.filter, page.toPageRequest(100)));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, descriptorListService.listDescriptorLists(filterInfo.filter, page.toPageRequest(100, 100)));
}
/**
......@@ -247,7 +247,7 @@ public class DescriptorListController {
FilterInfo<DescriptorListFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, DescriptorListFilter.class);
FilteredPage<DescriptorList> pageRes = new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, descriptorListService.listDescriptorLists(filterInfo.filter, page.toPageRequest(100)));
FilteredPage<DescriptorList> pageRes = new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, descriptorListService.listDescriptorLists(filterInfo.filter, page.toPageRequest(100, 100)));
Map<String, ElasticsearchService.TermResult> suggestionRes = descriptorListService.getSuggestions(filterInfo.filter);
return DescriptorListSuggestionPage.from(pageRes, suggestionRes);
}
......@@ -315,7 +315,7 @@ public class DescriptorListController {
@RequestBody(required = false) DescriptorListFilter filter) throws IOException, SearchException {
ShortFilterService.FilterInfo<DescriptorListFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, DescriptorListFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, descriptorListService.listDescriptorListsForCurrentUser(filterInfo.filter, page.toPageRequest(100, Sort.Direction.DESC, "lastModifiedDate")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, descriptorListService.listDescriptorListsForCurrentUser(filterInfo.filter, page.toPageRequest(100, 100, Sort.Direction.DESC, "lastModifiedDate")));
}
/**
......
......@@ -165,7 +165,7 @@ public class DiversityTreeController extends ApiBaseController {
@RequestBody(required = false) DiversityTreeFilter filter) throws IOException, SearchException {
ShortFilterService.FilterInfo<DiversityTreeFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, DiversityTreeFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, treeService.list(filterInfo.filter, page.toPageRequest(100, Sort.Direction.ASC, "id")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, treeService.list(filterInfo.filter, page.toPageRequest(100, 100, Sort.Direction.ASC, "id")));
}
/**
......@@ -183,7 +183,7 @@ public class DiversityTreeController extends ApiBaseController {
ShortFilterService.FilterInfo<DiversityTreeFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, DiversityTreeFilter.class);
FilteredPage<DiversityTree> pageRes = new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, treeService.list(filterInfo.filter, page.toPageRequest(100, Sort.Direction.ASC, "id")));
FilteredPage<DiversityTree> pageRes = new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, treeService.list(filterInfo.filter, page.toPageRequest(100, 100, Sort.Direction.ASC, "id")));
Map<String, ElasticsearchService.TermResult> suggestionRes = treeService.getSuggestions(filterInfo.filter);
return DiversityTreeSuggestionPage.from(pageRes, suggestionRes);
......@@ -202,7 +202,7 @@ public class DiversityTreeController extends ApiBaseController {
@RequestBody(required = false) DiversityTreeFilter filter) throws IOException {
ShortFilterService.FilterInfo<DiversityTreeFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, DiversityTreeFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, treeService.listForCurrentUser(filterInfo.filter, page.toPageRequest(100, Sort.Direction.DESC, "lastModifiedDate")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, treeService.listForCurrentUser(filterInfo.filter, page.toPageRequest(100, 100, Sort.Direction.DESC, "lastModifiedDate")));
}
/**
......@@ -216,7 +216,7 @@ public class DiversityTreeController extends ApiBaseController {
@JsonView({ JsonViews.Public.class })
@GetMapping(value = "/accessions/{uuid}", produces = { MediaType.APPLICATION_JSON_VALUE, CSVMessageConverter.TEXT_CSV_VALUE })
public Page<DiversityTreeAccessionRef> listAccessions(@PathVariable("uuid") final UUID uuid, final Pagination page) throws NotFoundElement {
return treeService.listAccessionRefs(treeService.get(uuid), page.toPageRequest(100));
return treeService.listAccessionRefs(treeService.get(uuid), page.toPageRequest(100, 100));
}
/**
......@@ -232,7 +232,7 @@ public class DiversityTreeController extends ApiBaseController {
public Page<Accession> listFullAccessions(@PathVariable("uuid") final UUID uuid, final Pagination page) throws NotFoundElement, SearchException {
AccessionFilter filter = new AccessionFilter();
filter.diversityTrees = Sets.newHashSet(uuid);
return accessionService.list(filter, page.toPageRequest(100));
return accessionService.list(filter, page.toPageRequest(100, 100));
}
/**
......
......@@ -71,7 +71,7 @@ public class DiversityTreeCreatorController extends ApiBaseController {
*/
@GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
public Page<DiversityTreeCreator> list(@PathVariable("uuid") final UUID uuid, final Pagination page) {
return treeService.listCreators(uuid, page.toPageRequest(100, Sort.Direction.ASC, "id"));
return treeService.listCreators(uuid, page.toPageRequest(100, 100, Sort.Direction.ASC, "id"));
}
/**
......
......@@ -128,7 +128,7 @@ public class InstituteController {
@RequestBody(required = false) InstituteFilter filter) throws IOException, SearchException {
FilterInfo<InstituteFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, InstituteFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, instituteService.list(filterInfo.filter, page.toPageRequest(100, Sort.Direction.ASC, "id")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, instituteService.list(filterInfo.filter, page.toPageRequest(100, 100, Sort.Direction.ASC, "id")));
}
@JsonView({ JsonViews.Protected.class })
......
......@@ -78,7 +78,7 @@ public class KPIController {
@GetMapping(value="/parameters")
public Page<KPIParameter> listParameters(final Pagination page) {
return kpiService.listParameters(page.toPageRequest(100));
return kpiService.listParameters(page.toPageRequest(100, 100));
}
......@@ -107,7 +107,7 @@ public class KPIController {
@JsonView(JsonViews.Minimal.class)
@GetMapping(value="/dimensions")
public Page<Dimension<?>> listDimensions(final Pagination page) {
return kpiService.listDimensions(page.toPageRequest(100));
return kpiService.listDimensions(page.toPageRequest(100, 100));
}
/**
......@@ -129,7 +129,7 @@ public class KPIController {
@JsonView(JsonViews.Minimal.class)
@GetMapping(value="/executions")
public Page<Execution> listExecution(final Pagination page) {
return kpiService.listExecutions(page.toPageRequest(100));
return kpiService.listExecutions(page.toPageRequest(100, 100));
}
@PostMapping(value = "/executions/{name}/execute")
......@@ -156,7 +156,7 @@ public class KPIController {
@GetMapping(value = "/executions/{name}/runs")
public Page<ExecutionRun> executionRuns(final @PathVariable String name, final Pagination page) {
return kpiService.listExecutionRuns(kpiService.getExecution(name), page.toPageRequest(100));
return kpiService.listExecutionRuns(kpiService.getExecution(name), page.toPageRequest(100, 100));
}
@GetMapping(value = "/executions/{name}/run")
......
......@@ -105,7 +105,7 @@ public class KPIReadController {
}
Page<Tuple> observations = kpiService.listObservations(execution, from, to, keys, pagination.toPageRequest(1000, Direction.DESC, "id"));
Page<Tuple> observations = kpiService.listObservations(execution, from, to, keys, pagination.toPageRequest(1000, 1000, Direction.DESC, "id"));
return observations.map(tuple -> toMap(tuple));
}
......
......@@ -181,7 +181,7 @@ public class NetworkController extends ApiBaseController {
@GetMapping(value = "/{shortName}/institutes", produces = { MediaType.APPLICATION_JSON_VALUE })
public Page<FaoInstitute> getNetworkInstitutes(@PathVariable("shortName") String shortName, Pagination page) {
PGRFANetwork org = networkService.getNetwork(shortName);
return networkService.getInstitutes(org, page.toPageRequest(100, Sort.Direction.DESC, "accessionCount"));
return networkService.getInstitutes(org, page.toPageRequest(100, 100, Sort.Direction.DESC, "accessionCount"));
}
/**
......
......@@ -70,7 +70,7 @@ public class OAuthManagementController extends BaseController {
@RequestBody(required = false) OAuthClientFilter filter) throws IOException {
ShortFilterService.FilterInfo<OAuthClientFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, OAuthClientFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, clientDetailsService.listClientDetails(page.toPageRequest(100, Sort.Direction.ASC, "clientId")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, clientDetailsService.listClientDetails(page.toPageRequest(100, 100, Sort.Direction.ASC, "clientId")));
}
@PostMapping(value = "/save-client")
......
......@@ -169,7 +169,7 @@ public class PartnerController {
@RequestBody(required = false) PartnerFilter filter) throws IOException, SearchException {
FilterInfo<PartnerFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, PartnerFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, partnerService.list(filterInfo.filter, page.toPageRequest(100)));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, partnerService.list(filterInfo.filter, page.toPageRequest(100, 100)));
}
/**
......@@ -181,7 +181,7 @@ public class PartnerController {
@PostMapping(value = "/{UUID}/institutes")
public Page<FaoInstitute> listInstitutes(@PathVariable("UUID") final UUID uuid,
@RequestBody(required = false) InstituteFilter filter, Pagination page) {
return partnerService.loadPartnerInstitutes(uuid, filter, page.toPageRequest(100, Sort.Direction.DESC, "accessionCount"));
return partnerService.loadPartnerInstitutes(uuid, filter, page.toPageRequest(100, 100, Sort.Direction.DESC, "accessionCount"));
}
/**
......@@ -193,6 +193,6 @@ public class PartnerController {
*/
@PostMapping(value = "/list-mine")
public Page<Partner> myPartners(final Pagination page, @RequestBody final PartnerFilter partnerFilter) {
return partnerService.listPartnersForCurrentUser(partnerFilter, page.toPageRequest(100));
return partnerService.listPartnersForCurrentUser(partnerFilter, page.toPageRequest(100, 100));
}
}
......@@ -334,7 +334,7 @@ public class RepositoryController {
@JsonView(JsonViews.Protected.class)
public Page<RepositoryFolder> getFolderSubfolders(final HttpServletRequest request, final Pagination page) throws InvalidRepositoryPathException {
final String folderPath = ((String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE)).substring((CONTROLLER_URL + "/folder").length());
return repositoryService.listFolders(Paths.get(folderPath), page.toPageRequest(50));
return repositoryService.listFolders(Paths.get(folderPath), page.toPageRequest(50, 50));
}
/**
......@@ -350,7 +350,7 @@ public class RepositoryController {
@JsonView(JsonViews.Protected.class)
public Page<RepositoryFile> getFolderFiles(final HttpServletRequest request, final Pagination page) throws InvalidRepositoryPathException {
final String folderPath = ((String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE)).substring((CONTROLLER_URL + "/folder").length());
return repositoryService.listFiles(Paths.get(folderPath), page.toPageRequest(50));
return repositoryService.listFiles(Paths.get(folderPath), page.toPageRequest(50, 50));
}
/**
......
......@@ -96,7 +96,7 @@ public class RequestsController extends ApiBaseController {
@RequestBody(required = false) MaterialSubRequestFilter filter) throws IOException {
ShortFilterService.FilterInfo<MaterialSubRequestFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, MaterialSubRequestFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, requestService.listSubRequests(filterInfo.filter, page.toPageRequest(100, Sort.Direction.ASC, "id")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, requestService.listSubRequests(filterInfo.filter, page.toPageRequest(100, 100, Sort.Direction.ASC, "id")));
}
/**
......@@ -111,7 +111,7 @@ public class RequestsController extends ApiBaseController {
@RequestBody(required = false) MaterialSubRequestFilter filter) throws IOException {
ShortFilterService.FilterInfo<MaterialSubRequestFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, MaterialSubRequestFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, requestService.listMineSubRequests(filterInfo.filter, page.toPageRequest(100, Sort.Direction.DESC, "createdDate")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, requestService.listMineSubRequests(filterInfo.filter, page.toPageRequest(100, 100, Sort.Direction.DESC, "createdDate")));
}
/**
......@@ -130,7 +130,7 @@ public class RequestsController extends ApiBaseController {
@RequestBody(required = false) MaterialRequestFilter filter) throws IOException {
FilterInfo<MaterialRequestFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, MaterialRequestFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, requestService.list(filterInfo.filter, page.toPageRequest(maxPageSize, Sort.Direction.ASC, "id")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, requestService.list(filterInfo.filter, page.toPageRequest(maxPageSize, maxPageSize, Sort.Direction.ASC, "id")));
}
/**
......@@ -292,7 +292,7 @@ public class RequestsController extends ApiBaseController {
final FaoInstitute institute = instituteService.getInstitute(instCode);
FilterInfo<MaterialSubRequestFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, MaterialSubRequestFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, requestService.list(institute, filterInfo.filter, page.toPageRequest(maxPageSize, Sort.Direction.ASC, "id")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, requestService.list(institute, filterInfo.filter, page.toPageRequest(maxPageSize, maxPageSize, Sort.Direction.ASC, "id")));
}
/**
......
......@@ -187,7 +187,7 @@ public class SubsetController extends ApiBaseController {
@RequestBody(required = false) SubsetFilter filter) throws IOException, SearchException {
FilterInfo<SubsetFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, SubsetFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, subsetService.list(filterInfo.filter, page.toPageRequest(10, Sort.Direction.ASC, "id")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, subsetService.list(filterInfo.filter, page.toPageRequest(50, 20, Sort.Direction.ASC, "id")));
}
/**
......@@ -205,7 +205,7 @@ public class SubsetController extends ApiBaseController {
FilterInfo<SubsetFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, SubsetFilter.class);
FilteredPage<Subset> pageRes = new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, subsetService.list(filterInfo.filter, page.toPageRequest(10, Sort.Direction.ASC, "id")));
FilteredPage<Subset> pageRes = new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, subsetService.list(filterInfo.filter, page.toPageRequest(50, 20, Sort.Direction.ASC, "id")));
Map<String, ElasticsearchService.TermResult> suggestionRes = subsetService.getSuggestions(filterInfo.filter);
return SubsetSuggestionPage.from(pageRes, suggestionRes);
......@@ -224,7 +224,7 @@ public class SubsetController extends ApiBaseController {
@RequestBody(required = false) SubsetFilter filter) throws IOException {
FilterInfo<SubsetFilter> filterInfo = shortFilterProcessor.processFilter(filterCode, filter, SubsetFilter.class);
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, subsetService.listSubsetsForCurrentUser(filterInfo.filter, page.toPageRequest(10, Sort.Direction.DESC, "lastModifiedDate")));
return new FilteredPage<>(filterInfo.filterCode, filterInfo.filter, subsetService.listSubsetsForCurrentUser(filterInfo.filter, page.toPageRequest(50, 20, Sort.Direction.DESC, "lastModifiedDate")));
}
/**
......@@ -291,7 +291,7 @@ public class SubsetController extends ApiBaseController {
@JsonView({ JsonViews.Public.class })
@GetMapping(value = "/accessions/{uuid}", produces = { MediaType.APPLICATION_JSON_VALUE, CSVMessageConverter.TEXT_CSV_VALUE })
public Page<SubsetAccessionRef> listAccessions(@PathVariable("uuid") final UUID uuid, final Pagination page) throws NotFoundElement {
return subsetService.listAccessions(subsetService.getSubset(uuid), page.toPageRequest(50));
return subsetService.listAccessions(subsetService.getSubset(uuid), page.toPageRequest(50, 20));
}
/**
......@@ -307,7 +307,7 @@ public class SubsetController extends ApiBaseController {
public Page<Accession> listFullAccessions(@PathVariable("uuid") final UUID uuid, final Pagination page) throws NotFoundElement, SearchException {
AccessionFilter filter = new AccessionFilter();
filter.subsets = Sets.newHashSet(uuid);
return accessionService.list(filter, page.toPageRequest(50));
return accessionService.list(filter, page.toPageRequest(50, 20));
}
/**
......
......@@ -63,7 +63,7 @@ public class SubsetCreatorController {
*/
@GetMapping(value = "/list")
public Page<SubsetCreator> listSubsetCreators(@PathVariable("uuid") final UUID uuid, final Pagination page) {
return subsetService.listSubsetCreators(uuid, page.toPageRequest(100, Sort.Direction.ASC, "id"));
return subsetService.listSubsetCreators(uuid, page.toPageRequest(100, 100, Sort.Direction.ASC, "id"));
}
/**
......
Supports Markdown
0% or .