Interface CatalogService
-
- All Known Subinterfaces:
CatalogListService
- All Known Implementing Classes:
CatalogListServiceImpl
,CatalogServiceImpl
public interface CatalogService
A service allowing all necessary operations onCatalogModel
s andCatalogVersionModel
s
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addToCategories(TypedObject categorizableItem, java.util.List<TypedObject> categories)
Adds given categorizable item to given categories.boolean
assignProduct(TypedObject product, CatalogVersionModel catalogVersionModel, CategoryModel removeFromCategory)
Assigns product to catalog versionboolean
assignProduct(TypedObject product, CategoryModel newSuperCategory, CategoryModel removeFromCategory)
Assigns product to categoryboolean
assignProducts(java.util.Collection<TypedObject> products, CategoryModel newSuperCategory, CategoryModel removeFromCategory)
Assigns products to categoryjava.util.List<CatalogVersionModel>
getAllCatalogVersions(UserModel user)
Get all available catalog versions for an userjava.util.List<CatalogModel>
getAvailableCatalogs(UserModel user)
Get the available catalogs for an userjava.util.List<CatalogVersionModel>
getAvailableCatalogVersions()
Get the available catalog versions for the current userCatalogModel
getCatalog(CatalogVersionModel version)
Get the catalog for the given catalog versionCatalogVersionModel
getCatalogVersion(CategoryModel category)
Get the catalog versions containing the given categoryCatalogVersionModel
getCatalogVersion(PK pk)
Get the CatalogVersion for a Catalog item, specified by PKjava.util.List<CatalogVersionModel>
getCatalogVersions(CatalogModel catalog, UserModel user)
Get the catalog versions for a catalogTypedObject
getCatalogVersionTypedObject(CatalogVersionModel catVer)
Converts catalog version intoTypedObject
java.util.List<CategoryModel>
getCategories(CatalogVersionModel version)
Get all root categories under a catalog versionjava.util.List<CategoryModel>
getCategories(CategoryModel category)
Get all direct sub-categories for a categorylong
getCategoryCount(CatalogVersionModel version)
get the number of root categories under a catalog versionlong
getCategoryCount(CategoryModel category)
Get the number of sub-categories for a categoryjava.util.List<CategoryModel>
getCategoryPath(CategoryModel category)
Get a list of categories representing the path from the given category through all supercategories to the root categoryint
getItemCount(MacFinderTreeNode wrappedCategory, CatalogVersionModel version, boolean includeSubCategory, MacFinderTreeNode connectedItem)
Counts subitems in MacFinder tree for specified node.java.util.List<MacFinderTreeNode>
getItems(MacFinderTreeNode wrappedCategory, CatalogVersionModel version, boolean includeSubCategory, MacFinderTreeNode connectedItem)
Get the products for a given category.java.util.List<CatalogVersionModel>
getSortedCatalogVersions(UserModel user)
Get the available catalog versions for an user in an alternative orderjava.util.Collection<java.lang.String>
getSubcategoriesHavingSubcategories(ItemModel item)
Get a collection of all non-empty sub-categories for a given category or catalog versionjava.util.List<TypedObject>
getSupercategories(TypedObject categorizableItem, boolean fromSameCatalogVersionOnly)
Returns list of supercategories of the given categorizable item.boolean
isAssignProductPermitted(TypedObject product, CategoryModel newSuperCategory, CategoryModel removeFromCategory)
Checks if user is allowed to assing product to a categoryboolean
isMoveCategoriesPermitted(java.util.Collection<TypedObject> categories, CategoryModel newSuperCategory, CategoryModel removeCategory)
Checks if user is allowed to move categories from one to otherboolean
isMoveCategoryPermitted(CategoryModel category, CategoryModel newSuperCategory, CategoryModel removeCategory)
Checks if user is allowed to move category from one to otherboolean
moveCategories(java.util.Collection<TypedObject> categories, CategoryModel newSuperCategory, CategoryModel removeCategory)
Moves categories from one to otherboolean
moveCategory(CategoryModel category, CategoryModel newSuperCategory, CategoryModel removeCategory)
Moves category from one to othervoid
removeFromCategories(TypedObject categorizableItem, java.util.List<TypedObject> categories)
Removes given categorizable item from given categories.boolean
setAsRootCategory(CategoryModel category)
Marks a category as rootCatalogVersionModel
wrapCatalogVersion(TypedObject typedObject)
Extracts catalog version model from provided typedObjectCategoryModel
wrapCategory(TypedObject typedObject)
Extracts category model from provided typedObject
-
-
-
Method Detail
-
getAvailableCatalogs
java.util.List<CatalogModel> getAvailableCatalogs(UserModel user)
Get the available catalogs for an user- Parameters:
user
- the user- Returns:
- a list of catalogs
-
getCatalogVersions
java.util.List<CatalogVersionModel> getCatalogVersions(CatalogModel catalog, UserModel user)
Get the catalog versions for a catalog- Parameters:
catalog
- the catalog containing the versionsuser
- the user- Returns:
- a list of catalog versions
-
getAllCatalogVersions
java.util.List<CatalogVersionModel> getAllCatalogVersions(UserModel user)
Get all available catalog versions for an user- Parameters:
user
- the user- Returns:
- a list of catalog versions
-
getAvailableCatalogVersions
java.util.List<CatalogVersionModel> getAvailableCatalogVersions()
Get the available catalog versions for the current user- Returns:
- a list of catalog versions
-
getSortedCatalogVersions
java.util.List<CatalogVersionModel> getSortedCatalogVersions(UserModel user)
Get the available catalog versions for an user in an alternative order- Parameters:
user
- the user- Returns:
- a list of catalog versions
-
getCategories
java.util.List<CategoryModel> getCategories(CatalogVersionModel version)
Get all root categories under a catalog version- Parameters:
version
- the catalog version- Returns:
- a list of categories
-
getCategoryCount
long getCategoryCount(CatalogVersionModel version)
get the number of root categories under a catalog version- Parameters:
version
- the catalog version- Returns:
- the number of root categories
-
getCategories
java.util.List<CategoryModel> getCategories(CategoryModel category)
Get all direct sub-categories for a category- Parameters:
category
- the super-category- Returns:
- the list of sub-categories
-
getCategoryCount
long getCategoryCount(CategoryModel category)
Get the number of sub-categories for a category- Parameters:
category
- the category- Returns:
- the number of direct sub-categories
-
getCatalog
CatalogModel getCatalog(CatalogVersionModel version)
Get the catalog for the given catalog version- Parameters:
version
- the catalog version- Returns:
- the catalog containing the catalog version
-
getCatalogVersion
CatalogVersionModel getCatalogVersion(CategoryModel category)
Get the catalog versions containing the given category- Parameters:
category
- the category- Returns:
- the containing catalog version
-
getCategoryPath
java.util.List<CategoryModel> getCategoryPath(CategoryModel category)
Get a list of categories representing the path from the given category through all supercategories to the root category- Parameters:
category
- the category- Returns:
- a list of categories
-
getSubcategoriesHavingSubcategories
java.util.Collection<java.lang.String> getSubcategoriesHavingSubcategories(ItemModel item)
Get a collection of all non-empty sub-categories for a given category or catalog version- Parameters:
item
- the catalog or catalog version- Returns:
- a list of categories
-
getCatalogVersion
CatalogVersionModel getCatalogVersion(PK pk)
Get the CatalogVersion for a Catalog item, specified by PK- Parameters:
pk
- the pk of the item- Returns:
- the catalog version if it exists, null otherwise
-
getItems
java.util.List<MacFinderTreeNode> getItems(MacFinderTreeNode wrappedCategory, CatalogVersionModel version, boolean includeSubCategory, MacFinderTreeNode connectedItem)
Get the products for a given category.- Parameters:
wrappedCategory
- the categoryincludeSubCategory
- if true, also include products from sub-categories- Returns:
- a list of products
-
getItemCount
int getItemCount(MacFinderTreeNode wrappedCategory, CatalogVersionModel version, boolean includeSubCategory, MacFinderTreeNode connectedItem)
Counts subitems in MacFinder tree for specified node.- Parameters:
wrappedCategory
- category tree nodeversion
- catalog versionincludeSubCategory
-true
if subitems in subcategories should also be countedconnectedItem
- item which subitems should be counted- Returns:
- number of subitems matching requirements
- See Also:
AbstractDao.getItemCount(de.hybris.platform.jalo.Item, de.hybris.platform.catalog.jalo.CatalogVersion, boolean)
-
isMoveCategoriesPermitted
boolean isMoveCategoriesPermitted(java.util.Collection<TypedObject> categories, CategoryModel newSuperCategory, CategoryModel removeCategory)
Checks if user is allowed to move categories from one to other- Parameters:
categories
- categories to be movednewSuperCategory
- new parent category for categoriesremoveCategory
- parent category from which categories should be removed- Returns:
true
if allowed
-
isMoveCategoryPermitted
boolean isMoveCategoryPermitted(CategoryModel category, CategoryModel newSuperCategory, CategoryModel removeCategory)
Checks if user is allowed to move category from one to other- Parameters:
category
- category to be movednewSuperCategory
- new parent category for categoryremoveCategory
- parent category from which category should be removed- Returns:
true
if allowed
-
isAssignProductPermitted
boolean isAssignProductPermitted(TypedObject product, CategoryModel newSuperCategory, CategoryModel removeFromCategory)
Checks if user is allowed to assing product to a category- Parameters:
product
- product to be assignednewSuperCategory
- new parent categoryremoveFromCategory
- parent category from which product should be removed- Returns:
true
if allowed
-
moveCategory
boolean moveCategory(CategoryModel category, CategoryModel newSuperCategory, CategoryModel removeCategory)
Moves category from one to other- Parameters:
category
- category to be movednewSuperCategory
- new parent category for categoryremoveCategory
- parent category from which category should be removed- Returns:
true
if moving was successfully performed
-
moveCategories
boolean moveCategories(java.util.Collection<TypedObject> categories, CategoryModel newSuperCategory, CategoryModel removeCategory)
Moves categories from one to other- Parameters:
categories
- categories to be movednewSuperCategory
- new parent category for categoriesremoveCategory
- parent category from which categories should be removed- Returns:
true
if moving was successfully performed
-
setAsRootCategory
boolean setAsRootCategory(CategoryModel category)
Marks a category as root- Parameters:
category
- root category- Returns:
true
is category was successfully marked as root
-
assignProduct
boolean assignProduct(TypedObject product, CategoryModel newSuperCategory, CategoryModel removeFromCategory)
Assigns product to category- Parameters:
product
- product to be assignednewSuperCategory
- new parent categoryremoveFromCategory
- parent category from which product should be removed- Returns:
true
if moving was successfully performed
-
assignProducts
boolean assignProducts(java.util.Collection<TypedObject> products, CategoryModel newSuperCategory, CategoryModel removeFromCategory)
Assigns products to category- Parameters:
products
- products to be assignednewSuperCategory
- new parent categoryremoveFromCategory
- parent category from which products should be removed- Returns:
true
if moving was successfully performed
-
assignProduct
boolean assignProduct(TypedObject product, CatalogVersionModel catalogVersionModel, CategoryModel removeFromCategory)
Assigns product to catalog version- Parameters:
product
- product to be assignedcatalogVersionModel
- new catalog versionremoveFromCategory
- parent category from which product should be removed- Returns:
true
if moving was successfully performed
-
wrapCategory
CategoryModel wrapCategory(TypedObject typedObject)
Extracts category model from provided typedObject- Parameters:
typedObject
- object to extract category from- Returns:
- category extracted or
null
if @typedObject is not category
-
wrapCatalogVersion
CatalogVersionModel wrapCatalogVersion(TypedObject typedObject)
Extracts catalog version model from provided typedObject- Parameters:
typedObject
- object to extract catalog version from- Returns:
- catalog version extracted or
null
if @typedObject is not catalog version
-
getCatalogVersionTypedObject
TypedObject getCatalogVersionTypedObject(CatalogVersionModel catVer)
Converts catalog version intoTypedObject
- Parameters:
catVer
- catalog version to be converted- Returns:
- converted catalog version
-
getSupercategories
java.util.List<TypedObject> getSupercategories(TypedObject categorizableItem, boolean fromSameCatalogVersionOnly)
Returns list of supercategories of the given categorizable item.- Parameters:
categorizableItem
- a categorizable item (product, category..)fromSameCatalogVersionOnly
- if true, only supercategories belonging to the same catalog version as given categorizable item are returned- Returns:
- list of supercategories of the given categorizable item
-
addToCategories
void addToCategories(TypedObject categorizableItem, java.util.List<TypedObject> categories)
Adds given categorizable item to given categories.- Parameters:
categorizableItem
- the categorizable item to be addedcategories
- the categories to add to
-
removeFromCategories
void removeFromCategories(TypedObject categorizableItem, java.util.List<TypedObject> categories)
Removes given categorizable item from given categories.- Parameters:
categorizableItem
- the categorizable item to be removedcategories
- the categories to remove from
-
-