Class CatalogServiceImpl
- java.lang.Object
-
- de.hybris.platform.cockpit.services.impl.AbstractServiceImpl
-
- de.hybris.platform.productcockpit.services.catalog.impl.CatalogServiceImpl
-
- All Implemented Interfaces:
CatalogService
- Direct Known Subclasses:
CatalogListServiceImpl
public class CatalogServiceImpl extends AbstractServiceImpl implements CatalogService
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.cockpit.services.impl.AbstractServiceImpl
modelService, typeService
-
-
Constructor Summary
Constructors Constructor Description CatalogServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToCategories(TypedObject categorizableItem, java.util.List<TypedObject> categories)Adds given categorizable item to given categories.booleanassignProduct(TypedObject product, CatalogVersionModel catalogVersionModel, CategoryModel removeFromCategory)Assigns product to catalog versionbooleanassignProduct(TypedObject product, CategoryModel newSuperCategory, CategoryModel removeFromCategory)Assigns product to categorybooleanassignProducts(java.util.Collection<TypedObject> products, CategoryModel newSuperCategory, CategoryModel oldSuperCategory)Assigns products to categoryjava.util.List<CatalogVersionModel>getAllCatalogVersions(UserModel u)Get all available catalog versions for an userjava.util.Collection<CategoryModel>getAllSupercategories(CategoryModel category)java.util.List<CatalogModel>getAvailableCatalogs(UserModel u)Get the available catalogs for an userjava.util.List<CatalogVersionModel>getAvailableCatalogVersions()Get the available catalog versions for the current userCatalogModelgetCatalog(CatalogVersionModel version)Get the catalog for the given catalog versionCatalogVersionModelgetCatalogVersion(CategoryModel category)Get the catalog versions containing the given categoryCatalogVersionModelgetCatalogVersion(PK pk)Get the CatalogVersion for a Catalog item, specified by PKjava.util.List<CatalogVersionModel>getCatalogVersions(CatalogModel catalog, UserModel u)Get the catalog versions for a catalogTypedObjectgetCatalogVersionTypedObject(CatalogVersionModel catVer)Converts catalog version intoTypedObjectjava.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 categorylonggetCategoryCount(CatalogVersionModel version)get the number of root categories under a catalog versionlonggetCategoryCount(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 categoryprotected java.util.Collection<java.util.List<Category>>getCategoryPaths(Category category)intgetItemCount(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 includSubCategory, MacFinderTreeNode connectedItem)Get the products for a given category.protected java.util.Collection<Product>getProducts(Category category)protected java.util.List<ProductModel>getProducts(CategoryModel category)java.util.List<CatalogVersionModel>getSortedCatalogVersions(UserModel u)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.UIAccessRightServicegetUiAccessRightService()protected booleanisAssignCatalogVersionPermitted(TypedObject product)booleanisAssignProductPermitted(TypedObject product, CategoryModel newSuperCategory, CategoryModel removeFromCategory)Checks if user is allowed to assing product to a categoryprotected booleanisAssignProductsPermitted(java.util.Collection<TypedObject> products, CategoryModel newSuperCategory, CategoryModel removeFromCategory)protected booleanisAssignProductsPermitted(java.util.Collection<TypedObject> products, CategoryModel newSuperCategory, java.util.List<CategoryModel> removeFromCategories)booleanisMoveCategoriesPermitted(java.util.Collection<TypedObject> categories, CategoryModel newSuperCategory, CategoryModel removeFromCategory)Checks if user is allowed to move categories from one to otherbooleanisMoveCategoryPermitted(CategoryModel category, CategoryModel newSuperCategory, CategoryModel removeCategory)Checks if user is allowed to move category from one to otherbooleanmoveCategories(java.util.Collection<TypedObject> categories, CategoryModel newSuperCategory, CategoryModel removeCategory)Moves categories from one to otherbooleanmoveCategory(CategoryModel category, CategoryModel newSuperCategory, CategoryModel removeCategory)Moves category from one to othervoidremoveFromCategories(TypedObject categorizableItem, java.util.List<TypedObject> categories)Removes given categorizable item from given categories.booleansetAsRootCategory(CategoryModel category)Marks a category as rootvoidsetCatalogService(CatalogService catalogService)voidsetCatalogVersionService(CatalogVersionService catalogVersionService)voidsetSearchRestrictionService(SearchRestrictionService searchRestrictionService)voidsetSessionService(SessionService sessionService)voidsetUiAccessRightService(UIAccessRightService accessService)voidsetUserService(UserService userService)CatalogVersionModelwrapCatalogVersion(TypedObject typedObject)Extracts catalog version model from provided typedObjectCategoryModelwrapCategory(TypedObject typedObject)Extracts category model from provided typedObject-
Methods inherited from class de.hybris.platform.cockpit.services.impl.AbstractServiceImpl
getEnum, getEnums, getLocalizedLabel, getLocalizedLabel, getModelService, getTypeService, setCockpitTypeService, setLabelResolver, setModelService
-
-
-
-
Method Detail
-
getAvailableCatalogs
public java.util.List<CatalogModel> getAvailableCatalogs(UserModel u)
Description copied from interface:CatalogServiceGet the available catalogs for an user- Specified by:
getAvailableCatalogsin interfaceCatalogService- Parameters:
u- the user- Returns:
- a list of catalogs
-
getCatalogVersions
public java.util.List<CatalogVersionModel> getCatalogVersions(CatalogModel catalog, UserModel u)
Description copied from interface:CatalogServiceGet the catalog versions for a catalog- Specified by:
getCatalogVersionsin interfaceCatalogService- Parameters:
catalog- the catalog containing the versionsu- the user- Returns:
- a list of catalog versions
-
getAllCatalogVersions
public java.util.List<CatalogVersionModel> getAllCatalogVersions(UserModel u)
Description copied from interface:CatalogServiceGet all available catalog versions for an user- Specified by:
getAllCatalogVersionsin interfaceCatalogService- Parameters:
u- the user- Returns:
- a list of catalog versions
-
getSortedCatalogVersions
public java.util.List<CatalogVersionModel> getSortedCatalogVersions(UserModel u)
Description copied from interface:CatalogServiceGet the available catalog versions for an user in an alternative order- Specified by:
getSortedCatalogVersionsin interfaceCatalogService- Parameters:
u- the user- Returns:
- a list of catalog versions
-
getSubcategoriesHavingSubcategories
public java.util.Collection<java.lang.String> getSubcategoriesHavingSubcategories(ItemModel item)
Description copied from interface:CatalogServiceGet a collection of all non-empty sub-categories for a given category or catalog version- Specified by:
getSubcategoriesHavingSubcategoriesin interfaceCatalogService- Parameters:
item- the catalog or catalog version- Returns:
- a list of categories
-
getCategories
public java.util.List<CategoryModel> getCategories(CatalogVersionModel version)
Description copied from interface:CatalogServiceGet all root categories under a catalog version- Specified by:
getCategoriesin interfaceCatalogService- Parameters:
version- the catalog version- Returns:
- a list of categories
-
getCategories
public java.util.List<CategoryModel> getCategories(CategoryModel category)
Description copied from interface:CatalogServiceGet all direct sub-categories for a category- Specified by:
getCategoriesin interfaceCatalogService- Parameters:
category- the super-category- Returns:
- the list of sub-categories
-
getCatalog
public CatalogModel getCatalog(CatalogVersionModel version)
Description copied from interface:CatalogServiceGet the catalog for the given catalog version- Specified by:
getCatalogin interfaceCatalogService- Parameters:
version- the catalog version- Returns:
- the catalog containing the catalog version
-
getCatalogVersion
public CatalogVersionModel getCatalogVersion(CategoryModel category)
Description copied from interface:CatalogServiceGet the catalog versions containing the given category- Specified by:
getCatalogVersionin interfaceCatalogService- Parameters:
category- the category- Returns:
- the containing catalog version
-
getAllSupercategories
public java.util.Collection<CategoryModel> getAllSupercategories(CategoryModel category)
-
getCategoryPath
public java.util.List<CategoryModel> getCategoryPath(CategoryModel category)
Description copied from interface:CatalogServiceGet a list of categories representing the path from the given category through all supercategories to the root category- Specified by:
getCategoryPathin interfaceCatalogService- Parameters:
category- the category- Returns:
- a list of categories
-
getAvailableCatalogVersions
public java.util.List<CatalogVersionModel> getAvailableCatalogVersions()
Description copied from interface:CatalogServiceGet the available catalog versions for the current user- Specified by:
getAvailableCatalogVersionsin interfaceCatalogService- Returns:
- a list of catalog versions
-
getCategoryCount
public long getCategoryCount(CatalogVersionModel version)
Description copied from interface:CatalogServiceget the number of root categories under a catalog version- Specified by:
getCategoryCountin interfaceCatalogService- Parameters:
version- the catalog version- Returns:
- the number of root categories
-
getCategoryCount
public long getCategoryCount(CategoryModel category)
Description copied from interface:CatalogServiceGet the number of sub-categories for a category- Specified by:
getCategoryCountin interfaceCatalogService- Parameters:
category- the category- Returns:
- the number of direct sub-categories
-
getItems
public java.util.List<MacFinderTreeNode> getItems(MacFinderTreeNode wrappedCategory, CatalogVersionModel version, boolean includSubCategory, MacFinderTreeNode connectedItem)
Description copied from interface:CatalogServiceGet the products for a given category.- Specified by:
getItemsin interfaceCatalogService- Parameters:
wrappedCategory- the categoryincludSubCategory- if true, also include products from sub-categories- Returns:
- a list of products
-
getItemCount
public int getItemCount(MacFinderTreeNode wrappedCategory, CatalogVersionModel version, boolean includeSubCategory, MacFinderTreeNode connectedItem)
Description copied from interface:CatalogServiceCounts subitems in MacFinder tree for specified node.- Specified by:
getItemCountin interfaceCatalogService- Parameters:
wrappedCategory- category tree nodeversion- catalog versionincludeSubCategory-trueif 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)
-
getCatalogVersion
public CatalogVersionModel getCatalogVersion(PK pk)
Description copied from interface:CatalogServiceGet the CatalogVersion for a Catalog item, specified by PK- Specified by:
getCatalogVersionin interfaceCatalogService- Parameters:
pk- the pk of the item- Returns:
- the catalog version if it exists, null otherwise
-
assignProduct
public boolean assignProduct(TypedObject product, CatalogVersionModel catalogVersionModel, CategoryModel removeFromCategory)
Description copied from interface:CatalogServiceAssigns product to catalog version- Specified by:
assignProductin interfaceCatalogService- Parameters:
product- product to be assignedcatalogVersionModel- new catalog versionremoveFromCategory- parent category from which product should be removed- Returns:
trueif moving was successfully performed
-
assignProduct
public boolean assignProduct(TypedObject product, CategoryModel newSuperCategory, CategoryModel removeFromCategory)
Description copied from interface:CatalogServiceAssigns product to category- Specified by:
assignProductin interfaceCatalogService- Parameters:
product- product to be assignednewSuperCategory- new parent categoryremoveFromCategory- parent category from which product should be removed- Returns:
trueif moving was successfully performed
-
assignProducts
public boolean assignProducts(java.util.Collection<TypedObject> products, CategoryModel newSuperCategory, CategoryModel oldSuperCategory)
Description copied from interface:CatalogServiceAssigns products to category- Specified by:
assignProductsin interfaceCatalogService- Parameters:
products- products to be assignednewSuperCategory- new parent categoryoldSuperCategory- parent category from which products should be removed- Returns:
trueif moving was successfully performed
-
moveCategories
public boolean moveCategories(java.util.Collection<TypedObject> categories, CategoryModel newSuperCategory, CategoryModel removeCategory)
Description copied from interface:CatalogServiceMoves categories from one to other- Specified by:
moveCategoriesin interfaceCatalogService- Parameters:
categories- categories to be movednewSuperCategory- new parent category for categoriesremoveCategory- parent category from which categories should be removed- Returns:
trueif moving was successfully performed
-
moveCategory
public boolean moveCategory(CategoryModel category, CategoryModel newSuperCategory, CategoryModel removeCategory)
Description copied from interface:CatalogServiceMoves category from one to other- Specified by:
moveCategoryin interfaceCatalogService- Parameters:
category- category to be movednewSuperCategory- new parent category for categoryremoveCategory- parent category from which category should be removed- Returns:
trueif moving was successfully performed
-
isAssignProductPermitted
public boolean isAssignProductPermitted(TypedObject product, CategoryModel newSuperCategory, CategoryModel removeFromCategory)
Description copied from interface:CatalogServiceChecks if user is allowed to assing product to a category- Specified by:
isAssignProductPermittedin interfaceCatalogService- Parameters:
product- product to be assignednewSuperCategory- new parent categoryremoveFromCategory- parent category from which product should be removed- Returns:
trueif allowed
-
isAssignCatalogVersionPermitted
protected boolean isAssignCatalogVersionPermitted(TypedObject product)
-
getCategoryPaths
protected java.util.Collection<java.util.List<Category>> getCategoryPaths(Category category)
-
getProducts
protected java.util.List<ProductModel> getProducts(CategoryModel category)
-
isAssignProductsPermitted
protected boolean isAssignProductsPermitted(java.util.Collection<TypedObject> products, CategoryModel newSuperCategory, CategoryModel removeFromCategory)
-
isAssignProductsPermitted
protected boolean isAssignProductsPermitted(java.util.Collection<TypedObject> products, CategoryModel newSuperCategory, java.util.List<CategoryModel> removeFromCategories)
-
isMoveCategoriesPermitted
public boolean isMoveCategoriesPermitted(java.util.Collection<TypedObject> categories, CategoryModel newSuperCategory, CategoryModel removeFromCategory)
Description copied from interface:CatalogServiceChecks if user is allowed to move categories from one to other- Specified by:
isMoveCategoriesPermittedin interfaceCatalogService- Parameters:
categories- categories to be movednewSuperCategory- new parent category for categoriesremoveFromCategory- parent category from which categories should be removed- Returns:
trueif allowed
-
isMoveCategoryPermitted
public boolean isMoveCategoryPermitted(CategoryModel category, CategoryModel newSuperCategory, CategoryModel removeCategory)
Description copied from interface:CatalogServiceChecks if user is allowed to move category from one to other- Specified by:
isMoveCategoryPermittedin interfaceCatalogService- Parameters:
category- category to be movednewSuperCategory- new parent category for categoryremoveCategory- parent category from which category should be removed- Returns:
trueif allowed
-
setAsRootCategory
public boolean setAsRootCategory(CategoryModel category)
Description copied from interface:CatalogServiceMarks a category as root- Specified by:
setAsRootCategoryin interfaceCatalogService- Parameters:
category- root category- Returns:
trueis category was successfully marked as root
-
wrapCategory
public CategoryModel wrapCategory(TypedObject typedObject)
Description copied from interface:CatalogServiceExtracts category model from provided typedObject- Specified by:
wrapCategoryin interfaceCatalogService- Parameters:
typedObject- object to extract category from- Returns:
- category extracted or
nullif @typedObject is not category
-
wrapCatalogVersion
public CatalogVersionModel wrapCatalogVersion(TypedObject typedObject)
Description copied from interface:CatalogServiceExtracts catalog version model from provided typedObject- Specified by:
wrapCatalogVersionin interfaceCatalogService- Parameters:
typedObject- object to extract catalog version from- Returns:
- catalog version extracted or
nullif @typedObject is not catalog version
-
getCatalogVersionTypedObject
public TypedObject getCatalogVersionTypedObject(CatalogVersionModel catVer)
Description copied from interface:CatalogServiceConverts catalog version intoTypedObject- Specified by:
getCatalogVersionTypedObjectin interfaceCatalogService- Parameters:
catVer- catalog version to be converted- Returns:
- converted catalog version
-
getSupercategories
public java.util.List<TypedObject> getSupercategories(TypedObject categorizableItem, boolean fromSameCatalogVersionOnly)
Description copied from interface:CatalogServiceReturns list of supercategories of the given categorizable item.- Specified by:
getSupercategoriesin interfaceCatalogService- 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
public void addToCategories(TypedObject categorizableItem, java.util.List<TypedObject> categories)
Description copied from interface:CatalogServiceAdds given categorizable item to given categories.- Specified by:
addToCategoriesin interfaceCatalogService- Parameters:
categorizableItem- the categorizable item to be addedcategories- the categories to add to
-
removeFromCategories
public void removeFromCategories(TypedObject categorizableItem, java.util.List<TypedObject> categories)
Description copied from interface:CatalogServiceRemoves given categorizable item from given categories.- Specified by:
removeFromCategoriesin interfaceCatalogService- Parameters:
categorizableItem- the categorizable item to be removedcategories- the categories to remove from
-
setUiAccessRightService
public void setUiAccessRightService(UIAccessRightService accessService)
-
getUiAccessRightService
public UIAccessRightService getUiAccessRightService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
setSearchRestrictionService
public void setSearchRestrictionService(SearchRestrictionService searchRestrictionService)
-
setCatalogService
public void setCatalogService(CatalogService catalogService)
-
setCatalogVersionService
public void setCatalogVersionService(CatalogVersionService catalogVersionService)
-
setUserService
public void setUserService(UserService userService)
-
-