本文整理了Java中org.mongodb.morphia.query.Query.limit
方法的一些代码示例,展示了Query.limit
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.limit
方法的具体详情如下:
包路径:org.mongodb.morphia.query.Query
类名称:Query
方法名:limit
[英]Limit the fetched result set to a certain number of values.
[中]将获取的结果集限制为一定数量的值。
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public List<JobFeedbackPo> fetchTop(String jobClientNodeGroup, int top) {
Query<JobFeedbackPo> query = createQuery(jobClientNodeGroup);
query.order("gmtCreated").limit(top);
return query.asList();
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public List<JobFeedbackPo> fetchTop(String jobClientNodeGroup, int top) {
Query<JobFeedbackPo> query = createQuery(jobClientNodeGroup);
query.order("gmtCreated").limit(top);
return query.asList();
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public List<JobPo> getNeedGenerateJobPos(Long checkTime, int topSize) {
Query<JobPo> query = template.createQuery(JobPo.class);
query.field("relyOnPrevCycle").equal(false);
query.field("lastGenerateTriggerTime").equal(checkTime);
query.offset(0).limit(topSize);
return query.asList();
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public List<JobPo> getNeedGenerateJobPos(Long checkTime, int topSize) {
Query<JobPo> query = template.createQuery(JobPo.class);
query.field("relyOnPrevCycle").equal(false);
query.field("lastGenerateTriggerTime").equal(checkTime);
query.offset(0).limit(topSize);
return query.asList();
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
protected List<JobPo> load(String loadTaskTrackerNodeGroup, int loadSize) {
// load
String tableName = JobQueueUtils.getExecutableQueueName(loadTaskTrackerNodeGroup);
Query<JobPo> query = template.createQuery(tableName, JobPo.class);
query.field("isRunning").equal(false)
.filter("triggerTime < ", SystemClock.now())
.order(" priority, triggerTime , gmtCreated").offset(0).limit(loadSize);
return query.asList();
}
代码示例来源:origin: ltsopensource/light-task-scheduler
protected List<JobPo> load(String loadTaskTrackerNodeGroup, int loadSize) {
// load
String tableName = JobQueueUtils.getExecutableQueueName(loadTaskTrackerNodeGroup);
Query<JobPo> query = template.createQuery(tableName, JobPo.class);
query.field("isRunning").equal(false)
.filter("triggerTime < ", SystemClock.now())
.order(" priority, triggerTime , gmtCreated").offset(0).limit(loadSize);
return query.asList();
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public PaginationRsp<NodeGroupPo> getNodeGroup(NodeGroupGetReq request) {
Query<NodeGroupPo> query = template.createQuery(NodeGroupPo.class);
if (request.getNodeType() != null) {
query.field("nodeType").equal(request.getNodeType());
}
if (StringUtils.isNotEmpty(request.getNodeGroup())) {
query.field("name").equal(request.getNodeGroup());
}
PaginationRsp<NodeGroupPo> response = new PaginationRsp<NodeGroupPo>();
Long results = template.getCount(query);
response.setResults(results.intValue());
if (results == 0) {
return response;
}
query.order("-gmtCreated").offset(request.getStart()).limit(request.getLimit());
response.setRows(query.asList());
return response;
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public PaginationRsp<NodeGroupPo> getNodeGroup(NodeGroupGetReq request) {
Query<NodeGroupPo> query = template.createQuery(NodeGroupPo.class);
if (request.getNodeType() != null) {
query.field("nodeType").equal(request.getNodeType());
}
if (StringUtils.isNotEmpty(request.getNodeGroup())) {
query.field("name").equal(request.getNodeGroup());
}
PaginationRsp<NodeGroupPo> response = new PaginationRsp<NodeGroupPo>();
Long results = template.getCount(query);
response.setResults(results.intValue());
if (results == 0) {
return response;
}
query.order("-gmtCreated").offset(request.getStart()).limit(request.getLimit());
response.setRows(query.asList());
return response;
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
query.order(("ASC".equalsIgnoreCase(request.getDirection()) ? "" : "-") + request.getField());
query.offset(request.getStart()).limit(request.getLimit());
response.setRows(query.asList());
return response;
代码示例来源:origin: ltsopensource/light-task-scheduler
query.order(("ASC".equalsIgnoreCase(request.getDirection()) ? "" : "-") + request.getField());
query.offset(request.getStart()).limit(request.getLimit());
response.setRows(query.asList());
return response;
代码示例来源:origin: ltsopensource/light-task-scheduler
query.order("-logTime").offset(request.getStart()).limit(request.getLimit());
代码示例来源:origin: ltsopensource/light-task-scheduler
query.order("-logTime").offset(request.getStart()).limit(request.getLimit());
代码示例来源:origin: com.github.ltsopensource/lts-core
@Override
public List<JobFeedbackPo> fetchTop(String jobClientNodeGroup, int top) {
Query<JobFeedbackPo> query = createQuery(jobClientNodeGroup);
query.order("gmtCreated").limit(top);
return query.asList();
}
}
代码示例来源:origin: groupon/DotCi
private Query<DynamicBuild> applyQueryFilters(Query<DynamicBuild> query) {
query = filterBranch(query);
query = query.limit(getBuildCount());
return query.order("number");
}
代码示例来源:origin: groupon/DotCi
public <T extends DbBackedBuild> T getLastBuild(final DbBackedProject project) {
final DbBackedBuild build = getQuery(project).limit(1).order("-number").disableValidation().get();
associateProject(project, build);
return (T) build;
}
代码示例来源:origin: groupon/DotCi
public <T extends DbBackedBuild> T getFirstBuild(final DbBackedProject project) {
final DbBackedBuild build = getQuery(project).disableValidation().
limit(1).order("number").
get();
associateProject(project, build);
return (T) build;
}
代码示例来源:origin: groupon/DotCi
public <T extends DbBackedBuild> T getLastFailedBuild(final DbBackedProject project) {
final DbBackedBuild build = getQuery(project).limit(1).order("-number").
field("result").equal(Result.FAILURE.toString()).
get();
associateProject(project, build);
return (T) build;
}
代码示例来源:origin: com.github.ltsopensource/lts-core
@Override
public List<JobPo> getNeedGenerateJobPos(Long checkTime, int topSize) {
Query<JobPo> query = template.createQuery(JobPo.class);
query.field("relyOnPrevCycle").equal(false);
query.field("lastGenerateTriggerTime").equal(checkTime);
query.offset(0).limit(topSize);
return query.asList();
}
}
代码示例来源:origin: groupon/DotCi
public DbBackedBuild getPreviousFinishedBuildOfSameBranch(final DbBackedBuild build, final String branch) {
final DbBackedProject project = (DbBackedProject) build.getProject();
final Query<DbBackedBuild> query = getQuery(project);
if (branch != null) filterExpression(branch, query);
final DbBackedBuild previousBuild = query.
limit(1).
order("-number").
field("state").equal("COMPLETED").field("number").lessThan(build.getNumber()).
get();
associateProject(project, previousBuild);
return previousBuild;
}
代码示例来源:origin: groupon/DotCi
private Query<DynamicBuild> getDynamicBuildsForUser(final String user, final int numberOfBuilds) {
final Query<DynamicBuild> query = getDatastore().createQuery(DynamicBuild.class)
.limit(numberOfBuilds)
.disableValidation()
.order("-timestamp")
.field("className").equal("com.groupon.jenkins.dynamic.build.DynamicBuild");
query.or(
query.criteria("actions.causes.user").equal(user),
query.criteria("actions.causes.pusher").equal(user)
);
return query;
}
内容来源于网络,如有侵权,请联系作者删除!