use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class UserProteinListDaoImpl method deleteAllProteinListItems.
@Override
public int deleteAllProteinListItems(long listId) {
final String DELETE_SQL = sqlDictionary.getSQLQuery("delete-all-protein-list-items");
Map<String, Object> params = new HashMap<String, Object>();
params.put("list_id", listId);
return new NamedParameterJdbcTemplate(dsLocator.getUserDataSource()).update(DELETE_SQL, params);
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class UserProteinListDaoImpl method getUserProteinListById.
@Override
public UserProteinList getUserProteinListById(long listId) throws DataAccessException {
String sql = sqlDictionary.getSQLQuery("read-user-protein-list-by-id");
SqlParameterSource namedParams = new MapSqlParameterSource("list_id", listId);
NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(dsLocator.getUserDataSource());
UserProteinList userProteinList = template.queryForObject(sql, namedParams, new ProteinListRowMapper());
userProteinList.setAccessions(getAccessionsByListId(listId));
return userProteinList;
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class UserProteinListDaoImpl method getUserProteinLists.
@Override
public List<UserProteinList> getUserProteinLists(String username) {
String sql = sqlDictionary.getSQLQuery("read-user-protein-lists-by-username");
SqlParameterSource namedParameters = new MapSqlParameterSource("user_name", username);
return new NamedParameterJdbcTemplate(dsLocator.getUserDataSource()).query(sql, namedParameters, new ProteinListRowMapper());
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class UserProteinListDaoImpl method createUserProteinList.
@Override
public long createUserProteinList(final UserProteinList userProteinList) {
final String INSERT_SQL = sqlDictionary.getSQLQuery("create-user-protein-list");
MapSqlParameterSource namedParameters = new MapSqlParameterSource();
namedParameters.addValue("list_name", userProteinList.getName());
namedParameters.addValue("description", userProteinList.getDescription());
namedParameters.addValue("owner_id", userProteinList.getOwnerId());
namedParameters.addValue("public_id", userProteinList.getPublicId());
return JdbcUtils.insertAndGetKey(INSERT_SQL, "list_id", namedParameters, new NamedParameterJdbcTemplate(dsLocator.getUserDataSource())).longValue();
}
use of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate in project nextprot-api by calipho-sib.
the class IsoformDAOImpl method findIsoformsSynonymsByEntryName.
@Override
public List<EntityName> findIsoformsSynonymsByEntryName(String entryName) {
String sql = sqlDictionary.getSQLQuery("isoforms-synonyms-by-entry-name");
SqlParameterSource namedParameters = new MapSqlParameterSource("unique_name", entryName);
return new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sql, namedParameters, new EntityNameRowMapper());
}
Aggregations