@@ -77,16 +77,16 @@ public Series add(AddSeriesDto dto, User user, boolean userCanAddComments) {
77
77
series .setPerforated (dto .getPerforated ());
78
78
79
79
setMichelNumbersIfProvided (dto , series );
80
- setMichelPriceIfProvided ( dto , series );
80
+ series . setMichelPrice ( Price . valueOf ( dto . getMichelPrice (), dto . getMichelCurrency ()) );
81
81
82
82
setScottNumbersIfProvided (dto , series );
83
- setScottPriceIfProvided ( dto , series );
83
+ series . setScottPrice ( Price . valueOf ( dto . getScottPrice (), dto . getScottCurrency ()) );
84
84
85
85
setYvertNumbersIfProvided (dto , series );
86
- setYvertPriceIfProvided ( dto , series );
86
+ series . setYvertPrice ( Price . valueOf ( dto . getYvertPrice (), dto . getYvertCurrency ()) );
87
87
88
88
setGibbonsNumbersIfProvided (dto , series );
89
- setGibbonsPriceIfProvided ( dto , series );
89
+ series . setGibbonsPrice ( Price . valueOf ( dto . getGibbonsPrice (), dto . getGibbonsCurrency ()) );
90
90
91
91
String imageUrl = imageService .save (dto .getImage ());
92
92
Validate .validState (imageUrl != null , "Image url must be non null" );
@@ -204,18 +204,6 @@ private static void setMichelNumbersIfProvided(AddSeriesDto dto, Series series)
204
204
}
205
205
}
206
206
207
- private static void setMichelPriceIfProvided (AddSeriesDto dto , Series series ) {
208
- if (dto .getMichelPrice () == null ) {
209
- return ;
210
- }
211
-
212
- Validate .isTrue (
213
- dto .getMichelCurrency () != null ,
214
- "Michel currency must be non null when price is specified"
215
- );
216
- series .setMichelPrice (new Price (dto .getMichelPrice (), dto .getMichelCurrency ()));
217
- }
218
-
219
207
private static void setScottNumbersIfProvided (AddSeriesDto dto , Series series ) {
220
208
Set <ScottCatalog > scottNumbers =
221
209
CatalogUtils .fromString (dto .getScottNumbers (), ScottCatalog .class );
@@ -224,18 +212,6 @@ private static void setScottNumbersIfProvided(AddSeriesDto dto, Series series) {
224
212
}
225
213
}
226
214
227
- private static void setScottPriceIfProvided (AddSeriesDto dto , Series series ) {
228
- if (dto .getScottPrice () == null ) {
229
- return ;
230
- }
231
-
232
- Validate .isTrue (
233
- dto .getScottCurrency () != null ,
234
- "Scott currency must be non null when price is specified"
235
- );
236
- series .setScottPrice (new Price (dto .getScottPrice (), dto .getScottCurrency ()));
237
- }
238
-
239
215
private static void setYvertNumbersIfProvided (AddSeriesDto dto , Series series ) {
240
216
Set <YvertCatalog > yvertNumbers =
241
217
CatalogUtils .fromString (dto .getYvertNumbers (), YvertCatalog .class );
@@ -244,18 +220,6 @@ private static void setYvertNumbersIfProvided(AddSeriesDto dto, Series series) {
244
220
}
245
221
}
246
222
247
- private static void setYvertPriceIfProvided (AddSeriesDto dto , Series series ) {
248
- if (dto .getYvertPrice () == null ) {
249
- return ;
250
- }
251
-
252
- Validate .isTrue (
253
- dto .getYvertCurrency () != null ,
254
- "Yvert currency must be non null when price is specified"
255
- );
256
- series .setYvertPrice (new Price (dto .getYvertPrice (), dto .getYvertCurrency ()));
257
- }
258
-
259
223
private static void setGibbonsNumbersIfProvided (AddSeriesDto dto , Series series ) {
260
224
Set <GibbonsCatalog > gibbonsNumbers =
261
225
CatalogUtils .fromString (dto .getGibbonsNumbers (), GibbonsCatalog .class );
@@ -264,16 +228,4 @@ private static void setGibbonsNumbersIfProvided(AddSeriesDto dto, Series series)
264
228
}
265
229
}
266
230
267
- private static void setGibbonsPriceIfProvided (AddSeriesDto dto , Series series ) {
268
- if (dto .getGibbonsPrice () == null ) {
269
- return ;
270
- }
271
-
272
- Validate .isTrue (
273
- dto .getGibbonsCurrency () != null ,
274
- "Gibbons currency must be non null when price is specified"
275
- );
276
- series .setGibbonsPrice (new Price (dto .getGibbonsPrice (), dto .getGibbonsCurrency ()));
277
- }
278
-
279
231
}
0 commit comments