Interface CategoryDao
- All Known Implementing Classes:
CategoryDaoImpl
public interface CategoryDao
CategoryDao provides persistence access to Category instances.-
Method Summary
Modifier and TypeMethodDescriptioncreate()Create a newCategoryinstance.voidRemoved the passed inCategoryinstance from the datastorefindCategoryByURI(String uri) findXrefByCategoryWithDefaultReference(Long categoryId) returns a list of CategoryProductXref where provided category is default reference(xref.defaultReference=true)Returns the number of milliseconds that the current date/time will be cached for queries before refreshing.readActiveSubCategoriesByCategory(Category category) Retrieve a list of all active child categories of the passed inCategoryinstance.readActiveSubCategoriesByCategory(Category category, int limit, int offset) Retrieve a list of all active child categories of the passed inCategoryinstance.Retrieve all categories in the datastorereadAllCategories(int limit, int offset) Retrieve a subset of all categoriesRetrieve all products in the datastorereadAllProducts(int limit, int offset) Retrieve a list of all child categories of the passed inCategoryinstancereadAllSubCategories(Category category) Retrieve a list of all child categories of the passed inCategoryinstancereadAllSubCategories(Category category, int limit, int offset) Retrieve a list of all child categories of the passed inCategoryinstancereadCategoriesByIds(List<Long> categoryIds) Retrieves a List of Category IDsreadCategoriesByName(String categoryName) Retrieve a list ofCategoryinstances by name.readCategoriesByName(String categoryName, int limit, int offset) readCategoriesByNames(List<String> names) readCategoryByExternalId(String externalId) Retrieve aCategoryinstance by the external idreadCategoryById(Long categoryId) Retrieve aCategoryinstance by its primary keyreadCategoryByName(String categoryName) Deprecated, for removal: This API element is subject to removal in a future version.readCountAllActiveProductsByCategory(Category category) Persist aCategoryinstance to the datastorevoidsetCurrentDateResolution(Long currentDateResolution) Sets the number of milliseconds that the current date/time will be cached for queries before refreshing.
-
Method Details
-
readCategoryById
Retrieve aCategoryinstance by its primary key- Parameters:
categoryId- the primary key of theCategory- Returns:
- the
Categoryat the specified primary key
-
readCategoriesByIds
Retrieves a List of Category IDs- Parameters:
categoryIds-- Returns:
-
readCategoryByExternalId
Retrieve aCategoryinstance by the external id- Parameters:
externalId-- Returns:
-
readCategoryByName
Deprecated, for removal: This API element is subject to removal in a future version.Retrieve aCategoryinstance by its name.Broadleaf allows more than one category to have the same name. Calling this method could produce an exception in such situations. Use
readCategoriesByName(String)instead.- Parameters:
categoryName- the name of the category- Returns:
- the Category having the specified name
-
readCategoriesByName
Retrieve a list ofCategoryinstances by name.- Parameters:
categoryName- the name to search by- Returns:
- the Category instances having the specified name
-
readCategoriesByName
-
readCategoriesByNames
-
save
Persist aCategoryinstance to the datastore- Parameters:
category- theCategoryinstance- Returns:
- the updated state of the passed in
Categoryafter being persisted
-
readAllCategories
Retrieve all categories in the datastore- Returns:
- a list of all the
Categoryinstances in the datastore
-
readAllCategories
Retrieve a subset of all categories- Parameters:
limit- the maximum number of results, defaults to 20offset- the starting point in the record set, defaults to 0- Returns:
-
readTotalCategoryCount
Long readTotalCategoryCount() -
readAllProducts
Retrieve all products in the datastore- Returns:
- a list of all
Categoryinstances in the datastore, regardless of their category association
-
readAllProducts
-
readAllSubCategories
Retrieve a list of all child categories of the passed inCategoryinstance- Parameters:
category- the parent category- Returns:
- a list of all child categories
-
readAllSubCategories
Retrieve a list of all child categories of the passed inCategoryinstance- Parameters:
id- the parent category ID- Returns:
- a list of all child categories
-
readAllSubCategories
@Nonnull List<Category> readAllSubCategories(@Nonnull Category category, @Nonnull int limit, @Nonnull int offset) Retrieve a list of all child categories of the passed inCategoryinstance- Parameters:
category- the parent categorylimit- the maximum number of results to returnoffset- the starting point in the record set- Returns:
- a list of all child categories
-
delete
Removed the passed inCategoryinstance from the datastore- Parameters:
category- theCategoryinstance to remove
-
create
Create a newCategoryinstance. The system will use the configuration in/BroadleafCommerce/core/BroadleafCommerceFramework/src/main/resources/bl-framework-applicationContext-entity.xmlto determine which polymorphic version ofCategoryto instantiate. To make Broadleaf instantiate your extension ofCategoryby default, include an entity configuration bean in your application context xml similar to:
Declare the same key for your desired entity in your entity xml that is used in the Broadleaf entity xml, but change the value to the fully qualified classname of your entity extension.<bean id="blEntityConfiguration" class="org.broadleafcommerce.common.persistence.EntityConfiguration"> <property name="entityContexts"> <list> <value>classpath:myCompany-applicationContext-entity.xml</value> </list> </property> </bean>- Returns:
- a
Categoryinstance based on the Broadleaf entity configuration.
-
readActiveSubCategoriesByCategory
Retrieve a list of all active child categories of the passed inCategoryinstance. This method bases its search on a current time value. To make the retrieval of values more efficient, the current time is cached for a configurable amount of time. SeegetCurrentDateResolution()- Parameters:
category- the parent category- Returns:
- a list of all active child categories
-
readActiveSubCategoriesByCategory
@Nonnull List<Category> readActiveSubCategoriesByCategory(@Nonnull Category category, @Nonnull int limit, @Nonnull int offset) Retrieve a list of all active child categories of the passed inCategoryinstance. This method bases its search on a current time value. To make the retrieval of values more efficient, the current time is cached for a configurable amount of time. SeegetCurrentDateResolution()- Parameters:
category- the parent categorylimit- the maximum number of results to returnoffset- the starting point in the record set- Returns:
- a list of all active child categories
-
findCategoryByURI
-
getCurrentDateResolution
Long getCurrentDateResolution()Returns the number of milliseconds that the current date/time will be cached for queries before refreshing. This aids in query caching, otherwise every query that utilized current date would be different and caching would be ineffective.- Returns:
- the milliseconds to cache the current date/time
-
setCurrentDateResolution
Sets the number of milliseconds that the current date/time will be cached for queries before refreshing. This aids in query caching, otherwise every query that utilized current date would be different and caching would be ineffective.- Parameters:
currentDateResolution- the milliseconds to cache the current date/time
-
readCountAllActiveProductsByCategory
-
findXrefByCategoryWithDefaultReference
returns a list of CategoryProductXref where provided category is default reference(xref.defaultReference=true)- Parameters:
categoryId- long, id of the category- Returns:
- returns a list of CategoryProductXref where provided category is default reference(xref.defaultReference=true)
-