|
17 | 17 | */
|
18 | 18 | package ru.mystamps.web.feature.participant;
|
19 | 19 |
|
20 |
| -import lombok.RequiredArgsConstructor; |
21 | 20 | import org.apache.commons.lang3.Validate;
|
22 |
| -import org.springframework.beans.factory.annotation.Value; |
| 21 | +import org.springframework.core.env.Environment; |
23 | 22 | import org.springframework.dao.EmptyResultDataAccessException;
|
24 | 23 | import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
25 | 24 | import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
|
35 | 34 |
|
36 | 35 | // The String literal "name" appears 4 times in this file
|
37 | 36 | @SuppressWarnings("PMD.AvoidDuplicateLiterals")
|
38 |
| -@RequiredArgsConstructor |
39 | 37 | public class JdbcParticipantDao implements ParticipantDao {
|
40 | 38 |
|
41 | 39 | private final NamedParameterJdbcTemplate jdbcTemplate;
|
42 |
| - |
43 |
| - @Value("${transaction_participant.create}") |
44 |
| - private String addParticipantSql; |
45 |
| - |
46 |
| - @Value("${transaction_participant.find_buyers_with_parent_names}") |
47 |
| - private String findBuyersWithParentNamesSql; |
48 |
| - |
49 |
| - @Value("${transaction_participant.find_sellers_with_parent_names}") |
50 |
| - private String findSellersWithParentNamesSql; |
51 |
| - |
52 |
| - @Value("${transaction_participant.find_seller_id_by_name}") |
53 |
| - private String findSellerIdByNameSql; |
54 |
| - |
55 |
| - @Value("${transaction_participant.find_seller_id_by_name_and_url}") |
56 |
| - private String findSellerIdByNameAndUrlSql; |
57 |
| - |
58 |
| - @Value("${transaction_participant_group.find_all}") |
59 |
| - private String findAllGroupsSql; |
60 |
| - |
61 |
| - @Value("${transaction_participant_group.find_id_by_name}") |
62 |
| - private String findGroupIdByNameSql; |
| 40 | + private final String addParticipantSql; |
| 41 | + private final String findBuyersWithParentNamesSql; |
| 42 | + private final String findSellersWithParentNamesSql; |
| 43 | + private final String findSellerIdByNameSql; |
| 44 | + private final String findSellerIdByNameAndUrlSql; |
| 45 | + private final String findAllGroupsSql; |
| 46 | + private final String findGroupIdByNameSql; |
| 47 | + |
| 48 | + @SuppressWarnings("checkstyle:linelength") |
| 49 | + public JdbcParticipantDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) { |
| 50 | + this.jdbcTemplate = jdbcTemplate; |
| 51 | + this.addParticipantSql = env.getRequiredProperty("transaction_participant.create"); |
| 52 | + this.findBuyersWithParentNamesSql = env.getRequiredProperty("transaction_participant.find_buyers_with_parent_names"); |
| 53 | + this.findSellersWithParentNamesSql = env.getRequiredProperty("transaction_participant.find_sellers_with_parent_names"); |
| 54 | + this.findSellerIdByNameSql = env.getRequiredProperty("transaction_participant.find_seller_id_by_name"); |
| 55 | + this.findSellerIdByNameAndUrlSql = env.getRequiredProperty("transaction_participant.find_seller_id_by_name_and_url"); |
| 56 | + this.findAllGroupsSql = env.getRequiredProperty("transaction_participant_group.find_all"); |
| 57 | + this.findGroupIdByNameSql = env.getRequiredProperty("transaction_participant_group.find_id_by_name"); |
| 58 | + } |
63 | 59 |
|
64 | 60 | @Override
|
65 | 61 | public Integer add(AddParticipantDbDto participant) {
|
|
0 commit comments