Class SkuDaoImpl
java.lang.Object
org.broadleafcommerce.core.catalog.dao.SkuDaoImpl
- All Implemented Interfaces:
SkuDao
- Author:
- Jeff Fischer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Dateprotected Longprotected jakarta.persistence.EntityManagerprotected org.broadleafcommerce.common.persistence.EntityConfigurationprotected SkuDaoExtensionManagerprotected org.broadleafcommerce.common.sandbox.SandBoxHelper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate()Create a newSkuinstance.voidRemove theSkuinstance from the datastorefindSkuByURI(String uri) Look up a sku that matches the given URIprotected jakarta.persistence.criteria.CriteriaQuery<Sku>getCriteriaForActiveSkus(Date currentDate) protected jakarta.persistence.criteria.CriteriaQuery<Sku>getCriteriaForActiveSkus(Date currentDate, Long lastId) Returns the number of milliseconds that the current date/time will be cached for queries before refreshing.readAllActiveSkus(int page, int pageSize) Reads all Skus from the database that are currently active.readAllActiveSkus(Integer pageSize, Long lastId) Reads all skus from the database that are currently active.readAllActiveSkusInternal(int page, int pageSize, Date currentDate) readAllActiveSkusInternal(Integer pageSize, Date currentDate, Long lastId) Retrieve allSkuinstances from the datastorereadAllSkus(int offset, int limit) Retrieve allSkuinstances from the datastoreReturns the number of Skus that are currently active.protected LongreadCountAllActiveSkusInternal(Date currentDate) Retrieve theSkuinstance whose primary key is the smallest of all skus in the datastorereadSkuByExternalId(String externalId) Retrieve aSkuinstance by its external idreadSkuById(Long skuId) Retrieve aSkuinstance by its primary keyreadSkuByUpc(String upc) Queries for aSkuinstance by its Universal Product Code (UPC).readSkusByIds(List<Long> skuIds) Find all theSkuinstances whose primary key matches one of the values from the passed in listPersist aSkuinstance to the datastoresaveSkuFee(SkuFee fee) voidsetCurrentDateResolution(Long currentDateResolution) Sets the number of milliseconds that the current date/time will be cached for queries before refreshing.
-
Field Details
-
em
protected jakarta.persistence.EntityManager em -
entityConfiguration
protected org.broadleafcommerce.common.persistence.EntityConfiguration entityConfiguration -
sandBoxHelper
protected org.broadleafcommerce.common.sandbox.SandBoxHelper sandBoxHelper -
extensionManager
-
currentDateResolution
-
cachedDate
-
-
Constructor Details
-
SkuDaoImpl
public SkuDaoImpl()
-
-
Method Details
-
save
Description copied from interface:SkuDaoPersist aSkuinstance to the datastore -
saveSkuFee
- Specified by:
saveSkuFeein interfaceSkuDao
-
readSkuById
Description copied from interface:SkuDaoRetrieve aSkuinstance by its primary key- Specified by:
readSkuByIdin interfaceSkuDao- Parameters:
skuId- the primary key of the sku- Returns:
- the sku at the primary key
-
readSkuByExternalId
Description copied from interface:SkuDaoRetrieve aSkuinstance by its external id- Specified by:
readSkuByExternalIdin interfaceSkuDao- Parameters:
externalId- the external id of the sku- Returns:
- the sku with this external id
-
readSkuByUpc
Description copied from interface:SkuDaoQueries for aSkuinstance by its Universal Product Code (UPC).- Specified by:
readSkuByUpcin interfaceSkuDao- Returns:
-
readFirstSku
Description copied from interface:SkuDaoRetrieve theSkuinstance whose primary key is the smallest of all skus in the datastore- Specified by:
readFirstSkuin interfaceSkuDao- Returns:
- the sku with the smallest primary key
-
readAllSkus
Description copied from interface:SkuDaoRetrieve allSkuinstances from the datastore- Specified by:
readAllSkusin interfaceSkuDao- Returns:
- the list of all skus
-
readAllSkus
Description copied from interface:SkuDaoRetrieve allSkuinstances from the datastore- Specified by:
readAllSkusin interfaceSkuDao- Parameters:
offset- the starting offset of the querylimit- the maximum number of Skus to gather- Returns:
- the list of all skus in the given range
-
readSkusByIds
Description copied from interface:SkuDaoFind all theSkuinstances whose primary key matches one of the values from the passed in list- Specified by:
readSkusByIdsin interfaceSkuDao- Parameters:
skuIds- the list of primary key values- Returns:
- the list of skus that match the list of primary key values
-
delete
Description copied from interface:SkuDaoRemove theSkuinstance from the datastore -
create
Description copied from interface:SkuDaoCreate a newSkuinstance. The system will use the configuration in/BroadleafCommerce/core/BroadleafCommerceFramework/src/main/resources/bl-framework-applicationContext-entity.xmlto determine which polymorphic version ofSkuto instantiate. To make Broadleaf instantiate your extension ofSkuby 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> -
readCountAllActiveSkus
Description copied from interface:SkuDaoReturns the number of Skus that are currently active.- Specified by:
readCountAllActiveSkusin interfaceSkuDao- Returns:
- the number of currently active Skus
-
readCountAllActiveSkusInternal
-
readAllActiveSkus
Description copied from interface:SkuDaoReads all Skus from the database that are currently active. This method utilizes database paging.It will fetch results in pages. For example, if page = 3 and pageSize = 25, this method would return rows 75-99 from the database.
- Specified by:
readAllActiveSkusin interfaceSkuDao- Parameters:
page- - the number of the page to get (0 indexed)pageSize- - the number of results per page- Returns:
- a list of active Skus for the given page
-
readAllActiveSkus
Description copied from interface:SkuDaoReads all skus from the database that are currently active. This method utilizes efficient paging to retrieve a subset of records. This approach does not use an offset technique (likeSkuDao.readAllActiveSkus(int, int), but rather limits the retrieved records to those greater than the given id and returns a max results of pageSize. This is more efficient that using an offset, since the database will not have to retrieve all the records from the beginning of the table and trim the offset.- Specified by:
readAllActiveSkusin interfaceSkuDao- Parameters:
pageSize- the number of results per pagelastId- the last id from the previous page - can be null if this is the first page request- Returns:
- a list of active skus for the given page
-
getCurrentDateResolution
Description copied from interface:SkuDaoReturns 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 interfaceSkuDao- Returns:
- the milliseconds to cache the current date/time
-
setCurrentDateResolution
Description copied from interface:SkuDaoSets 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 interfaceSkuDao- Parameters:
currentDateResolution- the milliseconds to cache the current date/time
-
findSkuByURI
Description copied from interface:SkuDaoLook up a sku that matches the given URI- Specified by:
findSkuByURIin interfaceSkuDao- Parameters:
uri- - the relative URL to look up the sku by- Returns:
- List of skus that match the passed in URI.
-
readAllActiveSkusInternal
-
readAllActiveSkusInternal
-
getCriteriaForActiveSkus
-
getCriteriaForActiveSkus
-