|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.broadleafcommerce.core.catalog.dao.ProductDaoImpl
@Repository(value="blProductDao") public class ProductDaoImpl
| Field Summary | |
|---|---|
protected Date |
currentDate
|
protected Long |
currentDateResolution
|
protected javax.persistence.EntityManager |
em
|
protected EntityConfiguration |
entityConfiguration
|
| Constructor Summary | |
|---|---|
ProductDaoImpl()
|
|
| Method Summary | |
|---|---|
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)
|
Long |
getCurrentDateResolution()
Returns the number of milliseconds that the current date/time will be cached for queries before refreshing. |
protected Date |
getDateFactoringInDateResolution(Date currentDate)
|
List<Product> |
readActiveProductsByCategory(Long categoryId,
Date currentDate)
Find all products whose start and end dates are before and after the passed in date and who are related to the given category |
List<Product> |
readActiveProductsByCategory(Long categoryId,
Date currentDate,
int limit,
int offset)
|
List<Product> |
readAllActiveProducts(Date currentDate)
Reads all products from the database that are currently active. |
List<Product> |
readAllActiveProducts(int page,
int pageSize,
Date currentDate)
Reads all products from the database that are currently active. |
List<ProductBundle> |
readAutomaticProductBundles()
Returns all active ProductBundles whose automatic property is true. |
Long |
readCountAllActiveProducts(Date currentDate)
Returns the number of products that are currently active. |
List<Product> |
readFilteredActiveProductsByCategory(Long categoryId,
Date currentDate,
ProductSearchCriteria 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. |
List<Product> |
readFilteredActiveProductsByQuery(String query,
Date currentDate,
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. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected javax.persistence.EntityManager em
protected EntityConfiguration entityConfiguration
protected Long currentDateResolution
protected Date currentDate
| Constructor Detail |
|---|
public ProductDaoImpl()
| Method Detail |
|---|
public Product save(Product product)
ProductDaoProduct instance to the datastore
save in interface ProductDaoproduct - the product instance
public Product readProductById(Long productId)
ProductDaoProduct instance by its primary key
readProductById in interface ProductDaoproductId - the primary key of the product
public List<Product> readProductsByIds(List<Long> productIds)
ProductDao
readProductsByIds in interface ProductDaoproductIds - the list of primary keys for products
public List<Product> readProductsByName(String searchName)
ProductDaoProduct instances whose name starts with
or is equal to the passed in search parameter
readProductsByName in interface ProductDaosearchName - the partial or whole name to match
public 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. Res
readProductsByName in interface ProductDaolimit - the maximum number of resultsoffset - the starting point in the record set
protected Date getDateFactoringInDateResolution(Date currentDate)
public List<Product> readActiveProductsByCategory(Long categoryId,
Date currentDate)
ProductDao
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 state
public List<Product> readFilteredActiveProductsByQuery(String query,
Date currentDate,
ProductSearchCriteria searchCriteria)
ProductDao
readFilteredActiveProductsByQuery in interface ProductDao
public List<Product> readFilteredActiveProductsByCategory(Long categoryId,
Date currentDate,
ProductSearchCriteria searchCriteria)
ProductDao
readFilteredActiveProductsByCategory in interface ProductDao
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,
Date currentDate,
int limit,
int offset)
readActiveProductsByCategory in interface ProductDaopublic List<Product> readProductsByCategory(Long categoryId)
ProductDao
readProductsByCategory in interface ProductDaocategoryId - the primary key of the category to whom the resulting product list should be related
public List<Product> readProductsByCategory(Long categoryId,
int limit,
int offset)
ProductDao
readProductsByCategory 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 set
public void delete(Product product)
ProductDao
delete 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()
ProductDao
readAutomaticProductBundles in interface ProductDaopublic Long getCurrentDateResolution()
ProductDao
getCurrentDateResolution in interface ProductDaopublic void setCurrentDateResolution(Long currentDateResolution)
ProductDao
setCurrentDateResolution in interface ProductDaocurrentDateResolution - the milliseconds to cache the current date/timepublic List<Product> findProductByURI(String uri)
ProductDao
findProductByURI in interface ProductDao
public List<Product> readAllActiveProducts(int page,
int pageSize,
Date currentDate)
ProductDaoProductDao.readAllActiveProducts(Date) 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
public List<Product> readAllActiveProducts(Date currentDate)
ProductDao
readAllActiveProducts in interface ProductDaopublic Long readCountAllActiveProducts(Date currentDate)
ProductDao
readCountAllActiveProducts in interface ProductDaoprotected javax.persistence.criteria.CriteriaQuery<Product> getCriteriaForActiveProducts(Date currentDate)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||