use of com.j256.ormlite.stmt.QueryBuilder in project SORMAS-Project by hzi-braunschweig.
the class CaseDao method queryBaseForEq.
public List<Case> queryBaseForEq(String fieldName, Object value, String orderBy, boolean ascending, long offset, long limit) {
try {
QueryBuilder builder = queryBuilder();
Where where = builder.where();
where.eq(fieldName, value);
where.and().eq(AbstractDomainObject.SNAPSHOT, false).query();
builder.selectColumns(Case.UUID, Case.LAST_OPENED_DATE, Case.LOCAL_CHANGE_DATE, Case.MODIFIED, Case.REPORT_DATE, Case.REPORTING_USER, Case.DISEASE, Case.DISEASE_DETAILS, Case.PERSON, Case.CASE_CLASSIFICATION, Case.INVESTIGATION_STATUS, Case.OUTCOME, Case.HEALTH_FACILITY);
return builder.orderBy(orderBy, ascending).offset(offset).limit(limit).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 AbstractAdoDao method queryForNull.
public List<ADO> queryForNull(String fieldName) {
try {
QueryBuilder builder = queryBuilder();
Where where = builder.where();
where.and(where.isNull(fieldName), where.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 queryForAll.
/**
* @see Dao#queryForAll()
*/
public List<ADO> queryForAll() {
try {
QueryBuilder builder = queryBuilder();
Where where = builder.where();
where.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, long offset, long limit) {
try {
QueryBuilder builder = queryBuilder();
Where where = builder.where();
where.eq(fieldName, value);
where.and().eq(AbstractDomainObject.SNAPSHOT, false).query();
return builder.orderBy(orderBy, ascending).offset(offset).limit(limit).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 AbstractAdoDao method querySnapshotsForEq.
public List<ADO> querySnapshotsForEq(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, true).query();
return builder.orderBy(orderBy, ascending).query();
} catch (SQLException | IllegalArgumentException e) {
Log.e(getTableName(), "Could not perform queryForEq");
throw new RuntimeException(e);
}
}
Aggregations