use of org.springframework.data.domain.PageRequest in project ocvn by devgateway.
the class AbstractSpringDataRestControllerTest method setUp.
@Before
public void setUp() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context).build();
this.persistentEntityResourceAssembler = mock(PersistentEntityResourceAssembler.class);
this.pageRequest = new PageRequest(0, GenericPagingRequest.DEFAULT_PAGE_SIZE);
mockHttpServletRequestForResouceAssemblerSupport();
}
use of org.springframework.data.domain.PageRequest in project goci by EBISPOT.
the class SolrIndexer method mapEfo.
Integer mapEfo() {
Sort sort = new Sort(new Sort.Order("id"));
Pageable pager = new PageRequest(0, pageSize, sort);
Page<EfoTrait> efoTraitPage = efoTraitRepository.findAll(pager);
efoMapper.map(efoTraitPage.getContent());
while (efoTraitPage.hasNext()) {
if (maxPages != -1 && efoTraitPage.getNumber() >= maxPages - 1) {
break;
}
pager = pager.next();
efoTraitPage = efoTraitRepository.findAll(pager);
efoMapper.map(efoTraitPage.getContent());
if (sysOutLogging) {
System.out.print(".");
}
}
return (int) efoTraitPage.getTotalElements();
}
use of org.springframework.data.domain.PageRequest in project goci by EBISPOT.
the class SolrIndexer method mapTraits.
Integer mapTraits() {
Sort sort = new Sort(new Sort.Order("trait"));
Pageable pager = new PageRequest(0, pageSize, sort);
Page<DiseaseTrait> diseaseTraitPage = diseaseTraitRepository.findAll(pager);
traitMapper.map(diseaseTraitPage.getContent());
while (diseaseTraitPage.hasNext()) {
if (maxPages != -1 && diseaseTraitPage.getNumber() >= maxPages - 1) {
break;
}
pager = pager.next();
diseaseTraitPage = diseaseTraitRepository.findAll(pager);
traitMapper.map(diseaseTraitPage.getContent());
if (sysOutLogging) {
System.out.print(".");
}
}
return (int) diseaseTraitPage.getTotalElements();
}
use of org.springframework.data.domain.PageRequest in project goci by EBISPOT.
the class JsonBuilder method getJsons.
public Collection<String> getJsons(String snp2geneMappingFilePath) throws IOException {
Collection<String> jsons = new ArrayList<>();
SnpToGeneMapper snpToGeneMapper = new SnpToGeneMapper(snp2geneMappingFilePath);
Sort sort = new Sort(new Sort.Order("id"));
int setNumber = 0;
Pageable pager = new PageRequest(setNumber, 200, sort);
Page<Association> associationPage = associationService.findPublishedAssociations(pager);
Iterator<Association> assoIterator = associationPage.iterator();
while (assoIterator.hasNext()) {
jsons.addAll(processAssociation(assoIterator.next(), snpToGeneMapper));
}
while (associationPage.hasNext()) {
pager = associationPage.nextPageable();
associationPage = associationService.findPublishedAssociations(pager);
assoIterator = associationPage.iterator();
while (assoIterator.hasNext()) {
jsons.addAll(processAssociation(assoIterator.next(), snpToGeneMapper));
}
}
return jsons;
}
use of org.springframework.data.domain.PageRequest in project ignite by apache.
the class SpringDataExample method queryRepository.
/**
* Execute advanced queries over the repository.
*/
private static void queryRepository() {
System.out.println("\n>>> Persons with name 'John':");
List<Person> persons = repo.findByFirstName("John");
for (Person person : persons) System.out.println(" >>> " + person);
Cache.Entry<Long, Person> topPerson = repo.findTopByLastNameLike("Smith");
System.out.println("\n>>> Top Person with surname 'Smith': " + topPerson.getValue());
List<Long> ids = repo.selectId(1000L, new PageRequest(0, 4));
System.out.println("\n>>> Persons working for organization with ID > 1000: ");
for (Long id : ids) System.out.println(" >>> [id=" + id + "]");
}
Aggregations