本文整理匯總了Java中org.springframework.data.domain.Page.map方法的典型用法代碼示例。如果您正苦於以下問題:Java Page.map方法的具體用法?Java Page.map怎麽用?Java Page.map使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.data.domain.Page
的用法示例。
在下文中一共展示了Page.map方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: listarPorFuncionarioId
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
/**
* Retorna a listagem de lançamentos de um funcionário.
*
* @param funcionarioId
* @return ResponseEntity<Response<LancamentoDto>>
*/
@GetMapping(value = "/funcionario/{funcionarioId}")
public ResponseEntity<Response<Page<LancamentoDto>>> listarPorFuncionarioId(
@PathVariable("funcionarioId") Long funcionarioId,
@RequestParam(value = "pag", defaultValue = "0") int pag,
@RequestParam(value = "ord", defaultValue = "id") String ord,
@RequestParam(value = "dir", defaultValue = "DESC") String dir) {
log.info("Buscando lançamentos por ID do funcionário: {}, página: {}", funcionarioId, pag);
Response<Page<LancamentoDto>> response = new Response<Page<LancamentoDto>>();
PageRequest pageRequest = new PageRequest(pag, this.qtdPorPagina, Direction.valueOf(dir), ord);
Page<Lancamento> lancamentos = this.lancamentoService.buscarPorFuncionarioId(funcionarioId, pageRequest);
Page<LancamentoDto> lancamentosDto = lancamentos.map(lancamento -> this.converterLancamentoDto(lancamento));
response.setData(lancamentosDto);
return ResponseEntity.ok(response);
}
示例2: findAll
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
/**
* Get all the programs.
*
* @param pageable the pagination information
* @return the list of entities
*/
@Override
@Transactional(readOnly = true)
public Page<ProgramDTO> findAll(Pageable pageable) {
log.debug("Request to get all Programs");
Page<Program> result = programRepository.findAll(pageable);
return result.map(program -> programMapper.programToProgramDTO(program));
}
示例3: search
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
public Page<ProjectDTO> search(String keyWord, List<Integer> jobTitles, List<Integer> skills, String status, String remote,Integer page, Integer size) {
Page<Project> projectPages = null;
List<Project> projects = null;
if (page==null){
page=0;
}
if (size == null){
if(skills != null && jobTitles != null) {
projects = projectDAO.findByKeywordAndJobAndSkill(keyWord, jobTitles, skills, status, remote);
} else if(skills != null) {
projects = projectDAO.findByKeywordAndSkill(keyWord, skills, status, remote);
} else if(jobTitles != null) {
projects = projectDAO.findByKeywordAndJob(keyWord, jobTitles, status, remote);
} else {
projects = projectDAO.findByKeyword(keyWord, status, remote);
}
projectPages=new PageImpl<Project>(projects);
} else{
Pageable pageable = new PageRequest(page,size);
if(skills != null && jobTitles != null) {
projectPages = projectDAO.findByKeywordAndJobAndSkill(keyWord, jobTitles, skills, status, remote, pageable);
} else if(skills != null) {
projectPages = projectDAO.findByKeywordAndSkill(keyWord, skills, status, remote, pageable);
} else if(jobTitles != null) {
projectPages = projectDAO.findByKeywordAndJob(keyWord, jobTitles, status, remote, pageable);
} else {
projectPages = projectDAO.findByKeyword(keyWord, status, remote, pageable);
}
}
return projectPages.map(p -> projectMapper.getProjectDtoFromEntity(p));
}
示例4: findAll
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
/**
* Get all the courses.
*
* @param pageable the pagination information
* @return the list of entities
*/
@Override
@Transactional(readOnly = true)
public Page<CourseDTO> findAll(Pageable pageable) {
log.debug("Request to get all Courses");
Page<Course> result = courseRepository.findAll(pageable);
return result.map(course -> courseMapper.courseToCourseDTO(course));
}
示例5: search
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
@Override
public Page<UserDTO> search(String keyWord, List<Integer> jobTitles, List<Integer> skills, String status, String role, String publishFlag, Integer page, Integer size) {
Page<User> userPages = null;
List<User> users = null;
if (page == null)
page=0;
if (size == null) {
if(skills != null && jobTitles != null) {
users = userDAO.findByKeywordAndJobAndSkill(keyWord, jobTitles, skills, status, role, publishFlag);
} else if(skills != null) {
users = userDAO.findByKeywordAndSkill(keyWord, skills, status, role, publishFlag);
} else if(jobTitles != null) {
users = userDAO.findByKeywordAndJob(keyWord, jobTitles, status, role, publishFlag);
} else {
users = userDAO.findByKeyword(keyWord, status, role, publishFlag);
}
userPages=new PageImpl<User>(users);
} else {
Pageable pageable = new PageRequest(page,size);
if(skills != null && jobTitles != null) {
userPages = userDAO.findByKeywordAndJobAndSkill(keyWord, jobTitles, skills, status, role, publishFlag, pageable);
} else if(skills != null) {
userPages = userDAO.findByKeywordAndSkill(keyWord, skills, status, role, publishFlag, pageable);
} else if(jobTitles != null) {
userPages = userDAO.findByKeywordAndJob(keyWord, jobTitles, status, role, publishFlag, pageable);
} else {
userPages = userDAO.findByKeyword(keyWord, status, role, publishFlag, pageable);
}
}
Page<UserDTO> userDTOS = userPages.map(p -> userMapper.getUserDtoFromEntity(p));
return userDTOS;// mapUsersToUserDtos(users);
}
示例6: getUsers
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
@PreAuthorize("@securityServiceImpl.hasAdminPermissions(#userPrincipal)")
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<?> getUsers(@AuthenticationPrincipal User userPrincipal, Pageable pageable) {
LOGGER.info("Start getUsers");
Page<User> users = userService.findAllByPage(pageable);
Page<UserDto> ordersDtos = users.map(UserDto::toDto);
return new ResponseEntity<>(ordersDtos, HttpStatus.OK);
}
示例7: getOrders
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
@PreAuthorize("@securityServiceImpl.hasPermissions(#userPrincipal, #userId)")
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<?> getOrders(@AuthenticationPrincipal User userPrincipal,
@PathVariable("user_id") long userId, Pageable pageable) {
LOGGER.info("getOrders for userId: {}", userId);
Page<Order> orders = orderService.findByUserId(userId, pageable);
Page<OrderDto> ordersDtos = orders.map(OrderDto::toDto);
return new ResponseEntity<>(ordersDtos, HttpStatus.OK);
}
示例8: getUpcomingOccurrences
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
@Override
public Page<Occurrence> getUpcomingOccurrences(final Pageable pageable) {
final RScoredSortedSet<String> set = getUpcomingEventsFromStore();
final int page = pageable.getPageNumber();
final int count = pageable.getPageSize();
final List<ScoredEntry<String>> occurrenceCollection = new ArrayList<>(set.entryRange(page * count, ((page + 1) * count) - 1));
final Page<ScoredEntry<String>> occurrences = new PageImpl<>(occurrenceCollection, pageable, set.size());
return occurrences
.map(this::convertParsedEventToOccurrence);
}
示例9: findByCriteria
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
public Page<OrganizationDTO> findByCriteria(String keyWord, List<String> countries, Boolean open, String status, List<String> categories, Integer page, Integer size) {
Page<Organization> organizationPages=null;
List<Organization> organizations=null;
if (page==null) page=0;
if (size==null){
if(countries != null && !countries.isEmpty()){
if(open != null){
organizations = organizationDAO.findByCriteriaAndCountriesAndOpen(keyWord, countries, open, status, categories);
}
else{
organizations = organizationDAO.findByCriteriaAndCountries(keyWord, countries, open, status, categories);
}
}
else{
if(open != null){
organizations = organizationDAO.findByCriteriaAndOpen(keyWord, open, status, categories);
}
else{
organizations = organizationDAO.findByCriteria(keyWord, open, status, categories);
}
}
organizationPages=new PageImpl<Organization>(organizations);
} else {
Pageable pageable=new PageRequest(page,size);
if(countries != null && !countries.isEmpty()){
if(open != null){
organizationPages = organizationDAO.findByCriteriaAndCountriesAndOpen(keyWord, countries, open, status, categories,pageable);
}
else{
organizationPages = organizationDAO.findByCriteriaAndCountries(keyWord, countries, open, status, categories,pageable);
}
}
else{
if(open != null){
organizationPages = organizationDAO.findByCriteriaAndOpen(keyWord, open, status, categories,pageable);
}
else{
organizationPages = organizationDAO.findByCriteria(keyWord, open, status, categories,pageable);
}
}
}
return organizationPages.map(o -> organizationMapper.getOrganizationDtoFromEntity(o));
}
示例10: findActiveVolunteers
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
@Override
public Page<UserDTO> findActiveVolunteers(Pageable pageable) {
Page<User> users = userDAO.findActiveVolunteers(pageable);
Page<UserDTO> userDTOS = users.map(p -> userMapper.getUserDtoFromEntity(p));
return userDTOS;
}
示例11: fetch
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
@Override
public Page<ProductDto> fetch(Pageable pageable) {
Page<Product> products = repository.findAll(pageable);
return products.map(product -> mapper.map(product, ProductDto.class));
}
示例12: findAll
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
/**
* Get all the settings.
*
* @param pageable the pagination information
* @return the list of entities
*/
public Page<SettingDTO> findAll(Pageable pageable) {
log.debug("Request to get all Settings");
Page<Setting> result = settingRepository.findAll(pageable);
return result.map(setting -> settingMapper.settingToSettingDTO(setting));
}
示例13: findAll
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
/**
* Get all the tasks.
*
* @param pageable the pagination information
* @return the list of entities
*/
public Page<TaskDTO> findAll(Pageable pageable) {
log.debug("Request to get all Tasks");
Page<Task> result = taskRepository.findAll(pageable);
return result.map(task -> taskMapper.taskToTaskDTO(task));
}
示例14: findAll
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
/**
* Get all the subscribers.
*
* @param pageable the pagination information
* @return the list of entities
*/
public Page<SubscriberDTO> findAll(Pageable pageable) {
log.debug("Request to get all Subscribers");
Page<Subscriber> result = subscriberRepository.findAll(pageable);
return result.map(subscriber -> subscriberMapper.subscriberToSubscriberDTO(subscriber));
}
示例15: findAll
import org.springframework.data.domain.Page; //導入方法依賴的package包/類
/**
* Get all the bots.
*
* @param pageable the pagination information
* @return the list of entities
*/
public Page<BotDTO> findAll(Pageable pageable) {
log.debug("Request to get all Bots");
Page<Bot> result = botRepository.findAll(pageable);
return result.map(bot -> botMapper.botToBotDTO(bot));
}