Package org.pentaho.reporting.engine.classic.core.util

Examples of org.pentaho.reporting.engine.classic.core.util.ReportParameterValues


     */
    public void run()
    {
      try
      {
        resultTableModel = dataFactory.queryData(query, new ReportParameterValues());
      }
      catch (ReportDataFactoryException e)
      {
        exception = e;
      }
View Full Code Here


    public void run()
    {
      try
      {
        dataFactory.open();
        resultTableModel = dataFactory.queryData(query, new ReportParameterValues());
        dataFactory.close();
      }
      catch (ReportDataFactoryException e)
      {
        exception = e;
View Full Code Here

    public void run()
    {
      try
      {
        dataFactory.open();
        resultTableModel = dataFactory.queryData(query, new ReportParameterValues());
        dataFactory.close();
      }
      catch (ReportDataFactoryException e)
      {
        exception = e;
View Full Code Here

    if (query == null)
    {
      return null;
    }

    final QueryDataRowWrapper dataRow = new QueryDataRowWrapper(new ReportParameterValues(), 1, 0);
    final int size = availableDataSourcesModel.size();
    for (int i = 0; i < size; i++)
    {
      final DataFactoryWrapper factoryWrapper = availableDataSourcesModel.get(i);
      if (factoryWrapper.isRemoved())
View Full Code Here

                (reportDefinition.getResourceBundleFactory(), reportDefinition.getReportEnvironment()));
      }

      dataFactory.open();
      final TableModel tableModel = dataFactory.queryData
          (queryName, new QueryDataRowWrapper(new ReportParameterValues(), 1, 0));

      final int colCount = tableModel.getColumnCount();
      final String[] cols = new String[colCount];
      for (int i = 0; i < colCount; i++)
      {
View Full Code Here

    public void run()
    {
      try
      {
        dataFactory.open();
        resultTableModel = dataFactory.queryData(query, new ReportParameterValues());
        dataFactory.close();
      }
      catch (ReportDataFactoryException e)
      {
        exception = e;
View Full Code Here

              throw new Exception( Messages.getInstance().getErrorString(
                "JFreeReport.ERROR_0012_CLASS_LOCATION_MISSING" ) ); //$NON-NLS-1$
            } else {
              // Get input parameters, and set them as properties in the report
              // object.
              final ReportParameterValues reportProperties = new ReportParameterValues();
              IActionInput[] actionInputs = jFreeReportAction.getInputs();
              for ( IActionInput element : actionInputs ) {
                final Object paramValue = element.getValue();
                if ( paramValue instanceof Object[] ) {
                  final Object[] values = (Object[]) paramValue;
                  final StringBuffer valuesBuffer = new StringBuffer();
                  // TODO support non-string items
                  for ( int z = 0; z < values.length; z++ ) {
                    if ( z == 0 ) {
                      valuesBuffer.append( values[z].toString() );
                    } else {
                      valuesBuffer.append( ',' ).append( values[z].toString() );
                    }
                  }
                  reportProperties.put( element.getName(), valuesBuffer.toString() );
                } else {
                  reportProperties.put( element.getName(), paramValue );
                }
              }

              final DataFactory dataFactory = new PentahoDataFactory( loader );
              final TableModel model =
View Full Code Here

            } else {
              final String classLocation =
                  getInputStringValue( AbstractJFreeReportComponent.DATACOMPONENT_CLASSLOCINPUT );
              // Get input parameters, and set them as properties in the report
              // object.
              final ReportParameterValues reportProperties = new ReportParameterValues();
              final Set paramNames = getInputNames();
              final Iterator it = paramNames.iterator();
              while ( it.hasNext() ) {
                final String paramName = (String) it.next();
                final Object paramValue = getInputValue( paramName );
                if ( paramValue instanceof Object[] ) {
                  final Object[] values = (Object[]) paramValue;
                  final StringBuffer valuesBuffer = new StringBuffer();
                  // TODO support non-string items
                  for ( int i = 0; i < values.length; i++ ) {
                    if ( i == 0 ) {
                      valuesBuffer.append( values[i].toString() );
                    } else {
                      valuesBuffer.append( ',' ).append( values[i].toString() );
                    }
                  }
                  reportProperties.put( paramName, valuesBuffer.toString() );
                } else {
                  reportProperties.put( paramName, paramValue );
                }
              }

              final DataFactory dataFactory = new PentahoDataFactory( loader );
              final TableModel model = dataFactory.queryData( classLocation, new ParameterDataRow( reportProperties ) );
View Full Code Here

        final AppUser currentUser = this.context.authenticatedUser();

        try {

            final ReportParameterValues rptParamValues = report.getParameterValues();
            final ReportParameterDefinition paramsDefinition = report.getParameterDefinition();

            /*
             * only allow integer, long, date and string parameter types and
             * assume all mandatory - could go more detailed like Pawel did in
             * Mifos later and could match incoming and pentaho parameters
             * better... currently assuming they come in ok... and if not an
             * error
             */
            for (final ParameterDefinitionEntry paramDefEntry : paramsDefinition.getParameterDefinitions()) {
                final String paramName = paramDefEntry.getName();
                if (!((paramName.equals("tenantUrl")) || (paramName.equals("userhierarchy") || (paramName.equals("username")) || (paramName
                        .equals("password"))))) {
                    logger.info("paramName:" + paramName);
                    final String pValue = queryParams.get(paramName);
                    if (StringUtils.isBlank(pValue)) { throw new PlatformDataIntegrityException("error.msg.reporting.error",
                            "Pentaho Parameter: " + paramName + " - not Provided"); }

                    final Class<?> clazz = paramDefEntry.getValueType();
                    logger.info("addParametersToReport(" + paramName + " : " + pValue + " : " + clazz.getCanonicalName() + ")");
                    if (clazz.getCanonicalName().equalsIgnoreCase("java.lang.Integer")) {
                        rptParamValues.put(paramName, Integer.parseInt(pValue));
                    } else if (clazz.getCanonicalName().equalsIgnoreCase("java.lang.Long")) {
                        rptParamValues.put(paramName, Long.parseLong(pValue));
                    } else if (clazz.getCanonicalName().equalsIgnoreCase("java.sql.Date")) {
                        rptParamValues.put(paramName, Date.valueOf(pValue));
                    } else {
                        rptParamValues.put(paramName, pValue);
                    }
                }

            }

            // tenant database name and current user's office hierarchy
            // passed as parameters to allow multitenant penaho reporting
            // and
            // data scoping
            final Connection connection = this.dataSource.getConnection();
            String tenantUrl;
            try {
                tenantUrl = connection.getMetaData().getURL();
            } finally {
                connection.close();
            }
            final String userhierarchy = currentUser.getOffice().getHierarchy();
            logger.info("db URL:" + tenantUrl + "      userhierarchy:" + userhierarchy);
            rptParamValues.put("userhierarchy", userhierarchy);

            final MifosPlatformTenant tenant = ThreadLocalContextUtil.getTenant();

            rptParamValues.put("tenantUrl", tenantUrl);
            rptParamValues.put("username", tenant.getSchemaUsername());
            rptParamValues.put("password", tenant.getSchemaPassword());
        } catch (final Exception e) {
            logger.error("error.msg.reporting.error:" + e.getMessage());
            throw new PlatformDataIntegrityException("error.msg.reporting.error", e.getMessage());
        }
    }
View Full Code Here

      fixConfiguration(report, openerp_settings, postgres_settings, parameters);
     
      if (parameters != null){
        HashMap<String, Object> parameters_types = getParametersTypes(report);
        // Set parameters available
        ReportParameterValues values = report.getParameterValues();
        for(String parameter_name : parameters.keySet()) {
          Object parameter_value = parameters.get(parameter_name);
 
          if(parameters_types.get(parameter_name) != null){
            typeCastAndStore(values, ((Class<?>) parameters_types.get(parameter_name)).getName(), parameter_name, parameter_value);
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.util.ReportParameterValues

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.