fr.paris.lutece.plugins.stock.modules.tickets.service
Class StatisticService

java.lang.Object
  extended by fr.paris.lutece.plugins.stock.modules.tickets.service.StatisticService
All Implemented Interfaces:
IStatisticService

public class StatisticService
extends java.lang.Object
implements IStatisticService

The service Statistic.


Field Summary
static java.lang.String CONSTANT_GROUP_BY_DAY
          The CONSTAN t_ grou p_ b y_ day.
static java.lang.String CONSTANT_GROUP_BY_MONTH
          The CONSTAN t_ grou p_ b y_ month.
static java.lang.String CONSTANT_GROUP_BY_WEEK
          The CONSTAN t_ grou p_ b y_ week.
static java.lang.String EMPTY_STRING
          The EMPT y_ string.
static java.lang.String EXPORT_HEADER_DATE
          The EXPOR t_ heade r_ date.
static java.lang.String EXPORT_HEADER_GROUPE_DAY
          The EXPOR t_ heade r_ group e_ day.
static java.lang.String EXPORT_HEADER_GROUPE_MONTH
          The EXPOR t_ heade r_ group e_ month.
static java.lang.String EXPORT_HEADER_GROUPE_WEEK
          The EXPOR t_ heade r_ group e_ week.
static java.lang.String EXPORT_HEADER_NB_PRODUCTS
          The EXPOR t_ heade r_ n b_ products.
 
Constructor Summary
StatisticService()
           
 
Method Summary
static java.sql.Timestamp addStatisticInterval(java.sql.Timestamp timestamp, java.lang.String strTimesUnit, int nDecal)
          return a timestamp Object which correspond to the timestamp in parameter add with a number of times unit (day,week,month)specify in strTimesUnit .
static java.util.List<java.lang.String[]> buildListToCSVWriter(java.util.Collection<ResultStatistic> listData, java.lang.String strTimesUnit, java.util.Locale locale)
          Converts the informations to export into a list of String[].
static org.jfree.chart.JFreeChart createXYGraph(java.util.List<ResultStatistic> listStatistic, java.lang.String strLabelX, java.lang.String strLableY, java.lang.String strTimesUnit)
          create a JFreeChart Graph function of the statistic form submit.
 void doManageProductSaving(ShowDTO productDTO)
          Modifies a productStatistic
 void doManagePurchaseSaving(ReservationDTO purchaseDTO)
          Modifies a purchaseStatistic
 void doRemoveProductStatisticByIdProduct(java.lang.Integer nIdProduct)
          remove all product statistic associated to the product identifier
 void doRemovePurchaseStatisticByIdPurchase(java.lang.Integer nIdPurchase)
          remove all purchase statistic associated to the purchase identifier
 java.lang.Integer getCountProductALAffiche()
          get the product showing count
 java.lang.Integer getCountProductAVenir()
          get the product forthcoming count
 java.lang.Integer getCountProductsByDates(java.lang.String strDateDebut, java.lang.String strDateFin)
          get the products count by dates parameters
 java.lang.Integer getCountPurchaseOfDay()
          get the purchase day count
 java.lang.Integer getCountPurchaseOfMonth()
          get the purchase month count
 java.lang.Integer getCountPurchasesByDates(java.lang.String strDateDebut, java.lang.String strDateFin)
          get the purchase count by dates parameters.
 java.util.List<ResultStatistic> getProductStatistic(java.lang.String strTimesUnit, java.lang.String strDateDebut, java.lang.String strDateFin)
          get a list of ResultStatistic containing all associations of date and number of product by parameters
 java.util.List<ResultStatistic> getPurchaseStatistic(java.lang.String strTimesUnit, java.lang.String strDateDebut, java.lang.String strDateFin)
          get a list of ResultStatistic containing all associations of date and number of purchase by parameters
static boolean sameDate(java.sql.Timestamp timestamp1, java.sql.Timestamp timestamp2, java.lang.String strTimesUnit)
          Compare two timestamp and return true if they have the same times unit(Day,week,month).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTANT_GROUP_BY_DAY

public static final java.lang.String CONSTANT_GROUP_BY_DAY
The CONSTAN t_ grou p_ b y_ day.

See Also:
Constant Field Values

CONSTANT_GROUP_BY_WEEK

public static final java.lang.String CONSTANT_GROUP_BY_WEEK
The CONSTAN t_ grou p_ b y_ week.

See Also:
Constant Field Values

CONSTANT_GROUP_BY_MONTH

public static final java.lang.String CONSTANT_GROUP_BY_MONTH
The CONSTAN t_ grou p_ b y_ month.

See Also:
Constant Field Values

EXPORT_HEADER_DATE

public static final java.lang.String EXPORT_HEADER_DATE
The EXPOR t_ heade r_ date.

See Also:
Constant Field Values

EXPORT_HEADER_NB_PRODUCTS

public static final java.lang.String EXPORT_HEADER_NB_PRODUCTS
The EXPOR t_ heade r_ n b_ products.

See Also:
Constant Field Values

EXPORT_HEADER_GROUPE_DAY

public static final java.lang.String EXPORT_HEADER_GROUPE_DAY
The EXPOR t_ heade r_ group e_ day.

See Also:
Constant Field Values

EXPORT_HEADER_GROUPE_WEEK

public static final java.lang.String EXPORT_HEADER_GROUPE_WEEK
The EXPOR t_ heade r_ group e_ week.

See Also:
Constant Field Values

EXPORT_HEADER_GROUPE_MONTH

public static final java.lang.String EXPORT_HEADER_GROUPE_MONTH
The EXPOR t_ heade r_ group e_ month.

See Also:
Constant Field Values

EMPTY_STRING

public static final java.lang.String EMPTY_STRING
The EMPT y_ string.

See Also:
Constant Field Values
Constructor Detail

StatisticService

public StatisticService()
Method Detail

addStatisticInterval

public static java.sql.Timestamp addStatisticInterval(java.sql.Timestamp timestamp,
                                                      java.lang.String strTimesUnit,
                                                      int nDecal)
return a timestamp Object which correspond to the timestamp in parameter add with a number of times unit (day,week,month)specify in strTimesUnit .

Parameters:
timestamp - date
strTimesUnit - (day,week,month)
nDecal - the number of timesUnit
Returns:
a timestamp Object which correspond with the string specified in parameter add with a number of times unit (day,week,month)specify in strTimesUnit.

sameDate

public static boolean sameDate(java.sql.Timestamp timestamp1,
                               java.sql.Timestamp timestamp2,
                               java.lang.String strTimesUnit)
Compare two timestamp and return true if they have the same times unit(Day,week,month).

Parameters:
timestamp1 - timestamp1
timestamp2 - timestamp2
strTimesUnit - (day,week,month)
Returns:
Compare two timestamp and return true if they have the same times unit(Day,week,month)

doManageProductSaving

public void doManageProductSaving(ShowDTO productDTO)
Modifies a productStatistic

Specified by:
doManageProductSaving in interface IStatisticService
Parameters:
productDTO - The product of the productStatistic to modify in database

getProductStatistic

public java.util.List<ResultStatistic> getProductStatistic(java.lang.String strTimesUnit,
                                                           java.lang.String strDateDebut,
                                                           java.lang.String strDateFin)
get a list of ResultStatistic containing all associations of date and number of product by parameters

Specified by:
getProductStatistic in interface IStatisticService
Parameters:
strTimesUnit - the time unit
strDateDebut - the date begin
strDateFin - teh date end
Returns:
the list of ResultStatistic

createXYGraph

public static org.jfree.chart.JFreeChart createXYGraph(java.util.List<ResultStatistic> listStatistic,
                                                       java.lang.String strLabelX,
                                                       java.lang.String strLableY,
                                                       java.lang.String strTimesUnit)
create a JFreeChart Graph function of the statistic form submit.

Parameters:
listStatistic - the list of statistic of form submit
strLabelX - the label of axis x
strLableY - the label of axis x
strTimesUnit - the times unit of axis x(Day,Week,Month)
Returns:
a JFreeChart Graph function of the statistic form submit

getCountProductsByDates

public java.lang.Integer getCountProductsByDates(java.lang.String strDateDebut,
                                                 java.lang.String strDateFin)
get the products count by dates parameters

Specified by:
getCountProductsByDates in interface IStatisticService
Parameters:
strDateDebut - the date begin
strDateFin - teh date end
Returns:
the product count

buildListToCSVWriter

public static java.util.List<java.lang.String[]> buildListToCSVWriter(java.util.Collection<ResultStatistic> listData,
                                                                      java.lang.String strTimesUnit,
                                                                      java.util.Locale locale)
Converts the informations to export into a list of String[].

Parameters:
listData - The list data to convert
strTimesUnit - the str times unit
locale - the locale
Returns:
a list of String[] corresponding to listData or null if there is no data to convert

doManagePurchaseSaving

public void doManagePurchaseSaving(ReservationDTO purchaseDTO)
Modifies a purchaseStatistic

Specified by:
doManagePurchaseSaving in interface IStatisticService
Parameters:
purchaseDTO - The purchase of the purchaseStatistic to modify in database

getPurchaseStatistic

public java.util.List<ResultStatistic> getPurchaseStatistic(java.lang.String strTimesUnit,
                                                            java.lang.String strDateDebut,
                                                            java.lang.String strDateFin)
get a list of ResultStatistic containing all associations of date and number of purchase by parameters

Specified by:
getPurchaseStatistic in interface IStatisticService
Parameters:
strTimesUnit - the time unit
strDateDebut - the date begin
strDateFin - teh date end
Returns:
the list of ResultStatistic

getCountPurchasesByDates

public java.lang.Integer getCountPurchasesByDates(java.lang.String strDateDebut,
                                                  java.lang.String strDateFin)
get the purchase count by dates parameters.

Specified by:
getCountPurchasesByDates in interface IStatisticService
Parameters:
strDateDebut - the date begin
strDateFin - the date end
Returns:
the count purchases by dates

getCountProductALAffiche

public java.lang.Integer getCountProductALAffiche()
get the product showing count

Specified by:
getCountProductALAffiche in interface IStatisticService
Returns:
the product count

getCountProductAVenir

public java.lang.Integer getCountProductAVenir()
get the product forthcoming count

Specified by:
getCountProductAVenir in interface IStatisticService
Returns:
the product count

getCountPurchaseOfDay

public java.lang.Integer getCountPurchaseOfDay()
get the purchase day count

Specified by:
getCountPurchaseOfDay in interface IStatisticService
Returns:
the purchase count

getCountPurchaseOfMonth

public java.lang.Integer getCountPurchaseOfMonth()
get the purchase month count

Specified by:
getCountPurchaseOfMonth in interface IStatisticService
Returns:
the purchase count

doRemoveProductStatisticByIdProduct

public void doRemoveProductStatisticByIdProduct(java.lang.Integer nIdProduct)
remove all product statistic associated to the product identifier

Specified by:
doRemoveProductStatisticByIdProduct in interface IStatisticService
Parameters:
nIdProduct - the identifier of the product

doRemovePurchaseStatisticByIdPurchase

public void doRemovePurchaseStatisticByIdPurchase(java.lang.Integer nIdPurchase)
remove all purchase statistic associated to the purchase identifier

Specified by:
doRemovePurchaseStatisticByIdPurchase in interface IStatisticService
Parameters:
nIdPurchase - the identifier of the product


Copyright © 2012 Mairie de Paris. All Rights Reserved.