@Repository(value="blProductDao") public class ProductDaoImpl extends Object implements ProductDao
| Modifier and Type | Field and Description |
|---|---|
protected Date |
cachedDate |
protected Long |
currentDateResolution |
protected DialectHelper |
dialectHelper |
protected javax.persistence.EntityManager |
em |
protected EntityConfiguration |
entityConfiguration |
protected ProductDaoExtensionManager |
extensionManager |
protected SandBoxHelper |
sandBoxHelper |
| Constructor and Description |
|---|
ProductDaoImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
attachActiveRestriction(Date currentDate,
javax.persistence.criteria.Path<? extends Product> product,
javax.persistence.criteria.Path<? extends Sku> sku,
List<javax.persistence.criteria.Predicate> restrictions) |
protected void |
attachOrderBy(ProductSearchCriteria searchCriteria,
javax.persistence.criteria.From<?,? extends Product> product,
javax.persistence.criteria.Path<? extends Sku> sku,
javax.persistence.criteria.CriteriaQuery<?> criteria) |
protected void |
attachProductSearchCriteria(ProductSearchCriteria searchCriteria,
javax.persistence.criteria.From<?,? extends Product> product,
javax.persistence.criteria.From<?,? extends Sku> sku,
List<javax.persistence.criteria.Predicate> restrictions) |
Product |
create(ProductType productType)
Create a new
Product instance. |
void |
delete(Product product)
Remove the passed in product instance from the datastore
|
List<Product> |
findProductByURI(String uri)
Look up a product that matches the given URI
|
protected javax.persistence.criteria.CriteriaQuery<Product> |
getCriteriaForActiveProducts(Date currentDate) |
protected Date |
getCurrentDateAfterFactoringInDateResolution() |
Long |
getCurrentDateResolution()
Returns the number of milliseconds that the current date/time will be cached for queries before refreshing.
|
List<Product> |
readActiveProductsByCategory(Long categoryId)
Find all products whose in the passed in category.
|
List<Product> |
readActiveProductsByCategory(Long categoryId,
Date currentDate)
Deprecated.
|
List<Product> |
readActiveProductsByCategory(Long categoryId,
Date currentDate,
int limit,
int offset)
Deprecated.
|
List<Product> |
readActiveProductsByCategory(Long categoryId,
int limit,
int offset)
Read a page of products for a category.
|
protected List<Product> |
readActiveProductsByCategoryInternal(Long categoryId,
Date currentDate) |
List<Product> |
readActiveProductsByCategoryInternal(Long categoryId,
Date currentDate,
int limit,
int offset) |
List<Product> |
readAllActiveProducts()
Reads all products from the database that are currently active.
|
List<Product> |
readAllActiveProducts(Date currentDate)
Deprecated.
|
List<Product> |
readAllActiveProducts(int page,
int pageSize)
Reads all products from the database that are currently active.
|
List<Product> |
readAllActiveProducts(int page,
int pageSize,
Date currentDate)
Deprecated.
|
protected List<Product> |
readAllActiveProductsInternal(Date currentDate) |
protected List<Product> |
readAllActiveProductsInternal(int page,
int pageSize,
Date currentDate) |
List<ProductBundle> |
readAutomaticProductBundles()
Returns all active ProductBundles whose automatic property is true.
|
Long |
readCountAllActiveProducts()
Returns the number of products that are currently active.
|
Long |
readCountAllActiveProducts(Date currentDate)
Deprecated.
|
protected Long |
readCountAllActiveProductsInternal(Date currentDate) |
List<Product> |
readFilteredActiveProductsByCategory(Long categoryId,
Date currentDate,
ProductSearchCriteria searchCriteria)
Deprecated.
|
List<Product> |
readFilteredActiveProductsByCategory(Long categoryId,
ProductSearchCriteria searchCriteria)
Find all active products that are related to the given category, match the given search criteria, and
are not marked as archived.
|
protected List<Product> |
readFilteredActiveProductsByCategoryInternal(Long categoryId,
Date currentDate,
ProductSearchCriteria searchCriteria) |
List<Product> |
readFilteredActiveProductsByQuery(String query,
Date currentDate,
ProductSearchCriteria searchCriteria)
Deprecated.
|
List<Product> |
readFilteredActiveProductsByQuery(String query,
ProductSearchCriteria 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.
|
protected List<Product> |
readFilteredActiveProductsByQueryInternal(String query,
Date currentDate,
ProductSearchCriteria searchCriteria) |
Product |
readProductById(Long productId)
Retrieve a
Product instance by its primary key |
List<Product> |
readProductsByCategory(Long categoryId)
Find all products related to the passed in category
|
List<Product> |
readProductsByCategory(Long categoryId,
int limit,
int offset)
Find all products related to the passed in category
|
List<Product> |
readProductsByIds(List<Long> productIds)
Retrieves a list of Product instances by their primary keys
|
List<Product> |
readProductsByName(String searchName)
Find all
Product instances whose name starts with
or is equal to the passed in search parameter |
List<Product> |
readProductsByName(String searchName,
int limit,
int offset)
Find a subset of
Product instances whose name starts with
or is equal to the passed in search parameter. |
Product |
save(Product product)
Persist a
Product instance to the datastore |
void |
setCurrentDateResolution(Long currentDateResolution)
Sets the number of milliseconds that the current date/time will be cached for queries before refreshing.
|
protected javax.persistence.EntityManager em
protected EntityConfiguration entityConfiguration
protected SandBoxHelper sandBoxHelper
protected ProductDaoExtensionManager extensionManager
protected DialectHelper dialectHelper
protected Long currentDateResolution
protected Date cachedDate
public Product save(Product product)
ProductDaoProduct instance to the datastoresave in interface ProductDaoproduct - the product instancepublic Product readProductById(Long productId)
ProductDaoProduct instance by its primary keyreadProductById in interface ProductDaoproductId - the primary key of the productpublic List<Product> readProductsByIds(List<Long> productIds)
ProductDaoreadProductsByIds in interface ProductDaoproductIds - the list of primary keys for productspublic List<Product> readProductsByName(String searchName)
ProductDaoProduct instances whose name starts with
or is equal to the passed in search parameterreadProductsByName in interface ProductDaosearchName - the partial or whole name to matchpublic List<Product> readProductsByName(@Nonnull String searchName, @Nonnull int limit, @Nonnull int offset)
ProductDaoProduct instances whose name starts with
or is equal to the passed in search parameter. ResreadProductsByName in interface ProductDaolimit - the maximum number of resultsoffset - the starting point in the record setprotected Date getCurrentDateAfterFactoringInDateResolution()
public List<Product> readActiveProductsByCategory(Long categoryId)
ProductDaoreadActiveProductsByCategory in interface ProductDaocategoryId - the primary key of the category to whom the resulting product list should be related@Deprecated public List<Product> readActiveProductsByCategory(Long categoryId, Date currentDate)
readActiveProductsByCategory in interface ProductDaocategoryId - the primary key of the category to whom the resulting product list should be relatedcurrentDate - the date for which the products should be checked against to determine their active stateprotected List<Product> readActiveProductsByCategoryInternal(Long categoryId, Date currentDate)
public List<Product> readFilteredActiveProductsByQuery(String query, ProductSearchCriteria searchCriteria)
ProductDaoreadFilteredActiveProductsByQuery in interface ProductDao@Deprecated public List<Product> readFilteredActiveProductsByQuery(String query, Date currentDate, ProductSearchCriteria searchCriteria)
readFilteredActiveProductsByQuery in interface ProductDaoprotected List<Product> readFilteredActiveProductsByQueryInternal(String query, Date currentDate, ProductSearchCriteria searchCriteria)
public List<Product> readFilteredActiveProductsByCategory(Long categoryId, ProductSearchCriteria searchCriteria)
ProductDaoreadFilteredActiveProductsByCategory in interface ProductDao@Deprecated public List<Product> readFilteredActiveProductsByCategory(Long categoryId, Date currentDate, ProductSearchCriteria searchCriteria)
readFilteredActiveProductsByCategory in interface ProductDaoprotected List<Product> readFilteredActiveProductsByCategoryInternal(Long categoryId, Date currentDate, ProductSearchCriteria searchCriteria)
protected void attachActiveRestriction(Date currentDate, javax.persistence.criteria.Path<? extends Product> product, javax.persistence.criteria.Path<? extends Sku> sku, List<javax.persistence.criteria.Predicate> restrictions)
protected void attachOrderBy(ProductSearchCriteria searchCriteria, javax.persistence.criteria.From<?,? extends Product> product, javax.persistence.criteria.Path<? extends Sku> sku, javax.persistence.criteria.CriteriaQuery<?> criteria)
protected void attachProductSearchCriteria(ProductSearchCriteria searchCriteria, javax.persistence.criteria.From<?,? extends Product> product, javax.persistence.criteria.From<?,? extends Sku> sku, List<javax.persistence.criteria.Predicate> restrictions)
public List<Product> readActiveProductsByCategory(Long categoryId, int limit, int offset)
ProductDaoreadActiveProductsByCategory in interface ProductDao@Deprecated public List<Product> readActiveProductsByCategory(Long categoryId, Date currentDate, int limit, int offset)
readActiveProductsByCategory in interface ProductDaopublic List<Product> readActiveProductsByCategoryInternal(Long categoryId, Date currentDate, int limit, int offset)
public List<Product> readProductsByCategory(Long categoryId)
ProductDaoreadProductsByCategory in interface ProductDaocategoryId - the primary key of the category to whom the resulting product list should be relatedpublic List<Product> readProductsByCategory(Long categoryId, int limit, int offset)
ProductDaoreadProductsByCategory in interface ProductDaocategoryId - 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 setpublic void delete(Product product)
ProductDaodelete in interface ProductDaoproduct - the product instance to removepublic Product create(ProductType productType)
ProductDaoProduct instance. The system will use the configuration in
/BroadleafCommerce/core/BroadleafCommerceFramework/src/main/resources/bl-framework-applicationContext-entity.xml
to determine which polymorphic version of Product to instantiate. To make Broadleaf instantiate your
extension of Product by default, include an entity configuration bean in your application context xml similar to:
<bean id="blEntityConfiguration" class="org.broadleafcommerce.common.persistence.EntityConfiguration">
<property name="entityContexts">
<list>
<value>classpath:myCompany-applicationContext-entity.xml</value>
</list>
</property>
</bean>
create in interface ProductDaoproductType - the type of product you would like to create (presumably a Product or ProductSku instance). The getType method of ProductType provides the key for the entity configuration.Product instance based on the Broadleaf entity configuration.public List<ProductBundle> readAutomaticProductBundles()
ProductDaoreadAutomaticProductBundles in interface ProductDaopublic Long getCurrentDateResolution()
ProductDaogetCurrentDateResolution in interface ProductDaopublic void setCurrentDateResolution(Long currentDateResolution)
ProductDaosetCurrentDateResolution in interface ProductDaocurrentDateResolution - the milliseconds to cache the current date/timepublic List<Product> findProductByURI(String uri)
ProductDaofindProductByURI in interface ProductDaopublic List<Product> readAllActiveProducts(int page, int pageSize)
ProductDaoProductDao.readAllActiveProducts() 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.readAllActiveProducts in interface ProductDaopage - - the number of the page to get (0 indexed)pageSize - - the number of results per page@Deprecated public List<Product> readAllActiveProducts(int page, int pageSize, Date currentDate)
readAllActiveProducts in interface ProductDaopage - - the number of the page to get (0 indexed)pageSize - - the number of results per pageprotected List<Product> readAllActiveProductsInternal(int page, int pageSize, Date currentDate)
public List<Product> readAllActiveProducts()
ProductDaoreadAllActiveProducts in interface ProductDao@Deprecated public List<Product> readAllActiveProducts(Date currentDate)
readAllActiveProducts in interface ProductDaoprotected List<Product> readAllActiveProductsInternal(Date currentDate)
public Long readCountAllActiveProducts()
ProductDaoreadCountAllActiveProducts in interface ProductDao@Deprecated public Long readCountAllActiveProducts(Date currentDate)
readCountAllActiveProducts in interface ProductDaoprotected Long readCountAllActiveProductsInternal(Date currentDate)
Copyright © 2015. All Rights Reserved.