S - a subclass implementation of BaseSyncOptions that is used to allow/deny some specific options,
specified by the user, on reference resolution.public abstract class BaseReferenceResolver<T,S extends BaseSyncOptions>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
BLANK_ID_VALUE_ON_RESOURCE_IDENTIFIER |
protected S |
options |
| Modifier | Constructor and Description |
|---|---|
protected |
BaseReferenceResolver(S options) |
| Modifier and Type | Method and Description |
|---|---|
protected static java.lang.String |
getKeyFromResourceIdentifier(io.sphere.sdk.models.ResourceIdentifier resourceIdentifier,
boolean allowUuidKeys)
This method fetches the id value on the passed
ResourceIdentifier, if valid. |
abstract java.util.concurrent.CompletionStage<T> |
resolveReferences(T draft)
Given a draft this method attempts to resolve the all the references on the draft to
return a
CompletionStage which contains a new instance of the draft with the resolved
references. |
public static final java.lang.String BLANK_ID_VALUE_ON_RESOURCE_IDENTIFIER
protected S extends BaseSyncOptions options
protected BaseReferenceResolver(@Nonnull
S options)
public abstract java.util.concurrent.CompletionStage<T> resolveReferences(@Nonnull T draft)
CompletionStage which contains a new instance of the draft with the resolved
references. The keys of the references are either taken from the expanded references or
taken from the id field of the references.draft - the productDraft to resolve it's references.CompletionStage that contains as a result a new draft instance with resolved references
or, in case an error occurs during reference resolution, a ReferenceResolutionException.@Nonnull
protected static java.lang.String getKeyFromResourceIdentifier(@Nonnull
io.sphere.sdk.models.ResourceIdentifier resourceIdentifier,
boolean allowUuidKeys)
throws ReferenceResolutionException
ResourceIdentifier, if valid. If it is not valid, a
ReferenceResolutionException will be thrown. The validity checks are:
allowUuidKeys flag set to true, or the id value
doesn't have a UUID format.ReferenceResolutionException is thrown.
Note: Currently the key is expected to be set on the id field of the ResourceIdentifier. This is in
order to make key setting consistent on both Reference and
ResourceIdentifier. However, this will be changed when GITHUB ISSUE#138 is resolved.
resourceIdentifier - the reference from which the id value is validated and returned.allowUuidKeys - flag that signals whether the key could be UUID format or not.ResourceIdentifierReferenceResolutionException - if any of the validation checks fail.