use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class DbXrefDaoImpl method findDbXrefsProperties.
@Override
public List<DbXrefProperty> findDbXrefsProperties(String entryName, List<Long> resourceIds) {
List<DbXrefProperty> result = new ArrayList<>();
// we must split the query into multiple queries otherwise we get an SQL error:
// the number of parameters (list of resource id) cannot exceed 32767 and miss titin has now 43012 xrefs !
List<List> paramsList = splitList(resourceIds);
for (List l : paramsList) {
Map<String, Object> params = new HashMap<>();
params.put("resourceIds", l);
List<DbXrefProperty> someProps = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("dbxref-props-by-resource-ids"), params, new DbXrefPropertyRowMapper());
result.addAll(someProps);
params.put("entryName", entryName);
List<DbXrefProperty> someOtherProps = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("dbxref-entry-link-props-by-entry-and-resource-ids"), params, new DbXrefPropertyRowMapper());
result.addAll(someOtherProps);
}
// System.out.println("AAA final size is " + result.size());
return result;
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class DbXrefDaoImpl method findDbXRefByPublicationIds.
@Override
public List<PublicationDbXref> findDbXRefByPublicationIds(List<Long> publicationIds) {
if (publicationIds.isEmpty()) {
return new ArrayList<>();
}
Map<String, Object> params = new HashMap<>();
params.put("publicationIds", publicationIds);
return new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("dbxref-by-publication-ids"), params, new PublicationDbXRefRowMapper());
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class DbXrefDaoImpl method findDbXrefEnsemblInfos.
@Override
public List<DbXref.EnsemblInfos> findDbXrefEnsemblInfos(String uniqueName, List<Long> xrefIds) {
if (!xrefIds.isEmpty()) {
Map<String, Object> params = new HashMap<>();
params.put("uniqueName", uniqueName);
params.put("xrefIds", xrefIds);
return new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("ensembl-props-by-xref-accession"), params, new EnsemblInfosRowMapper());
}
return new ArrayList<>();
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class DbXrefDaoImpl method findAntibodyXrefs.
@Override
public Set<DbXref> findAntibodyXrefs(List<Long> ids) {
SqlParameterSource namedParams = new MapSqlParameterSource("ids", ids);
List<DbXref> xrefs = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("dbxref-by-antibody-ids"), namedParams, new DbXRefRowMapper());
return new HashSet<>(xrefs);
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class DbXrefDaoImpl method findPeptideXrefs.
@Override
public Set<DbXref> findPeptideXrefs(List<String> names) {
SqlParameterSource namedParams = new MapSqlParameterSource("names", names);
List<DbXref> xrefs = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("dbxref-by-peptide-names"), namedParams, new DbXRefRowMapper());
return new HashSet<>(xrefs);
}
Aggregations