public interface CategoryService
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.CompletionStage<java.util.Map<java.lang.String,java.lang.String>> |
cacheKeysToIds()
If not already done once before, it fetches all the category keys from the CTP project defined in a potentially
injected
SphereClient and stores a mapping for every category to id in Map
and returns this cached map. |
java.util.concurrent.CompletionStage<java.util.Set<io.sphere.sdk.categories.Category>> |
createCategories(java.util.Set<io.sphere.sdk.categories.CategoryDraft> categoryDrafts)
Given a
Set of categoryDrafts, this method creates Categories corresponding to them in the CTP project
defined in a potentially injected SphereClient. |
java.util.concurrent.CompletionStage<java.util.Optional<io.sphere.sdk.categories.Category>> |
createCategory(io.sphere.sdk.categories.CategoryDraft categoryDraft)
Given a
CategoryDraft, this method creates a Category based on it in the CTP project defined in
a potentially injected SphereClient. |
java.util.concurrent.CompletionStage<java.util.Optional<java.lang.String>> |
fetchCachedCategoryId(java.lang.String key)
Given a
key, this method first checks if cached map of category keys -> ids is not empty. |
java.util.concurrent.CompletionStage<java.util.Optional<io.sphere.sdk.categories.Category>> |
fetchCategory(java.lang.String key)
Given a category key, this method fetches a category that matches this given key in the CTP project defined in a
potentially injected
SphereClient. |
java.util.concurrent.CompletionStage<java.util.Set<io.sphere.sdk.categories.Category>> |
fetchMatchingCategoriesByKeys(java.util.Set<java.lang.String> categoryKeys)
Given a
Set of category keys, this method fetches a set of all the categories matching this given set of
keys in the CTP project defined in a potentially injected SphereClient. |
java.util.concurrent.CompletionStage<io.sphere.sdk.categories.Category> |
updateCategory(io.sphere.sdk.categories.Category category,
java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.categories.Category>> updateActions)
Given a
Category and a List<UpdateAction<Category>>, this method
issues an update request with these update actions on this Category in the CTP project defined in a
potentially injected SphereClient. |
@Nonnull java.util.concurrent.CompletionStage<java.util.Map<java.lang.String,java.lang.String>> cacheKeysToIds()
SphereClient and stores a mapping for every category to id in Map
and returns this cached map.CompletionStage<Map> in which the result of it's completion contains a map of all
category keys -> ids@Nonnull
java.util.concurrent.CompletionStage<java.util.Set<io.sphere.sdk.categories.Category>> fetchMatchingCategoriesByKeys(@Nonnull
java.util.Set<java.lang.String> categoryKeys)
Set of category keys, this method fetches a set of all the categories matching this given set of
keys in the CTP project defined in a potentially injected SphereClient.categoryKeys - set of category keys to fetch matching categories by.CompletionStage<Map> in which the result of it's completion contains a Set
of all matching categories.@Nonnull
java.util.concurrent.CompletionStage<java.util.Optional<io.sphere.sdk.categories.Category>> fetchCategory(@Nullable
java.lang.String key)
SphereClient. If there is no matching category an empty Optional will be
returned in the returned future.key - the key of the category to fetch.CompletionStage<Optional> in which the result of it's completion contains an
Optional that contains the matching Category if exists, otherwise empty.@Nonnull
java.util.concurrent.CompletionStage<java.util.Set<io.sphere.sdk.categories.Category>> createCategories(@Nonnull
java.util.Set<io.sphere.sdk.categories.CategoryDraft> categoryDrafts)
Set of categoryDrafts, this method creates Categories corresponding to them in the CTP project
defined in a potentially injected SphereClient.categoryDrafts - set of categoryDrafts to create on the CTP project.CompletionStage<Map> in which the result of it's completion contains a Set
of all created categories.@Nonnull
java.util.concurrent.CompletionStage<java.util.Optional<java.lang.String>> fetchCachedCategoryId(@Nonnull
java.lang.String key)
key, this method first checks if cached map of category 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 categories' keys
to ids in the CTP project. 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 Category
was found in the CTP project with this key.key - the key by which a Category 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
Category was found in the CTP project with this key.@Nonnull
java.util.concurrent.CompletionStage<java.util.Optional<io.sphere.sdk.categories.Category>> createCategory(@Nonnull
io.sphere.sdk.categories.CategoryDraft categoryDraft)
CategoryDraft, this method creates a Category based on it in the CTP project defined in
a potentially injected SphereClient. The created category's id and key are also
cached. This method returns CompletionStage<Category> in which the result of it's
completion contains an instance of the Category which was created in the CTP project.categoryDraft - the CategoryDraft to create a Category based off of.CompletionStage<Category> containing as a result of it's completion an instance of
the Category which was created in the CTP project or a
SphereException.@Nonnull
java.util.concurrent.CompletionStage<io.sphere.sdk.categories.Category> updateCategory(@Nonnull
io.sphere.sdk.categories.Category category,
@Nonnull
java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.categories.Category>> updateActions)
Category and a List<UpdateAction<Category>>, this method
issues an update request with these update actions on this Category in the CTP project defined in a
potentially injected SphereClient. This method returns
CompletionStage<Category> in which the result of it's completion contains an instance of
the Category which was updated in the CTP project.category - the Category to update.updateActions - the update actions to update the Category with.CompletionStage<Category> containing as a result of it's completion an instance of
the Category which was updated in the CTP project or a
SphereException.