Class AssetActionFactory<T extends com.commercetools.api.models.ResourceUpdateAction<T>,D>
- java.lang.Object
-
- com.commercetools.sync.commons.helpers.AssetActionFactory<T,D>
-
- Type Parameters:
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.
- Direct Known Subclasses:
CategoryAssetActionFactory
,ProductAssetActionFactory
public abstract class AssetActionFactory<T extends com.commercetools.api.models.ResourceUpdateAction<T>,D> extends java.lang.Object
Helper class for building update actions for assets that are contained in the resource of typeT
.
-
-
Field Summary
Fields Modifier and Type Field Description BaseSyncOptions
syncOptions
-
Constructor Summary
Constructors Constructor Description AssetActionFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract T
buildAddAssetAction(com.commercetools.api.models.common.AssetDraft newAssetDraft, java.lang.Integer position)
Takes an asset draft and an asset position to build an AddAsset action of the type T.abstract java.util.List<T>
buildAssetActions(D newResource, com.commercetools.api.models.common.Asset oldAsset, com.commercetools.api.models.common.AssetDraft newAssetDraft)
Takes a matching old asset and a new asset and computes the update actions needed to sync them.abstract T
buildChangeAssetOrderAction(java.util.List<java.lang.String> newAssetOrder)
Takes a list of asset ids to build a ChangeAssetOrder action of the type T.abstract T
buildRemoveAssetAction(java.lang.String assetKey)
Takes an asset key to build a RemoveAsset action of the type T.
-
-
-
Field Detail
-
syncOptions
public BaseSyncOptions syncOptions
-
-
Method Detail
-
buildAssetActions
public abstract java.util.List<T> buildAssetActions(@Nonnull D newResource, @Nonnull com.commercetools.api.models.common.Asset oldAsset, @Nonnull com.commercetools.api.models.common.AssetDraft newAssetDraft)
Takes a matching old asset and a new asset and computes the update actions needed to sync them.- Parameters:
newResource
- new mainresource draft, which contains the asset to update.oldAsset
- the old asset to compare.newAssetDraft
- the matching new asset draft.- Returns:
- update actions needed to sync the two assets.
-
buildRemoveAssetAction
public abstract T buildRemoveAssetAction(@Nonnull java.lang.String assetKey)
Takes an asset key to build a RemoveAsset action of the type T.- Parameters:
assetKey
- the key of the asset used un building the update action.- Returns:
- the built remove asset update action.
-
buildChangeAssetOrderAction
public abstract T buildChangeAssetOrderAction(@Nonnull java.util.List<java.lang.String> newAssetOrder)
Takes a list of asset ids to build a ChangeAssetOrder action of the type T.- Parameters:
newAssetOrder
- the new asset order needed to build the action.- Returns:
- the built update action.
-
buildAddAssetAction
public abstract T buildAddAssetAction(@Nonnull com.commercetools.api.models.common.AssetDraft newAssetDraft, @Nonnull java.lang.Integer position)
Takes an asset draft and an asset position to build an AddAsset action of the type T. buildRemoveAssetAction- Parameters:
newAssetDraft
- the new asset draft to create an Add asset action for.position
- the position to add the new asset to.- Returns:
- the built update action.
-
-