Package it.eng.spagobi.kpi.model.bo

Examples of it.eng.spagobi.kpi.model.bo.Resource


          logger.debug("Setted the tree Root.");
          kpiRBlocks.add(block);
        } else {
          Iterator resourcesIt = this.resources.iterator();
          while (resourcesIt.hasNext()) {
            Resource r = (Resource) resourcesIt.next();
            logger.info("-------Resource: " + r.getName());
            KpiResourceBlock block = new KpiResourceBlock();
            block.setR(r);

        block.setD(dateOfKPI);
            block.setOptions(options);
            KpiLine line = getBlock(mI.getModelInstanceNodeId(), r);
            block.setRoot(line);
            logger.debug("Setted the tree Root.");
            kpiRBlocks.add(block);
          }
        }
      } 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);
          logger.debug("New value calculated");
        } else {
          Iterator resourcesIt = this.resources.iterator();
          while (resourcesIt.hasNext()) {
            Resource r = (Resource) resourcesIt.next();
            logger.debug("Resource: " + r.getName());
            logger.debug("Retrieved the Dataset to be calculated: " + dataSet.getId());
            value = getNewKpiValue(dataSet, kpiI, r,mI.getModelInstanceNodeId(), null);         
          }
        }
        logger.debug("New value calculated");
View Full Code Here


        kpiRBlocks.add(block);

      }else {
        Iterator resourcesIt = this.resources.iterator();
        while (resourcesIt.hasNext()) {
          Resource r = (Resource) resourcesIt.next();
          logger.info("Resource: " + r.getName());
          KpiResourceBlock block = new KpiResourceBlock();
          block.setR(r);
          block.setD(dateOfKPI);
          block.setParMap(this.parametersObject);
          KpiLine line = getBlock(mI.getModelInstanceNodeId(), r);
View Full Code Here

            logger.debug("Setted the kpiValue xmlData:"+xmlData);
          }  
          else if(fieldName.equalsIgnoreCase(RESOURCE)){
            String fieldValue = f.getValue().toString();
            if (fieldValue!=null){
              Resource rTemp = DAOFactory.getResourceDAO().loadResourcesByNameAndModelInst(fieldValue);
              kpiValueToReturn.setR(rTemp);
              logger.info("Setted the kpiValue Resource with resource name:"+fieldValue);
            }
          }/*else if(fieldName.equalsIgnoreCase("ORG_UNIT_ID")){
            String fieldValue = f.getValue().toString();
View Full Code Here

        if (values.size() == 1) {
          if (url.equals("ParKpiResources")) {
            this.resources = new ArrayList();
            String value = (String) values.get(0);
            Integer res = new Integer(value);
            Resource toAdd = DAOFactory.getResourceDAO().loadResourceById(res);
            this.resources.add(toAdd);
          }else if (url.equals("ParKpiResourcesCode")) {
            this.resources = new ArrayList();
            for (int k = 0; k < values.size(); k++) {
              String value = (String) values.get(k);
              Resource toAdd = DAOFactory.getResourceDAO().loadResourceByCode(value);
              this.resources.add(toAdd);
            }
          }else if(url.equals("register_values")){
            String value = (String) values.get(0);
            if (value.equalsIgnoreCase("true")){
              this.register_values = true;
              this.register_par_setted = true;
            }else if (value.equalsIgnoreCase("false")){
              this.register_values = false;
              this.register_par_setted = true;
            }
          }else if (url.equals("behaviour")){
            String value = (String) values.get(0);
            behaviour = value;
            logger.debug("Behaviour is: "+ behaviour);
          }else if(url.equals("dataset_multires")){
            String value = (String) values.get(0);
            if (value.equalsIgnoreCase("true")){
              this.dataset_multires = true;
            }else if (value.equalsIgnoreCase("false")){
              this.dataset_multires = false;
            }
          }else{
            String value = (String) values.get(0)
            if (url.equals("ParKpiDate")) {
              value = setCalculationDateOfKpi(value);   
            }else if (url.equals("TimeRangeFrom")) {
              try {
                timeRangeFrom = f.parse(value);
              } catch (ParseException e) {
                logger.error("ParseException.value=" + value, e);
              }
              logger.debug("Setted TIME RANGE FROM");
            }else if (url.equals("TimeRangeTo")) {
              try {
                timeRangeTo = f.parse(value);
              } catch (ParseException e) {
                logger.error("ParseException.value=" + value, e);
              }
              logger.debug("Setted TIME RANGE TO");
            }else if(url.equals("dateIntervalFrom")){
              try {
                dateIntervalFrom = f.parse(value);
                value = getDateForDataset(dateIntervalFrom);
              } catch (ParseException e) {
                logger.error("ParseException.value=" + value, e);
              }
              logger.debug("Setted TIME RANGE TO");
            }else if(url.equals("dateIntervalTo")){
              try {
                dateIntervalTo = f.parse(value);
                value = getDateForDataset(dateIntervalTo);
              } catch (ParseException e) {
                logger.error("ParseException.value=" + value, e);
              }
              logger.debug("Setted TIME RANGE TO");
            }
            parametersMap.put(url, value);
          }  
          //instead if parameter has more than one value
        }else if (values != null && values.size() >= 1) {
          if (url.equals("ParKpiResources")) {
            this.resources = new ArrayList();
            for (int k = 0; k < values.size(); k++) {
              String value = (String) values.get(k);
              Integer res = new Integer(value);
              Resource toAdd = DAOFactory.getResourceDAO().loadResourceById(res);
              this.resources.add(toAdd);
            }
          }else if (url.equals("ParKpiResourcesCode")) {
            this.resources = new ArrayList();
            for (int k = 0; k < values.size(); k++) {
              String value = (String) values.get(k);
              Resource toAdd = DAOFactory.getResourceDAO().loadResourceByCode(value);
              this.resources.add(toAdd);
            }
          }else {
            String value = "'" + (String) values.get(0) + "'";
            for (int k = 1; k < values.size(); k++) {
View Full Code Here

//  Add a resource band
  public List newResource(KpiResourceBlock block, SourceBean bandDetailReport){
    logger.debug("IN");
    List sourceBeansToAdd = new ArrayList();
    Resource res=block.getR();
     
      try{
        actualHeight+=separatorModelsHeight;

        SourceBean bandRes=new SourceBean(resourceBand);
        SourceBean bandName=new SourceBean(resourceName);
        SourceBean columnHeadBand=new SourceBean(columnHeaderBand);
        SourceBean modelColHeader=new SourceBean(columnModelHeader);
        SourceBean weightColHeader=new SourceBean(columnWeightHeader);
        SourceBean kpiColHeader=new SourceBean(columnKPIHeader);
        SourceBean kthreshColHeader=new SourceBean(columnThresholdHeader);
       
        if(res!=null){
          bandRes.setAttribute("reportElement.y", actualHeight.toString());
          bandName.setAttribute("reportElement.y", actualHeight.toString());
          logger.debug("add resource band for resource "+res.getName());
          SourceBean textValue1=(SourceBean)bandName.getAttribute("text");
          textValue1.setCharacters("RESOURCE: "+res.getName());

          sourceBeansToAdd.add(bandRes);
          sourceBeansToAdd.add(bandName);
          actualHeight+=resourceBandHeight;
        }
View Full Code Here

    if (!resources.isEmpty()) {
      Iterator i = resources.iterator();
      IModelResourceDAO resDAO = DAOFactory.getModelResourcesDAO();
      while (i.hasNext()) {
        SbiKpiModelResources dls = (SbiKpiModelResources) i.next();
        Resource r = resDAO.toResource(dls);
        logger.debug("SbiKpiModelInstanceNode resource name: "
            + (r.getName() != null ? r.getName()
                : "Resource name null"));
        res.add(r);
      }
    }
    // gets father id
View Full Code Here

      // load resource

      if (modRes.getResourceId() != null) {
        Integer resId=modRes.getResourceId();
        IResourceDAO resDAO=DAOFactory.getResourceDAO();
        Resource res=resDAO.loadResourceById(resId);

        insertResource(res, session);
        SbiResources sbiRes= (SbiResources) session.load(SbiResources.class, res.getId());
        if(sbiRes!=null){
          hibModRes.setSbiResources(sbiRes);
        }
      }
View Full Code Here

 
 
  public Resource toResource(SbiKpiModelResources re) throws EMFUserError {

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

    IResourceDAO resDao=DAOFactory.getResourceDAO();
   
    SbiResources r = re.getSbiResources();
    toReturn = resDao.toResource(r);
View Full Code Here

  private void modelResourcesExtendedListCreate(List<ModelResourcesExtended> modelResourcesExtenList,
      List<Resource> allResources,
      HashMap<Integer, ModelResources> modResourcesIds ){
    if(allResources != null){
      for(int i =0;i<allResources.size(); i++){
        Resource res = allResources.get(i);
        if(!modResourcesIds.keySet().contains(res.getId())){
          ModelResourcesExtended extendedRes = new ModelResourcesExtended(res, new ModelResources());
          modelResourcesExtenList.add(extendedRes);
        }else{
          ModelResourcesExtended extendedRes = new ModelResourcesExtended(res, modResourcesIds.get(res.getId()));
          modelResourcesExtenList.add(extendedRes);
        }
      }
    }
  }
View Full Code Here

        List<String> resources = (List<String>)getSessionContainer().getAttribute(RESOURCES_LIST);
        if(resources == null){
          List<Resource> resourcesOBJ = resourceDao.loadResourcesList(null, null);
          resources = new ArrayList<String>();
          for(int i =0; i< resourcesOBJ.size(); i++){
            Resource res = resourcesOBJ.get(i);
            resources.add(res.getName());
          }
          resources.add(NO_RESOURCES_STR);
          getSessionContainer().setAttribute(RESOURCES_LIST, resources);
        }
       
View Full Code Here

TOP

Related Classes of it.eng.spagobi.kpi.model.bo.Resource

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.