Class TaxCategoryUpdateActionUtils
- java.lang.Object
-
- com.commercetools.sync.taxcategories.utils.TaxCategoryUpdateActionUtils
-
public final class TaxCategoryUpdateActionUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Optional<com.commercetools.api.models.tax_category.TaxCategoryUpdateAction>
buildChangeNameAction(com.commercetools.api.models.tax_category.TaxCategory oldTaxCategory, com.commercetools.api.models.tax_category.TaxCategoryDraft newTaxCategory)
Compares thename
values of aTaxCategory
and aTaxCategoryDraft
and returns anOptional
of update action, which would contain the"changeName"
TaxCategoryUpdateAction
.static java.util.Optional<com.commercetools.api.models.tax_category.TaxCategoryUpdateAction>
buildSetDescriptionAction(com.commercetools.api.models.tax_category.TaxCategory oldTaxCategory, com.commercetools.api.models.tax_category.TaxCategoryDraft newTaxCategory)
Compares thedescription
values of aTaxCategory
and aTaxCategoryDraft
and returns anOptional
of update action, which would contain the"setDescription"
TaxCategoryUpdateAction
.static java.util.List<com.commercetools.api.models.tax_category.TaxCategoryUpdateAction>
buildTaxRateUpdateActions(com.commercetools.api.models.tax_category.TaxCategory oldTaxCategory, com.commercetools.api.models.tax_category.TaxCategoryDraft newTaxCategory)
Compares the tax rates of aTaxCategory
and aTaxCategoryDraft
and returns a list ofTaxCategoryUpdateAction
as a result.
-
-
-
Method Detail
-
buildChangeNameAction
@Nonnull public static java.util.Optional<com.commercetools.api.models.tax_category.TaxCategoryUpdateAction> buildChangeNameAction(@Nonnull com.commercetools.api.models.tax_category.TaxCategory oldTaxCategory, @Nonnull com.commercetools.api.models.tax_category.TaxCategoryDraft newTaxCategory)
Compares thename
values of aTaxCategory
and aTaxCategoryDraft
and returns anOptional
of update action, which would contain the"changeName"
TaxCategoryUpdateAction
. If bothTaxCategory
andTaxCategoryDraft
have the samename
values, then no update action is needed and empty optional will be returned.- Parameters:
oldTaxCategory
- the tax category that should be updated.newTaxCategory
- the tax category draft which contains the new name.- Returns:
- optional containing update action or empty optional if names are identical.
-
buildSetDescriptionAction
@Nonnull public static java.util.Optional<com.commercetools.api.models.tax_category.TaxCategoryUpdateAction> buildSetDescriptionAction(@Nonnull com.commercetools.api.models.tax_category.TaxCategory oldTaxCategory, @Nonnull com.commercetools.api.models.tax_category.TaxCategoryDraft newTaxCategory)
Compares thedescription
values of aTaxCategory
and aTaxCategoryDraft
and returns anOptional
of update action, which would contain the"setDescription"
TaxCategoryUpdateAction
. If bothTaxCategory
andTaxCategoryDraft
have the samedescription
values, then no update action is needed and empty optional will be returned.- Parameters:
oldTaxCategory
- the tax category that should be updated.newTaxCategory
- the tax category draft which contains the new description.- Returns:
- optional containing update action or empty optional if descriptions are identical.
-
buildTaxRateUpdateActions
@Nonnull public static java.util.List<com.commercetools.api.models.tax_category.TaxCategoryUpdateAction> buildTaxRateUpdateActions(@Nonnull com.commercetools.api.models.tax_category.TaxCategory oldTaxCategory, @Nonnull com.commercetools.api.models.tax_category.TaxCategoryDraft newTaxCategory)
Compares the tax rates of aTaxCategory
and aTaxCategoryDraft
and returns a list ofTaxCategoryUpdateAction
as a result. If both theTaxCategory
and theTaxCategoryDraft
have identical tax rates, then no update action is needed and hence an emptyList
is returned.- Parameters:
oldTaxCategory
- the tax category which should be updated.newTaxCategory
- the tax category draft where we get the key.- Returns:
- A list with the update actions or an empty list if the tax rates are identical.
-
-