public final class TypeUpdateActionUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.types.Type>> |
buildChangeNameUpdateAction(io.sphere.sdk.types.Type oldType,
io.sphere.sdk.types.TypeDraft newType)
Compares the
LocalizedString name values of a Type and a TypeDraft and
returns an Optional of update action, which would contain the "changeName"
UpdateAction if values are different. |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.types.Type>> |
buildFieldDefinitionsUpdateActions(io.sphere.sdk.types.Type oldType,
io.sphere.sdk.types.TypeDraft newType,
TypeSyncOptions syncOptions)
Compares the field definitions of a
Type and a TypeDraft and returns a list of
UpdateAction <Type > as a result if the values are different. |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.types.Type>> |
buildSetDescriptionUpdateAction(io.sphere.sdk.types.Type oldType,
io.sphere.sdk.types.TypeDraft newType)
Compares the
LocalizedString descriptions of a Type and a TypeDraft and
returns an UpdateAction <Type > as a result in an Optional of
update action if values are different. |
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.types.Type>> buildChangeNameUpdateAction(@Nonnull io.sphere.sdk.types.Type oldType, @Nonnull io.sphere.sdk.types.TypeDraft newType)
LocalizedString
name values of a Type
and a TypeDraft
and
returns an Optional
of update action, which would contain the "changeName"
UpdateAction
if values are different.oldType
- the type that should be updated.newType
- the type draft which contains the new name.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.types.Type>> buildSetDescriptionUpdateAction(@Nonnull io.sphere.sdk.types.Type oldType, @Nonnull io.sphere.sdk.types.TypeDraft newType)
LocalizedString
descriptions of a Type
and a TypeDraft
and
returns an UpdateAction
<Type
> as a result in an Optional
of
update action if values are different.oldType
- the type which should be updated.newType
- the type draft where we get the new description.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.types.Type>> buildFieldDefinitionsUpdateActions(@Nonnull io.sphere.sdk.types.Type oldType, @Nonnull io.sphere.sdk.types.TypeDraft newType, @Nonnull TypeSyncOptions syncOptions)
Type
and a TypeDraft
and returns a list of
UpdateAction
<Type
> 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 this util doesn't support the following:
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.