public final class CustomUpdateActionUtils
extends java.lang.Object
| Constructor and Description |
|---|
CustomUpdateActionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends io.sphere.sdk.types.Custom & io.sphere.sdk.models.Resource<T>,S extends io.sphere.sdk.types.CustomDraft> |
buildCustomUpdateActions(T oldResource,
S newResource,
BaseSyncOptions syncOptions)
Compares the
CustomFields of an old resource T (for example Category,
Product, etc..), to the CustomFieldsDraft, of a new
resource draft S (for example CategoryDraft, ProductVariantDraft,
etc..), and returns a List<UpdateAction> as a result. |
@Nonnull
public static <T extends io.sphere.sdk.types.Custom & io.sphere.sdk.models.Resource<T>,S extends io.sphere.sdk.types.CustomDraft> java.util.List<io.sphere.sdk.commands.UpdateAction<T>> buildCustomUpdateActions(@Nonnull
T oldResource,
@Nonnull
S newResource,
@Nonnull
BaseSyncOptions syncOptions)
CustomFields of an old resource T (for example Category,
Product, etc..), to the CustomFieldsDraft, of a new
resource draft S (for example CategoryDraft, ProductVariantDraft,
etc..), and returns a List<UpdateAction> as a result. If no update action is needed,
for example in the case where both the CustomFields and the CustomFieldsDraft are null, an empty
List<UpdateAction> is returned. A BaseSyncOptions instance is injected into the
method which is responsible for supplying the sync options to the sync utility method. For example, custom error
callbacks for errors. The TypeService is injected also for fetching the key of the old resource type
from it's cache (see buildNonNullCustomFieldsUpdateActions(CustomFields,
CustomFieldsDraft, Custom, BaseSyncOptions)).
An update action will be added to the result list in the following cases:-
buildSetCustomFieldsUpdateActions(Map, Map, Custom, BaseSyncOptions))An update action will not be added to the result list in the following cases:-
T - the type of the ResourceS - the subtype of the CustomDraftoldResource - the resource which should be updated.newResource - the resource draft where we get the new custom fields.syncOptions - responsible for supplying the sync options to the sync utility method.