Search in sources :

Example 1 with PublicationCvJournal

use of org.nextprot.api.core.domain.PublicationCvJournal in project nextprot-api by calipho-sib.

the class PublicationDaoImpl method findPublicationById.

@Override
public Publication findPublicationById(long publicationId) {
    SqlParameterSource namedParameters = new MapSqlParameterSource("resourceId", publicationId);
    // get the journal found for publication id
    List<PublicationCvJournal> journals = journalDao.findCvJournalsByPublicationIds(Collections.singletonList(publicationId));
    return new NamedParameterJdbcTemplate(dsLocator.getDataSource()).queryForObject(sqlDictionary.getSQLQuery("publication-by-resourceid"), namedParameters, new PublicationRowMapper(journals));
}
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) PublicationCvJournal(org.nextprot.api.core.domain.PublicationCvJournal)

Example 2 with PublicationCvJournal

use of org.nextprot.api.core.domain.PublicationCvJournal 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));
}
Also used : NamedParameterJdbcTemplate(org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate) PublicationCvJournal(org.nextprot.api.core.domain.PublicationCvJournal)

Aggregations

PublicationCvJournal (org.nextprot.api.core.domain.PublicationCvJournal)2 NamedParameterJdbcTemplate (org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)2 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)1 SqlParameterSource (org.springframework.jdbc.core.namedparam.SqlParameterSource)1