|
| 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.sale; |
| 19 | + |
| 20 | +import lombok.Getter; |
| 21 | +import lombok.Setter; |
| 22 | +import org.hibernate.validator.constraints.NotEmpty; |
| 23 | +import org.hibernate.validator.constraints.URL; |
| 24 | +import ru.mystamps.web.feature.series.importing.HasSiteParser; |
| 25 | +import ru.mystamps.web.feature.series.importing.RequestImportDto; |
| 26 | +import ru.mystamps.web.feature.series.sale.SeriesSalesValidation; |
| 27 | +import ru.mystamps.web.support.beanvalidation.Group; |
| 28 | + |
| 29 | +import javax.validation.GroupSequence; |
| 30 | +import javax.validation.constraints.Size; |
| 31 | + |
| 32 | +@Getter |
| 33 | +@Setter |
| 34 | +@GroupSequence({ |
| 35 | + RequestSeriesSaleImportForm.class, |
| 36 | + Group.Level1.class, |
| 37 | + Group.Level2.class, |
| 38 | + Group.Level3.class, |
| 39 | + Group.Level4.class |
| 40 | +}) |
| 41 | +public class RequestSeriesSaleImportForm implements RequestImportDto { |
| 42 | + |
| 43 | + @NotEmpty(groups = Group.Level1.class) |
| 44 | + @Size( |
| 45 | + // Because the import saves nothing, this check actually isn't required. Perhaps, |
| 46 | + // we shouldn't validate on this stage and let it fail later, during a sale creation. |
| 47 | + max = SeriesSalesValidation.SERIES_SALES_URL_MAX_LENGTH, |
| 48 | + message = "{value.too-long}", |
| 49 | + groups = Group.Level2.class |
| 50 | + ) |
| 51 | + @URL(groups = Group.Level3.class) |
| 52 | + @HasSiteParser(groups = Group.Level4.class) |
| 53 | + private String url; |
| 54 | +} |
0 commit comments