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

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


    try {
      SourceBean thresholdslist = new SourceBean(thresholdsS);
      if(thresholdsList!=null && !thresholdsList.isEmpty()){
        Iterator th = thresholdsList.iterator();
        while(th.hasNext()){
          Threshold t2 = (Threshold)th.next();
          SourceBean singlethreshold = new SourceBean(thresholdS);
          singlethreshold.setAttribute("id",t2.getId()!=null?t2.getId().toString():"");
         
          String type = "";
          String code = "";
          List thValues = t2.getThresholdValues();
          if(thValues!=null && !thValues.isEmpty()){
            Iterator th2 = thValues.iterator();
            while(th2.hasNext()){
              ThresholdValue t = (ThresholdValue)th2.next();
              SourceBean range = new SourceBean(rangeS);
View Full Code Here


  }
 
 
  public Threshold loadThresholdById(Integer id) throws EMFUserError {
    logger.debug("IN");
    Threshold toReturn = null;
    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiThreshold hibThreshold = (SbiThreshold) aSession.load(
          SbiThreshold.class, id);
      toReturn = new Threshold();
      toReturn = toThreshold(hibThreshold);

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

        if ( line.getValue()!=null && line.getValue().getValue() != null) {
          t = line.getValue().getThresholdOfValue();
       
        if(t!=null){
          try {
            Threshold tr = DAOFactory.getThresholdDAO().loadThresholdById(t.getThresholdId());
            if (!thresholdsList.contains(tr)){
              thresholdsList.add(tr);
            }
            kpiValueToAdd.setAttribute("thresholdid",t.getThresholdId()!=null ? t.getThresholdId().toString() :"");
           
View Full Code Here

    return toReturn;
  }

  public Threshold loadThresholdByCode(String thrCode) throws EMFUserError {
    logger.debug("IN");
    Threshold toReturn = null;
    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      Criterion labelCriterrion = Expression.eq("code", thrCode);
      Criteria criteria = aSession.createCriteria(SbiThreshold.class);
      criteria.add(labelCriterrion);     
      SbiThreshold hibThreshold = (SbiThreshold)criteria.uniqueResult();
      if (hibThreshold == null) return null;
      toReturn = new Threshold();
      toReturn = toThreshold(hibThreshold);

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

        toTransform = aSession.createQuery("from SbiThreshold").list();
      }

      for (Iterator iterator = toTransform.iterator(); iterator.hasNext();) {
        SbiThreshold hibThreshold = (SbiThreshold) iterator.next();
        Threshold threshold = new Threshold();
        threshold.setName(hibThreshold.getName());
        threshold.setCode(hibThreshold.getCode());
        threshold.setDescription(hibThreshold.getDescription());
        threshold.setId(hibThreshold.getThresholdId());
        threshold.setThresholdTypeId(hibThreshold.getThresholdType().getValueId());
        threshold.setThresholdTypeCode(hibThreshold.getThresholdType().getValueCd());
        toReturn.add(threshold);
      }

    } catch (HibernateException he) {
      logger.error("Error while loading the list of Threshold", he);
View Full Code Here

 
  public Threshold toThreshold(SbiThreshold t) throws EMFUserError {

    logger.debug("IN");
    Threshold toReturn = new Threshold();

    Integer id=t.getThresholdId();
    String name=t.getName();
    String description=t.getDescription();
    String code=t.getCode();
    SbiDomains d=t.getThresholdType();

    toReturn.setId(id);
    toReturn.setName(name);
    toReturn.setDescription(description);
    toReturn.setCode(code);
    toReturn.setThresholdTypeId(d.getValueId());
    toReturn.setThresholdTypeCode(d.getValueCd());
   
    // get all the threshold Values
    IThresholdValueDAO thValuesDao=(IThresholdValueDAO)DAOFactory.getThresholdValueDAO();
    Set set=t.getSbiThresholdValues();
    ArrayList thValues=new ArrayList();
    for (Iterator iterator = set.iterator(); iterator.hasNext();) {
      SbiThresholdValue sbiThValue = (SbiThresholdValue) iterator.next();
      thValues.add(thValuesDao.toThresholdValue(sbiThValue));
    }
    toReturn.setThresholdValues(thValues);
   
    logger.debug("OUT");
    return toReturn;
  }
View Full Code Here

      toTransform = hibernateQuery.list();     

      for (Iterator iterator = toTransform.iterator(); iterator.hasNext();) {
        SbiThreshold hibThreshold = (SbiThreshold) iterator.next();
        Threshold threshold = toThreshold(hibThreshold);
        toReturn.add(threshold);
      }

    } catch (HibernateException he) {
      logger.error("Error while loading the list of Threshold", he);
View Full Code Here

      toTransform = hibernateQuery.list();     

      for (Iterator iterator = toTransform.iterator(); iterator.hasNext();) {
        SbiThreshold hibThreshold = (SbiThreshold) iterator.next();
        Threshold threshold = toThreshold(hibThreshold);
        toReturn.add(threshold);
      }

    } catch (HibernateException he) {
      logger.error("Error while loading the filtered list of Threshold", he);
View Full Code Here

          result.put(KPI_INST_CHART, kpiInst.getChartTypeId());
          result.put(KPI_INST_PERIODICITY, kpiInst.getPeriodicityId());
          result.put(KPI_INST_TARGET, kpiInst.getTarget());
          result.put(KPI_INST_THR_ID, kpiInst.getThresholdId());
          if(kpiInst.getThresholdId() != null){
            Threshold thr = DAOFactory.getThresholdDAO().loadThresholdById(kpiInst.getThresholdId());
            result.put(KPI_INST_THR_NAME, thr.getName());
          }
          result.put(KPI_INST_WEIGHT, kpiInst.getWeight());
          result.put(KPI_INST_SAVE_HISTORY, kpiInst.isSaveKpiHistory());

        }
View Full Code Here

        Iterator it = thresholdValues.iterator();
        while (it.hasNext()) {
          SbiThresholdValue val = (SbiThresholdValue) it.next();
          // TODO mettere a posto
          IThresholdDAO thDao=(IThresholdDAO)DAOFactory.getThresholdDAO();
          Threshold tr = thDao.toThreshold(null);
          logger.debug("Added threshold with label " + tr.getName());
          thresholds.add(tr);
        }
      }     

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