Interface ProductService
-
- All Known Implementing Classes:
DefaultProductService
public interface ProductService
Service to read and updateProductModel
s.- Spring Bean ID:
- productService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description boolean
containsProductsForCategory(CategoryModel category)
Checks whether or not the specificCategoryModel
or any of its sub-categories contains at least one product.java.lang.Integer
getAllProductsCountForCategory(CategoryModel category)
Counts all products of the specificCategoryModel
excluding double linked products.java.util.List<ProductModel>
getAllProductsForCatalogVersion(CatalogVersionModel catalogVersion)
Returns allProductModel
list belonging to the specifiedCatalogVersionModel
java.util.List<ProductModel>
getOfflineProductsForCategory(CategoryModel category)
Returns all offline products that belong to the specified category.java.util.List<ProductModel>
getOnlineProductsForCategory(CategoryModel category)
Returns all online products that belong to the specified category.UnitModel
getOrderableUnit(ProductModel product)
Returns for the givenproduct
the first foundUnitModel
from the PriceInformations of the product.ProductModel
getProduct(CatalogVersionModel catalogVersion, java.lang.String code)
Deprecated.since ages - as of release 4.3, please usegetProductForCode(CatalogVersionModel, String)
, however this method does not use any restrictionsProductModel
getProduct(java.lang.String code)
Deprecated.since ages - as of release 4.3, please usegetProductForCode(String)
ProductModel
getProductForCode(CatalogVersionModel catalogVersion, java.lang.String code)
Returns the Product with the specified code belonging to the specified CatalogVersion.ProductModel
getProductForCode(java.lang.String code)
Returns the Product with the specified code.java.util.List<ProductModel>
getProducts(CategoryModel category)
Deprecated.since ages - as of release 4.3, please usegetProductsForCategory(CategoryModel)
Returns all Products belonging to the specified Category as a List.SearchResult<ProductModel>
getProducts(CategoryModel category, int start, int count)
Deprecated.since ages - as of release 4.3, please usegetProductsForCategory(CategoryModel, int, int)
java.lang.Integer
getProductsCountForCategory(CategoryModel category)
Counts all products of the specificCategoryModel
.java.util.List<ProductModel>
getProductsForCategory(CategoryModel category)
Returns all Products belonging to the specified Category as a List.java.util.List<ProductModel>
getProductsForCategory(CategoryModel category, int start, int count)
Returns the specified range of Products belonging to the specified Category as a List.UnitModel
getUnit(java.lang.String code)
Deprecated.since ages - as of release 4.3, please useUnitService.getUnitForCode(String)
Returns the Unit with the specified code.
-
-
-
Method Detail
-
getProduct
@Deprecated ProductModel getProduct(java.lang.String code)
Deprecated.since ages - as of release 4.3, please usegetProductForCode(String)
Returns the Product with the specified code. As default the search uses the current session user, the current session language and the current active catalog versions (which are stored at the session in the attribute
SESSION_CATALOG_VERSIONS
). For modifying the search session context seeFlexibleSearchQuery
.- Parameters:
code
- the code of the Product- Returns:
- the Product with the specified code.
- Throws:
UnknownIdentifierException
- if no Product with the specified code is foundAmbiguousIdentifierException
- if more than one Product with the specified code is foundjava.lang.IllegalArgumentException
- if parameter code isnull
-
getProductForCode
ProductModel getProductForCode(java.lang.String code)
Returns the Product with the specified code. As default the search uses the current session user, the current session language and the current active catalog versions (which are stored at the session in the attributeSESSION_CATALOG_VERSIONS
). For modifying the search session context seeFlexibleSearchQuery
.- Parameters:
code
- the code of the Product- Returns:
- the Product with the specified code.
- Throws:
UnknownIdentifierException
- if no Product with the specified code is foundAmbiguousIdentifierException
- if more than one Product with the specified code is foundjava.lang.IllegalArgumentException
- if parameter code isnull
-
getProduct
@Deprecated ProductModel getProduct(CatalogVersionModel catalogVersion, java.lang.String code)
Deprecated.since ages - as of release 4.3, please usegetProductForCode(CatalogVersionModel, String)
, however this method does not use any restrictionsReturns the Product with the specified code belonging to the specified CatalogVersion. If the specified catalog version is not in the search restriction for the current user this method won't find any product (but it still exists). The admin user searches without any restrictions. As default the search uses the current session user, the current session language and the current active catalog versions (which are stored at the session in the attribute
SESSION_CATALOG_VERSIONS
). If there is no active catalog version specified CatalogVersion is set as active catalog version.- Parameters:
catalogVersion
- the CatalogVersion of the Productcode
- the code of the Product- Returns:
- the Product matching the specified code and CatalogVersion.
- Throws:
UnknownIdentifierException
- if no Product with the specified code and Catalog is found.AmbiguousIdentifierException
- if more than one Product with the specified code and Catalog is found
-
getOrderableUnit
UnitModel getOrderableUnit(ProductModel product)
Returns for the givenproduct
the first foundUnitModel
from the PriceInformations of the product.- Parameters:
product
- theProductModel
- Returns:
ProductModel.UNIT
if no PriceInformations is available at theProductModel
- Throws:
java.lang.IllegalArgumentException
- ifproduct
isnull
.ModelNotFoundException
- if noUnitModel
was found for the givenproduct
-
getUnit
@Deprecated UnitModel getUnit(java.lang.String code)
Deprecated.since ages - as of release 4.3, please useUnitService.getUnitForCode(String)
Returns the Unit with the specified code.- Parameters:
code
- the code of the Unit- Returns:
- the Unit with the specified code
- Throws:
UnknownIdentifierException
- if no Product with the specified code and Catalog is found.AmbiguousIdentifierException
- if more than one Product with the specified code and Catalog is found
-
getProducts
@Deprecated java.util.List<ProductModel> getProducts(CategoryModel category)
Deprecated.since ages - as of release 4.3, please usegetProductsForCategory(CategoryModel)
Returns all Products belonging to the specified Category as a List. For the search the current session active catalog versions of the current user are used.- Parameters:
category
- the category the returned Products belong to- Returns:
- a list of Products which belong to the specified Category
- Throws:
java.lang.IllegalArgumentException
- if parameter category is null
-
getProductsForCategory
java.util.List<ProductModel> getProductsForCategory(CategoryModel category)
Returns all Products belonging to the specified Category as a List. For the search the current session active catalog versions of the current user are used.- Parameters:
category
- the category the returned Products belong to- Returns:
- a list of Products which belong to the specified Category
- Throws:
java.lang.IllegalArgumentException
- if parameter category is null
-
getOnlineProductsForCategory
java.util.List<ProductModel> getOnlineProductsForCategory(CategoryModel category)
Returns all online products that belong to the specified category.- Parameters:
category
- the category the returned products belong to- Returns:
- all found products that belong to the specified category, or empty collection if no product can be found.
- Throws:
java.lang.IllegalArgumentException
- if parameter category is null
-
getOfflineProductsForCategory
java.util.List<ProductModel> getOfflineProductsForCategory(CategoryModel category)
Returns all offline products that belong to the specified category.- Parameters:
category
- the category the returned products belong to- Returns:
- all found products that belong to the specified category, or empty collection if no product can be found.
- Throws:
java.lang.IllegalArgumentException
- if parameter category is null
-
getProducts
@Deprecated SearchResult<ProductModel> getProducts(CategoryModel category, int start, int count)
Deprecated.since ages - as of release 4.3, please usegetProductsForCategory(CategoryModel, int, int)
Returns the specified range of Products belonging to the specified Category as a List. For the search the current session active catalog versions of the current user are used.
- Parameters:
category
- the category the returned Products belong tostart
- index position of the first Product, which will be included in the returned Listcount
- number of Products which will be returned in the List- Returns:
- a list of Products with belong to the specified Category
- Throws:
java.lang.IllegalArgumentException
- if parameter category is null
-
getProductsForCategory
java.util.List<ProductModel> getProductsForCategory(CategoryModel category, int start, int count)
Returns the specified range of Products belonging to the specified Category as a List. For the search the current session active catalogversions of the current user are used.- Parameters:
category
- the category the returned Products belong tostart
- index position of the first Product, which will be included in the returned Listcount
- number of Products which will be returned in the List- Returns:
- a list of Products with belong to the specified Category
- Throws:
java.lang.IllegalArgumentException
- if parameter category is null
-
getProductsCountForCategory
java.lang.Integer getProductsCountForCategory(CategoryModel category)
Counts all products of the specificCategoryModel
.- Parameters:
category
- theCategoryModel
- Returns:
- amount of all products of the category
- Throws:
java.lang.IllegalArgumentException
- if parametercategory
isnull
.
-
getAllProductsCountForCategory
java.lang.Integer getAllProductsCountForCategory(CategoryModel category)
Counts all products of the specificCategoryModel
excluding double linked products. This includes all its own products and products belonging to any sub category.- Parameters:
category
- theCategoryModel
- Returns:
- amount of all products of the category
- Throws:
java.lang.IllegalArgumentException
- if parametercategory
isnull
.
-
containsProductsForCategory
boolean containsProductsForCategory(CategoryModel category)
Checks whether or not the specificCategoryModel
or any of its sub-categories contains at least one product.- Parameters:
category
- theCategoryModel
- Returns:
- true if at least one product belong the the
CategoryModel
or any of its sub-categories, false otherwise. - Throws:
java.lang.IllegalArgumentException
- if parametercategory
isnull
.
-
getProductForCode
ProductModel getProductForCode(CatalogVersionModel catalogVersion, java.lang.String code)
Returns the Product with the specified code belonging to the specified CatalogVersion.- Parameters:
catalogVersion
- the CatalogVersion of the Productcode
- the code of the Product- Returns:
- the Product matching the specified code and CatalogVersion.
- Throws:
UnknownIdentifierException
- if no Product with the specified code and Catalog is found.AmbiguousIdentifierException
- if more than one Product with the specified code and Catalog is found
-
getAllProductsForCatalogVersion
java.util.List<ProductModel> getAllProductsForCatalogVersion(CatalogVersionModel catalogVersion)
Returns allProductModel
list belonging to the specifiedCatalogVersionModel
- Parameters:
catalogVersion
- the CatalogVersion of the Products- Returns:
- Product list belonging to the CatalogVersion
-
-