Class TypeUpdateActionUtils
- java.lang.Object
-
- com.commercetools.sync.types.utils.TypeUpdateActionUtils
-
public final class TypeUpdateActionUtils 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.type.TypeUpdateAction>
buildChangeNameUpdateAction(com.commercetools.api.models.type.Type oldType, com.commercetools.api.models.type.TypeDraft newType)
Compares theLocalizedString
name values of aType
and aTypeDraft
and returns anOptional
of update action, which would contain theTypeChangeNameAction
if values are different.static java.util.List<com.commercetools.api.models.type.TypeUpdateAction>
buildFieldDefinitionsUpdateActions(com.commercetools.api.models.type.Type oldType, com.commercetools.api.models.type.TypeDraft newType, TypeSyncOptions syncOptions)
Compares the field definitions of aType
and aTypeDraft
and returns a list ofTypeUpdateAction
as a result if the values are different.static java.util.Optional<com.commercetools.api.models.type.TypeUpdateAction>
buildSetDescriptionUpdateAction(com.commercetools.api.models.type.Type oldType, com.commercetools.api.models.type.TypeDraft newType)
Compares theLocalizedString
descriptions of aType
and aTypeDraft
and returns anTypeSetDescriptionAction
as a result in anOptional
of update action if values are different.
-
-
-
Method Detail
-
buildChangeNameUpdateAction
@Nonnull public static java.util.Optional<com.commercetools.api.models.type.TypeUpdateAction> buildChangeNameUpdateAction(@Nonnull com.commercetools.api.models.type.Type oldType, @Nonnull com.commercetools.api.models.type.TypeDraft newType)
Compares theLocalizedString
name values of aType
and aTypeDraft
and returns anOptional
of update action, which would contain theTypeChangeNameAction
if values are different.- Parameters:
oldType
- the type that should be updated.newType
- the type draft which contains the new name.- Returns:
- optional containing update action or empty optional if names are identical.
-
buildSetDescriptionUpdateAction
@Nonnull public static java.util.Optional<com.commercetools.api.models.type.TypeUpdateAction> buildSetDescriptionUpdateAction(@Nonnull com.commercetools.api.models.type.Type oldType, @Nonnull com.commercetools.api.models.type.TypeDraft newType)
Compares theLocalizedString
descriptions of aType
and aTypeDraft
and returns anTypeSetDescriptionAction
as a result in anOptional
of update action if values are different.- Parameters:
oldType
- the type which should be updated.newType
- the type draft where we get the new description.- Returns:
- A filled optional with the update action or an empty optional if the descriptions are identical.
-
buildFieldDefinitionsUpdateActions
@Nonnull public static java.util.List<com.commercetools.api.models.type.TypeUpdateAction> buildFieldDefinitionsUpdateActions(@Nonnull com.commercetools.api.models.type.Type oldType, @Nonnull com.commercetools.api.models.type.TypeDraft newType, @Nonnull TypeSyncOptions syncOptions)
Compares the field definitions of aType
and aTypeDraft
and returns a list ofTypeUpdateAction
as a result if the values are different. In case, the new type draft has a list of field definitions in which a duplicate name exists, the error callback is triggered and an empty list is returned.Note: Currently commercetools API doesn't support the following:
- removing the EnumValue/LocalizedEnumValue of a FieldDefinition
- Parameters:
oldType
- the type which should be updated.newType
- the type draft where we get the key.syncOptions
- responsible for supplying the sync options to the sync utility method. It is used for triggering the error callback within the utility, in case of errors.- Returns:
- A list with the update actions or an empty list if the field definitions are identical.
-
-