Examples of SbiKpi


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

      if(newKpiId==null) {
        logger.error("could not find kpi between association"+exportedKpiInst.getSbiKpi().getName());
      }
      else{
        // I must get the new SbiDomains object
        SbiKpi newSbiKpi = (SbiKpi) sessionCurrDB.load(SbiKpi.class, newKpiId);
        existingKpiInst.setSbiKpi(newSbiKpi);
      }
    }

    //    add Threshold
View Full Code Here

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

        logger.error("could not find Kpi between association"+exportedMod.getSbiKpi().getKpiId());
        existingMod.setSbiKpi(null);
      }
      else{
        // I must get the new SbiDomains object
        SbiKpi newSbiKpi = (SbiKpi) sessionCurrDB.load(SbiKpi.class, newKpiId);
        existingMod.setSbiKpi(newSbiKpi);
      }
    }
    else{
      existingMod.setSbiKpi(null);
View Full Code Here

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

      if(newKpiId==null) {
        logger.error("could not find association with kpi child with id " + exportedKpiRel.getSbiKpiByKpiChildId().getName());
        existingKpiRel.setSbiKpiByKpiChildId(null);
      }
      else{
        SbiKpi newSbiKpi = (SbiKpi) sessionCurrDB.load(SbiKpi.class, newKpiId);
        existingKpiRel.setSbiKpiByKpiChildId(newSbiKpi);
      }
    }
    // kpi father

    if(exportedKpiRel.getSbiKpiByKpiFatherId()!=null){
      Integer oldKpiId=exportedKpiRel.getSbiKpiByKpiFatherId().getKpiId();
      Integer newKpiId=(Integer)kpiAss.get(oldKpiId);
      if(newKpiId==null) {
        logger.error("could not find association with kpi father  with id " + exportedKpiRel.getSbiKpiByKpiFatherId().getName());
        existingKpiRel.setSbiKpiByKpiFatherId(null);
      }
      else{
        SbiKpi newSbiKpi = (SbiKpi) sessionCurrDB.load(SbiKpi.class, newKpiId);
        existingKpiRel.setSbiKpiByKpiFatherId(newSbiKpi);
      }
    }

    logger.debug("OUT");
View Full Code Here

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

   *
   * @return the new hibernate parameter object
   */
  public static SbiKpi makeNewSbiKpi(SbiKpi kpi,Session sessionCurrDB, MetadataAssociations metaAss){
    logger.debug("IN");
    SbiKpi newKpi = new SbiKpi();
    try{
      newKpi.setDescription(kpi.getDescription());
      newKpi.setCode(kpi.getCode());
      newKpi.setName(kpi.getName());
      newKpi.setSbiKpiDocumentses(kpi.getSbiKpiDocumentses());
      newKpi.setFlgIsFather(kpi.getFlgIsFather());
      newKpi.setMetric(kpi.getMetric());
      newKpi.setWeight(kpi.getWeight());
      newKpi.setInputAttributes(kpi.getInputAttributes());
      newKpi.setInterpretation(kpi.getInterpretation());
      newKpi.setModelReference(kpi.getModelReference());
      newKpi.setTargetAudience(kpi.getTargetAudience());

      // associations
      entitiesAssociationsSbiKpi(kpi, newKpi, sessionCurrDB, metaAss);

      logger.debug("OUT");
    }
    catch (Exception e) {
      logger.error("Error inc reating new kpi "+newKpi.getCode());     
    }
    finally{

    }
    return newKpi;
View Full Code Here

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

    Transaction tx = null;

    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiKpi hibKpi = (SbiKpi) aSession.load(SbiKpi.class, kpiId);
      SbiObjects hibObject = (SbiObjects) aSession.load(SbiObjects.class, docId);
      Criterion kpiCriterrion = Expression.eq("sbiKpi",hibKpi);
      Criterion sbiObjCriterrion = Expression.eq("sbiObjects",hibObject);
      Criteria crit = aSession.createCriteria(SbiKpiDocument.class);
      crit.add(kpiCriterrion);
View Full Code Here

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

    Transaction tx = null;

    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiKpi hibSbiKpi = (SbiKpi) aSession.load(SbiKpi.class, id);
      toReturn = toKpiDefinition(hibSbiKpi);

    } catch (HibernateException he) {
      logger.error("Error while loading the Kpi with id "
          + ((id == null) ? "" : id.toString()), he);
View Full Code Here

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

    Transaction tx = null;

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

    } catch (HibernateException he) {
      logger.error("Error while loading the Kpi with id "
          + ((id == null) ? "" : id.toString()), he);
View Full Code Here

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

    }

    Double standardWeight = kpi.getWeight();

    // Gets the father
    SbiKpi dad = kpi.getSbiKpi();
    Boolean isRoot = false;
    Integer father = null;
    if (dad != null) {
      father = dad.getKpiId();
    } else {
      isRoot = true;
    }

    String scaleCode = "";
View Full Code Here

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

      } else {
        toTransform = aSession.createQuery("from SbiKpi").list();
      }

      for (Iterator iterator = toTransform.iterator(); iterator.hasNext();) {
        SbiKpi hibKpi = (SbiKpi) iterator.next();
        Kpi kpi = new Kpi();
        kpi.setCode(hibKpi.getCode());
        kpi.setDescription(hibKpi.getDescription());
        kpi.setKpiName(hibKpi.getName());
        kpi.setKpiId(hibKpi.getKpiId());
        if(hibKpi.getSbiThreshold() != null){
          Threshold threshold = new Threshold();
          threshold.setId(hibKpi.getSbiThreshold().getThresholdId());
          threshold.setName(hibKpi.getSbiThreshold().getName());
          kpi.setThreshold(threshold);
        }
        toReturn.add(kpi);
      }
View Full Code Here

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

      if (kpi.getThreshold() != null) {
        Integer thresholdId = kpi.getThreshold().getId();
        sbiThreshold = (SbiThreshold) aSession.load(SbiThreshold.class, thresholdId);
      }

      SbiKpi sbiKpi = (SbiKpi) aSession.load(SbiKpi.class, kpi.getKpiId());

      SbiDomains kpiType = null;
      if (kpi.getKpiTypeId() != null) {
        Integer kpiTypeId = kpi.getKpiTypeId();
        kpiType = (SbiDomains) aSession.load(SbiDomains.class, kpiTypeId);
      }

      SbiDomains metricScaleType = null;
      if (kpi.getMetricScaleId() != null) {
        Integer metricScaleId = kpi.getMetricScaleId();
        metricScaleType = (SbiDomains) aSession.load(SbiDomains.class, metricScaleId);
      }

      SbiDomains measureType = null;
      if (kpi.getMeasureTypeId() != null) {
        Integer measureTypeId = kpi.getMeasureTypeId();
        measureType = (SbiDomains) aSession.load(SbiDomains.class, measureTypeId);
      }



      //Loading all old sbiObjects
      Criterion kpiCriter = Expression.eq("sbiKpi",sbiKpi);
      Criteria crite = aSession.createCriteria(SbiKpiDocument.class);
      crite.add(kpiCriter);
      List existingDocs = crite.list();

      List kpiDocsList = kpi.getSbiKpiDocuments();
      Set sbiKpiDocuments = new HashSet(0);
      Iterator i = kpiDocsList.iterator();
      while (i.hasNext()) {

        KpiDocuments doc = (KpiDocuments) i.next();

        String label = doc.getBiObjLabel();
        Criterion labelCriterrion = Expression.eq("label",label);
        Criteria criteria = aSession.createCriteria(SbiObjects.class);
        criteria.add(labelCriterrion);
        SbiObjects hibObject = (SbiObjects) criteria.uniqueResult();



        Integer kpiId = kpi.getKpiId();
        Criterion kpiCriterrion = Expression.eq("sbiKpi",sbiKpi);
        Criterion sbiObjCriterrion = Expression.eq("sbiObjects",hibObject);
        Criteria crit = aSession.createCriteria(SbiKpiDocument.class);
        crit.add(kpiCriterrion);
        crit.add(sbiObjCriterrion);
        SbiKpiDocument kpiDoc = (SbiKpiDocument) crit.uniqueResult();

        if(existingDocs!=null && !existingDocs.isEmpty() && kpiDoc!=null){
          if(existingDocs.contains(kpiDoc)){
            existingDocs.remove(kpiDoc);
          }
        }
        if(kpiDoc==null){
          SbiKpiDocument temp = new SbiKpiDocument();
          temp.setSbiKpi(sbiKpi);
          temp.setSbiObjects(hibObject);
          updateSbiCommonInfo4Update(temp);
          aSession.saveOrUpdate(temp);
        }
      }

      if(existingDocs!=null && !existingDocs.isEmpty() ){
        Iterator it2 = existingDocs.iterator();
        while(it2.hasNext()){
          SbiKpiDocument kpiDoc = (SbiKpiDocument) it2.next();
          aSession.delete(kpiDoc);
        }
      }

      sbiKpi.setInterpretation(interpretation);
      sbiKpi.setInputAttributes(inputAttribute);
      sbiKpi.setModelReference(modelReference);
      sbiKpi.setTargetAudience(targetAudience);
      sbiKpi.setSbiDomainsByKpiType(kpiType);
      sbiKpi.setSbiDomainsByMeasureType(measureType);
      sbiKpi.setSbiDomainsByMetricScaleType(metricScaleType);
      sbiKpi.setName(name);
      sbiKpi.setDescription(description);
      sbiKpi.setCode(code);
      sbiKpi.setMetric(metric);
      sbiKpi.setWeight(weight);
      sbiKpi.setIsAdditive(kpi.getIsAdditive());
      //sbiKpi.setSbiKpiDocumentses(sbiKpiDocuments);
      sbiKpi.setSbiDataSet(ds);
      sbiKpi.setSbiThreshold(sbiThreshold);
      updateSbiCommonInfo4Update(sbiKpi);
      aSession.saveOrUpdate(sbiKpi);
      IUdpValueDAO dao=DAOFactory.getUdpDAOValue();
      dao.setUserProfile(getUserProfile());
      dao.insertOrUpdateRelatedUdpValues(kpi, sbiKpi, aSession, "KPI");
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.