Search in sources :

Example 6 with QueryBuilder

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;
}
Also used : QueryBuilder(com.j256.ormlite.stmt.QueryBuilder)

Example 7 with QueryBuilder

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);
    }
}
Also used : SQLException(java.sql.SQLException) QueryBuilder(com.j256.ormlite.stmt.QueryBuilder) Where(com.j256.ormlite.stmt.Where)

Example 8 with QueryBuilder

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);
    }
}
Also used : SQLException(java.sql.SQLException) QueryBuilder(com.j256.ormlite.stmt.QueryBuilder) Where(com.j256.ormlite.stmt.Where)

Example 9 with QueryBuilder

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);
    }
}
Also used : SQLException(java.sql.SQLException) QueryBuilder(com.j256.ormlite.stmt.QueryBuilder) Where(com.j256.ormlite.stmt.Where)

Example 10 with QueryBuilder

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();
    }
}
Also used : SQLException(java.sql.SQLException) QueryBuilder(com.j256.ormlite.stmt.QueryBuilder)

Aggregations

SQLException (java.sql.SQLException)44 QueryBuilder (com.j256.ormlite.stmt.QueryBuilder)43 Where (com.j256.ormlite.stmt.Where)38 SelectArg (com.j256.ormlite.stmt.SelectArg)9 List (java.util.List)4 DatabaseHelper (ca.etsmtl.applets.etsmobile.db.DatabaseHelper)3 ArrayList (java.util.ArrayList)3 ElementEvaluation (ca.etsmtl.applets.etsmobile.model.ElementEvaluation)2 NonNull (androidx.annotation.NonNull)1 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)1 FicheEmploye (ca.etsmtl.applets.etsmobile.model.FicheEmploye)1 ExpandableListAdapter (ca.etsmtl.applets.etsmobile.ui.adapter.ExpandableListAdapter)1 Entry (com.faltenreich.diaguard.shared.data.database.entity.Entry)1 EntryTag (com.faltenreich.diaguard.shared.data.database.entity.EntryTag)1 Food (com.faltenreich.diaguard.shared.data.database.entity.Food)1 Tag (com.faltenreich.diaguard.shared.data.database.entity.Tag)1 Disease (de.symeda.sormas.api.Disease)1 FeatureTypeProperty (de.symeda.sormas.api.feature.FeatureTypeProperty)1 UserRole (de.symeda.sormas.api.user.UserRole)1 Date (java.util.Date)1