本文整理了Java中org.mongodb.morphia.query.Query.order
方法的一些代码示例,展示了Query.order
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.order
方法的具体详情如下:
包路径:org.mongodb.morphia.query.Query
类名称:Query
方法名:order
[英]Sorts based on a property (defines return order). Examples:
代码示例来源: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
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());
代码示例来源:origin: ltsopensource/light-task-scheduler
query.order(("ASC".equalsIgnoreCase(request.getDirection()) ? "" : "-") + request.getField());
代码示例来源: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: 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 String branch) {
final Query<DbBackedBuild> query = getQuery(project);
filterExpression(branch, query);
final DbBackedBuild build = query
.order("-number").get();
associateProject(project, build);
return (T) build;
}
代码示例来源: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> Iterable<T> getBuilds(final DbBackedProject project, final int offset) {
final Query<DbBackedBuild> query = getQuery(project).order("-number")
.offset(offset);
final List<DbBackedBuild> builds = query.asList();
for (final DbBackedBuild build : builds) {
associateProject(project, build);
}
return (Iterable<T>) query.asList();
}
代码示例来源:origin: groupon/DotCi
public <B extends DbBackedBuild<P, B>, P extends DbBackedProject<P, B>> B getNextBuild(final DbBackedProject<P, B> project, final int number) {
final DbBackedBuild build = getQuery(project).
field("number").greaterThan(number).order("number").
get();
if (build != null) {
associateProject(project, build);
}
return (B) 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: groupon/DotCi
public <T extends DbBackedBuild> T getLastSuccessfulBuild(final DbBackedProject project, final String branch) {
final DbBackedBuild build = getQuery(project).order("-number").
field("result").equal(Result.SUCCESS.toString()).
field("actions.causes.branch.branch").equal(branch).
get();
associateProject(project, build);
return (T) build;
}
代码示例来源:origin: groupon/DotCi
public <T extends DbBackedBuild> Iterable<T> getCurrentUserBuildsGreaterThan(final DbBackedProject project, final int number) {
final List<DbBackedBuild> builds = getQuery(project)
.order("-number")
.field("pusher").equal(Jenkins.getAuthentication().getName())
.field("number").greaterThan(number)
.asList();
for (final DbBackedBuild build : builds) {
associateProject(project, build);
}
return (Iterable<T>) builds;
}
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!