当前位置: 首页>>代码示例>>Java>>正文


Java Pageable类代码示例

本文整理汇总了Java中org.gbif.api.model.common.paging.Pageable的典型用法代码示例。如果您正苦于以下问题:Java Pageable类的具体用法?Java Pageable怎么用?Java Pageable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Pageable类属于org.gbif.api.model.common.paging包,在下文中一共展示了Pageable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: list

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
public List<Dataset> list() {
PagingResponse<Dataset> response = list((Pageable)null);
if(response == null)
    return null;

List<Dataset> datasets = Lists.newArrayList(response.getResults());
boolean isInitial = false;
int limit = -1;
while(Pager.isEndOfRecords(response)) {
    if(isInitial) {
	limit = Pager.getMaxLimit(response);
    }
    response.setOffset(response.getOffset() + response.getLimit());
    if(isInitial) {
	response.setLimit(limit);
	isInitial = false;
    }

    response = list(response);
    datasets.addAll(response.getResults());
}

return datasets;
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:25,代码来源:DatasetAPIClient.java

示例2: list

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
/**
 * This retrieves a list of all NameUsage from ChecklistBank.
 *
 * @param locale      identifier for a region
 * @param datasetKeys the optional checklist keys to limit paging to
 * @param page        the limit, offset paging information
 * @return requested list of NameUsage or an empty list if none could be found
 */
@GET
public PagingResponse<NameUsage> list(@Context Locale locale, @QueryParam(DATASET_KEY) Set<UUID> datasetKeys,
                                      @QueryParam("sourceId") String sourceId, @QueryParam("name") String canonicalName, @Context Pageable page) {

  // limit the maximum allowed offset
  checkDeepPaging(page);

  if (datasetKeys == null) {
    datasetKeys = ImmutableSet.of();
  }
  if (Strings.isNullOrEmpty(canonicalName)) {
    if (datasetKeys.size() > 1) {
      // https://github.com/gbif/checklistbank/issues/54
      throw new IllegalArgumentException("Multiple datasetKey parameters are not allowed");
    }
    return nameUsageService.list(locale,
        datasetKeys.isEmpty() ? null : datasetKeys.iterator().next(), sourceId, page);
  } else {
    return nameUsageService.listByCanonicalName(locale, canonicalName, page,
        datasetKeys.isEmpty() ? null : datasetKeys.toArray(new UUID[datasetKeys.size()]));
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:31,代码来源:SpeciesResource.java

示例3: visitOwnedDatasets

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
private void visitOwnedDatasets(UUID orgKey, DatasetVisitor visitor) {
  int datasetCount = 0;
  boolean endOfRecords = false;
  int offset = 0;
  do {
    Pageable page = new PagingRequest(offset, PAGING_LIMIT);
    PagingResponse<Dataset> datasets = orgService.publishedDatasets(orgKey, page);

    for (Dataset dataset : datasets.getResults()) {
      visitor.visit(dataset.getKey());
    }
    datasetCount += datasets.getResults().size();
    offset += PAGING_LIMIT;

    if (datasets.isEndOfRecords()) {
      endOfRecords = datasets.isEndOfRecords();
    }
  } while (!endOfRecords);
  LOG.info("Visited [{}] datasets owned by org [{}]", datasetCount, orgKey);
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:21,代码来源:RegistryChangeListener.java

示例4: list

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
@Override
public PagingResponse<Dataset> list(@Nullable Pageable page) {
  if (page == null) {
    page = new PagingResponse<Dataset>();
  }
  PagingResponse<Dataset> resp = new PagingResponse<Dataset>();
  int idx = 1;
  for (Map.Entry<UUID, Dataset> e: datasets.entrySet()) {
    if (idx >= page.getOffset()) {
      if (idx >= page.getLimit()) {
        break;
      }
      resp.getResults().add(e.getValue());
    }
    idx++;
  }
  resp.setCount((long) datasets.size());
  return resp;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:20,代码来源:DatasetServiceFileImpl.java

示例5: get

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
protected static String get(Pageable pager, int increment) {
StringBuffer pageParameter = new StringBuffer();
if(pager != null) {
    pageParameter.append("limit=").append(pager.getLimit()).append("&offset=").append(pager.getOffset() + increment);
}
return pageParameter.toString();
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:8,代码来源:Pager.java

示例6: search

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
public List<Dataset> search(String query) {
PagingResponse<Dataset> response = search(query, (Pageable)null);
if(response == null)
    return null;

List<Dataset> datasets = Lists.newArrayList(response.getResults());
while(Pager.isEndOfRecords(response)) {
    response.setOffset(response.getOffset() + response.getLimit());
    response = search(query, response);
    datasets.addAll(response.getResults());
}

return datasets;
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:15,代码来源:DatasetAPIClient.java

示例7: listByIdentifier

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
public List<Dataset> listByIdentifier(IdentifierType type, String identifier) 
   {
PagingResponse<Dataset> response = listByIdentifier(type, identifier, (Pageable)null);
if(response == null)
    return null;

List<Dataset> datasets = Lists.newArrayList(response.getResults());
while(Pager.isEndOfRecords(response)) {
    response.setOffset(response.getOffset() + response.getLimit());
    response = listByIdentifier(type, identifier, response);
    datasets.addAll(response.getResults());
}

return datasets;
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:16,代码来源:DatasetAPIClient.java

示例8: list

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
public PagingResponse<NameUsage> list(Locale locale, @Nullable UUID datasetKey, @Nullable String sourceId, @Nullable Pageable page)
   {
PagingResponse<NameUsage> response = null;
try {
    response = list(page, datasetKey, sourceId, locale);
}
catch (IOException e) {
}
return response;
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:11,代码来源:SpeciesAPIClient.java

示例9: listByCanonicalName

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
public PagingResponse<NameUsage> listByCanonicalName(Locale locale, String canonicalName, @Nullable Pageable page,
					       @Nullable UUID ... datasetKey)
   {
PagingResponse<NameUsage> response = null;
try {
    response = listByCanonicalName(page, canonicalName, getList(locale), datasetKey);
}
catch (IOException e) {
}

return response;
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:13,代码来源:SpeciesAPIClient.java

示例10: listByUser

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
@Override
public PagingResponse<Download> listByUser(
  @NotNull String s, @Nullable Pageable pageable, @Nullable Set<Download.Status> status
) {
  // TODO: Write implementation
  throw new UnsupportedOperationException("Not implemented yet");
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:8,代码来源:OccurrenceDownloadMockServices.java

示例11: listByUsage

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
@Override
public PagingResponse<NameUsageMediaObject> listByUsage(int usageKey, @Nullable Pageable page) {
  PagingResponse<NameUsageMediaObject> result = super.listByUsage(usageKey, page);
  //TODO: avoid live interpretations until we store the type properly
  for (NameUsageMediaObject m : result.getResults()) {
    MediaTypeUtils.detectType(m);
  }
  return result;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:10,代码来源:MultimediaServiceMyBatis.java

示例12: list

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
@Override
public PagingResponse<Download> list(
  @Nullable Pageable pageable, @Nullable Set<Download.Status> status
) {
  // TODO: Write implementation
  throw new UnsupportedOperationException("Not implemented yet");
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:8,代码来源:OccurrenceDownloadMockServices.java

示例13: getNextPage

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
public static String getNextPage(Pageable pager) {
return get(pager, 1);
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:4,代码来源:Pager.java

示例14: listConstituents

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
public PagingResponse<Dataset> listConstituents(@Nullable Pageable page)
   {
return null;
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:5,代码来源:DatasetAPIClient.java

示例15: listByCountry

import org.gbif.api.model.common.paging.Pageable; //导入依赖的package包/类
public PagingResponse<Dataset> listByCountry(Country country, @Nullable DatasetType type, @Nullable Pageable page)
   {
return null;
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:5,代码来源:DatasetAPIClient.java


注:本文中的org.gbif.api.model.common.paging.Pageable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。