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

Examples of org.pentaho.reporting.engine.classic.core.wizard.DefaultDataSchema


    final ExpressionDataRow expressionsRow = masterRow.getExpressionDataRow();
    final ReportDataRow massDataRow = masterRow.getReportDataRow();
    // imported data has been compiled in the subreport ...
    final ImportedVariablesDataRow importedDataRow = masterRow.getImportedDataRow();

    final DefaultDataSchema defaultDataSchema = new DefaultDataSchema();

    if (parameters != null)
    {
      final MasterDataRow parentRow = masterRow.getParentDataRow();
      if (parentRow == null)
      {
        processParameters(parameters, null, reportEnvironment,
            globalAttributes, indirectRules, directRules, defaultDataSchema);
      }
      else
      {
        // import the parameters that have been computed already ..
        final String[] parameterNames = parameters.getParentNames();
        final String[] innerNames = parameters.getColumnNames();
        for (int i = 0; i < parameterNames.length; i++)
        {
          final String name = parameterNames[i];
          final DataAttributes attributes = parentRow.getDataSchema().getAttributes(name);
          defaultDataSchema.setAttributes(innerNames[i], attributes);
        }
      }
    }

    // expressions
    final Expression[] expressions = expressionsRow.getExpressions();
    for (int i = 0; i < expressions.length; i++)
    {
      final Expression expression = expressions[i];
      final String name = expression.getName();
      if (name == null)
      {
        continue;
      }
      final DefaultDataAttributes computedParameterDataAttributes = new DefaultDataAttributes();
      computedParameterDataAttributes.merge(globalAttributes, context);
      computedParameterDataAttributes.merge(new ExpressionsDataAttributes(expression), context);

      applyRules(indirectRules, directRules, computedParameterDataAttributes);
      defaultDataSchema.setAttributes(name, computedParameterDataAttributes);
    }

    // massdata
    if (massDataRow != null)
    {
      final GenericDataAttributes parameterDataAttributes = getTableDataAttributes();
      final TableModel data = massDataRow.getReportData();
      if (data instanceof MetaTableModel == false)
      {
        final int count = data.getColumnCount();
        for (int i = 0; i < count; i++)
        {
          final String colName = data.getColumnName(i);
          parameterDataAttributes.setup
              (colName, data.getColumnClass(i), MetaAttributeNames.Core.SOURCE_VALUE_TABLE, colName, globalAttributes);

          final DefaultDataAttributes computedParameterDataAttributes = new DefaultDataAttributes();
          computedParameterDataAttributes.merge(parameterDataAttributes, context);
          applyRules(indirectRules, directRules, computedParameterDataAttributes);
          defaultDataSchema.setAttributes(colName, computedParameterDataAttributes);
        }
      }
      else
      {
        final MetaTableModel mt = (MetaTableModel) data;

        final DefaultDataAttributes tableGlobalAttributes = new DefaultDataAttributes();
        tableGlobalAttributes.merge(globalAttributes, context);
        tableGlobalAttributes.merge(mt.getTableAttributes(), context);
        try
        {
          defaultDataSchema.setTableAttributes(tableGlobalAttributes);
        }
        catch (CloneNotSupportedException e)
        {
          logger.warn("Unable to copy global data-attributes", e);
        }

        final int count = data.getColumnCount();
        for (int i = 0; i < count; i++)
        {
          final String colName = data.getColumnName(i);
          final DefaultDataAttributes computedParameterDataAttributes = new DefaultDataAttributes();
          computedParameterDataAttributes.merge(tableGlobalAttributes, context);
          computedParameterDataAttributes.merge(mt.getColumnAttributes(i), context);

          parameterDataAttributes.setup(colName, data.getColumnClass(i),
              MetaAttributeNames.Core.SOURCE_VALUE_TABLE, null, EmptyDataAttributes.INSTANCE);
          computedParameterDataAttributes.merge(parameterDataAttributes, context);

          applyRules(indirectRules, directRules, computedParameterDataAttributes);
          defaultDataSchema.setAttributes(colName, computedParameterDataAttributes);
        }
      }
    }

    // imported values ...
    if (importedDataRow != null)
    {
      final String[] columnNames = importedDataRow.getColumnNames();
      for (int i = 0; i < columnNames.length; i++)
      {
        final String columnName = columnNames[i];
        defaultDataSchema.setAttributes(columnName, importedDataRow.getAttributes(columnName));
      }
    }
    return defaultDataSchema;
  }
View Full Code Here


  public LayoutingContext(final MasterReport report)
  {
    this.outputProcessor = new DesignerOutputProcessor(report.getConfiguration());
    this.metaData = outputProcessor.getMetaData();

    final DefaultDataSchema schema = new DefaultDataSchema();
    final DataRow dataRow = new StaticDataRow();
    this.runtime = new DesignerExpressionRuntime(dataRow, schema, report);
  }
View Full Code Here

  {
    this.report = report;
    this.outputProcessor = new DesignerOutputProcessor(report.getConfiguration());
    this.metaData = outputProcessor.getMetaData();

    final DefaultDataSchema schema = new DefaultDataSchema();
    final DataRow dataRow = new StaticDataRow();
    this.runtime = new DesignerExpressionRuntime(dataRow, schema, report);
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.wizard.DefaultDataSchema

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.