Search in sources :

Example 6 with NodeGps

use of mom.trd.opentheso.bdd.helper.nodes.NodeGps in project opentheso by miledrousset.

the class GpsHelper method getCoordinate.

public NodeGps getCoordinate(HikariDataSource ds, String id_concept, String id_theso) {
    NodeGps coordonnees = null;
    if (isHaveCoordinate(ds, id_concept, id_theso)) {
        Connection conn;
        Statement stmt;
        ResultSet resultSet;
        try {
            // Get connection from pool
            conn = ds.getConnection();
            try {
                stmt = conn.createStatement();
                try {
                    String query = "select latitude, longitude from gps" + " where id_concept ='" + id_concept + "'" + " and id_theso = '" + id_theso + "'";
                    resultSet = stmt.executeQuery(query);
                    if (resultSet.next()) {
                        coordonnees = new NodeGps();
                        coordonnees.setLatitude(resultSet.getDouble("latitude"));
                        coordonnees.setLongitude(resultSet.getDouble("longitude"));
                    }
                } finally {
                    stmt.close();
                }
            } finally {
                conn.close();
            }
        } catch (SQLException sqle) {
            // Log exception
            log.error("Error while Add coordonnes : " + id_concept, sqle);
        }
    }
    return coordonnees;
}
Also used : SQLException(java.sql.SQLException) Statement(java.sql.Statement) NodeGps(mom.trd.opentheso.bdd.helper.nodes.NodeGps) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet)

Aggregations

NodeGps (mom.trd.opentheso.bdd.helper.nodes.NodeGps)6 Concept (mom.trd.opentheso.bdd.datas.Concept)3 GpsHelper (mom.trd.opentheso.bdd.helper.GpsHelper)3 NodeAlignment (mom.trd.opentheso.bdd.helper.nodes.NodeAlignment)3 Connection (java.sql.Connection)2 SQLException (java.sql.SQLException)2 HierarchicalRelationship (mom.trd.opentheso.bdd.datas.HierarchicalRelationship)2 NodeEM (mom.trd.opentheso.bdd.helper.nodes.NodeEM)2 NodeNote (mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)2 NodeTerm (mom.trd.opentheso.bdd.helper.nodes.term.NodeTerm)2 ResultSet (java.sql.ResultSet)1 Statement (java.sql.Statement)1 ArrayList (java.util.ArrayList)1 Term (mom.trd.opentheso.bdd.datas.Term)1 AlignmentHelper (mom.trd.opentheso.bdd.helper.AlignmentHelper)1 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)1 NoteHelper (mom.trd.opentheso.bdd.helper.NoteHelper)1 RelationsHelper (mom.trd.opentheso.bdd.helper.RelationsHelper)1 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)1 NodeHieraRelation (mom.trd.opentheso.bdd.helper.nodes.NodeHieraRelation)1