Class CategoryDaoImpl
java.lang.Object
org.broadleafcommerce.core.catalog.dao.CategoryDaoImpl
- All Implemented Interfaces:
CategoryDao
- Author:
- Jeff Fischer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Dateprotected Longprotected jakarta.persistence.EntityManagerprotected EntityConfigurationprotected CategoryDaoExtensionManagerprotected SandBoxHelper -
Constructor Summary
Constructors -
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)protected DateReturns 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.
-
Field Details
-
currentDateResolution
-
cachedDate
-
em
protected jakarta.persistence.EntityManager em -
entityConfiguration
-
sandBoxHelper
-
extensionManager
-
-
Constructor Details
-
CategoryDaoImpl
public CategoryDaoImpl()
-
-
Method Details
-
getCurrentDateAfterFactoringInDateResolution
-
save
Description copied from interface:CategoryDaoPersist aCategoryinstance to the datastore- Specified by:
savein interfaceCategoryDao- Parameters:
category- theCategoryinstance- Returns:
- the updated state of the passed in
Categoryafter being persisted
-
readCategoryById
Description copied from interface:CategoryDaoRetrieve aCategoryinstance by its primary key- Specified by:
readCategoryByIdin interfaceCategoryDao- Parameters:
categoryId- the primary key of theCategory- Returns:
- the
Categoryat the specified primary key
-
readCategoriesByIds
Description copied from interface:CategoryDaoRetrieves a List of Category IDs- Specified by:
readCategoriesByIdsin interfaceCategoryDao- Returns:
-
readCategoryByExternalId
Description copied from interface:CategoryDaoRetrieve aCategoryinstance by the external id- Specified by:
readCategoryByExternalIdin interfaceCategoryDao- Returns:
-
readCategoryByName
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:CategoryDaoRetrieve 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
CategoryDao.readCategoriesByName(String)instead.- Specified by:
readCategoryByNamein interfaceCategoryDao- Parameters:
categoryName- the name of the category- Returns:
- the Category having the specified name
-
readCategoriesByName
Description copied from interface:CategoryDaoRetrieve a list ofCategoryinstances by name.- Specified by:
readCategoriesByNamein interfaceCategoryDao- Parameters:
categoryName- the name to search by- Returns:
- the Category instances having the specified name
-
readCategoriesByName
- Specified by:
readCategoriesByNamein interfaceCategoryDao
-
readCategoriesByNames
- Specified by:
readCategoriesByNamesin interfaceCategoryDao
-
readAllCategories
Description copied from interface:CategoryDaoRetrieve all categories in the datastore- Specified by:
readAllCategoriesin interfaceCategoryDao- Returns:
- a list of all the
Categoryinstances in the datastore
-
readAllCategories
Description copied from interface:CategoryDaoRetrieve a subset of all categories- Specified by:
readAllCategoriesin interfaceCategoryDao- Parameters:
limit- the maximum number of results, defaults to 20offset- the starting point in the record set, defaults to 0- Returns:
-
readTotalCategoryCount
- Specified by:
readTotalCategoryCountin interfaceCategoryDao
-
readAllProducts
Description copied from interface:CategoryDaoRetrieve all products in the datastore- Specified by:
readAllProductsin interfaceCategoryDao- Returns:
- a list of all
Categoryinstances in the datastore, regardless of their category association
-
readAllProducts
- Specified by:
readAllProductsin interfaceCategoryDao
-
readAllSubCategories
Description copied from interface:CategoryDaoRetrieve a list of all child categories of the passed inCategoryinstance- Specified by:
readAllSubCategoriesin interfaceCategoryDao- Parameters:
category- the parent category- Returns:
- a list of all child categories
-
readAllSubCategories
Description copied from interface:CategoryDaoRetrieve a list of all child categories of the passed inCategoryinstance- Specified by:
readAllSubCategoriesin interfaceCategoryDao- Parameters:
id- the parent category ID- Returns:
- a list of all child categories
-
readAllSubCategories
Description copied from interface:CategoryDaoRetrieve a list of all child categories of the passed inCategoryinstance- Specified by:
readAllSubCategoriesin interfaceCategoryDao- 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
-
readActiveSubCategoriesByCategory
Description copied from interface:CategoryDaoRetrieve 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. SeeCategoryDao.getCurrentDateResolution()- Specified by:
readActiveSubCategoriesByCategoryin interfaceCategoryDao- Parameters:
category- the parent category- Returns:
- a list of all active child categories
-
readActiveSubCategoriesByCategory
Description copied from interface:CategoryDaoRetrieve 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. SeeCategoryDao.getCurrentDateResolution()- Specified by:
readActiveSubCategoriesByCategoryin interfaceCategoryDao- 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
-
getCurrentDateResolution
Description copied from interface:CategoryDaoReturns 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.- Specified by:
getCurrentDateResolutionin interfaceCategoryDao- Returns:
- the milliseconds to cache the current date/time
-
setCurrentDateResolution
Description copied from interface:CategoryDaoSets 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.- Specified by:
setCurrentDateResolutionin interfaceCategoryDao- Parameters:
currentDateResolution- the milliseconds to cache the current date/time
-
delete
Description copied from interface:CategoryDaoRemoved the passed inCategoryinstance from the datastore- Specified by:
deletein interfaceCategoryDao- Parameters:
category- theCategoryinstance to remove
-
create
Description copied from interface:CategoryDaoCreate 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>- Specified by:
createin interfaceCategoryDao- Returns:
- a
Categoryinstance based on the Broadleaf entity configuration.
-
findCategoryByURI
- Specified by:
findCategoryByURIin interfaceCategoryDao
-
readCountAllActiveProductsByCategory
- Specified by:
readCountAllActiveProductsByCategoryin interfaceCategoryDao
-
findXrefByCategoryWithDefaultReference
Description copied from interface:CategoryDaoreturns a list of CategoryProductXref where provided category is default reference(xref.defaultReference=true)- Specified by:
findXrefByCategoryWithDefaultReferencein interfaceCategoryDao- Parameters:
categoryId- long, id of the category- Returns:
- returns a list of CategoryProductXref where provided category is default reference(xref.defaultReference=true)
-