Skip to content

Commit 07ba579

Browse files
committed
refactor(RowMappers): move row mappers for the ru.mystamps.web.feature.site package to this package.
Addressed to #927 No functional changes.
1 parent 7a871e7 commit 07ba579

File tree

3 files changed

+56
-29
lines changed

3 files changed

+56
-29
lines changed

src/main/java/ru/mystamps/web/feature/site/JdbcSuspiciousActivityDao.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.apache.commons.lang3.Validate;
2222
import org.springframework.beans.factory.annotation.Value;
2323
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
24-
import ru.mystamps.web.support.jdbc.RowMappers;
2524

2625
import java.util.Collections;
2726
import java.util.Date;
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright (C) 2009-2019 Slava Semushin <[email protected]>
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 2 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program; if not, write to the Free Software
16+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17+
*/
18+
package ru.mystamps.web.feature.site;
19+
20+
import java.sql.ResultSet;
21+
import java.sql.SQLException;
22+
import java.util.Date;
23+
24+
final class RowMappers {
25+
26+
private RowMappers() {
27+
}
28+
29+
/**
30+
* @author Sergey Chechenev
31+
*/
32+
/* default */ static SuspiciousActivityDto forSuspiciousActivityDto(ResultSet rs, int unused)
33+
throws SQLException {
34+
35+
String type = rs.getString("activity_name");
36+
Date occurredAt = rs.getTimestamp("occurred_at");
37+
String page = rs.getString("page");
38+
String method = rs.getString("method");
39+
String userLogin = rs.getString("user_login");
40+
String ip = rs.getString("ip");
41+
String refererPage = rs.getString("referer_page");
42+
String userAgent = rs.getString("user_agent");
43+
44+
return new SuspiciousActivityDto(
45+
type,
46+
occurredAt,
47+
page,
48+
method,
49+
userLogin,
50+
ip,
51+
refererPage,
52+
userAgent
53+
);
54+
}
55+
56+
}

src/main/java/ru/mystamps/web/support/jdbc/RowMappers.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import ru.mystamps.web.feature.series.SeriesInfoDto;
2828
import ru.mystamps.web.feature.series.SeriesLinkDto;
2929
import ru.mystamps.web.feature.series.SitemapInfoDto;
30-
import ru.mystamps.web.feature.site.SuspiciousActivityDto;
3130

3231
import java.math.BigDecimal;
3332
import java.sql.ResultSet;
@@ -169,33 +168,6 @@ public static SeriesFullInfoDto forSeriesFullInfoDto(ResultSet rs, int unused)
169168
);
170169
}
171170

172-
/**
173-
* @author Sergey Chechenev
174-
*/
175-
public static SuspiciousActivityDto forSuspiciousActivityDto(ResultSet rs, int unused)
176-
throws SQLException {
177-
178-
String type = rs.getString("activity_name");
179-
Date occurredAt = rs.getTimestamp("occurred_at");
180-
String page = rs.getString("page");
181-
String method = rs.getString("method");
182-
String userLogin = rs.getString("user_login");
183-
String ip = rs.getString("ip");
184-
String refererPage = rs.getString("referer_page");
185-
String userAgent = rs.getString("user_agent");
186-
187-
return new SuspiciousActivityDto(
188-
type,
189-
occurredAt,
190-
page,
191-
method,
192-
userLogin,
193-
ip,
194-
refererPage,
195-
userAgent
196-
);
197-
}
198-
199171
public static EntityWithIdDto forEntityWithIdDto(ResultSet rs, int unused) throws SQLException {
200172
return new EntityWithIdDto(
201173
rs.getInt("id"),

0 commit comments

Comments
 (0)