use of org.hibernate.Criteria in project dhis2-core by dhis2.
the class HibernatePeriodStore method getPeriodsByPeriodType.
@Override
@SuppressWarnings("unchecked")
public List<Period> getPeriodsByPeriodType(PeriodType periodType) {
Criteria criteria = getCriteria();
criteria.add(Restrictions.eq("periodType", reloadPeriodType(periodType)));
return criteria.list();
}
use of org.hibernate.Criteria in project dhis2-core by dhis2.
the class HibernateProgramStageInstanceStore method get.
@Override
@SuppressWarnings("unchecked")
public List<ProgramStageInstance> get(TrackedEntityInstance entityInstance, EventStatus status) {
Criteria criteria = getCriteria();
criteria.createAlias("programInstance", "programInstance");
criteria.add(Restrictions.eq("programInstance.entityInstance", entityInstance));
criteria.add(Restrictions.eq("status", status));
return criteria.list();
}
use of org.hibernate.Criteria in project dhis2-core by dhis2.
the class HibernateProgramStore method get.
@SuppressWarnings("unchecked")
@Override
public List<Program> get(ProgramType type, OrganisationUnit organisationUnit) {
Criteria criteria1 = getCriteria();
criteria1.createAlias("organisationUnits", "orgunit");
criteria1.add(Restrictions.eq("programType", type));
criteria1.add(Restrictions.eq("orgunit.id", organisationUnit.getId()));
return criteria1.list();
}
use of org.hibernate.Criteria in project dhis2-core by dhis2.
the class HibernatePeriodStore method getIntersectingPeriodsByPeriodType.
@Override
@SuppressWarnings("unchecked")
public List<Period> getIntersectingPeriodsByPeriodType(PeriodType periodType, Date startDate, Date endDate) {
Criteria criteria = getCriteria();
criteria.add(Restrictions.eq("periodType", reloadPeriodType(periodType)));
criteria.add(Restrictions.ge("endDate", startDate));
criteria.add(Restrictions.le("startDate", endDate));
return criteria.list();
}
use of org.hibernate.Criteria in project dhis2-core by dhis2.
the class HibernatePeriodStore method getPeriodsBetweenDates.
@Override
@SuppressWarnings("unchecked")
public List<Period> getPeriodsBetweenDates(Date startDate, Date endDate) {
Criteria criteria = getCriteria();
criteria.add(Restrictions.ge("startDate", startDate));
criteria.add(Restrictions.le("endDate", endDate));
criteria.setCacheable(true);
return criteria.list();
}
Aggregations