Search in sources :

Example 31 with QueryBuilder

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

Example 32 with QueryBuilder

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

Example 33 with QueryBuilder

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

Example 34 with QueryBuilder

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

Example 35 with QueryBuilder

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

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 ArrayList (java.util.ArrayList)6 List (java.util.List)4 DatabaseHelper (ca.etsmtl.applets.etsmobile.db.DatabaseHelper)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