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

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


    if (isInitialized() == false)
    {
      init();
    }

    final DefaultDataAttributes globalAttributes = getGlobalAttributes();
    final MetaSelectorRule[] indirectRules = getIndirectRules();
    final DirectFieldSelectorRule[] directRules = getDirectRules();
    final DataAttributeContext context = getContext();
    final ParameterDataRow parameters = masterRow.getParameterDataRow();
    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), "table", 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), "table", EmptyDataAttributes.INSTANCE);
          computedParameterDataAttributes.merge(parameterDataAttributes, context);

          applyRules(indirectRules, directRules, computedParameterDataAttributes);
          defaultDataSchema.setAttributes(colName, computedParameterDataAttributes);
        }
      }
View Full Code Here


    columnCount = model.getColumnCount();
    columnTypes = new Class[columnCount];
    columnNames = new String[columnCount];
    columnAttributes = new DefaultDataAttributes[columnCount];
    values = new Object[columnCount];
    tableAttributes = new DefaultDataAttributes();

    for (int i = 0; i < columnCount; i++)
    {
      columnTypes[i] = model.getColumnClass(i);
      columnNames[i] = model.getColumnName(i);
      columnAttributes[i] = new DefaultDataAttributes();
    }
    if (model instanceof MetaTableModel)
    {
      final MetaTableModel metaTableModel = (MetaTableModel) model;
      tableAttributes.merge(metaTableModel.getTableAttributes(), dataAttributeContext);
View Full Code Here

{
  private DefaultDataAttributes dataAttributes;

  public RuleMetaAttributesReadHandler()
  {
    this.dataAttributes = new DefaultDataAttributes();
  }
View Full Code Here

  private EmptyDataAttributes emptyDataAttributes;

  public DefaultTableMetaData(final int colCount)
  {
    this.emptyDataAttributes = EmptyDataAttributes.INSTANCE;
    this.tableAttributes = new DefaultDataAttributes();
    this.columnAttributes = new DefaultDataAttributes[colCount];
    for (int i = 0; i < columnAttributes.length; i++)
    {
      columnAttributes[i] = new DefaultDataAttributes();
    }
  }
View Full Code Here

  public void setColumnAttribute(final int column,
                                 final String metaAttributeDomain,
                                 final String metaAttributeId,
                                 final Object value)
  {
    final DefaultDataAttributes colAtts = columnAttributes[column];
    colAtts.setMetaAttribute(metaAttributeDomain, metaAttributeId, DefaultConceptQueryMapper.INSTANCE, value);
  }
View Full Code Here

      final MetaTableModel metaTableModel = (MetaTableModel) model;
      for (int i = 0; i < model.getColumnCount(); i++)
      {
        final String columnName = model.getColumnName(i);
        final Class columnType = model.getColumnClass(i);
        final DefaultDataAttributes attributes = new DefaultDataAttributes();
        attributes.setMetaAttribute(MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.NAME,
            new DefaultConceptQueryMapper(), columnName);
        attributes.setMetaAttribute(MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.TYPE,
            new DefaultConceptQueryMapper(), columnType);
        attributes.merge(metaTableModel.getColumnAttributes(i), dataAttributeContext);
        columnAttributes.add(attributes);
      }

      if (metaTableModel.isCellDataAttributesSupported())
      {
        cellAttributes = new GenericObjectTable(Math.max(1,model.getRowCount()), Math.max(1,model.getColumnCount()));
        for (int row = 0; row < model.getRowCount(); row += 1)
        {
          for (int columns = 0; columns < model.getColumnCount(); columns += 1)
          {
            final DefaultDataAttributes attributes = new DefaultDataAttributes();
            attributes.merge(metaTableModel.getCellDataAttributes(row, columns), dataAttributeContext);
            cellAttributes.setObject(row, columns, attributes);
          }
        }
      }

      final DefaultDataAttributes attributes = new DefaultDataAttributes();
      attributes.merge(metaTableModel.getTableAttributes(), dataAttributeContext);
      tableAttributes = attributes;
    }
    else
    {
      for (int i = 0; i < model.getColumnCount(); i++)
      {
        final String columnName = model.getColumnName(i);
        final Class columnType = model.getColumnClass(i);
        final DefaultDataAttributes attributes = new DefaultDataAttributes();
        attributes.setMetaAttribute(MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.NAME,
            new DefaultConceptQueryMapper(), columnName);
        attributes.setMetaAttribute(MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.TYPE,
            new DefaultConceptQueryMapper(), columnType);
        columnAttributes.add(attributes);
      }
      tableAttributes = EmptyDataAttributes.INSTANCE;
    }
View Full Code Here

   *
   * @return the table attributes.
   */
  public DataAttributes getTableAttributes()
  {
    final DefaultDataAttributes dataAttributes = new DefaultDataAttributes();
    dataAttributes.setMetaAttribute(MetaAttributeNames.Core.NAMESPACE,
        MetaAttributeNames.Core.CROSSTAB_MODE, DefaultConceptQueryMapper.INSTANCE,  MetaAttributeNames.Core.CROSSTAB_VALUE_NORMALIZED);
    return dataAttributes;
  }
View Full Code Here

   *
   * @return
   */
  public DataAttributes getTableAttributes()
  {
    final DefaultDataAttributes dataAttributes = new DefaultDataAttributes();
    dataAttributes.setMetaAttribute(MetaAttributeNames.Core.NAMESPACE,
        MetaAttributeNames.Core.CROSSTAB_MODE, DefaultConceptQueryMapper.INSTANCE, MetaAttributeNames.Core.CROSSTAB_VALUE_NORMALIZED);
    return dataAttributes;
  }
View Full Code Here

   *
   * @return the table attributes.
   */
  public DataAttributes getTableAttributes()
  {
    final DefaultDataAttributes dataAttributes = new DefaultDataAttributes();
    dataAttributes.setMetaAttribute(MetaAttributeNames.Core.NAMESPACE,
        MetaAttributeNames.Core.CROSSTAB_MODE, DefaultConceptQueryMapper.INSTANCE, MetaAttributeNames.Core.CROSSTAB_VALUE_NORMALIZED);
    return dataAttributes;
  }
View Full Code Here

   *
   * @return the table attributes.
   */
  public DataAttributes getTableAttributes()
  {
    final DefaultDataAttributes dataAttributes = new DefaultDataAttributes();
    dataAttributes.setMetaAttribute(MetaAttributeNames.Core.NAMESPACE,
        MetaAttributeNames.Core.CROSSTAB_MODE, DefaultConceptQueryMapper.INSTANCE,  MetaAttributeNames.Core.CROSSTAB_VALUE_NORMALIZED);
    return dataAttributes;
  }
View Full Code Here

TOP

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

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.