Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Genesys Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
17
Issues
17
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Backend
Commits
57b981e7
Commit
57b981e7
authored
Dec 28, 2018
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pagination utility respects incoming maxPageSize
- /api/v0/datasets/../accessions lists up to 1000 entries
parent
596317d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
src/main/java/org/genesys2/server/api/Pagination.java
src/main/java/org/genesys2/server/api/Pagination.java
+3
-3
src/main/java/org/genesys2/server/api/v0/DatasetController.java
...in/java/org/genesys2/server/api/v0/DatasetController.java
+1
-1
No files found.
src/main/java/org/genesys2/server/api/Pagination.java
View file @
57b981e7
...
...
@@ -151,7 +151,7 @@ public class Pagination {
* @return the pageable
*/
public
Pageable
toPageRequest
(
int
maxPageSize
)
{
return
new
PageRequest
(
p
==
null
?
0
:
p
,
Integer
.
min
(
l
==
null
?
100
:
l
,
maxPageSize
),
getDirection
(
Sort
.
Direction
.
ASC
),
getSortProperties
(
DEFAULT_SORT_PROPERTIES
));
return
new
PageRequest
(
p
==
null
?
0
:
p
,
Integer
.
min
(
l
==
null
?
maxPageSize
:
l
,
maxPageSize
),
getDirection
(
Sort
.
Direction
.
ASC
),
getSortProperties
(
DEFAULT_SORT_PROPERTIES
));
}
/**
...
...
@@ -163,7 +163,7 @@ public class Pagination {
* @return the pageable
*/
public
Pageable
toPageRequest
(
int
maxPageSize
,
Direction
defaultDir
,
String
...
defaultSort
)
{
return
new
PageRequest
(
p
==
null
?
0
:
p
,
Integer
.
min
(
l
==
null
?
100
:
l
,
maxPageSize
),
getDirection
(
defaultDir
),
getSortProperties
(
defaultSort
));
return
new
PageRequest
(
p
==
null
?
0
:
p
,
Integer
.
min
(
l
==
null
?
maxPageSize
:
l
,
maxPageSize
),
getDirection
(
defaultDir
),
getSortProperties
(
defaultSort
));
}
/**
...
...
@@ -174,7 +174,7 @@ public class Pagination {
* @return the pageable
*/
public
static
Pageable
toPageRequest
(
int
maxPageSize
,
Sort
sort
)
{
return
new
PageRequest
(
0
,
Integer
.
min
(
100
,
maxPageSize
)
,
sort
);
return
new
PageRequest
(
0
,
maxPageSize
,
sort
);
}
}
src/main/java/org/genesys2/server/api/v0/DatasetController.java
View file @
57b981e7
...
...
@@ -141,7 +141,7 @@ public class DatasetController extends ApiBaseController {
*/
@GetMapping
(
"/{metadataId}/accessions"
)
public
Page
<
AccessionRef
>
listAccessions
(
@PathVariable
(
"metadataId"
)
long
metadataId
,
Pagination
pagination
)
{
return
genesysService
.
listMetadataAccessionRefs
(
metadataId
,
pagination
.
toPageRequest
(
5
0
,
Direction
.
ASC
,
"a.id"
));
return
genesysService
.
listMetadataAccessionRefs
(
metadataId
,
pagination
.
toPageRequest
(
100
0
,
Direction
.
ASC
,
"a.id"
));
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment