public abstract class BaseSyncOptionsBuilder<T extends BaseSyncOptionsBuilder<T,S,U,V>,S extends BaseSyncOptions,U,V>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
allowUuid |
protected int |
batchSize |
protected TriFunction<java.util.List<io.sphere.sdk.commands.UpdateAction<U>>,V,U,java.util.List<io.sphere.sdk.commands.UpdateAction<U>>> |
beforeUpdateCallback |
protected io.sphere.sdk.client.SphereClient |
ctpClient |
protected java.util.function.BiConsumer<java.lang.String,java.lang.Throwable> |
errorCallback |
protected boolean |
removeOtherCollectionEntries |
protected boolean |
removeOtherProperties |
protected boolean |
removeOtherSetEntries |
protected java.util.function.Consumer<java.lang.String> |
warningCallback |
| Constructor and Description |
|---|
BaseSyncOptionsBuilder() |
| Modifier and Type | Method and Description |
|---|---|
T |
allowUuidKeys(boolean allowUuid)
The sync expects the user to pass the keys to references in the
id field of References. |
T |
batchSize(int batchSize)
Set option that indicates batch size for sync process.
|
T |
beforeUpdateCallback(TriFunction<java.util.List<io.sphere.sdk.commands.UpdateAction<U>>,V,U,java.util.List<io.sphere.sdk.commands.UpdateAction<U>>> beforeUpdateCallback)
Sets the beforeUpdateCallback
TriFunction which can be applied on the supplied list of update actions
generated from comparing an old resource of type U (e.g. |
protected abstract S |
build()
Creates new instance of
S which extends BaseSyncOptions enriched with all attributes provided to
this builder. |
T |
errorCallback(java.util.function.BiConsumer<java.lang.String,java.lang.Throwable> errorCallback)
Sets the
errorCallback function of the sync module. |
protected abstract T |
getThis()
|
T |
removeOtherCollectionEntries(boolean removeOtherCollectionEntries)
Sets the
removeOtherSetEntries boolean flag which adds collection (e.g. |
T |
removeOtherProperties(boolean removeOtherProperties)
Sets the
removeOtherProperties boolean flag which adds additional object properties (e.g. |
T |
removeOtherSetEntries(boolean removeOtherSetEntries)
Sets the
removeOtherSetEntries boolean flag which adds additional Set entries without deleting
existing ones. |
T |
warningCallback(java.util.function.Consumer<java.lang.String> warningCallback)
Sets the
warningCallback function of the sync module. |
protected io.sphere.sdk.client.SphereClient ctpClient
protected java.util.function.BiConsumer<java.lang.String,java.lang.Throwable> errorCallback
protected java.util.function.Consumer<java.lang.String> warningCallback
protected int batchSize
protected boolean removeOtherSetEntries
protected boolean removeOtherCollectionEntries
protected boolean removeOtherProperties
protected boolean allowUuid
protected TriFunction<java.util.List<io.sphere.sdk.commands.UpdateAction<U>>,V,U,java.util.List<io.sphere.sdk.commands.UpdateAction<U>>> beforeUpdateCallback
public T errorCallback(@Nonnull java.util.function.BiConsumer<java.lang.String,java.lang.Throwable> errorCallback)
errorCallback function of the sync module. This callback will be called whenever an event occurs
that leads to an error alert from the sync process.errorCallback - the new value to set to the error callback.this instance of BaseSyncOptionsBuilderpublic T warningCallback(@Nonnull java.util.function.Consumer<java.lang.String> warningCallback)
warningCallback function of the sync module. This callback will be called whenever an event
occurs that leads to a warning alert from the sync process.warningCallback - the new value to set to the warning callback.this instance of BaseSyncOptionsBuilderpublic T batchSize(int batchSize)
This batch size is set to 30 by default.
batchSize - int that indicates batch size of resources to process. Has to be positive
or else will be ignored and default value of 30 would be used.this instance of BaseSyncOptionsBuilderpublic T removeOtherSetEntries(boolean removeOtherSetEntries)
removeOtherSetEntries boolean flag which adds additional Set entries without deleting
existing ones. If set to true, which is the default value of the option, it deletes the
existing Set entries. If set to false, it doesn't delete the existing ones.removeOtherSetEntries - new value to set to the boolean flag.this instance of BaseSyncOptionsBuilderpublic T removeOtherCollectionEntries(boolean removeOtherCollectionEntries)
removeOtherSetEntries boolean flag which adds collection (e.g. Assets, Images etc.) entries
without deleting existing ones. If set to true, which is the default value of the option, it deletes the
existing collection entries. If set to false, it doesn't delete the existing ones.removeOtherCollectionEntries - new value to set to the boolean flag.this instance of BaseSyncOptionsBuilderpublic T removeOtherProperties(boolean removeOtherProperties)
removeOtherProperties boolean flag which adds additional object properties (e.g. custom fields,
product attributes, etc..) without deleting existing ones. If set to true, which is the default value of the
option, it deletes the existing object properties. If set to false, it doesn't delete the existing ones.removeOtherProperties - new value to set to the boolean flag.this instance of BaseSyncOptionsBuilderpublic T allowUuidKeys(boolean allowUuid)
id field of References. If the key values
are in UUID format, then this flag must be set to true, otherwise the sync will fail to resolve the reference.
This flag, if set to true, enables the user to use keys with UUID format. By default, it is set to false.allowUuid - new value to set to the boolean flag.this instance of BaseSyncOptionsBuilderpublic T beforeUpdateCallback(@Nonnull TriFunction<java.util.List<io.sphere.sdk.commands.UpdateAction<U>>,V,U,java.util.List<io.sphere.sdk.commands.UpdateAction<U>>> beforeUpdateCallback)
TriFunction which can be applied on the supplied list of update actions
generated from comparing an old resource of type U (e.g. Product) to a new
draft of type V (e.g. ProductDraft). It results in a resultant list after
the specified TriFunction beforeUpdateCallback function has been applied.beforeUpdateCallback - function which can be applied on generated list of update actions.this instance of BaseSyncOptionsBuilderprotected abstract S build()
S which extends BaseSyncOptions enriched with all attributes provided to
this builder.BaseSyncOptionsprotected abstract T getThis()
this instance of T, which extends BaseSyncOptionsBuilder. The purpose of this
method is to make sure that this is an instance of a class which extends BaseSyncOptionsBuilder
in order to be used in the generic methods of the class. Otherwise, without this method, the methods above would
need to cast this to T which could lead to a runtime error of the class was extended in a wrong way.