Class CatalogServiceImpl

    • Constructor Detail

      • CatalogServiceImpl

        public CatalogServiceImpl()
    • Method Detail

      • getSubcategoriesHavingSubcategories

        public java.util.Collection<java.lang.String> getSubcategoriesHavingSubcategories​(ItemModel item)
        Description copied from interface: CatalogService
        Get a collection of all non-empty sub-categories for a given category or catalog version
        Specified by:
        getSubcategoriesHavingSubcategories in interface CatalogService
        Parameters:
        item - the catalog or catalog version
        Returns:
        a list of categories
      • getCategoryPath

        public java.util.List<CategoryModel> getCategoryPath​(CategoryModel category)
        Description copied from interface: CatalogService
        Get a list of categories representing the path from the given category through all supercategories to the root category
        Specified by:
        getCategoryPath in interface CatalogService
        Parameters:
        category - the category
        Returns:
        a list of categories
      • getCategoryCount

        public long getCategoryCount​(CatalogVersionModel version)
        Description copied from interface: CatalogService
        get the number of root categories under a catalog version
        Specified by:
        getCategoryCount in interface CatalogService
        Parameters:
        version - the catalog version
        Returns:
        the number of root categories
      • getCategoryCount

        public long getCategoryCount​(CategoryModel category)
        Description copied from interface: CatalogService
        Get the number of sub-categories for a category
        Specified by:
        getCategoryCount in interface CatalogService
        Parameters:
        category - the category
        Returns:
        the number of direct sub-categories
      • getCatalogVersion

        public CatalogVersionModel getCatalogVersion​(PK pk)
        Description copied from interface: CatalogService
        Get the CatalogVersion for a Catalog item, specified by PK
        Specified by:
        getCatalogVersion in interface CatalogService
        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: CatalogService
        Assigns product to catalog version
        Specified by:
        assignProduct in interface CatalogService
        Parameters:
        product - product to be assigned
        catalogVersionModel - new catalog version
        removeFromCategory - parent category from which product should be removed
        Returns:
        true if moving was successfully performed
      • assignProduct

        public boolean assignProduct​(TypedObject product,
                                     CategoryModel newSuperCategory,
                                     CategoryModel removeFromCategory)
        Description copied from interface: CatalogService
        Assigns product to category
        Specified by:
        assignProduct in interface CatalogService
        Parameters:
        product - product to be assigned
        newSuperCategory - new parent category
        removeFromCategory - parent category from which product should be removed
        Returns:
        true if moving was successfully performed
      • assignProducts

        public boolean assignProducts​(java.util.Collection<TypedObject> products,
                                      CategoryModel newSuperCategory,
                                      CategoryModel oldSuperCategory)
        Description copied from interface: CatalogService
        Assigns products to category
        Specified by:
        assignProducts in interface CatalogService
        Parameters:
        products - products to be assigned
        newSuperCategory - new parent category
        oldSuperCategory - parent category from which products should be removed
        Returns:
        true if moving was successfully performed
      • moveCategories

        public boolean moveCategories​(java.util.Collection<TypedObject> categories,
                                      CategoryModel newSuperCategory,
                                      CategoryModel removeCategory)
        Description copied from interface: CatalogService
        Moves categories from one to other
        Specified by:
        moveCategories in interface CatalogService
        Parameters:
        categories - categories to be moved
        newSuperCategory - new parent category for categories
        removeCategory - parent category from which categories should be removed
        Returns:
        true if moving was successfully performed
      • moveCategory

        public boolean moveCategory​(CategoryModel category,
                                    CategoryModel newSuperCategory,
                                    CategoryModel removeCategory)
        Description copied from interface: CatalogService
        Moves category from one to other
        Specified by:
        moveCategory in interface CatalogService
        Parameters:
        category - category to be moved
        newSuperCategory - new parent category for category
        removeCategory - parent category from which category should be removed
        Returns:
        true if moving was successfully performed
      • isAssignProductPermitted

        public boolean isAssignProductPermitted​(TypedObject product,
                                                CategoryModel newSuperCategory,
                                                CategoryModel removeFromCategory)
        Description copied from interface: CatalogService
        Checks if user is allowed to assing product to a category
        Specified by:
        isAssignProductPermitted in interface CatalogService
        Parameters:
        product - product to be assigned
        newSuperCategory - new parent category
        removeFromCategory - parent category from which product should be removed
        Returns:
        true if allowed
      • isAssignCatalogVersionPermitted

        protected boolean isAssignCatalogVersionPermitted​(TypedObject product)
      • getCategoryPaths

        protected java.util.Collection<java.util.List<Category>> getCategoryPaths​(Category category)
      • getProducts

        protected java.util.Collection<Product> getProducts​(Category 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: CatalogService
        Checks if user is allowed to move categories from one to other
        Specified by:
        isMoveCategoriesPermitted in interface CatalogService
        Parameters:
        categories - categories to be moved
        newSuperCategory - new parent category for categories
        removeFromCategory - parent category from which categories should be removed
        Returns:
        true if allowed
      • isMoveCategoryPermitted

        public boolean isMoveCategoryPermitted​(CategoryModel category,
                                               CategoryModel newSuperCategory,
                                               CategoryModel removeCategory)
        Description copied from interface: CatalogService
        Checks if user is allowed to move category from one to other
        Specified by:
        isMoveCategoryPermitted in interface CatalogService
        Parameters:
        category - category to be moved
        newSuperCategory - new parent category for category
        removeCategory - parent category from which category should be removed
        Returns:
        true if allowed
      • setAsRootCategory

        public boolean setAsRootCategory​(CategoryModel category)
        Description copied from interface: CatalogService
        Marks a category as root
        Specified by:
        setAsRootCategory in interface CatalogService
        Parameters:
        category - root category
        Returns:
        true is category was successfully marked as root
      • wrapCategory

        public CategoryModel wrapCategory​(TypedObject typedObject)
        Description copied from interface: CatalogService
        Extracts category model from provided typedObject
        Specified by:
        wrapCategory in interface CatalogService
        Parameters:
        typedObject - object to extract category from
        Returns:
        category extracted or null if @typedObject is not category
      • wrapCatalogVersion

        public CatalogVersionModel wrapCatalogVersion​(TypedObject typedObject)
        Description copied from interface: CatalogService
        Extracts catalog version model from provided typedObject
        Specified by:
        wrapCatalogVersion in interface CatalogService
        Parameters:
        typedObject - object to extract catalog version from
        Returns:
        catalog version extracted or null if @typedObject is not catalog version
      • getSupercategories

        public java.util.List<TypedObject> getSupercategories​(TypedObject categorizableItem,
                                                              boolean fromSameCatalogVersionOnly)
        Description copied from interface: CatalogService
        Returns list of supercategories of the given categorizable item.
        Specified by:
        getSupercategories in interface CatalogService
        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: CatalogService
        Adds given categorizable item to given categories.
        Specified by:
        addToCategories in interface CatalogService
        Parameters:
        categorizableItem - the categorizable item to be added
        categories - the categories to add to
      • removeFromCategories

        public void removeFromCategories​(TypedObject categorizableItem,
                                         java.util.List<TypedObject> categories)
        Description copied from interface: CatalogService
        Removes given categorizable item from given categories.
        Specified by:
        removeFromCategories in interface CatalogService
        Parameters:
        categorizableItem - the categorizable item to be removed
        categories - the categories to remove from
      • setUiAccessRightService

        public void setUiAccessRightService​(UIAccessRightService accessService)
      • 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)