Examples of SbiKpiInstance


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

    logger.debug("SbiKpiModelInstanceNode description: "
        + (descr != null ? descr : "Description null"));
    String name = hibSbiKpiModelInst.getName();
    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);
View Full Code Here

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

      e.printStackTrace();
    }

    Model aModel = ModelDAOImpl.toModelWithoutChildren(sbiKpiModel,
        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

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

      sbiKpiModelInst.setLabel(kpiModelInstanceLb);
      sbiKpiModelInst.setStartDate(kpiModelInstanceStartDate);
      sbiKpiModelInst.setEndDate(kpiModelInDateEndDate);
      sbiKpiModelInst.setModelUUID(modelUUID);

      SbiKpiInstance oldSbiKpiInstance = sbiKpiModelInst
      .getSbiKpiInstance();

      //default behaviour
      boolean newKpiInstanceHistory = true;
      boolean deleteOldHistory = false;
      boolean dontSaveKpiHistory = false;
      if(value.getKpiInstance() != null && !value.getKpiInstance().isSaveKpiHistory()){
        dontSaveKpiHistory = true;
      }

      // new kpiInstance is null
      if (value.getKpiInstance() == null) {
        newKpiInstanceHistory = false;
        deleteOldHistory = true;
      }

      if (value.getKpiInstance() != null
          && (!value.getKpiInstance().isSaveKpiHistory())) {
        newKpiInstanceHistory = false;
        dontSaveKpiHistory = true;
      }

      // old kpiInstance is null and new kpiInstance has a value
      if (oldSbiKpiInstance == null && value.getKpiInstance() != null) {
        newKpiInstanceHistory = false;
      }

      // old kpiId is different from new kpiId
      if (newKpiInstanceHistory
          && !(areBothNull(oldSbiKpiInstance.getSbiKpi(), value
              .getKpiInstance().getKpi()) || (oldSbiKpiInstance
                  .getSbiKpi() != null && areNullOrEquals(
                      oldSbiKpiInstance.getSbiKpi().getKpiId(), value
                      .getKpiInstance().getKpi())))) {
        newKpiInstanceHistory = false;
        deleteOldHistory = true;
        // create new sbiKpiInstance
      }

      // check if same value is changed
      if (newKpiInstanceHistory
          && !((areBothNull(oldSbiKpiInstance.getSbiThreshold(),
              value.getKpiInstance().getThresholdId()) || (oldSbiKpiInstance
                  .getSbiThreshold() != null && areNullOrEquals(
                      oldSbiKpiInstance.getSbiThreshold()
                      .getThresholdId(), value.getKpiInstance()
                      .getThresholdId())))
                      && (areBothNull(oldSbiKpiInstance.getChartType(),
                          value.getKpiInstance().getChartTypeId()) || (oldSbiKpiInstance
                              .getChartType() != null && areNullOrEquals(
                                  oldSbiKpiInstance.getChartType()
                                  .getValueId(), value
                                  .getKpiInstance().getChartTypeId())))
                                  /*
                                   * TODO && (areBothNull(oldSbiKpiInstance
                                   * .getSbiKpiPeriodicity(), value
                                   * .getKpiInstance().getPeriodicityId()) ||
                                   * (oldSbiKpiInstance .getSbiKpiPeriodicity() != null &&
                                   * areNullOrEquals( oldSbiKpiInstance.getSbiKpiPeriodicity()
                                   * .getIdKpiPeriodicity(), value .getKpiInstance()
                                   * .getPeriodicityId())))
                                   */
                                  && areNullOrEquals(oldSbiKpiInstance.getWeight(), value
                                      .getKpiInstance().getWeight()))) {
        // create new History
        Calendar now = Calendar.getInstance();
        SbiKpiInstanceHistory sbiKpiInstanceHistory = new SbiKpiInstanceHistory();
        sbiKpiInstanceHistory.setSbiKpiInstance(oldSbiKpiInstance);
        sbiKpiInstanceHistory.setSbiThreshold(oldSbiKpiInstance
            .getSbiThreshold());
        sbiKpiInstanceHistory.setSbiDomains(oldSbiKpiInstance
            .getChartType());
        sbiKpiInstanceHistory.setWeight(oldSbiKpiInstance.getWeight());
        sbiKpiInstanceHistory
        .setBeginDt(oldSbiKpiInstance.getBeginDt());
        sbiKpiInstanceHistory.setEndDt(now.getTime());
        updateSbiCommonInfo4Insert(sbiKpiInstanceHistory);
        aSession.save(sbiKpiInstanceHistory);
      }

      SbiKpiInstance kpiInstanceToCreate = null;



      if (value.getKpiInstance() != null) {
        if (newKpiInstanceHistory || dontSaveKpiHistory) {
          kpiInstanceToCreate = setSbiKpiInstanceFromModelInstance(
              aSession, value, oldSbiKpiInstance);
        } else {
          // create new kpiInstance
          kpiInstanceToCreate = new SbiKpiInstance();
          Calendar now = Calendar.getInstance();
          kpiInstanceToCreate.setBeginDt(now.getTime());
          kpiInstanceToCreate = setSbiKpiInstanceFromModelInstance(
              aSession, value, kpiInstanceToCreate);
        }
        updateSbiCommonInfo4Update(kpiInstanceToCreate);
        aSession.saveOrUpdate(kpiInstanceToCreate);
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

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

  }

  private SbiKpiInstance setSbiKpiInstanceFromModelInstance(Session aSession,
      ModelInstance value, SbiKpiInstance sbiKpiInstance) {
    if (sbiKpiInstance == null) {
      sbiKpiInstance = new SbiKpiInstance();
    }
    if (value.getKpiInstance().getD() != null) {
      sbiKpiInstance.setBeginDt(value.getKpiInstance().getD());
    } else {
      sbiKpiInstance.setBeginDt(new Date());
View Full Code Here

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

        // 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);
            aSession.save(sbiKpiInstance);
            sbiKpiModelInst.setSbiKpiInstance(sbiKpiInstance);
          }
        }
View Full Code Here

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

        sbiKpiModelInst.setSbiKpiModel(sbiKpiModel);

        // set the sbiKpiInstance
        SbiKpi sbiKpi = sbiKpiModel.getSbiKpi();
        if (sbiKpi != null) {
          SbiKpiInstance sbiKpiInstance = new SbiKpiInstance();
          sbiKpiInstance.setSbiKpi(sbiKpi);
          sbiKpiInstance.setSbiThreshold(sbiKpi.getSbiThreshold());
          sbiKpiInstance.setWeight(sbiKpi.getWeight());
          Calendar now = Calendar.getInstance();
          sbiKpiInstance.setBeginDt(now.getTime());
          aSession.save(sbiKpiInstance);
          sbiKpiModelInst.setSbiKpiInstance(sbiKpiInstance);
        }

      }
View Full Code Here

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

    Integer id = value.getKpiModelInst();
    SbiKpiModel sbiKpiModel = value.getSbiKpiModel();
    String modelUUID = value.getModelUUID();
    Model aModel = ModelDAOImpl
    .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

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

  }

  private void deleteKpiInstance(Session aSession, Integer kpiInstId)
  throws EMFUserError {
    SbiKpiInstance sbiKpiInst = (SbiKpiInstance) aSession.load(
        SbiKpiInstance.class, kpiInstId);

    // deleteKpiHistory(Integer sbiKpiInstance)
    Criteria critt = aSession.createCriteria(SbiKpiInstanceHistory.class);
    critt.add(Expression.eq("sbiKpiInstance", sbiKpiInst));
View Full Code Here

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

    aSession.delete(sbiKpiInst);
  }

  private void deleteKpiValue(Session aSession, Integer kpiInstId) {
    SbiKpiInstance sbiKpiInst = (SbiKpiInstance) aSession.load(
        SbiKpiInstance.class, kpiInstId);
    Criteria critt = aSession.createCriteria(SbiKpiValue.class);
    critt.add(Expression.eq("sbiKpiInstance", sbiKpiInst));
    List sbiKpiValueList = critt.list();
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.