Search in sources :

Example 1 with GpsPreferences

use of mom.trd.opentheso.core.alignment.GpsPreferences in project opentheso by miledrousset.

the class GpsBeans method recuperatePreferences.

public void recuperatePreferences() {
    if (!selectedAlignement.isEmpty()) {
        GpsHelper gpsHelper = new GpsHelper();
        GpsPreferences gpsPreferences;
        for (AlignementSource alignementSource : alignementSources) {
            if (alignementSource.getSource().equals(selectedAlignement)) {
                alignement_source = alignementSource;
            }
        }
        gpsPreferences = gpsHelper.getGpsPreferences(connect.getPoolConnexion(), id_theso, id_user1, alignement_source.getId());
        integrerTraduction = gpsPreferences.isGps_integrertraduction();
        alignementAutomatique = gpsPreferences.isGps_alignementautomatique();
        remplacerTraduction = gpsPreferences.isGps_reemplacertraduction();
    }
}
Also used : GpsHelper(mom.trd.opentheso.bdd.helper.GpsHelper) GpsPreferences(mom.trd.opentheso.core.alignment.GpsPreferences) AlignementSource(mom.trd.opentheso.core.alignment.AlignementSource)

Example 2 with GpsPreferences

use of mom.trd.opentheso.core.alignment.GpsPreferences in project opentheso by miledrousset.

the class GpsBeans method onRowSelect.

public void onRowSelect(SelectEvent event) {
    AlignmentHelper alignmentHelper = new AlignmentHelper();
    GpsHelper gpsHelper = new GpsHelper();
    GpsPreferences gpsPreferences;
    gpsPreferences = gpsHelper.getGpsPreferences(connect.getPoolConnexion(), id_theso, id_user1, ((AlignementSource) event.getObject()).getId());
    integrerTraduction = gpsPreferences.isGps_integrertraduction();
    alignementAutomatique = gpsPreferences.isGps_alignementautomatique();
    remplacerTraduction = gpsPreferences.isGps_reemplacertraduction();
    // alignement_source = "" + gpsPreferences.getId_alignement_source();
    for (AlignementSource alignementSource : alignementSources) {
        if (((AlignementSource) event.getObject()).getId() == alignementSource.getId()) {
            alignement_source = alignementSource;
        }
    }
    selectedAlignement = alignement_source.getRequete();
}
Also used : GpsHelper(mom.trd.opentheso.bdd.helper.GpsHelper) GpsPreferences(mom.trd.opentheso.core.alignment.GpsPreferences) AlignmentHelper(mom.trd.opentheso.bdd.helper.AlignmentHelper) AlignementSource(mom.trd.opentheso.core.alignment.AlignementSource)

Example 3 with GpsPreferences

use of mom.trd.opentheso.core.alignment.GpsPreferences in project opentheso by miledrousset.

the class GpsHelper method getGpsPreferences.

public GpsPreferences getGpsPreferences(HikariDataSource ds, String id_theso, int iduser, int id_source) {
    GpsPreferences gpsPreferences = new GpsPreferences();
    Connection conn;
    Statement stmt;
    ResultSet resultSet;
    try {
        // Get connection from pool
        conn = ds.getConnection();
        try {
            stmt = conn.createStatement();
            try {
                String query = "select * from gps_preferences" + " where id_thesaurus = '" + id_theso + "' and id_user =" + iduser + " and id_alignement_source =" + id_source;
                resultSet = stmt.executeQuery(query);
                if (resultSet.next()) {
                    gpsPreferences.setGps_alignementautomatique(resultSet.getBoolean("gps_alignementautomatique"));
                    gpsPreferences.setGps_integrertraduction(resultSet.getBoolean("gps_integrertraduction"));
                    gpsPreferences.setGps_reemplacertraduction(resultSet.getBoolean("gps_reemplacertraduction"));
                    gpsPreferences.setId_user(resultSet.getInt("id_user"));
                    gpsPreferences.setId_alignement_source(resultSet.getInt("id_alignement_source"));
                }
            } finally {
                stmt.close();
            }
        } finally {
            conn.close();
        }
    } catch (SQLException sqle) {
        // Log exception
        log.error("Error while Add coordonnes : ", sqle);
    }
    return gpsPreferences;
}
Also used : SQLException(java.sql.SQLException) Statement(java.sql.Statement) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) GpsPreferences(mom.trd.opentheso.core.alignment.GpsPreferences)

Aggregations

GpsPreferences (mom.trd.opentheso.core.alignment.GpsPreferences)3 GpsHelper (mom.trd.opentheso.bdd.helper.GpsHelper)2 AlignementSource (mom.trd.opentheso.core.alignment.AlignementSource)2 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Statement (java.sql.Statement)1 AlignmentHelper (mom.trd.opentheso.bdd.helper.AlignmentHelper)1