Skip to content

Commit 5d6f61d

Browse files
committed
refactor(SeriesImportValidation): move series import-related values to the corresponding class.
Addressed to #927 No functional changes.
1 parent 63e2523 commit 5d6f61d

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

src/main/java/ru/mystamps/web/feature/series/importing/RequestImportForm.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
import javax.validation.GroupSequence;
2727
import javax.validation.constraints.Size;
2828

29-
import static ru.mystamps.web.validation.ValidationRules.IMPORT_REQUEST_URL_MAX_LENGTH;
30-
3129
@Getter
3230
@Setter
3331
@GroupSequence({
@@ -46,7 +44,7 @@ public class RequestImportForm implements RequestImportDto {
4644
// we use IMPORT_REQUEST_URL_MAX_LENGTH here.
4745
// Also, as the import saves nothing, this check actually isn't required. Perhaps,
4846
// we shouldn't validate on this stage and let it fail later, during a sale creation.
49-
max = IMPORT_REQUEST_URL_MAX_LENGTH,
47+
max = SeriesImportValidation.IMPORT_REQUEST_URL_MAX_LENGTH,
5048
message = "{value.too-long}",
5149
groups = Group.Level2.class
5250
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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.series.importing;
19+
20+
import ru.mystamps.web.feature.series.importing.SeriesImportDb.SeriesImportRequest;
21+
22+
@SuppressWarnings("PMD.CommentDefaultAccessModifier")
23+
final class SeriesImportValidation {
24+
25+
static final int IMPORT_REQUEST_URL_MAX_LENGTH = SeriesImportRequest.URL_LENGTH;
26+
27+
private SeriesImportValidation() {
28+
}
29+
30+
}
31+

src/main/java/ru/mystamps/web/validation/ValidationRules.java

-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package ru.mystamps.web.validation;
1919

2020
import ru.mystamps.web.feature.series.SeriesDb.Series;
21-
import ru.mystamps.web.feature.series.importing.SeriesImportDb.SeriesImportRequest;
2221

2322
public final class ValidationRules {
2423

@@ -30,8 +29,6 @@ public final class ValidationRules {
3029
@SuppressWarnings({ "PMD.LongVariable", "checkstyle:linelength" })
3130
public static final String CATALOG_NUMBERS_AND_LETTERS_REGEXP = "[1-9][0-9]{0,3}[a-z]?(,[1-9][0-9]{0,3}[a-z]?)*";
3231

33-
public static final int IMPORT_REQUEST_URL_MAX_LENGTH = SeriesImportRequest.URL_LENGTH;
34-
3532
/** Maximum uploading image size in kilobytes. */
3633
public static final long MAX_IMAGE_SIZE = 500;
3734

0 commit comments

Comments
 (0)