Examples of KpiValue


Examples of it.eng.spagobi.kpi.config.bo.KpiValue

      }
    }else{//in case all the kpi children don't have to be calculated
      try {
        KpiInstance kpiI = mI.getKpiInstanceAssociated();
        IDataSet dataSet = DAOFactory.getKpiDAO().getDsFromKpiId(kpiI.getKpi());
        KpiValue value = new KpiValue();
        if (this.resources == null || this.resources.isEmpty()) {
          logger.debug("There are no resources assigned to the Model Instance");
          logger.debug("Retrieved the Dataset to be calculated: " + dataSet.getId());
          value = getNewKpiValue(dataSet, kpiI, null,mI.getModelInstanceNodeId(), null);
          logger.debug("New value calculated");
View Full Code Here

Examples of it.eng.spagobi.kpi.config.bo.KpiValue

        calculateAndInsertKpiValueWithResources(id, resources);
      }
    }
    KpiInstance kpiI = modI.getKpiInstanceAssociated();
    if (kpiI != null) {
      KpiValue kVal = new KpiValue();
      logger.info("Got KpiInstance with ID: " + kpiI.getKpiInstanceId().toString());

     
      IDataSet dataSet = DAOFactory.getKpiDAO().getDsFromKpiId(kpiI.getKpi())
      logger.info("Retrieved the Dataset to be calculated: " + (dataSet!=null ? dataSet.getId():"null"));
      Integer kpiInstanceID = kpiI.getKpiInstanceId();
      Date kpiInstBegDt = kpiI.getD();

      kVal = setTimeAttributes(kVal, kpiI);   
      kVal.setKpiInstanceId(kpiInstanceID);
      logger.debug("Setted the KpiValue Instance ID:"+kpiInstanceID)

      if ( (dateOfKPI.after(kpiInstBegDt)||dateOfKPI.equals(kpiInstBegDt))) {
        //kpiInstance doesn't change
      }else{
        KpiInstance tempKIn = DAOFactory.getKpiInstanceDAO().loadKpiInstanceByIdFromHistory(kpiInstanceID,dateOfKPI);
        if(tempKIn==null){//kpiInstance doesn't change
        }else{
          // in case older thresholds have to be retrieved
          kpiI = tempKIn;
        }
      }

      kVal = getFromKpiInstAndSetKpiValueAttributes(kpiI,kVal);

      // If it has to be calculated for a Resource. The resource will be set as parameter
      HashMap temp = (HashMap) this.parametersObject.clone();
      temp.put("ParModelInstance", miId)
      temp.put("ParKpiInstance", kpiInstanceID.toString());
      // If not, the dataset will be calculated without the parameter Resource
      // and the DataSet won't expect a parameter of type resource
      //if(dataSet.hasBehaviour( QuerableBehaviour.class.getName()) ) {
      if(dataSet!=null){
        Kpi kpi = DAOFactory.getKpiDAO().loadKpiById(kpiI.getKpi());
        //if parameter exists and OU is abilitaded for Model Instance, than calculate as dataset parameter
        String parKpiOuLabel = (String)this.parametersObject.get("ParKpiOU");
        logger.info("Got ParKpiOU: " + parKpiOuLabel);
       
        String paramLabelHierarchy = (String)this.parametersObject.get("ParKpiHierarchy");
        logger.info("Got ParKpiHierarchy: " + paramLabelHierarchy);
        setOUAbilitated(miId, parKpiOuLabel, paramLabelHierarchy);
       
        if(ouList != null && !ouList.isEmpty()){
          if(use_ou){
            for(int i = 0; i<ouList.size(); i++){
              OrganizationalUnitGrantNode grantNode = ouList.get(i);
              String ouLabel = grantNode.getOuNode().getOu().getLabel();
              String hierLabel = grantNode.getOuNode().getHierarchy().getLabel();
              if(parKpiOuLabel == null){
                this.parametersObject.put("ParKpiOU", ouLabel);
                this.parametersObject.put("ParKpiHierarchy", hierLabel);
              }

              kVal.setGrantNodeOU(grantNode);
              kVal = recursiveGetKpiValueFromKpiRel(kpi,dataSet,temp,kVal,dateOfKPI,kVal.getEndDate(), modI.getModelInstanceNodeId());
              kVal = getKpiValueFromDataset(dataSet,temp,kVal,dateOfKPI,kVal.getEndDate(), true, modI.getModelInstanceNodeId());
              if(ouWarning != null && kVal.getValue() == null){
                kVal.setValueDescr(ouWarning);   
              }
              if(parKpiOuLabel == null){
                this.parametersObject.remove("ParKpiOU");
                this.parametersObject.remove("ParKpiHierarchy");
              }
            }
          }else{
            kVal = recursiveGetKpiValueFromKpiRel(kpi,dataSet,temp,kVal,dateOfKPI,kVal.getEndDate(), modI.getModelInstanceNodeId());
            kVal = getKpiValueFromDataset(dataSet,temp,kVal,dateOfKPI,kVal.getEndDate(), true, modI.getModelInstanceNodeId());
          }
        }else{       
          if(use_ou){   
            kVal = new KpiValue();
            kVal.setValueDescr(ouWarning)
            kVal.setKpiInstanceId(kpiI.getKpiInstanceId());
                  if(dateIntervalFrom!=null && dateIntervalTo!=null){
                    kVal.setBeginDate(dateIntervalFrom);
                    kVal.setEndDate(dateIntervalTo);
                    } else{
                      kVal.setBeginDate(dateOfKPI);
                      kVal.setEndDate(dateOfKPI);           
                    }
            kVal.setValue(null);
          }else{
            kVal = recursiveGetKpiValueFromKpiRel(kpi,dataSet,temp,kVal,dateOfKPI,kVal.getEndDate(), modI.getModelInstanceNodeId());
            kVal = getKpiValueFromDataset(dataSet,temp,kVal,dateOfKPI,kVal.getEndDate(), true, modI.getModelInstanceNodeId());
           
         

        }
/*        if(ouList != null && !ouList.isEmpty()){
View Full Code Here

Examples of it.eng.spagobi.kpi.config.bo.KpiValue

        value = getValueDependingOnBehaviour(kpiI, miId, r,alreadyExistent , null);//standard behaviour 
        line.setValue(value);
      }
    }else{       
      if(use_ou){   
        value = new KpiValue();
        value.setValueDescr(ouWarning)
        value.setKpiInstanceId(kpiI.getKpiInstanceId());
              if(dateIntervalFrom!=null && dateIntervalTo!=null){
                value.setBeginDate(dateIntervalFrom);
                value.setEndDate(dateIntervalTo);
View Full Code Here

Examples of it.eng.spagobi.kpi.config.bo.KpiValue

    line.setChildren(children);
    if (kpiI != null) {
      Integer kpiInstID = kpiI.getKpiInstanceId();
      logger.info("Got KpiInstance with ID: " + kpiInstID.toString());
      KpiValue value = null;
     
      line = retrieveKpiLine(line, value, kpiI, miId, r, alreadyExistent);
     
      Integer kpiId = kpiI.getKpi();
      Kpi k = DAOFactory.getKpiDAO().loadKpiById(kpiId);
      logger.debug("Retrieved the kpi with id: " + kpiId.toString());
           
      if (k != null) {
        List docs = k.getSbiKpiDocuments();

        Iterator it = docs.iterator();
        List documents = new ArrayList();
        while(it.hasNext()){
          KpiDocuments doc = (KpiDocuments)it.next();
          String docLabel = doc.getBiObjLabel();
          if (docLabel != null && !docLabel.equals("")) {           
            logger.debug("Retrieved documents associated to the KPI");
            documents.add(docLabel);           
          }
        }
        line.setDocuments(documents);

      }
      if (display_alarm && value!=null && value.getValue()!= null) {
        Boolean alarm = DAOFactory.getKpiInstanceDAO().isKpiInstUnderAlramControl(kpiInstID);
        logger.debug("KPI is under alarm control: " + alarm.toString());
        line.setAlarm(alarm);
      }
View Full Code Here

Examples of it.eng.spagobi.kpi.config.bo.KpiValue

    }
    return found;
  }
  private KpiValue getValueDependingOnBehaviour(KpiInstance kpiI,Integer miId, Resource r, boolean alreadyExistent, OrganizationalUnitGrantNode grantNode) throws EMFUserError, EMFInternalError, SourceBeanException{
    logger.debug("IN");
    KpiValue value = new KpiValue();
    boolean no_period_to_period = false;
    OrganizationalUnitGrantNode grantNodeToUse = null;
    if(grantNode != null && use_ou){
      grantNodeToUse = grantNode;
    }
    if(alreadyExistent){//use diplay behaviour since value already exists
      logger.debug("Display behaviour");
      value = DAOFactory.getKpiDAO().getDisplayKpiValue(kpiI.getKpiInstanceId(), dateOfKPI, r, grantNodeToUse);
      logger.debug("Old KpiValue retrieved it could be still valid or not");
    }else
      if(behaviour.equalsIgnoreCase("timeIntervalDefault")){
        if(dateIntervalFrom!=null && dateIntervalTo!=null){
          value = DAOFactory.getKpiDAO().getKpiValueFromInterval(kpiI.getKpiInstanceId(), dateIntervalFrom, dateIntervalTo, r, grantNodeToUse);
          if (value==null){
            IDataSet dataSet = DAOFactory.getKpiDAO().getDsFromKpiId(kpiI.getKpi())
            logger.info("Retrieved the Dataset to be calculated: " + (dataSet!=null ? dataSet.getId():"null"));
            value = getNewKpiValue(dataSet, kpiI, r, miId, grantNodeToUse);   
          }
        }else{
          value = null;
        }
      }else if(behaviour.equalsIgnoreCase("timeIntervalForceRecalculation")){
        if(dateIntervalFrom!=null && dateIntervalTo!=null){
          DAOFactory.getKpiDAO().deleteKpiValueFromInterval(kpiI.getKpiInstanceId(), dateIntervalFrom, dateIntervalTo, r, grantNodeToUse);
          IDataSet dataSet = DAOFactory.getKpiDAO().getDsFromKpiId(kpiI.getKpi())
          logger.info("Retrieved the Dataset to be calculated: " + (dataSet!=null ? dataSet.getId():"null"));
          value = getNewKpiValue(dataSet, kpiI, r, miId, grantNodeToUse);   
        }else{
          value = null;
        }
      }else{
        if(behaviour.equalsIgnoreCase("default") || //If the behaviour is default
            (behaviour.equalsIgnoreCase("recalculate") && kpiI.getPeriodicityId()!=null)){//or the behaviour is recalculate and the kpiinstance has a setted periodicity
          // the old value still valid is retrieved
          logger.debug("Trying to retrieve the old value still valid");
          value = DAOFactory.getKpiDAO().getKpiValue(kpiI.getKpiInstanceId(), dateOfKPI, r, grantNodeToUse);
          logger.debug("Old KpiValue retrieved");   
        }
        if(value!=null && value.getEndDate()!=null && kpiI.getPeriodicityId()!=null){
          GregorianCalendar c2 = new GregorianCalendar();   
          c2.setTime(value.getEndDate());
          int year = c2.get(1);
          if(year==9999){
            no_period_to_period = true;
            logger.debug("The periodicity was null and now exists");
          }
View Full Code Here

Examples of it.eng.spagobi.kpi.config.bo.KpiValue

    logger.debug("IN");
    Integer kpiInstanceID = kpiInst.getKpiInstanceId();
    Date kpiInstBegDt = kpiInst.getD();

    KpiValue kVal = new KpiValue();
    kVal = setTimeAttributes(kVal, kpiInst);   
    kVal.setKpiInstanceId(kpiInstanceID);
    logger.debug("Setted the KpiValue Instance ID:"+kpiInstanceID)
    logger.debug("kpiInstBegDt begin date: "+(kpiInstBegDt!=null ? kpiInstBegDt.toString(): "Begin date null"));
   
    if(grantNode != null){
      kVal.setGrantNodeOU(grantNode);
      logger.debug("Setted the OU label :"+grantNode.getOuNode().getOu().getLabel())
      logger.debug("Setted the hierarchy label :"+grantNode.getOuNode().getHierarchy().getLabel())
    }
    if ( (dateOfKPI.after(kpiInstBegDt)||dateOfKPI.equals(kpiInstBegDt))) {
      //kpiInstance doesn't change
    }else{
      KpiInstance tempKIn = DAOFactory.getKpiInstanceDAO().loadKpiInstanceByIdFromHistory(kpiInstanceID,dateOfKPI);
      if(tempKIn==null){//kpiInstance doesn't change
      }else{
        // in case older thresholds have to be retrieved
        kpiInst = tempKIn;
      }
    }

    kVal = getFromKpiInstAndSetKpiValueAttributes(kpiInst,kVal);

    // If it has to be calculated for a Resource. The resource will be set
    // as parameter
    HashMap temp = (HashMap) this.parametersObject.clone();
    if (r != null) {
      String colName = r.getColumn_name();
      String value = r.getName();
      String code = r.getCode();
      kVal.setR(r);
      logger.info("Setted the Resource:"+r.getName());
      temp.put("ParKpiResource", value);
      temp.put("ParKpiResourceCode", code);
    }
    // cast Integer Ids to String
    temp.put("ParModelInstance", modelInstanceId.toString());
    temp.put("ParKpiInstance", kpiInstanceID.toString());

   
    // If not, the dataset will be calculated without the parameter Resource
    // and the DataSet won't expect a parameter of type resource
    //if(dataSet.hasBehaviour( QuerableBehaviour.class.getName()) ) {
    if(dataSet!=null){
      Kpi kpi = DAOFactory.getKpiDAO().loadKpiById(kpiInst.getKpi());
     
      if(behaviour.equalsIgnoreCase("timeIntervalDefault") || behaviour.equalsIgnoreCase("timeIntervalForceRecalculation")){
        if(dateIntervalFrom!=null && dateIntervalTo!=null){
          kVal.setBeginDate(dateIntervalFrom);
          kVal.setEndDate(dateIntervalTo);
        }
      }
      kVal = recursiveGetKpiValueFromKpiRel(kpi,dataSet,temp,kVal,dateOfKPI,kVal.getEndDate(), modelInstanceId);
      kVal = getKpiValueFromDataset(dataSet,temp,kVal,dateOfKPI,kVal.getEndDate(), true, modelInstanceId);
    }
    logger.debug("OUT");
    return kVal;
  }
View Full Code Here

Examples of it.eng.spagobi.kpi.config.bo.KpiValue

      IDataSet chDataSet = kpiDao.getDsFromKpiId(child.getKpiId());
      HashMap chPars  = new HashMap();
      chPars.putAll(pars);
      //then the one in rel table
      String parameter = rel.getParameter();
      KpiValue kpiVal = recursiveGetKpiValueFromKpiRel(child, chDataSet, chPars, kVal, begD, endDate, modInstNodeId);
      pars.put(parameter, kpiVal.getValue());

    }
    //checks if it is to recalculate
    //calculate with dataset
    KpiValue value = getKpiValueFromDataset(dataSet, pars, kVal, begD, endDate, false, modInstNodeId);
    logger.debug("gets value from dataset : "+value.getValue());
    logger.debug("OUT");
    return value;
  }
View Full Code Here

Examples of it.eng.spagobi.kpi.config.bo.KpiValue

  }

  public KpiValue getKpiValueFromDataset(IDataSet dataSet, HashMap pars, KpiValue kVal,
      Date begD, Date endDate, boolean doSave, Integer modInstNodeId) throws EMFInternalError, SourceBeanException, EMFUserError, DatasetException{
    logger.debug("IN");
    KpiValue kpiValTemp = null;

    dataSet.setParamsMap(pars);
    dataSet.setUserProfileAttributes(UserProfileUtils.getProfileAttributes( profile ));
   

    logger.info("Load Data Set. Label="+dataSet.getLabel());

    // Handle in table SbiKpiError dataset Error
    try {
      dataSet.loadData();
    } 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
            // sbi_alarm_event table and scheduled to be sent
            DAOFactory.getAlarmDAO().isAlarmingValue(kpiValTemp);
View Full Code Here

Examples of it.eng.spagobi.kpi.config.bo.KpiValue

  private SourceBean setLineAttributes(KpiLine line,SourceBean semaphor, SourceBean textCodeName, SourceBean textValue,
      SourceBean textWeight, SourceBean image1, int level, SourceBean separatorline,SourceBean threshCode,SourceBean threshValue, SourceBean extraimageToAdd){
    logger.debug("IN");
   
    KpiValue kpiValue=line.getValue();
   
    ThresholdValue t = null;
    Color colorSemaphor = null;
    if ( kpiValue!=null && kpiValue.getValue() != null) {
      t = kpiValue.getThresholdOfValue();
      if(t!=null){
        colorSemaphor = t.getColor()
      }
    } 

    Integer xValue=xStarter+(xIncrease*Integer.valueOf(level));
    Integer yValue=actualHeight;

    try {
      //set Semaphor
      semaphor.setAttribute("reportElement.x", xValue.toString());
      semaphor.setAttribute("reportElement.y", new Integer(yValue.intValue()+2).toString());
      if(colorSemaphor!=null){

        String color=Integer.toHexString(colorSemaphor.getRGB());
        color="#"+color.substring(2);

        semaphor.setAttribute("reportElement.forecolor""#000000");
        semaphor.setAttribute("reportElement.backcolor", color);
      }else{
        semaphor.setAttribute("reportElement.forecolor", "#FFFFFF");
        semaphor.setAttribute("reportElement.backcolor", "#FFFFFF");
      }
      xValue=xValue+semaphorWidth+separatorWidth;

      // set text 1: Model CODE - Model NAME
      textCodeName.setAttribute("reportElement.x", (xValue));
      textCodeName.setAttribute("reportElement.y", yValue.toString());
      SourceBean textValue1=(SourceBean)textCodeName.getAttribute("text");
      textValue1.setCharacters(line.getModelInstanceCode()+"-"+line.getModelNodeName());

      xValue=xValue+textWidth+separatorWidth;

      //Set Value, weight and threshold code and value
      if(kpiValue!=null){
        String value1=kpiValue.getValue() != null ? kpiValue.getValue() : "";
        //set text2
        textValue.setAttribute("reportElement.y", yValue.toString());
        SourceBean textValue2=(SourceBean)textValue.getAttribute("text");
        textValue2.setCharacters(value1);

        String weight=(kpiValue.getWeight()!=null) ? kpiValue.getWeight().toString() : "";
        //set text2
        xValue=xValue+numbersWidth+separatorWidth;
        textWeight.setAttribute("reportElement.y", new Integer(yValue.intValue()+2).toString());
        SourceBean textValue3=(SourceBean)textWeight.getAttribute("text");
        textValue3.setCharacters(weight);
       
       
        if(t!=null){
          try {
            Threshold tr = DAOFactory.getThresholdDAO().loadThresholdById(t.getThresholdId());
            if (!thresholdsList.contains(tr)){
              thresholdsList.add(tr);
            }
           
          } catch (EMFUserError e) {
            logger.error("error in loading the Threshold by Id",e);
            e.printStackTrace();
          }
          String code=t.getThresholdCode() != null ? t.getThresholdCode() : "";
          String codeTh = "Code: "+code;
          if(codeTh.length()>20)codeTh = codeTh.substring(0, 19);
         
          threshCode.setAttribute("reportElement.y"new Integer(yValue.intValue()-2).toString());
          SourceBean threshCode2=(SourceBean)threshCode.getAttribute("text");
          threshCode2.setCharacters(codeTh);
       
       
          String labelTh=t.getLabel() != null ? t.getLabel() : "";
          String min = t.getMinValue()!= null ? t.getMinValue().toString() : null;
          String max = t.getMaxValue()!= null ?  t.getMaxValue().toString() : null;
          String valueTh = "Value: ";
          if(t.getThresholdType().equalsIgnoreCase("RANGE")){
            if (min!=null && max !=null){
                valueTh = valueTh + min+"-"+max+" "+labelTh;
            }else if (min!=null && max==null){
              valueTh = valueTh + "> "+min+" "+labelTh;
            }else if (min==null && max!=null){
               valueTh = valueTh + "< "+max+" "+labelTh;
            }
          }else if(t.getThresholdType().equalsIgnoreCase("MINIMUM")){
            valueTh = valueTh + "< "+min+" "+labelTh;
          }else if(t.getThresholdType().equalsIgnoreCase("MAXIMUM")){
            valueTh = valueTh + "> "+max+" "+labelTh;
          }
          if(valueTh.length()>25)valueTh = valueTh.substring(0, 24);
         
          threshValue.setAttribute("reportElement.y", new Integer(yValue.intValue()+7).toString());
          SourceBean threshValue2=(SourceBean)threshValue.getAttribute("text");
          threshValue2.setCharacters(valueTh);
        }

      }
      //Sets the bullet chart and or the threshold image
      if(options.getDisplay_bullet_chart() && options.getDisplay_threshold_image()){
        //both threshold image and bullet chart have to be seen
        if ( kpiValue!=null &&  kpiValue.getValue()!= null && kpiValue.getThresholdValues()!=null && !kpiValue.getThresholdValues().isEmpty()) {

          List thresholdValues = kpiValue.getThresholdValues();     
          // String chartType = value.getChartType();
          String chartType = "BulletGraph";
          Double val = new Double(kpiValue.getValue());
          Double target = kpiValue.getTarget();
          ChartImpl sbi = ChartImpl.createChart(chartType);
          sbi.setValueDataSet(val);
          if (target != null) {
            sbi.setTarget(target);
          }
          sbi.setShowAxis(options.getShow_axis())
          sbi.setThresholdValues(thresholdValues);
       
          JFreeChart chart = sbi.createChart();
          ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
          String requestIdentity = null;
          UUIDGenerator uuidGen  = UUIDGenerator.getInstance();
          UUID uuid = uuidGen.generateTimeBasedUUID();
          requestIdentity = uuid.toString();
          requestIdentity = requestIdentity.replaceAll("-", "");
          String path_param = requestIdentity;
          String dir=System.getProperty("java.io.tmpdir");
          String path=dir+"/"+requestIdentity+".png";
          java.io.File file1 = new java.io.File(path);
          logger.debug("Where is the image: "+path);
          try {
            ChartUtilities.saveChartAsPNG(file1, chart, 89, 11, info);
          } catch (IOException e) {
            e.printStackTrace();
            logger.error("Error in saving chart",e);
          }
          String urlPng=GeneralUtilities.getSpagoBiHost()+GeneralUtilities.getSpagoBiContext() + GeneralUtilities.getSpagoAdapterHttpUrl() +
          "?ACTION_NAME=GET_PNG2&NEW_SESSION=TRUE&path="+path_param+"&LIGHT_NAVIGATOR_DISABLED=TRUE";
          urlPng = "new java.net.URL(\""+urlPng+"\")";
          logger.debug("Image url: "+urlPng);
         
          image1.setAttribute("reportElement.y", yValue.toString());
          image1.setAttribute("reportElement.x", new Integer(310).toString());
          image1.setAttribute("reportElement.width", 90);
          SourceBean imageValue=(SourceBean)image1.getAttribute("imageExpression");
          imageValue.setCharacters(urlPng);
        }
        ThresholdValue tOfVal = line.getThresholdOfValue();
        if (tOfVal!=null && tOfVal.getPosition()!=null && tOfVal.getThresholdCode()!=null){
          String fileName ="position_"+tOfVal.getPosition().intValue();
          String dirName = tOfVal.getThresholdCode();
          String urlPng=GeneralUtilities.getSpagoBiHost()+GeneralUtilities.getSpagoBiContext() + GeneralUtilities.getSpagoAdapterHttpUrl() +
          "?ACTION_NAME=GET_THR_IMAGE&NEW_SESSION=TRUE&fileName="+fileName+"&dirName="+dirName+"&LIGHT_NAVIGATOR_DISABLED=TRUE"
         
          urlPng = "new java.net.URL(\""+urlPng+"\")";
          logger.debug("url: "+urlPng);
         
          extraimageToAdd=new SourceBean(image);
          extraimageToAdd.setAttribute("reportElement.y", yValue.toString());
          extraimageToAdd.setAttribute("reportElement.width",35);
          extraimageToAdd.setAttribute("reportElement.x", new Integer(408).toString());
          SourceBean imageValue=(SourceBean)extraimageToAdd.getAttribute("imageExpression");
          imageValue.setCharacters(urlPng);     
        }
      }else if(options.getDisplay_bullet_chart() && !options.getDisplay_threshold_image()){
        //only bullet chart has to be seen
        if ( kpiValue!=null &&  kpiValue.getValue()!= null && kpiValue.getThresholdValues()!=null && !kpiValue.getThresholdValues().isEmpty()) {

          List thresholdValues = kpiValue.getThresholdValues();     
          // String chartType = value.getChartType();
          String chartType = "BulletGraph";
          Double val = new Double(kpiValue.getValue());
          Double target = kpiValue.getTarget();
          ChartImpl sbi = ChartImpl.createChart(chartType);
          sbi.setValueDataSet(val);
          if (target != null) {
            sbi.setTarget(target);
          }
View Full Code Here

Examples of it.eng.spagobi.kpi.config.bo.KpiValue

        logger.debug("Date in which the value has to be valid: "
            + (d != null ? d.toString() : "Date null"));
        if (d.after(kpiValueBegDt) && d.before(kpiValueEndDt)) {
          logger.debug("Date between beginDate and EndDate");
          KpiValue val = toKpiValue(value, d);
          if (chartType != null) {
            val.setChartType(chartType);
            logger.debug("Setted chart Type: " + chartType);
          }
          values.add(val);
          logger.debug("Setted the correct value: " + val.getValue());
        }
      }

    } catch (HibernateException he) {
      logger
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.