use of org.hisp.dhis.hibernate.JpaQueryParameters in project dhis2-core by dhis2.
the class HibernateIdentifiableObjectStore method getAllOrderedLastUpdated.
@Override
public List<T> getAllOrderedLastUpdated(int first, int max) {
CriteriaBuilder builder = getCriteriaBuilder();
JpaQueryParameters<T> param = new JpaQueryParameters<T>().addPredicates(getSharingPredicates(builder)).addOrder(root -> builder.asc(root.get("lastUpdated")));
return getList(builder, param);
}
use of org.hisp.dhis.hibernate.JpaQueryParameters in project dhis2-core by dhis2.
the class HibernateIdentifiableObjectStore method getCountGeCreated.
@Override
public int getCountGeCreated(Date created) {
CriteriaBuilder builder = getCriteriaBuilder();
JpaQueryParameters<T> param = new JpaQueryParameters<T>().addPredicates(getSharingPredicates(builder)).addPredicate(root -> builder.greaterThanOrEqualTo(root.get("created"), created)).count(root -> builder.countDistinct(root.get("id")));
return getCount(builder, param).intValue();
}
use of org.hisp.dhis.hibernate.JpaQueryParameters in project dhis2-core by dhis2.
the class HibernateIdentifiableObjectStore method getByDataDimension.
@Override
public List<T> getByDataDimension(boolean dataDimension) {
CriteriaBuilder builder = getCriteriaBuilder();
JpaQueryParameters<T> jpaQueryParameters = new JpaQueryParameters<T>().addPredicate(root -> builder.equal(root.get("dataDimension"), dataDimension)).addPredicates(getSharingPredicates(builder));
return getList(builder, jpaQueryParameters);
}
use of org.hisp.dhis.hibernate.JpaQueryParameters in project dhis2-core by dhis2.
the class HibernateIncomingSmsStore method getAll.
@Override
public List<IncomingSms> getAll(Integer min, Integer max, boolean hasPagination) {
CriteriaBuilder builder = getCriteriaBuilder();
JpaQueryParameters<IncomingSms> parameters = new JpaQueryParameters<IncomingSms>();
if (hasPagination) {
parameters.setFirstResult(min).setMaxResults(max);
}
return getList(builder, parameters);
}
use of org.hisp.dhis.hibernate.JpaQueryParameters in project dhis2-core by dhis2.
the class HibernateIdentifiableObjectStore method getAllOrderedName.
@Override
public List<T> getAllOrderedName() {
CriteriaBuilder builder = getCriteriaBuilder();
JpaQueryParameters<T> param = new JpaQueryParameters<T>().addPredicates(getSharingPredicates(builder)).addOrder(root -> builder.asc(root.get("name")));
return getList(builder, param);
}
Aggregations