Package it.eng.spagobi.kpi.threshold.bo

Examples of it.eng.spagobi.kpi.threshold.bo.Threshold


          logger.error("Threshold type CD does not exist");
          throw new SpagoBIServiceException(SERVICE_NAME,  "Threshold Type ID is undefined");
        }
 
      if (name != null && typeID != null && code != null) {
        Threshold thr = new Threshold();
        thr.setName(name);
        thr.setThresholdTypeCode(typeCD);
        thr.setThresholdTypeId(typeID);
        thr.setCode(code);
 
        if(description != null){
          thr.setDescription(description);
       
       
        List thrValuesList = new ArrayList();
        if(typeCD != null){
          if(typeCD.equals("MINIMUM") || typeCD.equals("MAXIMUM")){
            ThresholdValue tVal = new ThresholdValue();
            if(thrValId!= null && !thrValId.equals("") && !thrValId.equals("0")){
              tVal.setId(Integer.valueOf(thrValId));
            }
            tVal.setLabel(label);           
            tVal.setPosition(position);
            tVal.setColourString(colourString);
            tVal.setValue(value);
            tVal.setSeverityCd(severityCd);
            if(severityCd!=null && !severityCd.equals("")){
              Integer severityId = domainIds.get(severityCd);   
              tVal.setSeverityId(severityId);   
            }

            if(typeCD.equals("MINIMUM")){
              tVal.setMinClosed(minClosed);
              tVal.setMinValue(minValue);
            }else if(typeCD.equals("MAXIMUM")){
              tVal.setMaxClosed(maxClosed);
              tVal.setMaxValue(maxValue);
           
            thrValuesList.add(tVal);
                       
          }else if(typeCD.equals("RANGE")){
            if(thrValuesJSON!=null){
              try {
                thrValuesList = deserializeThresholdValuesJSONArray(thrValuesJSON, domainIds);
              } catch (JSONException e) {
                logger.error("JSON Exception");
                e.printStackTrace();
              }
            }
          }
          thr.setThresholdValues(thrValuesList);
        }
     
        try {

          Integer idToReturnToClient = null;
         
          if(id != null && !id.equals("") && !id.equals("0")){ 
            //modify
            thr.setId(Integer.valueOf(id));
            try{
              thrDao.modifyThreshold(thr);
            }catch(EMFUserError e){
              logger.error(e.getMessage(), e);
              throw e;
View Full Code Here


        }
      }

      // load threshold
      if (kpi.getThreshold() != null) {
        Threshold th=kpi.getThreshold();
        insertThreshold(th, session);
        SbiThreshold sbiTh= (SbiThreshold) session.load(SbiThreshold.class, th.getId());
        hibKpi.setSbiThreshold(sbiTh);
      }

      // Measure Unit   ???
      if(kpi.getScaleCode()!=null && !kpi.getScaleCode().equalsIgnoreCase("")){
View Full Code Here

        }
      }

      // load threshold
      if (kpi.getThreshold() != null) {
        Threshold th=kpi.getThreshold();
        insertThreshold(th, session);
        SbiThreshold sbiTh= (SbiThreshold) session.load(SbiThreshold.class, th.getId());
        hibKpi.setSbiThreshold(sbiTh);
      }

      // Measure Unit   ???
      if(kpi.getScaleCode()!=null && !kpi.getScaleCode().equalsIgnoreCase("")){
View Full Code Here

      }

      // load threshold
      if (kpiInst.getThresholdId() != null) {
        IThresholdDAO thresholdDAO=DAOFactory.getThresholdDAO();
        Threshold th=thresholdDAO.loadThresholdById(kpiInst.getThresholdId());
        insertThreshold(th, session);
        SbiThreshold sbiTh= (SbiThreshold) session.load(SbiThreshold.class, th.getId());
        hibKpiInst.setSbiThreshold(sbiTh);
      }

      // load measureUnit!
      if(kpiInst.getScaleCode()!=null){
View Full Code Here

    toReturn.setDsLabel(dsLabel);
    toReturn.setKpiDsId(dsId);
    logger.debug("Kpi dataset setted");

    if (kpi.getSbiThreshold() != null) {
      Threshold threshold = DAOFactory.getThresholdDAO().loadThresholdById(
          kpi.getSbiThreshold().getThresholdId());
      toReturn.setThreshold(threshold);
      logger.debug("Kpi threshold setted");

    }
View Full Code Here

    }

    IThresholdDAO thresholdDAO=DAOFactory.getThresholdDAO();
    SbiThreshold thresh = kpi.getSbiThreshold();
    if(thresh!=null){
      Threshold threshold=thresholdDAO.toThreshold(thresh);
      toReturn.setThreshold(threshold);
      logger.debug("Kpi threshold setted");
    }

    Double standardWeight = kpi.getWeight();
View Full Code Here

        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

    Integer kpiId = model.getKpiId();
    if(kpiId != null){
      Kpi kpi = DAOFactory.getKpiDAO().loadKpiById(kpiId);
      KpiInstance kpiInst = new KpiInstance();
      kpiInst.setKpi(kpiId);
      Threshold thrSrc = kpi.getThreshold();
      if(thrSrc != null){
        kpiInst.setThresholdId(thrSrc.getId());
      }
      kpiInst.setWeight(kpi.getStandardWeight());
      modelInstNode.setKpiInstance(kpiInst);
    }
View Full Code Here


        String kpiInstThrCode;
        try{
          kpiInstThrCode = obj.getString("kpiInstThrName");
          Threshold thr = DAOFactory.getThresholdDAO().loadThresholdByCode(kpiInstThrCode);
          if(thr != null){
            kpiInstance.setThresholdId(thr.getId());
          }
        }catch(Throwable t){
          kpiInstThrCode = null;
          if(kpiInstance != null) kpiInstance.setThresholdId(null);
        }
View Full Code Here

    if( !(o instanceof Threshold) ) {
      throw new SerializationException("ThresholdJSONSerializer is unable to serialize object of type: " + o.getClass().getName());
    }
   
    try {
      Threshold thr = (Threshold)o;
      result = new JSONObject();
     
      result.put(THRESHOLD_ID, thr.getId() );
      result.put(THRESHOLD_NAME, thr.getName() );
      result.put(THRESHOLD_DESCRIPTION, thr.getDescription() );
      result.put(THRESHOLD_CODE, thr.getCode() );
      result.put(THRESHOLD_TYPE_ID, thr.getThresholdTypeId() );
      result.put(THRESHOLD_TYPE_CD, thr.getThresholdTypeCode());   
      result.put(OLD_TO_DELETE, new Boolean(false))
     
      List thrValues = thr.getThresholdValues();
      JSONArray thValues = new JSONArray();
      if(thrValues!=null){   
        if(!thrValues.isEmpty()){
          if(thrValues.size()==1 && !thr.getThresholdTypeCode().equalsIgnoreCase("RANGE")){
            ThresholdValue thrVal = (ThresholdValue) thrValues.get(0);
            if(thrVal != null){
             result.put(THR_VAL_ID,  thrVal.getId());
             result.put(THR_VAL_LABEL,  thrVal.getLabel());
             result.put(THR_VAL_POSITION,  thrVal.getPosition());
View Full Code Here

TOP

Related Classes of it.eng.spagobi.kpi.threshold.bo.Threshold

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.