Examples of SbiKpiInstance


Examples of it.eng.spagobi.kpi.config.metadata.SbiKpiInstance

      Transaction tx = null;

      try {
        aSession = getSession();
        tx = aSession.beginTransaction();
        SbiKpiInstance hibSbiKpiInstance = (SbiKpiInstance) aSession
        .load(SbiKpiInstance.class, kpiInstID);
        Set alarms = hibSbiKpiInstance.getSbiAlarms();
        if (!alarms.isEmpty()) {

          Iterator itAl = alarms.iterator();
          while (itAl.hasNext()) {
            boolean isAlarming = false;
            SbiAlarm alarm = (SbiAlarm) itAl.next();
            SbiThresholdValue threshold = alarm
            .getSbiThresholdValue();
            String type = threshold.getSbiThreshold()
            .getThresholdType().getValueCd();
            double min;
            double max;
            String thresholdValue = "";
            logger.debug("Threshold Type: " + type);

            if (type.equals("RANGE")) {

              min = threshold.getMinValue();
              max = threshold.getMaxValue();
              logger.debug("Threshold Min: " + min);
              logger.debug("Threshold Max: " + max);

              // if the value is in the interval, then there
              // should be
              // an alarm
              if (kpiVal.doubleValue() >= min
                  && kpiVal.doubleValue() <= max) {
                isAlarming = true;
                thresholdValue = "Min:" + min + "-Max:" + max;
                logger.debug("The value "
                    + kpiVal.doubleValue()
                    + " is in the RANGE " + thresholdValue
                    + " and so an Alarm will be scheduled");
              }

            } else if (type.equals("MINIMUM")) {

              min = threshold.getMinValue();
              logger.debug("Threshold Min: " + min);
              // if the value is smaller than the min value
              if (kpiVal.doubleValue() <= min) {
                isAlarming = true;
                thresholdValue = "Min:" + min;
                logger.debug("The value "
                    + kpiVal.doubleValue()
                    + " is lower than " + thresholdValue
                    + " and so an Alarm will be scheduled");
              }

            } else if (type.equals("MAXIMUM")) {

              max = threshold.getMaxValue();
              logger.debug("Threshold Max: " + max);
              // if the value is higher than the max value
              if (kpiVal.doubleValue() >= max) {
                isAlarming = true;
                thresholdValue = "Max:" + max;
                logger.debug("The value "
                    + kpiVal.doubleValue()
                    + " is higher than " + thresholdValue
                    + " and so an Alarm will be scheduled");
              }
            }

            if (isAlarming) {
              SbiAlarmEvent alarmEv = new SbiAlarmEvent();
              String kpiName = hibSbiKpiInstance.getSbiKpi()
              .getName();
              logger.debug("Kpi Name: " + kpiName);
              String resources = null;
              if (value.getR() != null) {
                resources = value.getR().getName();
View Full Code Here

Examples of it.eng.spagobi.kpi.config.metadata.SbiKpiInstance

    logger.debug("IN");

    Integer kpiInstID = kpi.getIdKpiInstance();
    Session aSession = null;
    Transaction tx = null;
    SbiKpiInstance hibKpiInstance = null;
    List values = new ArrayList();

    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      hibKpiInstance = (SbiKpiInstance) aSession.load(
          SbiKpiInstance.class, kpiInstID);
      Set kpiValues = hibKpiInstance.getSbiKpiValues();
      SbiDomains dom = hibKpiInstance.getChartType();
      String chartType = null;
      if (dom != null)
        chartType = dom.getValueCd();

      Iterator iVa = kpiValues.iterator();
View Full Code Here

Examples of it.eng.spagobi.kpi.config.metadata.SbiKpiInstance

          + (kpiValue != null ? kpiValue : "Value null"));
      Integer kpiInstanceId = value.getKpiInstanceId();
      logger.debug("Kpi Instance ID: "
          + (kpiInstanceId != null ? kpiInstanceId.toString()
              : "Kpi Instance ID null"));
      SbiKpiInstance sbiKpiInstance = (SbiKpiInstance) aSession.load(
          SbiKpiInstance.class, kpiInstanceId);
      Resource r = value.getR();
      if (r != null) {
        IResourceDAO resDaoImpl=DAOFactory.getResourceDAO();
        SbiResources sbiResources = resDaoImpl.toSbiResource(r);
View Full Code Here

Examples of it.eng.spagobi.kpi.config.metadata.SbiKpiInstance

    kpiInstanceID = value.getSbiKpiInstance().getIdKpiInstance();
    logger.debug("SbiKpiValue kpiInstanceID: "
        + (kpiInstanceID != null ? kpiInstanceID.toString()
            : "kpiInstanceID null"));
    SbiKpiInstance kpiInst = value.getSbiKpiInstance();

    List thresholdValues = new ArrayList();
    Date kpiInstBegDt = kpiInst.getBeginDt();
    logger.debug("kpiInstBegDt begin date: "
        + (kpiInstBegDt != null ? kpiInstBegDt.toString()
            : "Begin date null"));
    // in case the current threshold is correct
    if (((d.before(endDate) || d.equals(endDate))
        && (d.after(beginDate) || d.equals(beginDate))
        && (d.after(kpiInstBegDt) || d.equals(kpiInstBegDt)))|| kpiInst.getSbiKpiInstanceHistories().isEmpty()) {

      weight = kpiInst.getWeight();
      logger.debug("SbiKpiValue weight: "
          + (weight != null ? weight.toString() : "weight null"));
      target = kpiInst.getTarget();
      logger.debug("SbiKpiValue target: "
          + (target != null ? target.toString() : "target null"));

      if (kpiInst.getSbiMeasureUnit() != null) {
        scaleCode = kpiInst.getSbiMeasureUnit().getScaleCd();
        logger.debug("SbiKpiValue scaleCode: "
            + (scaleCode != null ? scaleCode : "scaleCode null"));
        scaleName = kpiInst.getSbiMeasureUnit().getScaleNm();
        logger.debug("SbiKpiValue scaleName: "
            + (scaleName != null ? scaleName : "scaleName null"));
      }
      logger.debug("Requested date d: " + d.toString()
          + " in between beginDate and EndDate");
      SbiThreshold t = kpiInst.getSbiThreshold();
      if(t!=null){

        Set ts = t.getSbiThresholdValues();
        Iterator i = ts.iterator();
        while (i.hasNext()) {
          SbiThresholdValue tls = (SbiThresholdValue) i.next();

          IThresholdValueDAO thDao=(IThresholdValueDAO)DAOFactory.getThresholdValueDAO();
          ThresholdValue tr = thDao.toThresholdValue(tls);
          thresholdValues.add(tr);
        }
      }     

    } else {// in case older thresholds have to be retrieved

      Set kpiInstHist = kpiInst.getSbiKpiInstanceHistories();
      Iterator i = kpiInstHist.iterator();
      while (i.hasNext()) {
        SbiKpiInstanceHistory ih = (SbiKpiInstanceHistory) i.next();
        Date ihBegDt = ih.getBeginDt();
        Date ihEndDt = ih.getEndDt();
View Full Code Here

Examples of it.eng.spagobi.kpi.config.metadata.SbiKpiInstance

              : "ou name null"));
    }
    kpiInstanceID = value.getSbiKpiInstance().getIdKpiInstance();
    logger.debug("SbiKpiValue kpiInstanceID: "
        + (kpiInstanceID != null ? kpiInstanceID.toString() : "kpiInstanceID null"));
    SbiKpiInstance kpiInst = value.getSbiKpiInstance();

    List thresholdValues = new ArrayList();
    Date kpiInstBegDt = kpiInst.getBeginDt();
    logger.debug("kpiInstBegDt begin date: "
        + (kpiInstBegDt != null ? kpiInstBegDt.toString() : "Begin date null"));
   
    // TODO for the moment get actual values of weight/target etc check if it is correct
    weight = kpiInst.getWeight();
    logger.debug("SbiKpiValue weight: "
        + (weight != null ? weight.toString() : "weight null"));
    target = kpiInst.getTarget();
    logger.debug("SbiKpiValue target: "
        + (target != null ? target.toString() : "target null"));

    if (kpiInst.getSbiMeasureUnit() != null) {
      scaleCode = kpiInst.getSbiMeasureUnit().getScaleCd();
      logger.debug("SbiKpiValue scaleCode: "
          + (scaleCode != null ? scaleCode : "scaleCode null"));
      scaleName = kpiInst.getSbiMeasureUnit().getScaleNm();
      logger.debug("SbiKpiValue scaleName: "
          + (scaleName != null ? scaleName : "scaleName null"));
    }
    SbiThreshold t = kpiInst.getSbiThreshold();
    if(t!=null){

      Set ts = t.getSbiThresholdValues();
      Iterator i = ts.iterator();
      while (i.hasNext()) {
View Full Code Here

Examples of it.eng.spagobi.kpi.config.metadata.SbiKpiInstance

        SbiDomains dModality = DAOFactory.getDomainDAO().loadSbiDomainByCodeAndValue(DOMAIN_CD, modality);
       
        alarm.setModality(dModality);
      }
      if(kpiInstId != null){
        SbiKpiInstance sbiKpiInstance = DAOFactory.getKpiInstanceDAO().loadSbiKpiInstanceById(kpiInstId);
        alarm.setSbiKpiInstance(sbiKpiInstance);
      }
      if(thresholdId != null){
        SbiThresholdValue sbiThresholdValue = DAOFactory.getThresholdValueDAO().loadSbiThresholdValueById(thresholdId);
        alarm.setSbiThresholdValue(sbiThresholdValue);
View Full Code Here

Examples of it.eng.spagobi.kpi.config.metadata.SbiKpiInstance

    Transaction tx = null;

    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiKpiInstance hibSbiKpiInstance = (SbiKpiInstance) aSession.load(
          SbiKpiInstance.class, id);
      toReturn = toKpiInstance(hibSbiKpiInstance);

    } catch (HibernateException he) {
      logger.error("Error while loading the Model Instance with id "
View Full Code Here

Examples of it.eng.spagobi.kpi.config.metadata.SbiKpiInstance

    Transaction tx = null;

    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiKpiInstance hibSbiKpiInstance = (SbiKpiInstance) aSession.load(
          SbiKpiInstance.class, kpiInstanceID);
      SbiDomains d = hibSbiKpiInstance.getChartType();
      if (d != null) {
        chartType = d.getValueCd();
        logger.debug("Gotten chartType:" + chartType);
      }
View Full Code Here

Examples of it.eng.spagobi.kpi.config.metadata.SbiKpiInstance

    Transaction tx = null;

    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiKpiInstance hibSbiKpiInstance = (SbiKpiInstance) aSession.load(
          SbiKpiInstance.class, id);

      List thresholds = new ArrayList();
      Integer kpiInstanceID = null;
      Double weight = null;
      Double target = null;
      String scaleCode = null;
      String scaleName = null;
      Set kpiInstHist = hibSbiKpiInstance.getSbiKpiInstanceHistories();
      Iterator i = kpiInstHist.iterator();
      while (i.hasNext()) {
        SbiKpiInstanceHistory ih = (SbiKpiInstanceHistory) i.next();

        Date ihBegDt = ih.getBeginDt();
View Full Code Here

Examples of it.eng.spagobi.kpi.config.metadata.SbiKpiInstance

    Transaction tx = null;

    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiKpiInstance hibSbiKpiInstance = (SbiKpiInstance) aSession.load(
          SbiKpiInstance.class, k.getKpiInstanceId());
      SbiThreshold t = hibSbiKpiInstance.getSbiThreshold();

      if(t!=null){
        Set thresholdValues = t.getSbiThresholdValues();
        Iterator it = thresholdValues.iterator();
        while (it.hasNext()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.