use of com.j256.ormlite.stmt.QueryBuilder in project krypton-android by kryptco.
the class Approval method isGitTagApprovedNow.
public static synchronized boolean isGitTagApprovedNow(Dao<Approval, Long> db, UUID pairingUUID, Long temporaryApprovalSeconds) throws SQLException {
deleteExpiredApprovals(db, temporaryApprovalSeconds);
QueryBuilder query = db.queryBuilder();
return query.where().eq("pairing_uuid", pairingUUID).and().eq("type", ApprovalType.GIT_TAG_SIGNATURES).countOf() > 0;
}
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);
}
}
use of com.j256.ormlite.stmt.QueryBuilder in project SORMAS-Project by hzi-braunschweig.
the class AbstractAdoDao method queryForAll.
public List<ADO> queryForAll(String orderBy, boolean ascending) {
try {
QueryBuilder builder = queryBuilder();
builder.where().eq(AbstractDomainObject.SNAPSHOT, false).query();
return builder.orderBy(orderBy, ascending).query();
} catch (SQLException | IllegalArgumentException e) {
Log.e(getTableName(), "Could not perform queryForAll");
throw new RuntimeException();
}
}
Aggregations