Class AssetReferenceResolver
- java.lang.Object
 - 
- com.commercetools.sync.commons.helpers.BaseReferenceResolver<D,S>
 - 
- com.commercetools.sync.commons.helpers.CustomReferenceResolver<io.sphere.sdk.models.AssetDraft,io.sphere.sdk.models.AssetDraftBuilder,BaseSyncOptions>
 - 
- com.commercetools.sync.commons.helpers.AssetReferenceResolver
 
 
 
 
- 
public final class AssetReferenceResolver extends CustomReferenceResolver<io.sphere.sdk.models.AssetDraft,io.sphere.sdk.models.AssetDraftBuilder,BaseSyncOptions>
 
- 
- 
Field Summary
- 
Fields inherited from class com.commercetools.sync.commons.helpers.CustomReferenceResolver
TYPE_DOES_NOT_EXIST 
- 
Fields inherited from class com.commercetools.sync.commons.helpers.BaseReferenceResolver
BLANK_ID_VALUE_ON_REFERENCE, BLANK_KEY_VALUE_ON_RESOURCE_IDENTIFIER, options 
 - 
 
- 
Constructor Summary
Constructors Constructor Description AssetReferenceResolver(BaseSyncOptions options, TypeService typeService)Takes aBaseSyncOptionsinstance and aTypeServiceto instantiate aAssetReferenceResolverinstance that could be used to resolve the asset drafts in the CTP project specified in the injectedBaseSyncOptionsinstance. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.concurrent.CompletionStage<io.sphere.sdk.models.AssetDraftBuilder>resolveCustomTypeReference(io.sphere.sdk.models.AssetDraftBuilder assetDraftBuilder)Given a draft ofD(e.g.java.util.concurrent.CompletionStage<io.sphere.sdk.models.AssetDraft>resolveReferences(io.sphere.sdk.models.AssetDraft assetDraft)Given a draft this method attempts to resolve the all the references on the draft to return aCompletionStagewhich contains a new instance of the draft with the resolved references.- 
Methods inherited from class com.commercetools.sync.commons.helpers.CustomReferenceResolver
resolveCustomTypeReference 
- 
Methods inherited from class com.commercetools.sync.commons.helpers.BaseReferenceResolver
getIdFromReference, getKeyFromResourceIdentifier 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
AssetReferenceResolver
public AssetReferenceResolver(@Nonnull BaseSyncOptions options, @Nonnull TypeService typeService)Takes aBaseSyncOptionsinstance and aTypeServiceto instantiate aAssetReferenceResolverinstance that could be used to resolve the asset drafts in the CTP project specified in the injectedBaseSyncOptionsinstance.- Parameters:
 options- the container of all the options of the sync process including the CTP project client and/or configuration and other sync-specific options.typeService- the service to fetch the custom types for reference resolution.
 
 - 
 
- 
Method Detail
- 
resolveReferences
@Nonnull public java.util.concurrent.CompletionStage<io.sphere.sdk.models.AssetDraft> resolveReferences(@Nonnull io.sphere.sdk.models.AssetDraft assetDraft)Description copied from class:BaseReferenceResolverGiven a draft this method attempts to resolve the all the references on the draft to return aCompletionStagewhich contains a new instance of the draft with the resolved references.- Specified by:
 resolveReferencesin classBaseReferenceResolver<io.sphere.sdk.models.AssetDraft,BaseSyncOptions>- Parameters:
 assetDraft- the productDraft to resolve it's references.- Returns:
 - a 
CompletionStagethat contains as a result a new draft instance with resolved references or, in case an error occurs during reference resolution, aReferenceResolutionException. 
 
- 
resolveCustomTypeReference
@Nonnull protected java.util.concurrent.CompletionStage<io.sphere.sdk.models.AssetDraftBuilder> resolveCustomTypeReference(@Nonnull io.sphere.sdk.models.AssetDraftBuilder assetDraftBuilder)Description copied from class:CustomReferenceResolverGiven a draft ofD(e.g.CategoryDraft) this method attempts to resolve it's custom type reference to returnCompletionStagewhich contains a new instance of the draft with the resolved custom type reference.The method then tries to fetch the key of the custom type, optimistically from a cache. If the key is is not found, the resultant draft would remain exactly the same as the passed draft (without a custom type reference resolution).
- Specified by:
 resolveCustomTypeReferencein classCustomReferenceResolver<io.sphere.sdk.models.AssetDraft,io.sphere.sdk.models.AssetDraftBuilder,BaseSyncOptions>- Parameters:
 assetDraftBuilder- the draft builder to resolve it's references.- Returns:
 - a 
CompletionStagethat contains as a result a new draft instance with resolved custom type references or, in case an error occurs during reference resolution, aReferenceResolutionException. 
 
 - 
 
 -