All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.commercetools.sync.inventories.InventorySyncOptions Maven / Gradle / Ivy

package com.commercetools.sync.inventories;

import com.commercetools.api.client.ProjectApiRoot;
import com.commercetools.api.models.inventory.InventoryEntry;
import com.commercetools.api.models.inventory.InventoryEntryDraft;
import com.commercetools.api.models.inventory.InventoryEntryUpdateAction;
import com.commercetools.sync.commons.BaseSyncOptions;
import com.commercetools.sync.commons.exceptions.SyncException;
import com.commercetools.sync.commons.utils.QuadConsumer;
import com.commercetools.sync.commons.utils.TriConsumer;
import com.commercetools.sync.commons.utils.TriFunction;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public final class InventorySyncOptions
    extends BaseSyncOptions {
  private final boolean ensureChannels;

  InventorySyncOptions(
      @Nonnull final ProjectApiRoot ctpClient,
      @Nullable
          final QuadConsumer<
                  SyncException,
                  Optional,
                  Optional,
                  List>
              errorCallback,
      @Nullable
          final TriConsumer, Optional>
              warningCallback,
      final int batchSize,
      boolean ensureChannels,
      @Nullable
          final TriFunction<
                  List,
                  InventoryEntryDraft,
                  InventoryEntry,
                  List>
              beforeUpdateCallback,
      @Nullable final Function beforeCreateCallback,
      final long cacheSize) {
    super(
        ctpClient,
        errorCallback,
        warningCallback,
        batchSize,
        beforeUpdateCallback,
        beforeCreateCallback,
        cacheSize);
    this.ensureChannels = ensureChannels;
  }

  /**
   * @return option that indicates whether the sync process should create a supply channel of the
   *     given key when it doesn't exist in a target system yet.
   */
  public boolean shouldEnsureChannels() {
    return ensureChannels;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy