Skip to content

Commit 63e2523

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

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

src/main/java/ru/mystamps/web/feature/series/sale/AddSeriesSalesForm.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import ru.mystamps.web.support.beanvalidation.BothOrNoneRequired;
2626
import ru.mystamps.web.support.beanvalidation.FieldsMismatch;
2727
import ru.mystamps.web.support.beanvalidation.Group;
28-
import ru.mystamps.web.validation.ValidationRules;
2928

3029
import javax.validation.GroupSequence;
3130
import javax.validation.constraints.NotNull;
@@ -58,7 +57,7 @@ public class AddSeriesSalesForm implements AddSeriesSalesDto {
5857
private Integer sellerId;
5958

6059
@Size(
61-
max = ValidationRules.SERIES_SALES_URL_MAX_LENGTH,
60+
max = SeriesSalesValidation.SERIES_SALES_URL_MAX_LENGTH,
6261
message = "{value.too-long}",
6362
groups = Group.Level1.class
6463
)
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.sale;
19+
20+
import ru.mystamps.web.feature.series.sale.SeriesSalesDb.SeriesSales;
21+
22+
@SuppressWarnings("PMD.CommentDefaultAccessModifier")
23+
final class SeriesSalesValidation {
24+
25+
static final int SERIES_SALES_URL_MAX_LENGTH = SeriesSales.TRANSACTION_URL_LENGTH;
26+
27+
private SeriesSalesValidation() {
28+
}
29+
30+
}
31+

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

-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import ru.mystamps.web.feature.series.SeriesDb.Series;
2121
import ru.mystamps.web.feature.series.importing.SeriesImportDb.SeriesImportRequest;
22-
import ru.mystamps.web.feature.series.sale.SeriesSalesDb.SeriesSales;
2322

2423
public final class ValidationRules {
2524

@@ -31,8 +30,6 @@ public final class ValidationRules {
3130
@SuppressWarnings({ "PMD.LongVariable", "checkstyle:linelength" })
3231
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]?)*";
3332

34-
public static final int SERIES_SALES_URL_MAX_LENGTH = SeriesSales.TRANSACTION_URL_LENGTH;
35-
3633
public static final int IMPORT_REQUEST_URL_MAX_LENGTH = SeriesImportRequest.URL_LENGTH;
3734

3835
/** Maximum uploading image size in kilobytes. */

0 commit comments

Comments
 (0)