it.eng.spagobi.kpi.config.dao
Class KpiDAOImpl

java.lang.Object
  extended by it.eng.spagobi.commons.dao.AbstractHibernateDAO
      extended by it.eng.spagobi.kpi.config.dao.KpiDAOImpl
All Implemented Interfaces:
IKpiDAO

public class KpiDAOImpl
extends AbstractHibernateDAO
implements IKpiDAO


Constructor Summary
KpiDAOImpl()
           
 
Method Summary
 boolean deleteKpi(java.lang.Integer kpiId)
           
 void deleteResource(java.lang.Integer resouceId)
           
 java.lang.String getChartType(java.lang.Integer kpiInstanceID)
          Returns the ChartType of the specific KpiInstance (it could also be null)
 KpiValue getDisplayKpiValue(java.lang.Integer kpiInstanceId, java.util.Date d, Resource r)
          The last KpiValue for the the KpiInstance selected, for the resource selected, in the date selected or before
 it.eng.spagobi.tools.dataset.bo.IDataSet getDsFromKpiId(java.lang.Integer kpiId)
          Returns the DatasetConfig for the KPI with id kpiId
 java.lang.String getKpiTrendXmlResult(java.lang.Integer resId, java.lang.Integer kpiInstId, java.util.Date endDate)
          Returns a List of all the the Threshols of the KpiInstance
 KpiValue getKpiValue(java.lang.Integer kpiInstanceId, java.util.Date d, Resource r)
          KpiValue valid for the the KpiInstance selected, for the resource selected, in the date selected
 java.util.List getKpiValue(SbiKpiInstance kpi, java.util.Date d)
           
 java.lang.Integer getPeriodicitySeconds(java.lang.Integer periodicityId)
          Returns an Integer representing the seconds of the Periodicity with id periodicityId
 java.util.List getThresholds(KpiInstance k)
          Returns a List of all the the Threshols of the KpiInstance
 java.lang.Integer insertKpi(Kpi kpi)
           
 void insertKpiValue(KpiValue value)
          Inserts a new KPI Value with its date, value period and thresholds
 java.lang.Integer insertResource(Resource toCreate)
           
 void isAlarmingValue(KpiValue value)
          For the specific KpiValue verifies if it is ok with every threshold and if not writes an alarm event in the AlarmEvent table so that later on an alarm will be sent
 java.lang.Boolean isKpiInstUnderAlramControl(java.lang.Integer kpiInstID)
          Returns True if the KPIInstance with id kpiInstID is under AlarmControl, false if it is not
 Kpi loadKpiById(java.lang.Integer id)
          Returns the Kpi of the referred id
 Kpi loadKpiDefinitionById(java.lang.Integer id)
          Returns the Kpi Definition of the referred id
 KpiInstance loadKpiInstanceById(java.lang.Integer id)
          Returns the KpiInstance of the referred id
 KpiInstance loadKpiInstanceByIdFromHistory(java.lang.Integer id, java.util.Date d)
          Returns the KpiInstance with id 'id' that was valid in date d
 java.util.List loadKpiList()
          Returns the list of Kpi.
 java.util.List loadKpiList(java.lang.String fieldOrder, java.lang.String typeOrder)
           
 ModelInstanceNode loadModelInstanceById(java.lang.Integer id, java.util.Date requestedDate)
          Returns the ModelInstance of the referred id
 ModelInstanceNode loadModelInstanceByLabel(java.lang.String label, java.util.Date requestedDate)
          Returns the ModelInstance of the referred label
 Resource loadResourceById(java.lang.Integer id)
          Returns the Resource of the referred id
 java.util.List loadResourcesList(java.lang.String fieldOrder, java.lang.String typeOrder)
           
 java.util.List loadThresholdsById(java.lang.Integer id)
          Loads the list of Threshold interval for the threshold with id 'id'
 void modifyKpi(Kpi kpi)
           
 void modifyResource(Resource resource)
           
 void setKpiInstanceFromKPI(KpiInstance kpiInstance, java.lang.Integer kpiId)
           
 Kpi toKpi(SbiKpi kpi)
           
 Threshold toThreshold(SbiThresholdValue t)
           
 
Methods inherited from class it.eng.spagobi.commons.dao.AbstractHibernateDAO
getSession, logException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KpiDAOImpl

public KpiDAOImpl()
Method Detail

loadModelInstanceByLabel

public ModelInstanceNode loadModelInstanceByLabel(java.lang.String label,
                                                  java.util.Date requestedDate)
                                           throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Returns the ModelInstance of the referred label

Specified by:
loadModelInstanceByLabel in interface IKpiDAO
Parameters:
label - of the ModelInstance
Returns:
ModelInstance of the referred id
Throws:
it.eng.spago.error.EMFUserError - If an Exception occurred

loadModelInstanceById

public ModelInstanceNode loadModelInstanceById(java.lang.Integer id,
                                               java.util.Date requestedDate)
                                        throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Returns the ModelInstance of the referred id

Specified by:
loadModelInstanceById in interface IKpiDAO
Parameters:
id - of the ModelInstance
Returns:
ModelInstance of the referred id
Throws:
it.eng.spago.error.EMFUserError - If an Exception occurred

loadKpiInstanceById

public KpiInstance loadKpiInstanceById(java.lang.Integer id)
                                throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Returns the KpiInstance of the referred id

Specified by:
loadKpiInstanceById in interface IKpiDAO
Parameters:
id - of the KpiInstance
Returns:
KpiInstance of the referred id
Throws:
it.eng.spago.error.EMFUserError - If an Exception occurred

loadKpiInstanceByIdFromHistory

public KpiInstance loadKpiInstanceByIdFromHistory(java.lang.Integer id,
                                                  java.util.Date d)
                                           throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Returns the KpiInstance with id 'id' that was valid in date d

Specified by:
loadKpiInstanceByIdFromHistory in interface IKpiDAO
Parameters:
id - of the KpiInstance
Returns:
KpiInstance of the referred id valid in date d
Throws:
it.eng.spago.error.EMFUserError - If an Exception occurred

loadThresholdsById

public java.util.List loadThresholdsById(java.lang.Integer id)
                                  throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Loads the list of Threshold interval for the threshold with id 'id'

Specified by:
loadThresholdsById in interface IKpiDAO
Returns:
List of all the the Threshols for the threshold with id 'id'
Throws:
it.eng.spago.error.EMFUserError - If an Exception occurred

loadKpiDefinitionById

public Kpi loadKpiDefinitionById(java.lang.Integer id)
                          throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Returns the Kpi Definition of the referred id

Specified by:
loadKpiDefinitionById in interface IKpiDAO
Parameters:
id - of the Kpi
Returns:
Kpi of the referred id
Throws:
it.eng.spago.error.EMFUserError - If an Exception occurred

loadKpiById

public Kpi loadKpiById(java.lang.Integer id)
                throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Returns the Kpi of the referred id

Specified by:
loadKpiById in interface IKpiDAO
Parameters:
id - of the Kpi
Returns:
Kpi of the referred id
Throws:
it.eng.spago.error.EMFUserError - If an Exception occurred

getKpiTrendXmlResult

public java.lang.String getKpiTrendXmlResult(java.lang.Integer resId,
                                             java.lang.Integer kpiInstId,
                                             java.util.Date endDate)
                                      throws it.eng.spago.base.SourceBeanException
Description copied from interface: IKpiDAO
Returns a List of all the the Threshols of the KpiInstance

Specified by:
getKpiTrendXmlResult in interface IKpiDAO
Returns:
List of all the the Threshols of the KpiInstance
Throws:
it.eng.spago.base.SourceBeanException

loadResourceById

public Resource loadResourceById(java.lang.Integer id)
                          throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Returns the Resource of the referred id

Specified by:
loadResourceById in interface IKpiDAO
Parameters:
id - of the Resource
Returns:
Resource with the referred id
Throws:
it.eng.spago.error.EMFUserError - If an Exception occurred

getKpiValue

public java.util.List getKpiValue(SbiKpiInstance kpi,
                                  java.util.Date d)
                           throws it.eng.spago.error.EMFUserError
Throws:
it.eng.spago.error.EMFUserError

getPeriodicitySeconds

public java.lang.Integer getPeriodicitySeconds(java.lang.Integer periodicityId)
                                        throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Returns an Integer representing the seconds of the Periodicity with id periodicityId

Specified by:
getPeriodicitySeconds in interface IKpiDAO
Returns:
Integer representing the seconds of the Periodicity with id periodicityId
Throws:
it.eng.spago.error.EMFUserError - If an Exception occurred

insertKpiValue

public void insertKpiValue(KpiValue value)
                    throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Inserts a new KPI Value with its date, value period and thresholds

Specified by:
insertKpiValue in interface IKpiDAO
Throws:
it.eng.spago.error.EMFUserError - If an Exception occurred

getThresholds

public java.util.List getThresholds(KpiInstance k)
                             throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Returns a List of all the the Threshols of the KpiInstance

Specified by:
getThresholds in interface IKpiDAO
Returns:
List of all the the Threshols of the KpiInstance
Throws:
it.eng.spago.error.EMFUserError - If an Exception occurred

isKpiInstUnderAlramControl

public java.lang.Boolean isKpiInstUnderAlramControl(java.lang.Integer kpiInstID)
                                             throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Returns True if the KPIInstance with id kpiInstID is under AlarmControl, false if it is not

Specified by:
isKpiInstUnderAlramControl in interface IKpiDAO
Parameters:
kpiInstID - of the KPIInstance that we want to monitor
Returns:
Boolean that shows if the KPIInstance with id kpiInstID is under AlarmControl
Throws:
it.eng.spago.error.EMFUserError - if an Exception occurs

isAlarmingValue

public void isAlarmingValue(KpiValue value)
                     throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
For the specific KpiValue verifies if it is ok with every threshold and if not writes an alarm event in the AlarmEvent table so that later on an alarm will be sent

Specified by:
isAlarmingValue in interface IKpiDAO
Throws:
it.eng.spago.error.EMFUserError - if an Exception occurs

getDsFromKpiId

public it.eng.spagobi.tools.dataset.bo.IDataSet getDsFromKpiId(java.lang.Integer kpiId)
                                                        throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Returns the DatasetConfig for the KPI with id kpiId

Specified by:
getDsFromKpiId in interface IKpiDAO
Parameters:
kpiId - of the KPI
Returns:
DataSetConfig used to calculate the KPI with ID kpiId
Throws:
it.eng.spago.error.EMFUserError - if an Exception occurs

getKpiValue

public KpiValue getKpiValue(java.lang.Integer kpiInstanceId,
                            java.util.Date d,
                            Resource r)
                     throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
KpiValue valid for the the KpiInstance selected, for the resource selected, in the date selected

Specified by:
getKpiValue in interface IKpiDAO
Returns:
KpiValue valid for the the KpiInstance selected, for the resource selected, in the date selected
Throws:
it.eng.spago.error.EMFUserError - if an Exception occurs

getDisplayKpiValue

public KpiValue getDisplayKpiValue(java.lang.Integer kpiInstanceId,
                                   java.util.Date d,
                                   Resource r)
                            throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
The last KpiValue for the the KpiInstance selected, for the resource selected, in the date selected or before

Specified by:
getDisplayKpiValue in interface IKpiDAO
Returns:
The last KpiValue valid for the the KpiInstance selected, for the resource selected, in the date selected or before
Throws:
it.eng.spago.error.EMFUserError - if an Exception occurs

toKpi

public Kpi toKpi(SbiKpi kpi)
          throws it.eng.spago.error.EMFUserError
Throws:
it.eng.spago.error.EMFUserError

toThreshold

public Threshold toThreshold(SbiThresholdValue t)

getChartType

public java.lang.String getChartType(java.lang.Integer kpiInstanceID)
                              throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Returns the ChartType of the specific KpiInstance (it could also be null)

Specified by:
getChartType in interface IKpiDAO
Returns:
Returns the ChartType of the specific KpiInstance (it could also be null)
Throws:
it.eng.spago.error.EMFUserError - if an Exception occurs

loadKpiList

public java.util.List loadKpiList(java.lang.String fieldOrder,
                                  java.lang.String typeOrder)
                           throws it.eng.spago.error.EMFUserError
Specified by:
loadKpiList in interface IKpiDAO
Throws:
it.eng.spago.error.EMFUserError

loadKpiList

public java.util.List loadKpiList()
                           throws it.eng.spago.error.EMFUserError
Description copied from interface: IKpiDAO
Returns the list of Kpi.

Specified by:
loadKpiList in interface IKpiDAO
Returns:
the list of all Kpi.
Throws:
it.eng.spago.error.EMFUserError - if an Exception occurs

modifyResource

public void modifyResource(Resource resource)
                    throws it.eng.spago.error.EMFUserError
Specified by:
modifyResource in interface IKpiDAO
Throws:
it.eng.spago.error.EMFUserError

insertResource

public java.lang.Integer insertResource(Resource toCreate)
                                 throws it.eng.spago.error.EMFUserError
Specified by:
insertResource in interface IKpiDAO
Throws:
it.eng.spago.error.EMFUserError

setKpiInstanceFromKPI

public void setKpiInstanceFromKPI(KpiInstance kpiInstance,
                                  java.lang.Integer kpiId)
                           throws it.eng.spago.error.EMFUserError
Specified by:
setKpiInstanceFromKPI in interface IKpiDAO
Throws:
it.eng.spago.error.EMFUserError

deleteResource

public void deleteResource(java.lang.Integer resouceId)
                    throws it.eng.spago.error.EMFUserError
Specified by:
deleteResource in interface IKpiDAO
Throws:
it.eng.spago.error.EMFUserError

modifyKpi

public void modifyKpi(Kpi kpi)
               throws it.eng.spago.error.EMFUserError
Specified by:
modifyKpi in interface IKpiDAO
Throws:
it.eng.spago.error.EMFUserError

insertKpi

public java.lang.Integer insertKpi(Kpi kpi)
                            throws it.eng.spago.error.EMFUserError
Specified by:
insertKpi in interface IKpiDAO
Throws:
it.eng.spago.error.EMFUserError

deleteKpi

public boolean deleteKpi(java.lang.Integer kpiId)
                  throws it.eng.spago.error.EMFUserError
Specified by:
deleteKpi in interface IKpiDAO
Throws:
it.eng.spago.error.EMFUserError

loadResourcesList

public java.util.List loadResourcesList(java.lang.String fieldOrder,
                                        java.lang.String typeOrder)
                                 throws it.eng.spago.error.EMFUserError
Specified by:
loadResourcesList in interface IKpiDAO
Throws:
it.eng.spago.error.EMFUserError