com.rapleaf.jack.queries.AbstractQueryBuilder Maven / Gradle / Ivy
package com.rapleaf.jack.queries;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import com.rapleaf.jack.IModelPersistence;
import com.rapleaf.jack.ModelWithId;
public abstract class AbstractQueryBuilder implements IQueryBuilder {
private ModelQuery query;
private IModelPersistence caller;
public AbstractQueryBuilder(IModelPersistence caller) {
this.caller = caller;
this.query = new ModelQuery();
}
protected void addWhereConstraint(WhereConstraint whereConstraint) {
query.addConstraint(whereConstraint);
}
protected void addOrder(OrderCriterion orderCriterion) {
query.addOrder(orderCriterion);
}
protected void setLimit(LimitCriterion limitCriterion) {
query.setLimitCriterion(limitCriterion);
}
protected void addSelectedField(FieldSelector field) {
query.addSelectedField(field);
}
protected void addSelectedFields(FieldSelector... fields) {
query.addSelectedFields(fields);
}
protected void addGroupByFields(Enum... fields) {
query.addGroupByFields(fields);
}
protected void addIds(Collection ids) {
query.addIds(ids);
}
protected void addId(Long id) {
query.addId(id);
}
@Override
public List find() throws IOException {
return caller.findWithOrder(query);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy