Class UnresolvedReferencesServiceImpl<T extends WaitingToBeResolved>
- java.lang.Object
-
- com.commercetools.sync.services.impl.UnresolvedReferencesServiceImpl<T>
-
- All Implemented Interfaces:
UnresolvedReferencesService<T>
public class UnresolvedReferencesServiceImpl<T extends WaitingToBeResolved> extends java.lang.Object implements UnresolvedReferencesService<T>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCUSTOM_OBJECT_CATEGORY_CONTAINER_KEYstatic java.lang.StringCUSTOM_OBJECT_PRODUCT_CONTAINER_KEYstatic java.lang.StringCUSTOM_OBJECT_TRANSITION_CONTAINER_KEY
-
Constructor Summary
Constructors Constructor Description UnresolvedReferencesServiceImpl(BaseSyncOptions baseSyncOptions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletionStage<java.util.Optional<T>>delete(java.lang.String key, java.lang.String containerKey, java.lang.Class<T> clazz)Given a draft key, this methods deletes the matching draft from persistence.java.util.concurrent.CompletionStage<java.util.Set<T>>fetch(java.util.Set<java.lang.String> keys, java.lang.String containerKey, java.lang.Class<T> clazz)Given draft keys, this method fetches the persisted drafts waiting to be resolved.java.util.concurrent.CompletionStage<java.util.Optional<T>>save(T draft, java.lang.String containerKey, java.lang.Class<T> clazz)Persists a draft that is not ready to be resolved yet.
-
-
-
Field Detail
-
CUSTOM_OBJECT_PRODUCT_CONTAINER_KEY
public static final java.lang.String CUSTOM_OBJECT_PRODUCT_CONTAINER_KEY
- See Also:
- Constant Field Values
-
CUSTOM_OBJECT_CATEGORY_CONTAINER_KEY
public static final java.lang.String CUSTOM_OBJECT_CATEGORY_CONTAINER_KEY
- See Also:
- Constant Field Values
-
CUSTOM_OBJECT_TRANSITION_CONTAINER_KEY
public static final java.lang.String CUSTOM_OBJECT_TRANSITION_CONTAINER_KEY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UnresolvedReferencesServiceImpl
public UnresolvedReferencesServiceImpl(@Nonnull BaseSyncOptions baseSyncOptions)
-
-
Method Detail
-
fetch
@Nonnull public java.util.concurrent.CompletionStage<java.util.Set<T>> fetch(@Nonnull java.util.Set<java.lang.String> keys, @Nonnull java.lang.String containerKey, @Nonnull java.lang.Class<T> clazz)
Description copied from interface:UnresolvedReferencesServiceGiven draft keys, this method fetches the persisted drafts waiting to be resolved. If there is no matching draft, an emptySetwill be returned in the returned future.- Specified by:
fetchin interfaceUnresolvedReferencesService<T extends WaitingToBeResolved>- Parameters:
keys- the keys of the persisted drafts, waiting to be resolved, to fetch.containerKey- the key of the container, which contains the persisted draftclazz- Class of the object contained by custom object- Returns:
CompletionStage<Set> in which the result of its completion contains aSetthat contains the matching drafts if any exist, otherwise empty.
-
save
@Nonnull public java.util.concurrent.CompletionStage<java.util.Optional<T>> save(@Nonnull T draft, @Nonnull java.lang.String containerKey, @Nonnull java.lang.Class<T> clazz)
Description copied from interface:UnresolvedReferencesServicePersists a draft that is not ready to be resolved yet.- Specified by:
savein interfaceUnresolvedReferencesService<T extends WaitingToBeResolved>- Parameters:
draft- the draft that should be persisted.containerKey- the key of the container, which contains the persisted draftclazz- Class of the object contained by custom object- Returns:
- a
CompletionStagecontaining an optional with the created resource if successful otherwise an empty optional.
-
delete
@Nonnull public java.util.concurrent.CompletionStage<java.util.Optional<T>> delete(@Nonnull java.lang.String key, @Nonnull java.lang.String containerKey, @Nonnull java.lang.Class<T> clazz)
Description copied from interface:UnresolvedReferencesServiceGiven a draft key, this methods deletes the matching draft from persistence.- Specified by:
deletein interfaceUnresolvedReferencesService<T extends WaitingToBeResolved>- Parameters:
key- the key of the draft to delete from persistence.containerKey- the key of the container, which contains the persisted draftclazz- Class of the object contained by custom object- Returns:
- a
CompletionStagecontaining an optional with the deleted resource if successful otherwise an empty optional.
-
-