public final class AssetsUpdateActionUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ASSET_KEY_NOT_SET |
Modifier and Type | Method and Description |
---|---|
static <T extends io.sphere.sdk.models.Resource,D> |
buildAssetsUpdateActions(D newResource,
java.util.List<io.sphere.sdk.models.Asset> oldAssets,
java.util.List<io.sphere.sdk.models.AssetDraft> newAssetDrafts,
AssetActionFactory<T,D> assetActionFactory,
BaseSyncOptions syncOptions)
Compares a list of
Asset s with a list of AssetDraft s. |
public static final java.lang.String ASSET_KEY_NOT_SET
@Nonnull public static <T extends io.sphere.sdk.models.Resource,D> java.util.List<io.sphere.sdk.commands.UpdateAction<T>> buildAssetsUpdateActions(@Nonnull D newResource, @Nonnull java.util.List<io.sphere.sdk.models.Asset> oldAssets, @Nullable java.util.List<io.sphere.sdk.models.AssetDraft> newAssetDrafts, @Nonnull AssetActionFactory<T,D> assetActionFactory, @Nonnull BaseSyncOptions syncOptions) throws BuildUpdateActionException
Asset
s with a list of AssetDraft
s. 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 AssetDraft
s 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.D
- the type of the draft, which contains the changes the asset update actions are built
for.newResource
- resource draft from a source project, which contains the asset to update.oldAssets
- the old list of assets.newAssetDrafts
- the new list of asset drafts.assetActionFactory
- factory responsible for building asset update actions.syncOptions
- responsible for supplying the sync options to the sync utility method. It is
used for triggering the warn callback within the utilityBuildUpdateActionException
- in case there are asset drafts with duplicate keys.