use of org.molgenis.api.model.response.LinksResponse in project molgenis by molgenis.
the class EntityMapperImpl method map.
@Override
public EntitiesResponse map(EntityCollection entityCollection, Selection filter, Selection expand, int size, int number, int total) {
EntitiesResponse.Builder builder = mapRecursive(entityCollection, filter, expand, 0);
LinksResponse linksResponse = LinksUtils.createLinksResponse(number, size, total);
setPageResponse(entityCollection, builder);
return builder.setLinks(linksResponse).build();
}
use of org.molgenis.api.model.response.LinksResponse in project molgenis by molgenis.
the class LinksUtilsTest method createLinksResponseOnePage.
@Test
void createLinksResponseOnePage() throws URISyntaxException {
request.setQueryString("page=0");
LinksResponse linksResponse = LinksResponse.builder().setSelf(new URI("http://localhost?page=0")).build();
assertEquals(linksResponse, LinksUtils.createLinksResponse(0, 10, 10));
}
use of org.molgenis.api.model.response.LinksResponse in project molgenis by molgenis.
the class LinksUtilsTest method createLinksResponseLastPage.
@Test
void createLinksResponseLastPage() throws URISyntaxException {
request.setQueryString("page=2");
LinksResponse linksResponse = LinksResponse.builder().setPrevious(new URI("http://localhost?page=1")).setSelf(new URI("http://localhost?page=2")).build();
assertEquals(linksResponse, LinksUtils.createLinksResponse(2, 10, 30));
}
use of org.molgenis.api.model.response.LinksResponse in project molgenis by molgenis.
the class LinksUtilsTest method createLinksResponseOutOfRangePageZeroTotalElements.
@Test
void createLinksResponseOutOfRangePageZeroTotalElements() throws URISyntaxException {
request.setQueryString("page=100");
LinksResponse linksResponse = LinksResponse.builder().setSelf(new URI("http://localhost?page=100")).build();
assertEquals(linksResponse, LinksUtils.createLinksResponse(100, 10, 0));
}
use of org.molgenis.api.model.response.LinksResponse in project molgenis by molgenis.
the class LinksUtilsTest method createLinksResponseOutOfRangePage.
@Test
void createLinksResponseOutOfRangePage() throws URISyntaxException {
request.setQueryString("page=100");
LinksResponse linksResponse = LinksResponse.builder().setPrevious(new URI("http://localhost?page=2")).setSelf(new URI("http://localhost?page=100")).build();
assertEquals(linksResponse, LinksUtils.createLinksResponse(100, 10, 30));
}
Aggregations