Package it.eng.spagobi.kpi.config.dao

Examples of it.eng.spagobi.kpi.config.dao.IKpiErrorDAO


    } catch (RuntimeException e) {
      // Exception must be handled and recorded in table SbiKpiError, if it is a datasetexception

      if(e instanceof DatasetException){
        logger.error("write exception in tabe kpiError ", e);
        IKpiErrorDAO dao= DAOFactory.getKpiErrorDAO();
        dao.setUserProfile(profile);
        dao.insertKpiError(
            (DatasetException)e,
            modInstNodeId,
            kVal.getR() != null ? kVal.getR().getName() : null );
      }
      else{
        logger.error("Exception not handled by table KpiError ", e);
      }
      throw e;
    }

    IDataStore dataStore = dataSet.getDataStore();
    logger.debug("Got the datastore");

    if (dataStore != null && !dataStore.isEmpty()) {
      // Transform result into KPIValue (I suppose that the result has a unique value)
      IDataStoreMetaData d = dataStore.getMetaData();   
      int indexRes = d.getFieldIndex(RESOURCE);

      if(indexRes!=-1){
        Iterator it = dataStore.iterator();
        while(it.hasNext()){

          kpiValTemp = kVal.clone();
          IRecord record =(IRecord)it.next();
          List fields = record.getFields();
          kpiValTemp = setKpiValuesFromDataset(kpiValTemp,fields,d, begD, endDate, dataSet.getLabel(),modInstNodeId, kVal);

          if (kpiValTemp.getR()!=null && kVal.getR()!=null && kpiValTemp.getR().getId()!=null &&
              kVal.getR().getId()!=null && kpiValTemp.getR().getId().equals(kVal.getR().getId())){
            kVal = kpiValTemp.clone() ;
          }
          logger.debug("New value calculated");
          if(register_values && kpiValTemp.getR().getName()!=null){

            if(doSave){
              // Insert new Value into the DB
              IKpiDAO dao= DAOFactory.getKpiDAO();
              dao.setUserProfile(profile);
              Integer kpiValueId = dao.insertKpiValue(kpiValTemp);
              kVal.setKpiValueId(kpiValueId);
              logger.info("New value inserted in the DB. Resource="+kpiValTemp.getR().getName()+" KpiInstanceId="+kpiValTemp.getKpiInstanceId());
            }
            // Checks if the value is alarming (out of a certain range)
            // If the value is alarming a new line will be inserted in the
View Full Code Here


    if (kpiValueToReturn == null && valueFound == true){
      logger.error("cjheck dataset "+datasetLabel+ " because no value field for kpi was found");
      MissingKpiValueException missingKpiValueException = new MissingKpiValueException("cjheck dataset "+datasetLabel+ " because no value field for kpi was found");     
     
      IKpiErrorDAO dao= DAOFactory.getKpiErrorDAO();
      dao.setUserProfile(profile);
      dao.insertKpiError(
          missingKpiValueException,
          modInstId,
          kpiVal.getR() != null ? kpiVal.getR().getName() : null );
    }
View Full Code Here

TOP

Related Classes of it.eng.spagobi.kpi.config.dao.IKpiErrorDAO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.