Java Code Examples for org.mongodb.morphia.query.Query#get()

The following examples show how to use org.mongodb.morphia.query.Query#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomerServiceImpl.java    From acmeair with Apache License 2.0 5 votes vote down vote up
@Override
public Customer getCustomerByUsername(String username) {
	Query<CustomerImpl> q = datastore.find(CustomerImpl.class).field("_id").equal(username);
	Customer customer = q.get();
	if (customer != null) {
		customer.setPassword(null);
	}			
	return customer;
}
 
Example 2
Source File: MongoCronJobQueue.java    From light-task-scheduler with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 3
Source File: MongoRepeatJobQueue.java    From light-task-scheduler with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 4
Source File: MongoPreLoader.java    From light-task-scheduler with Apache License 2.0 5 votes vote down vote up
@Override
protected JobPo getJob(String taskTrackerNodeGroup, String jobId) {
    String tableName = JobQueueUtils.getExecutableQueueName(taskTrackerNodeGroup);
    Query<JobPo> query = template.createQuery(tableName, JobPo.class);
    query.field("jobId").equal(jobId).
            field("taskTrackerNodeGroup").equal(taskTrackerNodeGroup);
    return query.get();
}
 
Example 5
Source File: MongoExecutableJobQueue.java    From light-task-scheduler with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 6
Source File: MongoExecutingJobQueue.java    From light-task-scheduler with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 7
Source File: MongoSuspendJobQueue.java    From light-task-scheduler with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 8
Source File: DynamicBuildRepository.java    From DotCi with MIT License 5 votes vote down vote up
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;
    }
 
Example 9
Source File: BookingServiceImpl.java    From acmeair with Apache License 2.0 5 votes vote down vote up
@Override
public Booking getBooking(String user, String bookingId) {
	try{
		Query<BookingImpl> q = datastore.find(BookingImpl.class).field("_id").equal(bookingId);
		Booking booking = q.get();
		
		return booking;
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
Example 10
Source File: FlightServiceImpl.java    From acmeair with Apache License 2.0 5 votes vote down vote up
@Override
protected  FlightSegment getFlightSegment(String fromAirport, String toAirport){
	Query<FlightSegmentImpl> q = datastore.find(FlightSegmentImpl.class).field("originPort").equal(fromAirport).field("destPort").equal(toAirport);
	FlightSegment segment = q.get();
	if (segment == null) {
		segment = new FlightSegmentImpl(); // put a sentinel value of a non-populated flightsegment 
	}
	return segment;
}
 
Example 11
Source File: MongoSuspendJobQueue.java    From light-task-scheduler with Apache License 2.0 4 votes vote down vote up
@Override
public JobPo getJob(String jobId) {
    Query<JobPo> query = template.createQuery(JobPo.class);
    query.field("jobId").equal(jobId);
    return query.get();
}
 
Example 12
Source File: CustomerServiceImpl.java    From acmeair with Apache License 2.0 4 votes vote down vote up
@Override
protected CustomerSession getSession(String sessionid){
	Query<CustomerSessionImpl> q = datastore.find(CustomerSessionImpl.class).field("_id").equal(sessionid);		
	return q.get();
}
 
Example 13
Source File: CustomerServiceImpl.java    From acmeair with Apache License 2.0 4 votes vote down vote up
@Override
protected Customer getCustomer(String username) {
	Query<CustomerImpl> q = datastore.find(CustomerImpl.class).field("_id").equal(username);
	Customer customer = q.get();					
	return customer;
}
 
Example 14
Source File: FlightServiceImpl.java    From acmeair with Apache License 2.0 4 votes vote down vote up
protected Flight getFlight(String flightId, String segmentId) {
	Query<FlightImpl> q = datastore.find(FlightImpl.class).field("_id").equal(flightId);
	return q.get();
}
 
Example 15
Source File: MongoRepeatJobQueue.java    From light-task-scheduler with Apache License 2.0 4 votes vote down vote up
@Override
public JobPo getJob(String jobId) {
    Query<JobPo> query = template.createQuery(JobPo.class);
    query.field("jobId").equal(jobId);
    return query.get();
}
 
Example 16
Source File: MongoCronJobQueue.java    From light-task-scheduler with Apache License 2.0 4 votes vote down vote up
@Override
public JobPo getJob(String jobId) {
    Query<JobPo> query = template.createQuery(JobPo.class);
    query.field("jobId").equal(jobId);
    return query.get();
}
 
Example 17
Source File: MongoExecutingJobQueue.java    From light-task-scheduler with Apache License 2.0 4 votes vote down vote up
@Override
public JobPo getJob(String jobId) {
    Query<JobPo> query = template.createQuery(JobPo.class);
    query.field("jobId").equal(jobId);
    return query.get();
}