use of com.j256.ormlite.stmt.QueryBuilder in project SORMAS-Project by hzi-braunschweig.
the class AbstractAdoDao method queryForEq.
/**
* @see Dao#queryForEq(String, Object)
*/
public List<ADO> queryForEq(String fieldName, Object value) {
try {
QueryBuilder builder = queryBuilder();
Where where = builder.where();
where.eq(fieldName, value);
where.and().eq(AbstractDomainObject.SNAPSHOT, false).query();
return builder.query();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
use of com.j256.ormlite.stmt.QueryBuilder in project SORMAS-Project by hzi-braunschweig.
the class AbstractAdoDao method queryForEq.
public List<ADO> queryForEq(String fieldName, Object value, String orderBy, boolean ascending) {
try {
QueryBuilder builder = queryBuilder();
Where where = builder.where();
where.eq(fieldName, value);
where.and().eq(AbstractDomainObject.SNAPSHOT, false).query();
return builder.orderBy(orderBy, ascending).query();
} catch (SQLException | IllegalArgumentException e) {
Log.e(getTableName(), "Could not perform queryForEq");
throw new RuntimeException(e);
}
}
use of com.j256.ormlite.stmt.QueryBuilder in project SORMAS-Project by hzi-braunschweig.
the class FacilityDao method getActiveLaboratories.
public List<Facility> getActiveLaboratories(boolean includeOtherFacility) {
try {
QueryBuilder builder = queryBuilder();
Where where = builder.where();
where.eq(Facility.TYPE, FacilityType.LABORATORY);
where.and().eq(InfrastructureAdo.ARCHIVED, false);
where.and().eq(AbstractDomainObject.SNAPSHOT, false);
where.and().ne(Facility.UUID, FacilityDto.OTHER_FACILITY_UUID).query();
List<Facility> facilities = builder.orderBy(Facility.NAME, true).query();
if (includeOtherFacility) {
facilities.add(queryUuid(FacilityDto.OTHER_FACILITY_UUID));
}
return facilities;
} catch (SQLException | IllegalArgumentException e) {
Log.e(getTableName(), "Could not perform queryForEq");
throw new RuntimeException(e);
}
}
use of com.j256.ormlite.stmt.QueryBuilder in project SORMAS-Project by hzi-braunschweig.
the class FeatureConfigurationDao method isFeatureDisabled.
public boolean isFeatureDisabled(FeatureType featureType) {
try {
QueryBuilder builder = queryBuilder();
Where where = builder.where();
where.eq(FeatureConfiguration.FEATURE_TYPE, featureType);
where.and().eq(FeatureConfiguration.ENABLED, false);
return builder.countOf() > 0;
} catch (SQLException e) {
Log.e(getTableName(), "Could not perform isFeatureDisabled");
throw new RuntimeException(e);
}
}
use of com.j256.ormlite.stmt.QueryBuilder in project SORMAS-Project by hzi-braunschweig.
the class DiseaseConfigurationDao method getDiseaseConfiguration.
public DiseaseConfiguration getDiseaseConfiguration(Disease disease) {
try {
QueryBuilder builder = queryBuilder();
Where where = builder.where();
where.eq(DiseaseConfiguration.DISEASE, disease);
return (DiseaseConfiguration) builder.queryForFirst();
} catch (SQLException e) {
Log.e(getTableName(), "Could not perform getDiseaseConfiguration");
throw new RuntimeException(e);
}
}
Aggregations