Interface SkuDao
- All Known Implementing Classes:
SkuDaoImpl
public interface SkuDao
SkuDao provides persistence access to Sku instances- Author:
- Jeff Fischer
-
Method Summary
Modifier and TypeMethodDescriptioncreate()Create a newSkuinstance.voidRemove theSkuinstance from the datastorefindSkuByURI(String uri) Look up a sku that matches the given URIReturns 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.Retrieve allSkuinstances from the datastorereadAllSkus(int offset, int limit) Retrieve allSkuinstances from the datastoreReturns the number of Skus that are currently active.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> ids) 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.
-
Method Details
-
readSkuById
Retrieve aSkuinstance by its primary key- Parameters:
skuId- the primary key of the sku- Returns:
- the sku at the primary key
-
readSkuByUpc
Queries for aSkuinstance by its Universal Product Code (UPC).- Parameters:
upc-- Returns:
-
readSkuByExternalId
Retrieve aSkuinstance by its external id- Parameters:
externalId- the external id of the sku- Returns:
- the sku with this external id
-
save
Persist aSkuinstance to the datastore- Parameters:
sku- the sku to persist- Returns:
- the saved state of the passed in sku
-
saveSkuFee
-
readFirstSku
Sku readFirstSku()Retrieve theSkuinstance whose primary key is the smallest of all skus in the datastore- Returns:
- the sku with the smallest primary key
-
readAllSkus
Retrieve allSkuinstances from the datastore- Returns:
- the list of all skus
-
readAllSkus
Retrieve allSkuinstances from the datastore- 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
Find all theSkuinstances whose primary key matches one of the values from the passed in list- Parameters:
ids- the list of primary key values- Returns:
- the list of skus that match the list of primary key values
-
delete
Remove theSkuinstance from the datastore- Parameters:
sku- the sku to remove
-
create
Sku create()Create 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>- Returns:
- a
Skuinstance based on the Broadleaf entity configuration.
-
readCountAllActiveSkus
Long readCountAllActiveSkus()Returns the number of Skus that are currently active.- Returns:
- the number of currently active Skus
-
readAllActiveSkus
Reads 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.
- 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
Reads 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 (likereadAllActiveSkus(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.- 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
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
-
findSkuByURI
Look up a sku that matches the given URI- Parameters:
uri- - the relative URL to look up the sku by- Returns:
- List of skus that match the passed in URI.
-