use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class PublicationDaoImpl method findSortedPublicationsByMasterId.
@Override
public List<Publication> findSortedPublicationsByMasterId(Long masterId) {
Map<String, Object> params = new HashMap<>();
params.put("identifierId", masterId);
params.put("publicationTypes", Arrays.asList(10, 20, 30, 40, 50, 60, 70, 80));
// get all journals found for all publication ids
List<PublicationCvJournal> journals = journalDao.findCvJournalsByPublicationIds(findSortedPublicationIdsByMasterId(masterId));
return new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("publication-sorted-for-master"), params, new PublicationRowMapper(journals));
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class PublicationDaoImpl method findSortedPublicationIdsByMasterId.
@Override
public List<Long> findSortedPublicationIdsByMasterId(Long masterId) {
Map<String, Object> params = new HashMap<>();
params.put("identifierId", masterId);
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"));
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class EntityNameDaoImpl method findNames.
@Override
public List<EntityName> findNames(String uniqueName) {
SqlParameterSource namedParameters = new MapSqlParameterSource("uniqueName", uniqueName);
List<EntityName> entityNames = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("entity-names"), namedParameters, new EntryNameRowMapper());
return entityNames;
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class EntryPropertiesDaoImpl method findEntryProperties.
@Override
public EntryProperties findEntryProperties(String uniqueName) {
SqlParameterSource namedParameters = new MapSqlParameterSource("uniqueName", uniqueName);
NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(dsLocator.getDataSource());
return template.queryForObject(sqlDictionary.getSQLQuery("entry-properties"), namedParameters, new EntryPropertyRowMapper());
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class EntryPublicationDaoImpl method findPublicationDirectLinks.
@Override
public Map<Long, List<PublicationDirectLink>> findPublicationDirectLinks(String entryAccession) {
Map<String, Object> params = new HashMap<>();
params.put("masterId", masterIdentifierDao.findIdByUniqueName(entryAccession));
EntryPublicationPropertyRowMapper mapper = new EntryPublicationPropertyRowMapper();
return new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("publications-scopes-and-comments-of-master"), params, mapper).stream().collect(Collectors.groupingBy(PublicationDirectLink::getPublicationId));
}
Aggregations