Interface CatalogService
- All Known Subinterfaces:
CatalogListService
- All Known Implementing Classes:
CatalogListServiceImpl,CatalogServiceImpl
public interface CatalogService
A service allowing all necessary operations on
CatalogModels and CatalogVersionModels-
Method Summary
Modifier and TypeMethodDescriptionvoidaddToCategories(TypedObject categorizableItem, 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(Collection<TypedObject> products, CategoryModel newSuperCategory, CategoryModel removeFromCategory) Assigns products to categoryGet all available catalog versions for an userGet the available catalogs for an userGet the available catalog versions for the current usergetCatalog(CatalogVersionModel version) Get the catalog for the given catalog versiongetCatalogVersion(CategoryModel category) Get the catalog versions containing the given categorygetCatalogVersion(PK pk) Get the CatalogVersion for a Catalog item, specified by PKgetCatalogVersions(CatalogModel catalog, UserModel user) Get the catalog versions for a catalogConverts catalog version intoTypedObjectgetCategories(CatalogVersionModel version) Get all root categories under a catalog versiongetCategories(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 categorygetCategoryPath(CategoryModel category) Get a list of categories representing the path from the given category through all supercategories to the root categoryintgetItemCount(MacFinderTreeNode wrappedCategory, CatalogVersionModel version, boolean includeSubCategory, MacFinderTreeNode connectedItem) Counts subitems in MacFinder tree for specified node.getItems(MacFinderTreeNode wrappedCategory, CatalogVersionModel version, boolean includeSubCategory, MacFinderTreeNode connectedItem) Get the products for a given category.Get the available catalog versions for an user in an alternative orderGet a collection of all non-empty sub-categories for a given category or catalog versiongetSupercategories(TypedObject categorizableItem, boolean fromSameCatalogVersionOnly) Returns list of supercategories of the given categorizable item.booleanisAssignProductPermitted(TypedObject product, CategoryModel newSuperCategory, CategoryModel removeFromCategory) Checks if user is allowed to assing product to a categorybooleanisMoveCategoriesPermitted(Collection<TypedObject> categories, CategoryModel newSuperCategory, CategoryModel removeCategory) 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(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, List<TypedObject> categories) Removes given categorizable item from given categories.booleansetAsRootCategory(CategoryModel category) Marks a category as rootwrapCatalogVersion(TypedObject typedObject) Extracts catalog version model from provided typedObjectwrapCategory(TypedObject typedObject) Extracts category model from provided typedObject
-
Method Details
-
getAvailableCatalogs
Get the available catalogs for an user- Parameters:
user- the user- Returns:
- a list of catalogs
-
getCatalogVersions
Get the catalog versions for a catalog- Parameters:
catalog- the catalog containing the versionsuser- the user- Returns:
- a list of catalog versions
-
getAllCatalogVersions
Get all available catalog versions for an user- Parameters:
user- the user- Returns:
- a list of catalog versions
-
getAvailableCatalogVersions
List<CatalogVersionModel> getAvailableCatalogVersions()Get the available catalog versions for the current user- Returns:
- a list of catalog versions
-
getSortedCatalogVersions
Get the available catalog versions for an user in an alternative order- Parameters:
user- the user- Returns:
- a list of catalog versions
-
getCategories
Get all root categories under a catalog version- Parameters:
version- the catalog version- Returns:
- a list of categories
-
getCategoryCount
get the number of root categories under a catalog version- Parameters:
version- the catalog version- Returns:
- the number of root categories
-
getCategories
Get all direct sub-categories for a category- Parameters:
category- the super-category- Returns:
- the list of sub-categories
-
getCategoryCount
Get the number of sub-categories for a category- Parameters:
category- the category- Returns:
- the number of direct sub-categories
-
getCatalog
Get the catalog for the given catalog version- Parameters:
version- the catalog version- Returns:
- the catalog containing the catalog version
-
getCatalogVersion
Get the catalog versions containing the given category- Parameters:
category- the category- Returns:
- the containing catalog version
-
getCategoryPath
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
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
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
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-trueif subitems in subcategories should also be countedconnectedItem- item which subitems should be counted- Returns:
- number of subitems matching requirements
- See Also:
-
isMoveCategoriesPermitted
boolean isMoveCategoriesPermitted(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:
trueif 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:
trueif 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:
trueif 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:
trueif moving was successfully performed
-
moveCategories
boolean moveCategories(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:
trueif moving was successfully performed
-
setAsRootCategory
Marks a category as root- Parameters:
category- root category- Returns:
trueis 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:
trueif moving was successfully performed
-
assignProducts
boolean assignProducts(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:
trueif 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:
trueif moving was successfully performed
-
wrapCategory
Extracts category model from provided typedObject- Parameters:
typedObject- object to extract category from- Returns:
- category extracted or
nullif @typedObject is not category
-
wrapCatalogVersion
Extracts catalog version model from provided typedObject- Parameters:
typedObject- object to extract catalog version from- Returns:
- catalog version extracted or
nullif @typedObject is not catalog version
-
getCatalogVersionTypedObject
Converts catalog version intoTypedObject- Parameters:
catVer- catalog version to be converted- Returns:
- converted catalog version
-
getSupercategories
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
Adds given categorizable item to given categories.- Parameters:
categorizableItem- the categorizable item to be addedcategories- the categories to add to
-
removeFromCategories
Removes given categorizable item from given categories.- Parameters:
categorizableItem- the categorizable item to be removedcategories- the categories to remove from
-