Search in sources :

Example 96 with NamedParameterJdbcTemplate

use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.

the class EntryPublicationsDaoImpl method findSortedPublicationIds.

@Override
public List<Long> findSortedPublicationIds(String entryAccession) {
    Map<String, Object> params = new HashMap<>();
    params.put("identifierId", masterIdentifierDao.findIdByUniqueName(entryAccession));
    params.put("publicationTypes", Arrays.asList(10, 20, 30, 40, 50, 60, 70, 80));
    return new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("publication-sorted-for-master"), params, new JdbcUtils.LongRowMapper("resource_id"));
}
Also used : JdbcUtils(org.nextprot.api.commons.utils.JdbcUtils) HashMap(java.util.HashMap) NamedParameterJdbcTemplate(org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)

Example 97 with NamedParameterJdbcTemplate

use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.

the class GeneDAOImpl method findTranscriptMappingsByIsoformName.

@Override
public Map<String, List<TranscriptGeneMapping>> findTranscriptMappingsByIsoformName(Collection<String> isoformNames) {
    SqlParameterSource namedParameters = new MapSqlParameterSource("isoform_names", isoformNames);
    List<TranscriptGeneMapping> list = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("transcripts-by-isoform-names"), namedParameters, new TranscriptRowMapper());
    return list.stream().collect(Collectors.groupingBy(TranscriptGeneMapping::getIsoformName, Collectors.toList()));
}
Also used : 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)

Example 98 with NamedParameterJdbcTemplate

use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.

the class GeneDAOImpl method findExonsAlignedToTranscriptOfGene.

@Override
public List<UncategorizedExon> findExonsAlignedToTranscriptOfGene(String transcriptName, String geneName) {
    MapSqlParameterSource namedParameters = new MapSqlParameterSource("transcriptName", transcriptName);
    namedParameters.addValue("geneName", geneName);
    return new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("exons-aligned-to-transcript"), namedParameters, new ExonMapper());
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) NamedParameterJdbcTemplate(org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)

Example 99 with NamedParameterJdbcTemplate

use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.

the class InteractionDaoImpl method findInteractionsByEntry.

@Override
public List<Interaction> findInteractionsByEntry(String entryName) {
    String sql = sqlDictionary.getSQLQuery("interactions_by_entry");
    SqlParameterSource namedParameters = new MapSqlParameterSource("entryName", entryName);
    return new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sql, namedParameters, new InteractionRowMapper());
}
Also used : 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)

Example 100 with NamedParameterJdbcTemplate

use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.

the class AntibodyMappingDaoImpl method findAntibodyMappingAnnotationsById.

@Override
public List<Annotation> findAntibodyMappingAnnotationsById(long masterId) {
    SqlParameterSource namedParams = new MapSqlParameterSource("id", masterId);
    AntibodyRowMapper rowMapper = new AntibodyRowMapper();
    new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("antibodies-by-id"), namedParams, rowMapper);
    return rowMapper.getAnnotations();
}
Also used : 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)

Aggregations

NamedParameterJdbcTemplate (org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)119 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)66 SqlParameterSource (org.springframework.jdbc.core.namedparam.SqlParameterSource)42 HashMap (java.util.HashMap)30 ResultSet (java.sql.ResultSet)16 SQLException (java.sql.SQLException)16 DbXref (org.nextprot.api.core.domain.DbXref)8 NextProtException (org.nextprot.api.commons.exception.NextProtException)7 PublicationDbXref (org.nextprot.api.core.domain.PublicationDbXref)7 ArrayList (java.util.ArrayList)5 JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)5 List (java.util.List)4 Map (java.util.Map)4 CvTerm (org.nextprot.api.core.domain.CvTerm)4 GargoyleException (com.kyj.fx.voeditor.visual.exceptions.GargoyleException)3 NotSupportException (com.kyj.fx.voeditor.visual.exceptions.NotSupportException)3 DataSource (javax.sql.DataSource)3 UserProteinList (org.nextprot.api.user.domain.UserProteinList)3 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)2 Date (java.util.Date)2