當前位置: 首頁>>代碼示例>>Java>>正文


Java Page.map方法代碼示例

本文整理匯總了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);
}
 
開發者ID:m4rciosouza,項目名稱:ponto-inteligente-api,代碼行數:23,代碼來源:LancamentoController.java

示例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));
}
 
開發者ID:ElectronicArmory,項目名稱:Armory,代碼行數:14,代碼來源:ProgramServiceImpl.java

示例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));
  }
 
開發者ID:Code4SocialGood,項目名稱:c4sg-services,代碼行數:36,代碼來源:ProjectServiceImpl.java

示例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));
}
 
開發者ID:ElectronicArmory,項目名稱:Armory,代碼行數:14,代碼來源:CourseServiceImpl.java

示例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);
}
 
開發者ID:Code4SocialGood,項目名稱:c4sg-services,代碼行數:37,代碼來源:UserServiceImpl.java

示例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);
}
 
開發者ID:atereshkov,項目名稱:Diber-backend,代碼行數:9,代碼來源:UserController.java

示例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);
}
 
開發者ID:atereshkov,項目名稱:Diber-backend,代碼行數:10,代碼來源:UserOrderController.java

示例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);
}
 
開發者ID:mhaddon,項目名稱:Sound.je,代碼行數:14,代碼來源:EventServiceImpl.java

示例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));    	
 }
 
開發者ID:Code4SocialGood,項目名稱:c4sg-services,代碼行數:46,代碼來源:OrganizationServiceImpl.java

示例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;
}
 
開發者ID:Code4SocialGood,項目名稱:c4sg-services,代碼行數:7,代碼來源:UserServiceImpl.java

示例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));
}
 
開發者ID:rozidan,項目名稱:project-template,代碼行數:6,代碼來源:ProductServiceImpl.java

示例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));
}
 
開發者ID:quanticc,項目名稱:sentry,代碼行數:12,代碼來源:SettingService.java

示例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));
}
 
開發者ID:quanticc,項目名稱:sentry,代碼行數:12,代碼來源:TaskService.java

示例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));
}
 
開發者ID:quanticc,項目名稱:sentry,代碼行數:12,代碼來源:SubscriberService.java

示例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));
}
 
開發者ID:quanticc,項目名稱:sentry,代碼行數:12,代碼來源:BotService.java


注:本文中的org.springframework.data.domain.Page.map方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。