|
1 | 1 | package com.commercetools.sync.products.templates.beforeupdatecallback; |
2 | 2 |
|
3 | | -import com.commercetools.sync.products.ProductSync; |
4 | | -import com.commercetools.sync.products.ProductSyncOptions; |
5 | | -import com.commercetools.sync.products.ProductSyncOptionsBuilder; |
6 | | -import io.sphere.sdk.client.SphereClient; |
7 | 3 | import io.sphere.sdk.commands.UpdateAction; |
8 | 4 | import io.sphere.sdk.models.LocalizedString; |
9 | 5 | import io.sphere.sdk.models.LocalizedStringEntry; |
|
17 | 13 | import io.sphere.sdk.products.commands.updateactions.SetMetaKeywords; |
18 | 14 | import io.sphere.sdk.products.commands.updateactions.SetMetaTitle; |
19 | 15 | import io.sphere.sdk.producttypes.ProductType; |
20 | | -import org.slf4j.Logger; |
21 | 16 |
|
22 | 17 | import javax.annotation.Nonnull; |
23 | 18 | import java.util.List; |
|
30 | 25 | import static java.util.stream.Collectors.toMap; |
31 | 26 |
|
32 | 27 | final class SyncSingleLocale { |
33 | | - |
34 | | - private static void sync(@Nonnull final SphereClient ctpClient, |
35 | | - @Nonnull final Logger logger, |
36 | | - @Nonnull final List<ProductDraft> newProductDrafts) { |
37 | | - final ProductSyncOptions syncOptions = |
38 | | - ProductSyncOptionsBuilder.of(ctpClient) |
39 | | - .errorCallback(logger::error) |
40 | | - .warningCallback(logger::warn) |
41 | | - .beforeUpdateCallback(SyncSingleLocale::syncFrenchDataOnly) |
42 | | - .build(); |
43 | | - |
44 | | - final ProductSync productSync = new ProductSync(syncOptions); |
45 | | - productSync.sync(newProductDrafts).toCompletableFuture().join(); |
46 | | - } |
47 | | - |
48 | 28 | /** |
49 | 29 | * Takes in a {@link List} of product update actions that was built from comparing a {@code newDraft} and an |
50 | 30 | * {@code oldProduct} and maps the update actions so that only localizations with value {@link Locale#FRENCH} |
|
0 commit comments