Interface ProductDao
- All Known Implementing Classes:
ProductDaoImpl
public interface ProductDao
ProductDao provides persistence access to Product instances- Author:
- Jeff Fischer
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncreate(ProductType productType) Create a newProductinstance.voidRemove the passed in product instance from the datastorefindProductByURI(String key) Look up a product that matches the given URIReturns the number of milliseconds that the current date/time will be cached for queries before refreshing.readActiveProductsByCategory(Long categoryId) Find all products whose in the passed in category.readActiveProductsByCategory(Long categoryId, int limit, int offset) Read a page of products for a category.readActiveProductsByCategory(Long categoryId, Date currentDate, int limit, int offset) Deprecated, for removal: This API element is subject to removal in a future version.readAllActiveProductIds(Long lastId, int pageSize) Reads a paginated list of active product IDs, in ascending order, starting immediately after the lastId.Reads all products from the database that are currently active.readAllActiveProducts(int page, int pageSize) Reads all products from the database that are currently active.readAllActiveProducts(int page, int pageSize, Date currentDate) Deprecated.readAllActiveProducts(Integer pageSize, Long lastId) Reads all products from the database that are currently active.readAllActiveProducts(Date currentDate) Deprecated, for removal: This API element is subject to removal in a future version.readAllActiveProductsForSiteMap(int page, int pageSize) Returns all active ProductBundles whose automatic property is true.Returns the number of products that are currently active.readCountAllActiveProducts(Date currentDate) Deprecated.readFilteredActiveProductsByCategory(Long categoryId, Date currentDate, SearchCriteria searchCriteria) Deprecated, for removal: This API element is subject to removal in a future version.readFilteredActiveProductsByCategory(Long categoryId, SearchCriteria searchCriteria) Find all active products that are related to the given category, match the given search criteria, and are not marked as archived.readFilteredActiveProductsByQuery(String query, Date currentDate, SearchCriteria searchCriteria) Deprecated, for removal: This API element is subject to removal in a future version.UsereadFilteredActiveProductsByQuery(String, SearchCriteria)Find all products whose start and end dates are before and after the passed in date, who match the search string, match the given search criteria, and are not marked as archived.readFilteredActiveProductsByQuery(String query, SearchCriteria searchCriteria) Find all products whose start and end dates are before and after the passed in date, who match the search string, match the given search criteria, and are not marked as archived.readProductByExternalId(String externalId) readProductById(Long productId) Retrieve aProductinstance by its primary keyreadProductsByCategory(Long categoryId) Find all products related to the passed in categoryreadProductsByCategory(Long categoryId, int limit, int offset) Find all products related to the passed in categoryreadProductsByIds(List<Long> productIds) Retrieves a list of Product instances by their primary keysreadProductsByName(String searchName) Find allProductinstances whose name starts with or is equal to the passed in search parameterreadProductsByName(String searchName, int limit, int offset) Find a subset ofProductinstances whose name starts with or is equal to the passed in search parameter.Persist aProductinstance to the datastorevoidsetCurrentDateResolution(Long currentDateResolution) Sets the number of milliseconds that the current date/time will be cached for queries before refreshing.
-
Method Details
-
readProductById
Retrieve aProductinstance by its primary key- Parameters:
productId- the primary key of the product- Returns:
- the product instance at the specified primary key
-
readProductByExternalId
-
readProductsByIds
Retrieves a list of Product instances by their primary keys- Parameters:
productIds- the list of primary keys for products- Returns:
- the list of products specified by the primary keys
-
save
Persist aProductinstance to the datastore- Parameters:
product- the product instance- Returns:
- the updated state of the product instance after being persisted
-
readProductsByName
Find allProductinstances whose name starts with or is equal to the passed in search parameter- Parameters:
searchName- the partial or whole name to match- Returns:
- the list of product instances that were search hits
-
readProductsByName
@Nonnull List<Product> readProductsByName(@Nonnull String searchName, @Nonnull int limit, @Nonnull int offset) Find a subset ofProductinstances whose name starts with or is equal to the passed in search parameter. Res- Parameters:
searchName-limit- the maximum number of resultsoffset- the starting point in the record set- Returns:
- the list of product instances that fit the search criteria
-
readActiveProductsByCategory
Find all products whose in the passed in category.- Parameters:
categoryId- the primary key of the category to whom the resulting product list should be related- Returns:
- the list of products qualified for the category and date
-
readActiveProductsByCategory
List<Product> readActiveProductsByCategory(@Nonnull Long categoryId, @Nonnull int limit, @Nonnull int offset) Read a page of products for a category.- Parameters:
categoryId-limit-offset-- Returns:
-
readFilteredActiveProductsByCategory
@Nonnull List<Product> readFilteredActiveProductsByCategory(Long categoryId, SearchCriteria searchCriteria) Find all active products that are related to the given category, match the given search criteria, and are not marked as archived.- Parameters:
categoryId-searchCriteria-- Returns:
- the matching products
-
readFilteredActiveProductsByQuery
@Nonnull List<Product> readFilteredActiveProductsByQuery(String query, SearchCriteria searchCriteria) Find all products whose start and end dates are before and after the passed in date, who match the search string, match the given search criteria, and are not marked as archived.- Parameters:
query-searchCriteria-- Returns:
- the matching products
-
readFilteredActiveProductsByCategory
@Deprecated(forRemoval=true) @Nonnull List<Product> readFilteredActiveProductsByCategory(Long categoryId, Date currentDate, SearchCriteria searchCriteria) Deprecated, for removal: This API element is subject to removal in a future version.UsereadFilteredActiveProductsByCategory(Long, SearchCriteria)Find all products whose start and end dates are before and after the passed in date, who are related to the given category, match the given search criteria, and are not marked as archived.
- Parameters:
categoryId-currentDate-searchCriteria-- Returns:
- the matching products
-
readFilteredActiveProductsByQuery
@Deprecated(forRemoval=true) @Nonnull List<Product> readFilteredActiveProductsByQuery(String query, Date currentDate, SearchCriteria searchCriteria) Deprecated, for removal: This API element is subject to removal in a future version.UsereadFilteredActiveProductsByQuery(String, SearchCriteria)Find all products whose start and end dates are before and after the passed in date, who match the search string, match the given search criteria, and are not marked as archived.- Parameters:
query-currentDate-searchCriteria-- Returns:
- the matching products
-
readActiveProductsByCategory
@Deprecated(forRemoval=true) @Nonnull List<Product> readActiveProductsByCategory(@Nonnull Long categoryId, @Nonnull Date currentDate, @Nonnull int limit, @Nonnull int offset) Deprecated, for removal: This API element is subject to removal in a future version. -
readProductsByCategory
Find all products related to the passed in category- Parameters:
categoryId- the primary key of the category to whom the resulting product list should be related- Returns:
- the list of products qualified for the category
-
readProductsByCategory
@Nonnull List<Product> readProductsByCategory(@Nonnull Long categoryId, @Nonnull int limit, @Nonnull int offset) Find all products related to the passed in category- Parameters:
categoryId- the primary key of the category to whom the resulting product list should be relatedlimit- the maximum number of results to returnoffset- the starting point in the record set- Returns:
- the list of products qualified for the category
-
delete
Remove the passed in product instance from the datastore- Parameters:
product- the product instance to remove
-
create
Create a newProductinstance. The system will use the configuration in/BroadleafCommerce/core/BroadleafCommerceFramework/src/main/resources/bl-framework-applicationContext-entity.xmlto determine which polymorphic version ofProductto instantiate. To make Broadleaf instantiate your extension ofProductby 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>- Parameters:
productType- the type of product you would like to create (presumably a Product or ProductSku instance). The getType method ofProductTypeprovides the key for the entity configuration.- Returns:
- a
Productinstance based on the Broadleaf entity configuration.
-
readAutomaticProductBundles
List<ProductBundle> readAutomaticProductBundles()Returns all active ProductBundles whose automatic property is true.- Returns:
-
findProductByURI
Look up a product that matches the given URI- Parameters:
key- - the relative URL to look up the Product by- Returns:
- List of products that match the passed in URI.
-
readAllActiveProducts
Reads all products from the database that are currently active.- Returns:
- a list of all active products
-
readAllActiveProducts
Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
currentDate-- Returns:
- a list of all active products
-
readAllActiveProducts
Reads all products from the database that are currently active. This method differs fromreadAllActiveProducts()in that this one will utilize 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.
When possible, it is suggested to use
readAllActiveProducts(Integer, Long)instead for performance.- Parameters:
page- - the number of the page to get (0 indexed)pageSize- - the number of results per page- Returns:
- a list of active products for the given page
-
readAllActiveProducts
Reads all products 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 (likereadAllActiveProducts(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 products for the given page
-
readAllActiveProducts
Deprecated.- Parameters:
page- - the number of the page to get (0 indexed)pageSize- - the number of results per pagecurrentDate-- Returns:
- a list of active products for the given page
-
readCountAllActiveProducts
Long readCountAllActiveProducts()Returns the number of products that are currently active.- Returns:
- the number of currently active products
-
readCountAllActiveProducts
Deprecated.- Parameters:
currentDate-- Returns:
- the number of currently active products
-
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
-
readAllActiveProductIds
Reads a paginated list of active product IDs, in ascending order, starting immediately after the lastId. If the lastId is null, then this returns the first page.- Parameters:
lastId-pageSize-- Returns:
-
readAllActiveProductsForSiteMap
-
readActiveProductsByCategory(Long)