fr.paris.lutece.plugins.stock.business.purchase
Class PurchaseDAO<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<java.lang.Integer,Purchase>
              extended by fr.paris.lutece.plugins.stock.business.purchase.PurchaseDAO<K,E>
Type Parameters:
K - the key type
E - the entity type
All Implemented Interfaces:
IPurchaseDAO, fr.paris.lutece.util.jpa.IGenericDAO<java.lang.Integer,Purchase>

public class PurchaseDAO<K,E>
extends fr.paris.lutece.plugins.stock.commons.dao.AbstractStockDAO<java.lang.Integer,Purchase>
implements IPurchaseDAO

This class provides Data Access methods for Purchase objects.


Constructor Summary
PurchaseDAO()
           
 
Method Summary
protected  void buildCriteriaQuery(PurchaseFilter filter, javax.persistence.criteria.Root<Purchase> root, javax.persistence.criteria.CriteriaQuery<Purchase> query, javax.persistence.criteria.CriteriaBuilder builder)
          Build the criteria query used when purchases are searched by filter.
protected  void buildSortQuery(PurchaseFilter filter, javax.persistence.criteria.Root<Purchase> root, javax.persistence.criteria.CriteriaQuery<Purchase> query, javax.persistence.criteria.CriteriaBuilder builder)
          Add the order by parameter to the query.
 fr.paris.lutece.plugins.stock.commons.ResultList<Purchase> findByFilter(PurchaseFilter filter, fr.paris.lutece.plugins.stock.commons.dao.PaginationProperties paginationProperties)
          Find purchases by filter.
 java.lang.Integer getCountPurchaseByBeginDateAndLastDate(java.lang.String strDateDebut, java.lang.String strDateFin)
          Return the number of purchase for the current month
 java.lang.String getPluginName()
           
 java.lang.Integer getQuantityPurchasedByIdProductAndUserName(java.lang.Integer idProduct, java.lang.Integer idOfferGenre, java.lang.String userName)
          Return the number of reservation for an offer and an agent.
 
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.util.jpa.IGenericDAO
create, detach, findAll, findById, flush, remove, update
 

Constructor Detail

PurchaseDAO

public PurchaseDAO()
Method Detail

getPluginName

public java.lang.String getPluginName()
Specified by:
getPluginName in class fr.paris.lutece.portal.service.jpa.JPALuteceDAO<java.lang.Integer,Purchase>

findByFilter

public fr.paris.lutece.plugins.stock.commons.ResultList<Purchase> findByFilter(PurchaseFilter filter,
                                                                               fr.paris.lutece.plugins.stock.commons.dao.PaginationProperties paginationProperties)
Find purchases by filter.

Specified by:
findByFilter in interface IPurchaseDAO
Parameters:
filter - the filter
paginationProperties - the pagination properties
Returns:
list of purchases

buildCriteriaQuery

protected void buildCriteriaQuery(PurchaseFilter filter,
                                  javax.persistence.criteria.Root<Purchase> root,
                                  javax.persistence.criteria.CriteriaQuery<Purchase> query,
                                  javax.persistence.criteria.CriteriaBuilder builder)
Build the criteria query used when purchases are searched by filter.

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

buildSortQuery

protected void buildSortQuery(PurchaseFilter filter,
                              javax.persistence.criteria.Root<Purchase> root,
                              javax.persistence.criteria.CriteriaQuery<Purchase> query,
                              javax.persistence.criteria.CriteriaBuilder builder)
Add the order by parameter to the query.

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

getQuantityPurchasedByIdProductAndUserName

public java.lang.Integer getQuantityPurchasedByIdProductAndUserName(java.lang.Integer idProduct,
                                                                    java.lang.Integer idOfferGenre,
                                                                    java.lang.String userName)
Return the number of reservation for an offer and an agent.

Specified by:
getQuantityPurchasedByIdProductAndUserName in interface IPurchaseDAO
Parameters:
idProduct - offer id
idOfferGenre - the id offer genre
userName - agent userName
Returns:
number of reservation

getCountPurchaseByBeginDateAndLastDate

public java.lang.Integer getCountPurchaseByBeginDateAndLastDate(java.lang.String strDateDebut,
                                                                java.lang.String strDateFin)
Return the number of purchase for the current month

Specified by:
getCountPurchaseByBeginDateAndLastDate in interface IPurchaseDAO
Parameters:
strDateDebut - the first date of the month
strDateFin - the last date of the month
Returns:
number of purchase


Copyright © 2012 Mairie de Paris. All Rights Reserved.