Package it.eng.spagobi.services.proxy

Examples of it.eng.spagobi.services.proxy.DocumentExecuteServiceProxy


  }
 
 
  public DocumentExecuteServiceProxy getDocumentExecuteServiceProxy() {
    if (documentExecuteProxy == null) {
      documentExecuteProxy = new DocumentExecuteServiceProxy(getUserIdentifier(),
          getHttpSession());
    }

    return documentExecuteProxy;
  }
View Full Code Here


    try {
      // Creazione GET method

      HashMap parametersMap=(HashMap)this.getParameterValue("REPORT_PARAMETERS_MAP");

      DocumentExecuteServiceProxy proxy=(DocumentExecuteServiceProxy)parametersMap.get(EngineConstants.ENV_DOCUMENT_EXECUTE_SERVICE_PROXY);
      logger.debug("DocumentExecuteServiceProxy is equal to [" + proxy + "]");
      HashMap chartParameters=new HashMap();

      // Get all defined variables wich start with prefix sbichart,
      // each is an image to fill
      Map allVariables = this.variablesMap;
      Map allParameters = this.parametersMap;

      boolean oldModeRetrievingChart=false;
      boolean done=false;
      if(allVariables==null)allVariables=new HashMap();
      if(allParameters==null)allParameters=new HashMap();


      // First search for the chart_label variable, if present switch to "old mode"

      for (Iterator iterator = allVariables.keySet().iterator(); iterator.hasNext() && done==false;) {
        String varName = (String) iterator.next();
        if(varName.equalsIgnoreCase(CHART_LABEL)){
          oldModeRetrievingChart=true;
          logger.debug("old mode for retrieving chart, getting label from CHART LABEL variable and inserting in CHART_IMAGE variable");
          done=true;
        }
      }


      logger.debug("Running all variables");
      done=false;
      for (Iterator iterator = allVariables.keySet().iterator(); iterator.hasNext() && done==false;) {
        String varName = (String) iterator.next();
        if(oldModeRetrievingChart==true){
          if(varName.equalsIgnoreCase(CHART_LABEL)){
            JRFillVariable labelValueO = (JRFillVariable) allVariables.get(CHART_LABEL);
            String labelValue = null;
            if(labelValueO.getValue()==null){
              logger.error("CHART_LABEL variable has no value");
              return;
            }
            labelValue=(String)labelValueO.getValue();
           
            // Set other parameters (only not system defined)
            for (Iterator iterator2 = allParameters.keySet().iterator(); iterator2.hasNext();) {
              String namePar = (String) iterator2.next();
              JRFillParameter par=(JRFillParameter)allParameters.get(namePar);
              if(!par.isSystemDefined() && par.getValue()!=null){
                Object val=par.getValue();
                chartParameters.put(namePar, val.toString());
              }
            }

            logger.debug("execute chart with lable "+labelValue);
           
            logger.debug("Calling Service");
            byte[] image=proxy.executeChart(labelValue, chartParameters);
            logger.debug("Back from Service");

            InputStream is=new ByteArrayInputStream(image);

            logger.debug("Input Stream filled, Setting variable");
            if(allVariables.keySet().contains(CHART_IMAGE)){
              this.setVariableValue(CHART_IMAGE, is);
            }
            else{
              logger.error("variable where to set image chart "+CHART_IMAGE+ " not defined");
              return;
            }
            done=true;
          }
        }
        else if(oldModeRetrievingChart==false){
          if(varName.startsWith("sbichart_")){
            logger.debug("Processing variable "+varName);         
            JRFillVariable variable=(JRFillVariable)allVariables.get(varName);
            if(variable.getValue()!=null){
              chartParameters=new HashMap();
//              the realVarName is the name of the target variable!
              String areaValue=varName.substring(9);
              // call a utility function that parse the variable, in the form var1=val1;var2=val2
              String varVal=(String)variable.getValue();
              // Value is defined as chart_label=label;par1=val1;par2=val2;
              Map nameValuePars=parseVariable(varVal);

              // check if there is the main parameters defined:
              // chart_label : indicating the label of the chart that has to be called.
              if(nameValuePars.get(CHART_LABEL)!=null){
                String labelValue=(String) nameValuePars.get(CHART_LABEL);
                logger.debug("execute chart with lable "+labelValue);

                // Set other parameters
                for (Iterator iterator2 = nameValuePars.keySet().iterator(); iterator2.hasNext();) {
                  String namePar = (String) iterator2.next();
                  if(!namePar.equalsIgnoreCase(CHART_LABEL)){
                    Object value=nameValuePars.get(namePar);
                    chartParameters.put(namePar, value);
                  }
                }

                logger.debug("Calling Service");
                byte[] image=proxy.executeChart(labelValue, chartParameters);
                logger.debug("Back from Service");

                InputStream is=new ByteArrayInputStream(image);

                logger.debug("Input Stream filled, Setting variable");
View Full Code Here

          String[] value=(String[])parametersMap.get(namePar);
          chartParameters.put(namePar, value[0]);
        }
      }   
 
      DocumentExecuteServiceProxy proxy=new DocumentExecuteServiceProxy(userId,session);
      logger.debug("Calling Service");
        byte[] image=proxy.executeChart(labelValue, chartParameters);
      logger.debug("Back from Service");
     
      is=new ByteArrayInputStream(image);
     
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of it.eng.spagobi.services.proxy.DocumentExecuteServiceProxy

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.