List of usage examples for org.springframework.data.domain PageImpl PageImpl
public PageImpl(List<T> content)
From source file:$.DemoApplicationController.java
@RequestMapping(value = "/application/apps", method = RequestMethod.GET) @OpenApi//w ww . ja v a 2s .c o m public Page<DemoApplication> getApplications() { return new PageImpl<DemoApplication>(demoApplicationService.getAllApplications()); }
From source file:org.apereo.openlrs.storage.inmemory.InMemoryStorage.java
@Override public Page<OpenLRSEntity> findAll(Pageable pageable) { return new PageImpl<OpenLRSEntity>(new ArrayList<OpenLRSEntity>(store.values())); }
From source file:com.frank.search.solr.core.query.result.SolrResultPage.java
private Page<FacetFieldEntry> getResultPage(String fieldname, Map<PageKey, Page<FacetFieldEntry>> resultPages) { Page<FacetFieldEntry> page = resultPages.get(new StringPageKey(fieldname)); return page != null ? page : new PageImpl<FacetFieldEntry>(Collections.<FacetFieldEntry>emptyList()); }
From source file:com.trenako.web.controllers.admin.AdminBrandsControllerMappingTests.java
@Test public void shouldShowTheBrandsList() throws Exception { when(mockService.findAll(Mockito.isA(Pageable.class))) .thenReturn(new PageImpl<Brand>(Arrays.asList(new Brand(), new Brand()))); mockMvc().perform(get("/admin/brands")).andExpect(status().isOk()).andExpect(model().size(1)) .andExpect(model().attributeExists("brands")).andExpect(forwardedUrl(view("brand", "list"))); }
From source file:de.appsolve.padelcampus.admin.controller.general.AdminGeneralModulesBlogController.java
@Override public ModelAndView showIndex(HttpServletRequest request, Pageable pageable, String search) { Module module = getModule(request);//from w w w . j ava2s.c o m List<PageEntry> all = pageEntryDAO.findByModule(module); Collections.sort(all); ModelAndView mav = getIndexView(new PageImpl<>(all)); mav.addObject("Module", module); return mav; }
From source file:org.openlmis.fulfillment.util.MergerTest.java
@Test public void shouldReturnElementIfArgumentListContainsOnlyOne() { List<String[]> arrays = ImmutableList.of(new String[] { "a", "b" }); List<PageDto<String>> pages = ImmutableList.of(new PageDto<>(new PageImpl<>(ImmutableList.of("a")))); assertThat(Merger.ofArrays(arrays).merge(), is(arrays.get(0))); assertThat(Merger.ofPages(pages).merge(), is(pages.get(0))); }
From source file:org.apereo.openlrs.storage.inmemory.InMemoryStorage.java
@Override public Page<OpenLRSEntity> findWithFilters(Map<String, String> filters, Pageable pageable) { log.warn("InMemoryStorage does not support filters. Return all."); return new PageImpl<OpenLRSEntity>(new ArrayList<OpenLRSEntity>(store.values())); }
From source file:it.f2informatica.test.services.gateway.mongodb.ConsultantRepositoryGatewayMongoDBTest.java
private Page<Consultant> consultants() { return new PageImpl<>( Arrays.asList(consultant().withFirstName("consultant_1").withLastName("consultant_1").build(), consultant().withFirstName("consultant_2").withLastName("consultant_2").build())); }
From source file:com.real.apps.shuttle.controller.VehicleControllerTest.java
@Test public void shouldReturnThePageOfAllVehiclesWhenAdminIsLoggedIn() throws Exception { String licenseNumber = "Test License Number To List"; final Vehicle vehicle = new Vehicle(); vehicle.setLicenseNumber(licenseNumber); List<Vehicle> vehicles = Arrays.asList(vehicle); final Page<Vehicle> page = new PageImpl<>(vehicles); controller.setService(service);// w ww . j a v a 2s.c o m context.checking(new Expectations() { { oneOf(service).page(skip, limit); will(returnValue(page)); } }); mockMvc.perform(get("/" + VIEW_PAGE + "/" + skip + "/" + limit).with(user(admin(ObjectId.get())))) .andExpect(status().isOk()).andExpect(jsonPath("$.content[0].licenseNumber").value(licenseNumber)); context.assertIsSatisfied(); }
From source file:org.mmonti.entitygraph.repository.CustomGenericJpaRepository.java
@Override public Page<T> findAll(Specification<T> spec, Pageable pageable, EntityGraphType type, String... attributeGraph) { final TypedQuery<T> typedQuery = getQuery(spec, pageable); if (attributeGraph != null && attributeGraph.length > 0) { final EntityGraph<T> entityGraph = this.entityManager.createEntityGraph(getDomainClass()); buildEntityGraph(entityGraph, attributeGraph); typedQuery.setHint(type.getType(), entityGraph); }/*from w w w . j a v a 2 s . c om*/ return pageable == null ? new PageImpl<T>(typedQuery.getResultList()) : readPage(typedQuery, pageable, spec); }