Package it.eng.spagobi.kpi.config.bo

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


      } catch (EMFInternalError e) {
        e.printStackTrace();
      }
    }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);
View Full Code Here


      while (childrenIt.hasNext()) {
        Integer id = (Integer) childrenIt.next()
        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;
        }
View Full Code Here

          children.add(childrenLine);
        }
      }
    }

    KpiInstance kpiI = modI.getKpiInstanceAssociated();
    //if true the kpi value will always use the display behaviour
    boolean alreadyExistent = false;

    if (kpiI == null && modI.getModelInstaceReferenceLabel() != null){
      ModelInstanceNode modelInstanceRefered = DAOFactory.getModelInstanceDAO().loadModelInstanceByLabel(modI.getModelInstaceReferenceLabel(), dateOfKPI);
      alreadyExistent = true;
      if (modelInstanceRefered != null && modelInstanceRefered.getKpiInstanceAssociated() != null){
        kpiI = modelInstanceRefered.getKpiInstanceAssociated();
        modI.setKpiInstanceAssociated(kpiI);
      }
    }   

    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();
View Full Code Here

      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;
      }
View Full Code Here

    logger.debug("SbiKpiModelInstanceNode name: "
        + (name != null ? name : "name null"));
    SbiKpiInstance kpiInst = hibSbiKpiModelInst.getSbiKpiInstance();

    IKpiInstanceDAO kpiInstDAO = DAOFactory.getKpiInstanceDAO();
    KpiInstance kpiInstanceAssociated = null;
    if (kpiInst != null) {
      kpiInstanceAssociated = kpiInstDAO.toKpiInstance(kpiInst);
    }

    Set resources = hibSbiKpiModelInst.getSbiKpiModelResourceses();
View Full Code Here

        aSession);
    SbiKpiInstance sbiKpiInstance = value.getSbiKpiInstance();

    if (sbiKpiInstance != null) {
      // toKpiInstance
      KpiInstance aKpiInstance = new KpiInstance();
      aKpiInstance.setKpiInstanceId(sbiKpiInstance.getIdKpiInstance());
      aKpiInstance.setKpi(sbiKpiInstance.getSbiKpi().getKpiId());
      if (sbiKpiInstance.getSbiThreshold() != null) {
        aKpiInstance.setThresholdId(sbiKpiInstance.getSbiThreshold()
            .getThresholdId());
      }
      if (sbiKpiInstance.getChartType() != null) {
        aKpiInstance.setChartTypeId(sbiKpiInstance.getChartType()
            .getValueId());
      }
      // TODO
      if (sbiKpiInstance.getSbiKpiInstPeriods() != null
          && !(sbiKpiInstance.getSbiKpiInstPeriods().isEmpty())) {
        SbiKpiInstPeriod instPeriod = (SbiKpiInstPeriod) sbiKpiInstance
        .getSbiKpiInstPeriods().toArray()[0];

        aKpiInstance.setPeriodicityId(instPeriod.getSbiKpiPeriodicity()
            .getIdKpiPeriodicity());
      } //
      aKpiInstance.setWeight(sbiKpiInstance.getWeight());
      aKpiInstance.setTarget(sbiKpiInstance.getTarget());
      aKpiInstance.setD(sbiKpiInstance.getBeginDt());
      //
      toReturn.setKpiInstance(aKpiInstance);
    }

    toReturn.setId(id);
View Full Code Here

        SbiKpiModel sbiKpiModel = (SbiKpiModel) aSession.load(
            SbiKpiModel.class, aModel.getId());
        sbiKpiModelInst.setSbiKpiModel(sbiKpiModel);

        // set the sbiKpiInstance
        KpiInstance kpiInst = toCreate.getKpiInstance();

        //if already present
        if(kpiInst != null){
          SbiKpiInstance sbiKpiInstance = new SbiKpiInstance();
          if(kpiInst.getKpi() != null){

            SbiKpi sbiKpi =  (SbiKpi) aSession.load(SbiKpi.class, kpiInst.getKpi());           
            sbiKpiInstance.setSbiKpi(sbiKpi);
            if(kpiInst.getThresholdId() != null){
              SbiThreshold sbiThr =  (SbiThreshold) aSession.load(SbiThreshold.class, kpiInst.getThresholdId());           
              sbiKpiInstance.setSbiThreshold(sbiThr);
            }
            sbiKpiInstance.setWeight(kpiInst.getWeight());

            sbiKpiInstance.setTarget(kpiInst.getTarget());           

            //if periodicity exists then set it
            if(kpiInst.getPeriodicityId() != null){
              Set periods = new HashSet<SbiKpiInstPeriod>();
              SbiKpiPeriodicity sbiPeriodicity =  (SbiKpiPeriodicity) aSession.load(SbiKpiPeriodicity.class, kpiInst.getPeriodicityId())
              if(sbiPeriodicity != null){
                periods.add(sbiPeriodicity);
                sbiKpiInstance.setSbiKpiInstPeriods(periods);
              }
            }
            if(kpiInst.getChartTypeId() != null){
              SbiDomains chartType =  (SbiDomains) aSession.load(SbiDomains.class, kpiInst.getChartTypeId())
              sbiKpiInstance.setChartType(chartType);
            }
            Calendar now = Calendar.getInstance();
            sbiKpiInstance.setBeginDt(now.getTime());
            updateSbiCommonInfo4Insert(sbiKpiInstance);
View Full Code Here

    .toModelWithoutChildren(sbiKpiModel, session);
    SbiKpiInstance sbiKpiInstance = value.getSbiKpiInstance();

    if (sbiKpiInstance != null) {
      // toKpiInstance
      KpiInstance aKpiInstance = new KpiInstance();
      aKpiInstance.setKpiInstanceId(sbiKpiInstance.getIdKpiInstance());
      aKpiInstance.setKpi(sbiKpiInstance.getSbiKpi().getKpiId());
      if (sbiKpiInstance.getSbiThreshold() != null) {
        aKpiInstance.setThresholdId(sbiKpiInstance.getSbiThreshold()
            .getThresholdId());
      }
      if (sbiKpiInstance.getChartType() != null) {
        aKpiInstance.setChartTypeId(sbiKpiInstance.getChartType()
            .getValueId());
      }
      // TODO
      if (sbiKpiInstance.getSbiKpiInstPeriods() != null
          && !(sbiKpiInstance.getSbiKpiInstPeriods().isEmpty())) {
        SbiKpiInstPeriod instPeriod = (SbiKpiInstPeriod) sbiKpiInstance
        .getSbiKpiInstPeriods().toArray()[0];

        aKpiInstance.setPeriodicityId(instPeriod.getSbiKpiPeriodicity()
            .getIdKpiPeriodicity());
      }
      aKpiInstance.setWeight(sbiKpiInstance.getWeight());
      aKpiInstance.setTarget(sbiKpiInstance.getTarget());
      aKpiInstance.setD(sbiKpiInstance.getBeginDt());
      //
      toReturn.setKpiInstance(aKpiInstance);
    }

    List childrenNodes = new ArrayList();
View Full Code Here

      xml = DAOFactory.getKpiDAO().loadKPIValueXml(new Integer(kpiValID));
    }
     
    if (kpiInstanceID!=null){
      IKpiInstanceDAO kpiInstDAO=DAOFactory.getKpiInstanceDAO();
      KpiInstance kI = kpiInstDAO.loadKpiInstanceById(new Integer(kpiInstanceID));
      Integer kpiID = kI.getKpi();
      if (kpiID!=null){
        Kpi k = DAOFactory.getKpiDAO().loadKpiById(kpiID);
        String kpiCode = k.getCode();
        String kpiDescription = k.getDescription();
        String kpiInterpretation = k.getInterpretation();
        String kpiName = k.getKpiName();
        String thresholdName = "";
        List thresholdValues = null;
        if(kI.getThresholdId()!=null){
          thresholdValues=DAOFactory.getThresholdValueDAO().loadThresholdValuesByThresholdId(kI.getThresholdId());
          Threshold thres = DAOFactory.getThresholdDAO().loadThresholdById(kI.getThresholdId());
          thresholdName = thres.getName();
        }
       
        if (kpiCode!=null){
          serviceResponse.setAttribute("KPI_CODE", kpiCode);
View Full Code Here

        hibMi.setSbiKpiModel(hibModel);
      }

      // Load tKpi Instance
      if (mi.getKpiInstance() != null) {
        KpiInstance kpiInstance=mi.getKpiInstance();
        insertKpiInstance(kpiInstance.getKpiInstanceId(), session);
        SbiKpiInstance hibKpiInst = (SbiKpiInstance) session.load(SbiKpiInstance.class, kpiInstance.getKpiInstanceId());
        hibMi.setSbiKpiInstance(hibKpiInst);

      }

      //load all organizational units
View Full Code Here

TOP

Related Classes of it.eng.spagobi.kpi.config.bo.KpiInstance

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.