本文整理汇总了Java中org.mongodb.morphia.query.Query.get方法的典型用法代码示例。如果您正苦于以下问题:Java Query.get方法的具体用法?Java Query.get怎么用?Java Query.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mongodb.morphia.query.Query
的用法示例。
在下文中一共展示了Query.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getJob
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
@Override
public JobPo getJob(String taskTrackerNodeGroup, String taskId) {
Query<JobPo> query = template.createQuery(JobPo.class);
query.field("taskId").equal(taskId).
field("taskTrackerNodeGroup").equal(taskTrackerNodeGroup);
return query.get();
}
示例2: getJob
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
@Override
public JobPo getJob(String taskTrackerNodeGroup, String taskId) {
String tableName = JobQueueUtils.getExecutableQueueName(taskTrackerNodeGroup);
Query<JobPo> query = template.createQuery(tableName, JobPo.class);
query.field("taskId").equal(taskId).
field("taskTrackerNodeGroup").equal(taskTrackerNodeGroup);
return query.get();
}
示例3: findById
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
public Author findById(String id) {
Datastore ds = getDatastore();
Query<Author> query = ds.createQuery(Author.class).field("_id")
.equal(id);
return query.get();
}
示例4: findByEmail
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
public WebAppUser findByEmail(String email) {
Datastore ds = getDatastore();
Query<WebAppUser> query = ds.createQuery(WebAppUser.class)
.field("email").equal(email);
return query.get();
}
示例5: findIndividualByIdentifier
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
public Post findIndividualByIdentifier(String identifier) {
Datastore ds = getDatastore();
Query<Post> query = ds.createQuery(Post.class).field("identificator")
.equal(identifier);
return query.get();
}
示例6: findById
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
public Parameter findById(String id) {
Datastore ds = getDatastore();
Query<Parameter> query = ds.createQuery(Parameter.class).field("_id")
.equal(id);
return query.get();
}
示例7: getDatabyTaskId
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
public TelemetryData getDatabyTaskId(String taskId) {
Datastore ds = getDataSource();
Query<TelemetryData> q = ds.find(TelemetryData.class, "taskId", taskId);
TelemetryData td = null;
if(q.asList().size() > 0) {
td = q.get();
}
return td;
}
示例8: executeQuery
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
@Override
public Object executeQuery(QueryInfo info, Object[] args) {
QueryVisitor visitor = MongoDBVisitorFactory.createQueryVisitor(info, args);
QueryRepresentation qr = visitor.getQueryRepresentation();
@SuppressWarnings("rawtypes")
Query q = (Query) qr.getQuery();
if(info.getQueryType() == QueryType.RETRIEVE_SINGLE)
return q.get();
else
return q.asList();
}
示例9: getBuildBySha
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
public <T extends DbBackedBuild> T getBuildBySha(final DbBackedProject<?, ?> project, final String sha, final Result result) {
Query<DbBackedBuild> query = getQuery(project).
field("actions.causes.sha").equal(sha);
if (result != null) {
query = query.filter("result", result.toString());
}
final DbBackedBuild build = query.get();
associateProject(project, build);
return (T) build;
}
示例10: get
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
@Override
public Activity get(ActivityFilter request, String id) {
Query<MongoActivity> q = q();
if (request.hasUser()) {
MongoUser u = (MongoUser) request.getUser();
if (request.isFriendActivities()) {
q.field(MongoActivity.USER)
.in(userDao.getFriendRefs(u));
} else {
q.field(MongoActivity.USER)
.equal(key(u));
}
}
if (request.hasGroup()) {
q.field(MongoActivity.USER)
.in(groupDao.getMemberRefs(request.getGroup()));
}
if (request.hasType()) {
q.field(MongoActivity.TYPE)
.equal(request.getType());
}
try {
q.field(MongoActivity.ID).equal(new ObjectId(id));
} catch (IllegalArgumentException e) {
return null;
}
return q.get();
}
示例11: testLoadingOfRefInList
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
@Test
public void testLoadingOfRefInList() throws Exception {
// TODO us: exclusion does not work properly with maven + junit4
if (!LazyFeatureDependencies.testDependencyFullFilled()) {
return;
}
getMorphia().map(ContainerWithRefList.class);
getMorphia().map(OtherEntity.class);
OtherEntity otherEntity = new OtherEntity();
ContainerWithRefList containerWithRefInList = new ContainerWithRefList();
getDs().save(asList(otherEntity, containerWithRefInList));
otherEntity = getDs().get(otherEntity);
containerWithRefInList = getDs().get(containerWithRefInList);
Assert.assertNotNull(otherEntity);
Assert.assertNotNull(containerWithRefInList);
final EmbedWithRef embedWithRef = new EmbedWithRef();
embedWithRef.otherEntity = otherEntity;
containerWithRefInList.embedWithRef.add(embedWithRef);
getDs().save(asList(otherEntity, containerWithRefInList));
containerWithRefInList = getDs().get(containerWithRefInList);
Assert.assertNotNull(containerWithRefInList);
final Query<ContainerWithRefList> createQuery = getDs().find(ContainerWithRefList.class);
containerWithRefInList = createQuery.get();
Assert.assertNotNull(containerWithRefInList);
}
示例12: testLoadingOfRefThroughInheritanceInList
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
@Test
public void testLoadingOfRefThroughInheritanceInList() throws Exception {
// TODO us: exclusion does not work properly with maven + junit4
if (!LazyFeatureDependencies.testDependencyFullFilled()) {
return;
}
getMorphia().map(ContainerWithRefList.class);
getMorphia().map(OtherEntityChild.class);
OtherEntityChild otherEntity = new OtherEntityChild();
ContainerWithRefList containerWithRefInList = new ContainerWithRefList();
getDs().save(asList(otherEntity, containerWithRefInList));
otherEntity = getDs().get(otherEntity);
final ContainerWithRefList reload = getDs().get(containerWithRefInList);
Assert.assertNotNull(otherEntity);
Assert.assertNotNull(reload);
final EmbedWithRef embedWithRef = new EmbedWithRef();
embedWithRef.otherEntity = otherEntity;
reload.embedWithRef.add(embedWithRef);
getDs().save(asList(otherEntity, reload));
getDs().get(reload);
containerWithRefInList = getDs().get(reload);
Assert.assertNotNull(containerWithRefInList);
final Query<ContainerWithRefList> createQuery = getDs().find(ContainerWithRefList.class);
containerWithRefInList = createQuery.get();
Assert.assertNotNull(containerWithRefInList);
}
示例13: finish
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
@Override
public JobPo finish(String jobId) {
Query<JobPo> query = template.createQuery(JobPo.class);
query.field("jobId").equal(jobId);
return query.get();
}
示例14: getJob
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
@Override
public JobPo getJob(String jobId) {
Query<JobPo> query = template.createQuery(JobPo.class);
query.field("jobId").equal(jobId);
return query.get();
}
示例15: update
import org.mongodb.morphia.query.Query; //导入方法依赖的package包/类
public Product update(String id, Product product){
final UpdateOperations<Product> updateOperations = datastore.createUpdateOperations(Product.class).set("name", product.getName()).set("description", product.getDescription()).set("value", product.getValue());
final Query<Product> query = datastore.createQuery(Product.class).filter("_id ==", new ObjectId(id));
datastore.update(query, updateOperations);
return query.get();
}