use of com.commercetools.sync.commons.utils.QuadConsumer in project commercetools-project-sync by commercetools.
the class StateSyncer method of.
public static StateSyncer of(@Nonnull final SphereClient sourceClient, @Nonnull final SphereClient targetClient, @Nonnull final Clock clock) {
final QuadConsumer<SyncException, Optional<StateDraft>, Optional<State>, List<UpdateAction<State>>> logErrorCallback = (exception, newResourceDraft, oldResource, updateActions) -> logErrorCallback(LOGGER, "state", exception, oldResource, updateActions);
final TriConsumer<SyncException, Optional<StateDraft>, Optional<State>> logWarningCallback = (exception, newResourceDraft, oldResource) -> logWarningCallback(LOGGER, "state", exception, oldResource);
StateSyncOptions syncOptions = StateSyncOptionsBuilder.of(targetClient).errorCallback(logErrorCallback).warningCallback(logWarningCallback).build();
StateSync stateSync = new StateSync(syncOptions);
CustomObjectService customObjectService = new CustomObjectServiceImpl(targetClient);
return new StateSyncer(stateSync, sourceClient, targetClient, customObjectService, clock);
}
use of com.commercetools.sync.commons.utils.QuadConsumer in project commercetools-project-sync by commercetools.
the class TaxCategorySyncer method of.
@Nonnull
public static TaxCategorySyncer of(@Nonnull final SphereClient sourceClient, @Nonnull final SphereClient targetClient, @Nonnull final Clock clock) {
final QuadConsumer<SyncException, Optional<TaxCategoryDraft>, Optional<TaxCategory>, List<UpdateAction<TaxCategory>>> logErrorCallback = (exception, newResourceDraft, oldResource, updateActions) -> logErrorCallback(LOGGER, "tax category", exception, oldResource, updateActions);
final TriConsumer<SyncException, Optional<TaxCategoryDraft>, Optional<TaxCategory>> logWarningCallback = (exception, newResourceDraft, oldResource) -> logWarningCallback(LOGGER, "tax category", exception, oldResource);
final TaxCategorySyncOptions syncOptions = TaxCategorySyncOptionsBuilder.of(targetClient).errorCallback(logErrorCallback).warningCallback(logWarningCallback).build();
final TaxCategorySync taxCategorySync = new TaxCategorySync(syncOptions);
final CustomObjectService customObjectService = new CustomObjectServiceImpl(targetClient);
return new TaxCategorySyncer(taxCategorySync, sourceClient, targetClient, customObjectService, clock);
}
use of com.commercetools.sync.commons.utils.QuadConsumer in project commercetools-project-sync by commercetools.
the class TypeSyncer method of.
@Nonnull
public static TypeSyncer of(@Nonnull final SphereClient sourceClient, @Nonnull final SphereClient targetClient, @Nonnull final Clock clock) {
final QuadConsumer<SyncException, Optional<TypeDraft>, Optional<Type>, List<UpdateAction<Type>>> logErrorCallback = (exception, newResourceDraft, oldResource, updateActions) -> logErrorCallback(LOGGER, "type", exception, oldResource, updateActions);
final TriConsumer<SyncException, Optional<TypeDraft>, Optional<Type>> logWarningCallback = (exception, newResourceDraft, oldResource) -> logWarningCallback(LOGGER, "type", exception, oldResource);
final TypeSyncOptions syncOptions = TypeSyncOptionsBuilder.of(targetClient).errorCallback(logErrorCallback).warningCallback(logWarningCallback).build();
final TypeSync typeSync = new TypeSync(syncOptions);
final CustomObjectService customObjectService = new CustomObjectServiceImpl(targetClient);
return new TypeSyncer(typeSync, sourceClient, targetClient, customObjectService, clock);
}
use of com.commercetools.sync.commons.utils.QuadConsumer in project commercetools-project-sync by commercetools.
the class CategorySyncer method of.
@Nonnull
public static CategorySyncer of(@Nonnull final SphereClient sourceClient, @Nonnull final SphereClient targetClient, @Nonnull final Clock clock) {
final QuadConsumer<SyncException, Optional<CategoryDraft>, Optional<Category>, List<UpdateAction<Category>>> logErrorCallback = (exception, newResourceDraft, oldResource, updateActions) -> logErrorCallback(LOGGER, "category", exception, oldResource, updateActions);
final TriConsumer<SyncException, Optional<CategoryDraft>, Optional<Category>> logWarningCallback = (exception, newResourceDraft, oldResource) -> logWarningCallback(LOGGER, "category", exception, oldResource);
final CategorySyncOptions syncOptions = CategorySyncOptionsBuilder.of(targetClient).errorCallback(logErrorCallback).warningCallback(logWarningCallback).build();
final CategorySync categorySync = new CategorySync(syncOptions);
final CustomObjectService customObjectService = new CustomObjectServiceImpl(targetClient);
return new CategorySyncer(categorySync, sourceClient, targetClient, customObjectService, clock);
}
use of com.commercetools.sync.commons.utils.QuadConsumer in project commercetools-project-sync by commercetools.
the class CustomerSyncer method of.
public static CustomerSyncer of(@Nonnull final SphereClient sourceClient, @Nonnull final SphereClient targetClient, @Nonnull final Clock clock) {
final QuadConsumer<SyncException, Optional<CustomerDraft>, Optional<Customer>, List<UpdateAction<Customer>>> logErrorCallback = (exception, newResourceDraft, oldResource, updateActions) -> logErrorCallback(LOGGER, "customer", exception, oldResource, updateActions);
final TriConsumer<SyncException, Optional<CustomerDraft>, Optional<Customer>> logWarningCallback = (exception, newResourceDraft, oldResource) -> logWarningCallback(LOGGER, "customer", exception, oldResource);
final CustomerSyncOptions customerSyncOptions = CustomerSyncOptionsBuilder.of(targetClient).errorCallback(logErrorCallback).warningCallback(logWarningCallback).build();
final CustomerSync customerSync = new CustomerSync(customerSyncOptions);
final CustomObjectService customObjectService = new CustomObjectServiceImpl(targetClient);
return new CustomerSyncer(customerSync, sourceClient, targetClient, customObjectService, clock);
}
Aggregations