public final class ChannelServiceImpl extends java.lang.Object implements ChannelService
| Constructor and Description |
|---|
ChannelServiceImpl(BaseSyncOptions syncOptions) |
ChannelServiceImpl(BaseSyncOptions syncOptions,
java.util.Set<io.sphere.sdk.channels.ChannelRole> channelRoles) |
| Modifier and Type | Method and Description |
|---|---|
void |
cacheChannel(io.sphere.sdk.channels.Channel channel)
Adds a new mapping of key to id of the supplied channel to a cache map.
|
java.util.concurrent.CompletionStage<io.sphere.sdk.channels.Channel> |
createAndCacheChannel(java.lang.String key)
Creates a new channel with the supplied
key and puts a new mapping of it's key
to id in a cache map. |
java.util.concurrent.CompletionStage<io.sphere.sdk.channels.Channel> |
createChannel(java.lang.String key)
Creates a new channel with the supplied
key. |
java.util.concurrent.CompletionStage<java.util.Optional<java.lang.String>> |
fetchCachedChannelId(java.lang.String key)
Given a
key, this method first checks if a cached map of channel keys -> ids is not empty. |
public ChannelServiceImpl(@Nonnull
BaseSyncOptions syncOptions,
@Nonnull
java.util.Set<io.sphere.sdk.channels.ChannelRole> channelRoles)
public ChannelServiceImpl(@Nonnull
BaseSyncOptions syncOptions)
@Nonnull
public java.util.concurrent.CompletionStage<java.util.Optional<java.lang.String>> fetchCachedChannelId(@Nonnull
java.lang.String key)
ChannelServicekey, this method first checks if a cached map of channel keys -> ids is not empty.
If not, it returns a completed future that contains an optional that contains what this key maps to in
the cache. If the cache is empty, the method populates the cache with the mapping of all channels' keys to ids in
the CTP project, by querying the CTP project channels.
After that, the method returns a CompletionStage<Optional<String>>
in which the result of it's completion could contain an
Optional with the id inside of it or an empty Optional if no Channel was
found in the CTP project with this key.
fetchCachedChannelId in interface ChannelServicekey - the key by which a Channel id should be fetched from the CTP project.CompletionStage<Optional<String>> in which the result of it's
completion could contain an Optional with the id inside of it or an empty Optional if no
Channel was found in the CTP project with this external id.@Nonnull
public java.util.concurrent.CompletionStage<io.sphere.sdk.channels.Channel> createChannel(@Nonnull
java.lang.String key)
ChannelServicekey.createChannel in interface ChannelServicekey - key of supply channel.Channel or a sphere exception.@Nonnull
public java.util.concurrent.CompletionStage<io.sphere.sdk.channels.Channel> createAndCacheChannel(@Nonnull
java.lang.String key)
ChannelServicekey and puts a new mapping of it's key
to id in a cache map.createAndCacheChannel in interface ChannelServicekey - key of supply channel.Channel or a sphere exception.public void cacheChannel(@Nonnull
io.sphere.sdk.channels.Channel channel)
ChannelServicecacheChannel in interface ChannelServicechannel - key of supply channel