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


Java PageableDefault類代碼示例

本文整理匯總了Java中org.springframework.data.web.PageableDefault的典型用法代碼示例。如果您正苦於以下問題:Java PageableDefault類的具體用法?Java PageableDefault怎麽用?Java PageableDefault使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PageableDefault類屬於org.springframework.data.web包,在下文中一共展示了PageableDefault類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getSeveral

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
@RequestMapping(method=GET)
@ResponseStatus(HttpStatus.OK)
@ApiOperation(value = "Get overviews of stocks", notes = "Return a page of stock-overviews")
public PagedResources<StockProductResource> getSeveral(
		@Or({
               @Spec(params="cn", path="id", spec=LikeIgnoreCase.class),
               @Spec(params="cn", path="name", spec=LikeIgnoreCase.class)}	
		) @ApiIgnore Specification<StockProduct> spec,
		@ApiParam(value="Exchange ID") @RequestParam(value="exchange", required=false) String exchangeId,
		@ApiParam(value="Index ID") @RequestParam(value="index", required=false) String indexId, 
		@ApiParam(value="Market ID") @RequestParam(value="market", required=false) MarketId marketId, 
           @ApiParam(value="Starts with filter") @RequestParam(value="sw", defaultValue="", required=false) String startWith, 
           @ApiParam(value="Contains filter") @RequestParam(value="cn", defaultValue="", required=false) String contain, 
           @ApiIgnore @PageableDefault(size=10, page=0, sort={"name"}, direction=Direction.ASC) Pageable pageable){
	return pagedAssembler.toResource(stockProductService.gather(indexId, exchangeId, marketId, startWith, spec, pageable), assembler);
}
 
開發者ID:alex-bretet,項目名稱:cloudstreetmarket.com,代碼行數:17,代碼來源:StockProductController.java

示例2: getAllPosts

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
@GetMapping()
//    @ApiOperation(nickname = "get-all-posts", value = "Get all posts")
//    @ApiResponses(
//        value = {
//            @ApiResponse(code = 200, message = "return all posts by page")
//        }
//    )
    @JsonView(View.Summary.class)
    public ResponseEntity<Page<Post>> getAllPosts(
        @RequestParam(value = "q", required = false) String keyword, //
        @RequestParam(value = "status", required = false) Post.Status status, //
        @PageableDefault(page = 0, size = 10, sort = "createdDate", direction = Direction.DESC) Pageable page) {

        log.debug("get all posts of [email protected]" + keyword + ", status @" + status + ", [email protected]" + page);

        Page<Post> posts = this.postRepository.findAll(PostSpecifications.filterByKeywordAndStatus(keyword, status), page);

        return new ResponseEntity<>(posts, HttpStatus.OK);
    }
 
開發者ID:hantsy,項目名稱:spring-microservice-sample,代碼行數:20,代碼來源:PostController.java

示例3: deleteGroep

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
/**
 * Verwijdert een groep.
 * @param leveringsautorisatieId Leveringsautorisatie ID
 * @param dienstbundelId Dienstbundel ID
 * @param groepId id van dienstbundel
 * @param pageable paginering
 * @return item
 * @throws NotFoundException wanneer het item niet gevonden kan worden
 */
@RequestMapping(value = "/{id}/dienstbundels/{did7}/dienstbundelgroepen/{gid1}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.OK)
public final Page<DienstbundelGroep> deleteGroep(
        @PathVariable("id") final Integer leveringsautorisatieId,
        @PathVariable("did7") final Integer dienstbundelId,
        @PathVariable("gid1") final Integer groepId,
        @PageableDefault(size = 10) final Pageable pageable) throws ErrorHandler.NotFoundException {
    return new SaveTransaction<Page<DienstbundelGroep>>(getTransactionTemplate()).execute(() -> {
        final Dienstbundel dienstbundel = dienstbundelController.get(dienstbundelId);

        dienstbundel.getDienstbundelGroepSet().removeIf(groep -> groep.getId().equals(groepId));

        final Dienstbundel opgeslagenDienstBundel = dienstbundelController.save(dienstbundel);

        // Herlaad de overige dienstbundel groepen.
        return dienstbundelGroepRepository.findByDienstbundel(opgeslagenDienstBundel, pageable);
    });
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:28,代碼來源:LeveringsautorisatieController.java

示例4: listAttribuut

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
/**
 * Haal een lijst van items op.
 * @param groepId groep ID
 * @param parameters request parameters
 * @param pageable paginering
 * @return lijst van item (inclusief paginering en sortering)
 */
@RequestMapping(value = "/{id}/dienstbundels/{did}/dienstbundelgroepen/{gid3}/attributen", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public final Page<DienstbundelGroepAttribuutView> listAttribuut(
        @PathVariable("gid3") final Integer groepId,
        @RequestParam final Map<String, String> parameters,
        @PageableDefault(size = 1000) final Pageable pageable) {
    return getReadonlyTransactionTemplate().execute(status -> {
        final DienstbundelGroep dienstbundelGroep = dienstbundelGroepRepository.findOne(groepId);
        // Aangezien de page die we terugkrijgen uit de repository immutable is, maken we een nieuwe lijst aan om
        // vervolgens een nieuw page object aan te maken met de betreffende subset van de lijst.
        final List<DienstbundelGroepAttribuutView> schermAttributen =
                bepaalActiefStatusAttributenVoorGroep(dienstbundelGroep);
        final int fromIndex = pageable.getOffset();
        final int toIndex =
                (fromIndex + pageable.getPageSize()) > schermAttributen.size() ? schermAttributen.size() : fromIndex + pageable.getPageSize();
        return new PageImpl<>(schermAttributen.subList(fromIndex, toIndex), pageable, schermAttributen.size());
    });
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:26,代碼來源:LeveringsautorisatieController.java

示例5: listToegangLeveringsautorisatie

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
/**
 * Haal een lijst van items op.
 * @param id id van Leveringsautorisatie
 * @param parameters request parameters
 * @param pageable paginering
 * @return lijst van item (inclusief paginering en sortering)
 */
@RequestMapping(value = "/{id}/toegangbijhoudingsautorisaties", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public final Page<ToegangBijhoudingsautorisatie> listToegangLeveringsautorisatie(
        @PathVariable(value = "id") final String id,
        @RequestParam final Map<String, String> parameters,
        @PageableDefault(size = 10) @SortDefault(sort = {DATUM_INGANG, DATUM_EINDE}, direction = Sort.Direction.ASC) final Pageable pageable) {
    parameters.put(ToegangBijhoudingsautorisatieController.PARAMETER_FILTER_BIJHOUDINGSAUTORISATIE, id);
    return toegangBijhoudingsautorisatieController.list(parameters, pageable);
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:17,代碼來源:BijhoudingsautorisatieController.java

示例6: listSoortAdministratieveHandelingen

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
/**
 * Haal een lijst van items op.
 * @param bijhoudingsautorisatieId bijhoudingsautorisatie ID
 * @param parameters request parameters
 * @param pageable paginering
 * @return lijst van item (inclusief paginering en sortering)
 */
@RequestMapping(value = "/{id}/bijhoudingsautorisatieSoortAdministratieveHandelingen", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public final Page<BijhoudingsautorisatieSoortAdministratieveHandelingView> listSoortAdministratieveHandelingen(
        @PathVariable("id") final Integer bijhoudingsautorisatieId,
        @RequestParam final Map<String, String> parameters,
        @PageableDefault(size = 1000) final Pageable pageable) {
    return getReadonlyTransactionTemplate().execute(status -> {
        try {
            final Bijhoudingsautorisatie bijhoudingsautorisatie = get(bijhoudingsautorisatieId);
            // Aangezien de page die we terugkrijgen uit de repository immutable is, maken we een nieuwe lijst aan om
            // vervolgens een nieuw page object aan te maken met de betreffende subset van de lijst.
            final List<BijhoudingsautorisatieSoortAdministratieveHandelingView> schermSoorten =
                    bepaalActiefStatusSoortAdministratieveHandelingen(bijhoudingsautorisatie);
            final int fromIndex = pageable.getOffset();
            final int toIndex = (fromIndex + pageable.getPageSize()) > schermSoorten.size() ? schermSoorten.size() : fromIndex + pageable.getPageSize();
            return new PageImpl<>(schermSoorten.subList(fromIndex, toIndex), pageable, schermSoorten.size());
        } catch (NotFoundException exception) {
            LOG.error(ExceptionUtils.getFullStackTrace(exception));
            return null;
        }
    });
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:30,代碼來源:BijhoudingsautorisatieController.java

示例7: list

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
/**
 * Haal een lijst van items op.
 *
 * @param parameters request parameters
 * @param pageable   paginering
 * @return lijst van item (inclusief paginering en sortering)
 */
@Override
public final Page<V> list(@RequestParam final Map<String, String> parameters, @PageableDefault(size = 10) final Pageable pageable) {
    return transactionTemplate.execute(status -> {
        final PredicateBuilderSpecification<T> specification = new PredicateBuilderSpecification<>();
        for (final Filter<?> filter : filters) {
            if (parameters.containsKey(filter.getParameterName())) {
                final String parameterValue = parameters.get(filter.getParameterName());
                if (parameterValue == null || "".equals(parameterValue)) {
                    continue;
                }
                specification.addPredicateBuilder(verwerkFilter(filter, parameterValue));
            }
        }
        if (queryShouldContainParameters && specification.isPredicateListEmpty()) {
            return new PageImpl<>(new ArrayList<V>());
        }
        return converteerNaarView(repository.findAll(specification, adaptPageble(pageable)));
    });
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:27,代碼來源:AbstractBaseReadonlyController.java

示例8: userList

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
@GetMapping({"/userlist", "/users"})
@SuppressWarnings("AssignmentToMethodParameter")
public String userList(HttpServletRequest request, @PageableDefault(50) Pageable pageable) {
    Sort sort = pageable.getSort();
    int pageSize = Math.min(pageable.getPageSize(), 500);

    if (sort == null || !sort.iterator().hasNext()) {
        sort = DEFAULT_SORT;
    }

    pageable = new PageRequest(pageable.getPageNumber(), pageSize, sort);

    String query = URLBuilder.fromRequest(request)
            .replaceQueryParam("page")
            .toString();

    request.setAttribute("url", query);
    request.setAttribute("page", accountService.findAll(pageable));
    return "users/list";
}
 
開發者ID:zjnu-acm,項目名稱:judge,代碼行數:21,代碼來源:UserListController.java

示例9: pesquisar

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
/**
 * Retorna os Veiculos de acordo com o filtro.
 * 
 * @param placa
 *            Número da Placa do Veiculo. Busca com like à direita.
 * @return todos os Veiculos do Usuário paginado de 10 em 10.
 */
@RequestMapping(value = "/pesquisar", method = RequestMethod.GET)
@ApiOperation(value = "Pesquisa de Veículo")
public ResponseEntity<Page<Veiculo>> pesquisar(
		@RequestParam(name = "placa", required = true) String placa, 
		@PageableDefault(sort = { "placa" }, direction = Direction.ASC) Pageable pageable) {
	
	// Não permite caracteres especiais na busca
	Validate.isTrue(StringUtils.isAlphanumeric(placa));
	
	Predicate predicate = QVeiculo.veiculo.placa.like(placa.toUpperCase() + '%');

	Page<Veiculo> page = veiculoRepository.findAll(predicate, pageable);
	
	page.forEach(v -> v.getProprietario().getId()); // TODO buscar uma
													// forma de arrumar
													// no
													// QueryDslPredicateExecutor
	return new ResponseEntity<>(page, HttpStatus.OK);
}
 
開發者ID:gustajz,項目名稱:parking-api,代碼行數:27,代碼來源:VeiculoController.java

示例10: getDrops

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
/**
 * Lists all the {@link Drop}s with pagination.
 * It uses View.DropSummary.class to return minimum fields 
 * that are annotated with @JsonView(View.DropSummary.class).
 *
 * @param repositoryId optionally filter by {@link Repository#id}
 * @param importedFilter optionally filter Drops that have been imported (
 * {@code null} no filter on imported status, {@code true} get only imported
 * {@code false} get only not imported)
 * @param canceledFilter optionally filter by Drops that have been canceled (
 * {@code null} no filter on canceled status, {@code true} get only canceled
 * {@code false} get only not canceled)
 * @param pageable pagination information
 * @return list of {@link Drop}
 * @throws Exception
 */
@JsonView(View.DropSummary.class)
@RequestMapping(method = RequestMethod.GET, value = "/api/drops")
public Page<Drop> getDrops(
        @RequestParam(value = "repositoryId", required = false) Long repositoryId,
        @RequestParam(value = "imported", required = false) Boolean importedFilter,
        @RequestParam(value = "canceled", required = false) Boolean canceledFilter,
        @PageableDefault(sort = "id", direction = Sort.Direction.DESC) Pageable pageable) throws Exception {

    Page<Drop> findAll = dropRepository.findAll(where(
            ifParamNotNull(repositoryIdEquals(repositoryId))).and(
            ifParamNotNull(isImported(importedFilter))).and(
            ifParamNotNull(isCanceled(canceledFilter))
    ),
            pageable
    );

    return new PageView<>(findAll);
}
 
開發者ID:box,項目名稱:mojito,代碼行數:35,代碼來源:DropWS.java

示例11: getPatientsByExample

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
/**
 * Returns a "paged" collection of resources matching the input query params using default
 * matching rules for strings of "contains and ignores case".
 * <p>
 * TODO I'm not exactly happy with the resource name "queryByExample".  Need to research more what
 * other APIs look like for this kind of functionality
 *
 * @param paramMap a Map of fields to use to search with
 * @param pageable a Pageable to restrict results
 * @return A paged result of matching Patients
 */
@GetMapping("/search/by-example")
public Page<Patient> getPatientsByExample(@RequestParam Map<String, Object> paramMap,
		@PageableDefault(size = DEFAULT_PAGE_SZ) Pageable pageable) {
	// naively copies map entries to matching properties in the Patient POJO
	Patient examplePatient = this.jacksonObjectMapper.convertValue(paramMap, Patient.class);

	Page<Patient> pagedResults = this.patientRepository
			.findAll(Example.of(examplePatient, DEFAULT_MATCHER), pageable);

	if (!pagedResults.hasContent()) {
		throw new NotFoundException(Patient.RESOURCE_PATH,
				"No Patients found matching example query " + examplePatient);
	}

	return pagedResults;
}
 
開發者ID:ssherwood,項目名稱:spring-boot-jpa,代碼行數:28,代碼來源:PatientController.java

示例12: searchApps

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
/**
 * 查詢apps分頁.
 */
@RequestMapping(value = "/projects/apps", method = RequestMethod.GET)
@ApiOperation(value = ApiDocs.SEARCH_APPS_PAGE, notes = ApiDocs.SEARCH_APPS_PAGE)
public Page<AppInfo> searchApps(@RequestParam("searchText") final String searchText, //
    @PageableDefault(page = DEFAULT_PAGE_NUM, size = DEFAULT_PAGE_SIZE,  //
        sort = "id", direction = Direction.ASC) final Pageable pageable) { 

  final Page<AppInfo> pageResult;
  if (StringUtils.isBlank(searchText)) {
    pageResult = appService.fetchAppInfos(pageable);
  } else {
    pageResult = appService.findByAppNameLike(searchText, pageable);
  }

  return pageResult;
}
 
開發者ID:Yirendai,項目名稱:cicada,代碼行數:19,代碼來源:ProjectInfoServiceApi.java

示例13: searchServices

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
/**
 * 分頁查詢app下的service信息.
 */
@RequestMapping(value = "/projects/services", method = RequestMethod.GET)
@ApiOperation(value = ApiDocs.SEARCH_APP_SERVICES_PAGE, notes = ApiDocs.SEARCH_APP_SERVICES_PAGE)
public Page<ServiceInfo> searchServices(@RequestParam("appId") final int appId, //
    @RequestParam("searchText") final String searchText, //
    @PageableDefault(page = DEFAULT_PAGE_NUM, size = DEFAULT_PAGE_SIZE,  //
        sort = "id", direction = Direction.ASC) final Pageable pageable) { 

  final Page<ServiceInfo> pageResult;
  if (StringUtils.isBlank(searchText)) {
    pageResult = serviceService.getServicesByAppId(appId, pageable);
  } else {
    pageResult = serviceService.findByAppIdAndserviceNameLike(appId, searchText, pageable);
  }

  return pageResult;
}
 
開發者ID:Yirendai,項目名稱:cicada,代碼行數:20,代碼來源:ProjectInfoServiceApi.java

示例14: searchMethods

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
/**
 * 分頁獲取service下的method詳情.
 */
@RequestMapping(value = "/projects/methods", method = RequestMethod.GET)
@ApiOperation(value = ApiDocs.SEARCH_APP_SERVICE_METHODS_PAGE, //
    notes = ApiDocs.SEARCH_APP_SERVICE_METHODS_PAGE)
public Page<MethodInfo> searchMethods(@RequestParam("serviceId") final int serviceId, //
    @RequestParam("searchText") final String searchText, //
    @PageableDefault(page = DEFAULT_PAGE_NUM, size = DEFAULT_PAGE_SIZE,  //
        sort = "id", direction = Direction.ASC) final Pageable pageable) { 

  final Page<MethodInfo> pageResult;
  if (StringUtils.isBlank(searchText)) {
    pageResult = methodService.getMethodsByService(serviceId, pageable);
  } else {
    pageResult = methodService.findByServiceIdAndMethodNameLike(serviceId, searchText, pageable);
  }
  return pageResult;
}
 
開發者ID:Yirendai,項目名稱:cicada,代碼行數:20,代碼來源:ProjectInfoServiceApi.java

示例15: findAll

import org.springframework.data.web.PageableDefault; //導入依賴的package包/類
@APIMapping(value="GET_ALL_HOUSING_INVENTORY")
@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
public ResponseEntity<Resources<Resource>> findAll(@RequestParam(value="inactive" ,required=false,defaultValue="false") Boolean inactive ,
		@RequestParam(value="projectId", required=false) UUID projectId,
		@RequestParam(value="vacant", required=false) Boolean vacant,
		@PageableDefault(size=30)  Pageable pageable,
		HttpServletRequest request) {
	
	Session session = sessionHelper.getSession(request);
	HousingInventory housingInventory=new HousingInventory();
	housingInventory.setProjectId(projectId);
	housingInventory.setVacant(vacant);
	housingInventory.setProjectGroupCode(session.getAccount().getProjectGroup().getProjectGroupCode());
			
	return new ResponseEntity<>(assembler.toResource(housingInventoryService.getAllHousingInventory(housingInventory, pageable), housingInventoryAssembler),
			HttpStatus.OK);
}
 
開發者ID:hserv,項目名稱:coordinated-entry,代碼行數:18,代碼來源:HousingInventoryResource.java


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