Search in sources :

Example 1 with OWLDatabase

use of org.nextprot.api.rdf.domain.OWLDatabase in project nextprot-api by calipho-sib.

the class SchemaDaoImpl method findAllDatabase.

@Override
public List<OWLDatabase> findAllDatabase() {
    SqlParameterSource params = new MapSqlParameterSource();
    List<OWLDatabase> databases = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("schema-database-list"), params, new ParameterizedRowMapper<OWLDatabase>() {

        @Override
        public OWLDatabase mapRow(ResultSet resultSet, int row) throws SQLException {
            OWLDatabase database = new OWLDatabase();
            database.setName(resultSet.getString("name"));
            database.setDescription(resultSet.getString("description"));
            database.setURL(resultSet.getString("url"));
            database.setCategory(resultSet.getString("category"));
            return database;
        }
    });
    return databases;
}
Also used : OWLDatabase(org.nextprot.api.rdf.domain.OWLDatabase) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) SqlParameterSource(org.springframework.jdbc.core.namedparam.SqlParameterSource) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) NamedParameterJdbcTemplate(org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate) SQLException(java.sql.SQLException) ResultSet(java.sql.ResultSet)

Example 2 with OWLDatabase

use of org.nextprot.api.rdf.domain.OWLDatabase in project nextprot-api by calipho-sib.

the class SchemaDaoImpl method findAllProvenance.

/**
 * same as findAllDatabase() union identifier type names as pseudo database name
 */
@Override
public List<OWLDatabase> findAllProvenance() {
    SqlParameterSource params = new MapSqlParameterSource();
    List<OWLDatabase> databases = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("schema-provenance-list"), params, new ParameterizedRowMapper<OWLDatabase>() {

        @Override
        public OWLDatabase mapRow(ResultSet resultSet, int row) throws SQLException {
            OWLDatabase database = new OWLDatabase();
            database.setName(resultSet.getString("name"));
            database.setDescription(resultSet.getString("description"));
            database.setURL(resultSet.getString("url"));
            database.setCategory(resultSet.getString("category"));
            return database;
        }
    });
    return databases;
}
Also used : OWLDatabase(org.nextprot.api.rdf.domain.OWLDatabase) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) SqlParameterSource(org.springframework.jdbc.core.namedparam.SqlParameterSource) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) NamedParameterJdbcTemplate(org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate) SQLException(java.sql.SQLException) ResultSet(java.sql.ResultSet)

Aggregations

ResultSet (java.sql.ResultSet)2 SQLException (java.sql.SQLException)2 OWLDatabase (org.nextprot.api.rdf.domain.OWLDatabase)2 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)2 NamedParameterJdbcTemplate (org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)2 SqlParameterSource (org.springframework.jdbc.core.namedparam.SqlParameterSource)2