fr.paris.lutece.plugins.stock.business.product
Class ProductDAO<K,E>

java.lang.Object
  extended by fr.paris.lutece.util.jpa.JPAGenericDAO<K,E>
      extended by fr.paris.lutece.portal.service.jpa.JPALuteceDAO<K,E>
          extended by fr.paris.lutece.plugins.stock.commons.dao.AbstractStockDAO<Integer,Product>
              extended by fr.paris.lutece.plugins.stock.business.product.ProductDAO<K,E>
Type Parameters:
K - the key type
E - the element type
All Implemented Interfaces:
IProductDAO, fr.paris.lutece.plugins.stock.commons.dao.IStockDAO<Integer,Product>, fr.paris.lutece.util.jpa.IGenericDAO<Integer,Product>

public class ProductDAO<K,E>
extends fr.paris.lutece.plugins.stock.commons.dao.AbstractStockDAO<Integer,Product>
implements IProductDAO

This class provides Data Access methods for Product objects.


Constructor Summary
ProductDAO()
           
 
Method Summary
protected  void buildCriteriaQuery(ProductFilter filter, javax.persistence.criteria.Root<Product> root, javax.persistence.criteria.CriteriaQuery<Product> query, javax.persistence.criteria.CriteriaBuilder builder)
          Build the criteria query from the filter.
protected  List<javax.persistence.criteria.Predicate> buildPredicates(ProductFilter filter, javax.persistence.criteria.Root<Product> root, javax.persistence.criteria.CriteriaBuilder builder)
          Build the predicate list from filter.
protected  void buildSortQuery(ProductFilter filter, javax.persistence.criteria.Root<Product> root, javax.persistence.criteria.CriteriaQuery<Product> query, javax.persistence.criteria.CriteriaBuilder builder)
          Build the sort query.
 List<Product> findByFilter(ProductFilter filter)
          Find product list by filter.
 fr.paris.lutece.plugins.stock.commons.ResultList<Product> findByFilter(ProductFilter filter, fr.paris.lutece.plugins.stock.commons.dao.PaginationProperties paginationProperties)
          Finds by filter.
 List<Product> getAllByName(String name)
          Returns products by name
 Integer getCountProductALAfficheByDate(String strDate)
          Return the number of current product
 Integer getCountProductAVenirByDate(String strDate)
          Return the number of future product
 String getPluginName()
          
 Boolean isFull(Integer productId)
          Check if product is ful
 Boolean isType(Integer productId, Integer genreId)
          Check if product is type of representation
 
Methods inherited from class fr.paris.lutece.plugins.stock.commons.dao.AbstractStockDAO
addRestriction, createPagedQuery, findAll
 
Methods inherited from class fr.paris.lutece.portal.service.jpa.JPALuteceDAO
createNativeQuery, getEntityManagerFactory
 
Methods inherited from class fr.paris.lutece.util.jpa.JPAGenericDAO
create, detach, findAll, findById, flush, getEM, getEntityClass, getEntityClassName, remove, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.paris.lutece.plugins.stock.commons.dao.IStockDAO
findAll
 
Methods inherited from interface fr.paris.lutece.util.jpa.IGenericDAO
create, detach, findAll, findById, flush, remove, update
 

Constructor Detail

ProductDAO

public ProductDAO()
Method Detail

getPluginName

public String getPluginName()

Specified by:
getPluginName in class fr.paris.lutece.portal.service.jpa.JPALuteceDAO<Integer,Product>

findByFilter

public List<Product> findByFilter(ProductFilter filter)
Find product list by filter.

Specified by:
findByFilter in interface IProductDAO
Parameters:
filter - the filter
Returns:
the list of product

findByFilter

public fr.paris.lutece.plugins.stock.commons.ResultList<Product> findByFilter(ProductFilter filter,
                                                                              fr.paris.lutece.plugins.stock.commons.dao.PaginationProperties paginationProperties)
Finds by filter.

Specified by:
findByFilter in interface IProductDAO
Parameters:
filter - the filter
paginationProperties - the pagination properties
Returns:
the product list

buildPredicates

protected List<javax.persistence.criteria.Predicate> buildPredicates(ProductFilter filter,
                                                                     javax.persistence.criteria.Root<Product> root,
                                                                     javax.persistence.criteria.CriteriaBuilder builder)
Build the predicate list from filter.

Parameters:
filter - the filter
root - the product root
builder - the criteria builder
Returns:
the predicate list

buildCriteriaQuery

protected void buildCriteriaQuery(ProductFilter filter,
                                  javax.persistence.criteria.Root<Product> root,
                                  javax.persistence.criteria.CriteriaQuery<Product> query,
                                  javax.persistence.criteria.CriteriaBuilder builder)
Build the criteria query from the filter.

Parameters:
filter - the filter
root - the category root
query - the criteria query
builder - the criteria builder

buildSortQuery

protected void buildSortQuery(ProductFilter filter,
                              javax.persistence.criteria.Root<Product> root,
                              javax.persistence.criteria.CriteriaQuery<Product> query,
                              javax.persistence.criteria.CriteriaBuilder builder)
Build the sort query.

Parameters:
filter - the filter
root - the product root
query - the criteria query
builder - the criteria builder

getAllByName

public List<Product> getAllByName(String name)
Returns products by name

Specified by:
getAllByName in interface IProductDAO
Parameters:
name - product name
Returns:
products list

getCountProductALAfficheByDate

public Integer getCountProductALAfficheByDate(String strDate)
Return the number of current product

Specified by:
getCountProductALAfficheByDate in interface IProductDAO
Parameters:
strDate - the current date
Returns:
number of product

getCountProductAVenirByDate

public Integer getCountProductAVenirByDate(String strDate)
Return the number of future product

Specified by:
getCountProductAVenirByDate in interface IProductDAO
Parameters:
strDate - the current date
Returns:
number of product

isFull

public Boolean isFull(Integer productId)
Check if product is ful

Specified by:
isFull in interface IProductDAO
Parameters:
productId - the product id
Returns:
true if full, false otherwise

isType

public Boolean isType(Integer productId,
                      Integer genreId)
Check if product is type of representation

Specified by:
isType in interface IProductDAO
Parameters:
genreId - the genre to check
Returns:
true if product is, false otherwise


Copyright © 2014 Mairie de Paris. All Rights Reserved.