@@ -129,23 +129,26 @@ private static ProductVariantDraftImport extractProductVariantDraftImport(Produc
129129 return ProductVariantDraftImport .builder ()
130130 .key (variant .getKey ())
131131 .sku (variant .getSku ())
132- .images (variant .getImages ()
133- .stream ()
134- .map (i -> com .commercetools .importapi .models .common .Image .builder ()
135- .dimensions (d -> com .commercetools .importapi .models .common .AssetDimensions .builder ()
136- .w (i .getDimensions ().getW ())
137- .h (i .getDimensions ().getH ()))
138- .url (i .getUrl ())
139- .label (i .getLabel ())
140- .build ())
141- .collect (Collectors .toList ()))
132+ .images (toImportImages (variant .getImages ()))
142133 .prices (mapPricesToImportApi (variant ))
143134 .attributes (
144135 variant .getAttributes ().stream ().map (ProductUtil ::mapAttribute ).collect (Collectors .toList ()))
145136 .assets (importAssets (variant .getAssets ()))
146137 .build ();
147138 }
148139
140+ public static @ NotNull List <Image > toImportImages (List <com .commercetools .api .models .common .Image > images ) {
141+ return images
142+ .stream ()
143+ .map (i -> Image .builder ()
144+ .dimensions (
145+ d -> AssetDimensions .builder ().w (i .getDimensions ().getW ()).h (i .getDimensions ().getH ()))
146+ .url (i .getUrl ())
147+ .label (i .getLabel ())
148+ .build ())
149+ .collect (Collectors .toList ());
150+ }
151+
149152 private static List <PriceDraftImport > mapPricesToImportApi (ProductVariant variant ) {
150153 return variant .getPrices ()
151154 .stream ()
@@ -163,7 +166,7 @@ private List<CategoryKeyReference> extractCategoryKeyReference(ProductProjection
163166 .collect (Collectors .toList ());
164167 }
165168
166- private static Attribute mapAttribute (com .commercetools .api .models .product .Attribute attribute ) {
169+ public static Attribute mapAttribute (com .commercetools .api .models .product .Attribute attribute ) {
167170 Object value = attribute .getValue ();
168171
169172 if (value instanceof String ) {
0 commit comments