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

com.commercetools.sync.commons.models.WaitingToBeResolvedCategories Maven / Gradle / Ivy

Go to download

Java Library used to import and/or sync (taking care of changes) data into one or more commercetools projects from external sources such as CSV, XML, JSON, etc.. or even from an already existing commercetools project.

The newest version!
package com.commercetools.sync.commons.models;

import com.commercetools.api.models.category.CategoryDraft;
import java.util.Objects;
import java.util.Set;
import javax.annotation.Nonnull;

public final class WaitingToBeResolvedCategories implements WaitingToBeResolved {
  private CategoryDraft categoryDraft;
  private Set missingReferencedCategoriesKeys;

  public Set getMissingReferencedCategoriesKeys() {
    return missingReferencedCategoriesKeys;
  }

  public void setMissingReferencedCategoriesKeys(Set missingReferencedCategoriesKeys) {
    this.missingReferencedCategoriesKeys = missingReferencedCategoriesKeys;
  }

  // Needed for the 'com.fasterxml.jackson' deserialization, for example, when fetching
  // from CTP custom objects.
  public WaitingToBeResolvedCategories() {}

  public WaitingToBeResolvedCategories(
      @Nonnull final CategoryDraft draft,
      @Nonnull final Set missingReferencedCategoriesKeys) {
    this.categoryDraft = draft;
    this.setMissingReferencedCategoriesKeys(missingReferencedCategoriesKeys);
  }

  public void setCategoryDraft(@Nonnull final CategoryDraft draft) {
    categoryDraft = draft;
  }

  public CategoryDraft getCategoryDraft() {
    return categoryDraft;
  }

  @Override
  public String getKey() {
    return getCategoryDraft().getKey();
  }

  @Override
  public boolean equals(final Object other) {
    if (this == other) {
      return true;
    }
    if (!(other instanceof WaitingToBeResolvedCategories)) {
      return false;
    }
    final WaitingToBeResolvedCategories that = (WaitingToBeResolvedCategories) other;
    return Objects.equals(getCategoryDraft().getKey(), that.getCategoryDraft().getKey())
        && getMissingReferencedCategoriesKeys().equals(that.getMissingReferencedCategoriesKeys());
  }

  @Override
  public int hashCode() {
    return Objects.hash(getCategoryDraft().getKey(), getMissingReferencedCategoriesKeys());
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy