All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.springframework.data.simpledb.query.SdbItemQuery Maven / Gradle / Ivy

package org.springframework.data.simpledb.query;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.simpledb.core.SimpleDbOperations;

/**
 * Convenience type for access to finder methods of enclosing 
 * {@link SimpleDbOperations} object.
 * 
 * @author Sayantam Dey
 *
 */
public class SdbItemQuery {

	private final SimpleDbOperations simpleDbOps;
	private final String query;
	private final Class entityClass;
	private final boolean defaultConsistentRead;
	
	public SdbItemQuery(Class entityClass, String query, SimpleDbOperations simpleDbOps) {
		this.simpleDbOps = simpleDbOps;
		this.query = query;
		this.entityClass = entityClass;
		this.defaultConsistentRead = simpleDbOps.getSimpleDb().isConsistentRead();
	}

	public List find() {
		return find(defaultConsistentRead);
	}

	public List find(boolean consistentRead) {
		return simpleDbOps.find(entityClass, query, consistentRead);
	}

	public Page executePagedQuery(Pageable pageable) {
		return executePagedQuery(pageable, defaultConsistentRead);
	}

	public Page executePagedQuery(Pageable pageable, boolean consistentRead) {
		return simpleDbOps.executePagedQuery(entityClass, query, pageable, consistentRead);
	}

	public long count() {
		return count(defaultConsistentRead);
	}

	public long count(boolean consistentRead) {
		return simpleDbOps.count(query, entityClass, consistentRead);
	}
	
	
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy