use of com.commercetools.sync.products.ActionGroup.PRICES in project commercetools-sync-java by commercetools.
the class ProductUpdateActionUtils method collectAllVariantUpdateActions.
@Nonnull
private static List<UpdateAction<Product>> collectAllVariantUpdateActions(@Nonnull final List<UpdateAction<Product>> sameForAllUpdateActions, @Nonnull final ProductProjection oldProduct, @Nonnull final ProductDraft newProduct, @Nonnull final ProductVariant oldProductVariant, @Nonnull final ProductVariantDraft newProductVariant, @Nonnull final Map<String, AttributeMetaData> attributesMetaData, @Nonnull final ProductSyncOptions syncOptions) {
final ArrayList<UpdateAction<Product>> updateActions = new ArrayList<>();
final SyncFilter syncFilter = syncOptions.getSyncFilter();
updateActions.addAll(buildActionsIfPassesFilter(syncFilter, ATTRIBUTES, () -> emptyIfNull(buildProductVariantAttributesUpdateActions(oldProduct, newProduct, oldProductVariant, newProductVariant, attributesMetaData, syncOptions)).stream().filter(collectedUpdateAction -> hasDuplicateSameForAllAction(sameForAllUpdateActions, collectedUpdateAction)).collect(Collectors.toList())));
updateActions.addAll(buildActionsIfPassesFilter(syncFilter, IMAGES, () -> buildProductVariantImagesUpdateActions(oldProductVariant, newProductVariant)));
updateActions.addAll(buildActionsIfPassesFilter(syncFilter, PRICES, () -> buildProductVariantPricesUpdateActions(oldProduct, newProduct, oldProductVariant, newProductVariant, syncOptions)));
updateActions.addAll(buildActionsIfPassesFilter(syncFilter, ASSETS, () -> buildProductVariantAssetsUpdateActions(oldProduct, newProduct, oldProductVariant, newProductVariant, syncOptions)));
buildActionIfPassesFilter(syncFilter, SKU, () -> buildProductVariantSkuUpdateAction(oldProductVariant, newProductVariant)).ifPresent(updateActions::add);
return updateActions;
}
Aggregations