public final class AssetsUpdateActionUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T> java.util.List<io.sphere.sdk.commands.UpdateAction<T>> |
buildAssetsUpdateActions(java.util.List<io.sphere.sdk.models.Asset> oldAssets,
java.util.List<io.sphere.sdk.models.AssetDraft> newAssetDrafts,
AssetActionFactory<T> assetActionFactory)
Compares a list of
Assets with a list of AssetDrafts. |
@Nonnull
public static <T> java.util.List<io.sphere.sdk.commands.UpdateAction<T>> buildAssetsUpdateActions(@Nonnull
java.util.List<io.sphere.sdk.models.Asset> oldAssets,
@Nullable
java.util.List<io.sphere.sdk.models.AssetDraft> newAssetDrafts,
@Nonnull
AssetActionFactory<T> assetActionFactory)
throws BuildUpdateActionException
Assets with a list of AssetDrafts. The method serves as a generic
implementation for assets syncing. The method takes in functions for building the required update actions (
AddAsset, RemoveAsset, ChangeAssetOrder and 1-1 update actions on assets (e.g. changeAssetName,
setAssetDescription, etc..) for the required resource.
If the list of new AssetDrafts is null, then remove actions are built for every existing asset
in the oldAssets list.
T - the type of the resource the asset update actions are built for.oldAssets - the old list of assets.newAssetDrafts - the new list of asset drafts.assetActionFactory - factory responsible for building asset update actions.BuildUpdateActionException - in case there are asset drafts with duplicate keys.