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

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


  }

  private void populateSourceList()
  {
    final DataSchemaModel dataSchemaModel = getEditorModel().getDataSchema();
    final DataSchema dataSchema = dataSchemaModel.getDataSchema();
    final String[] names = dataSchema.getNames();
    Arrays.sort(names);
    final ArrayList<SourceFieldDefinition> fields = new ArrayList<SourceFieldDefinition>();
    for (int i = 0; i < names.length; i++)
    {
      final String fieldName = names[i];
View Full Code Here


  }

  public List<FieldWrapper> getDetailFields()
  {
    final ArrayList<FieldWrapper> fields = new ArrayList<FieldWrapper>();
    final DataSchema schema = getEditorModel().getDataSchema().getDataSchema();
    for (final DetailFieldDefinition field : getEditorModel().getReportSpec().getDetailFieldDefinitions())
    {
      fields.add(new FieldWrapper(field, schema));
    }
    return fields;
View Full Code Here

  }

  public List<FieldWrapper> getGroupFields()
  {
    final ArrayList<FieldWrapper> groups = new ArrayList<FieldWrapper>();
    final DataSchema schema = getEditorModel().getDataSchema().getDataSchema();
    for (final GroupDefinition group : getEditorModel().getReportSpec().getGroupDefinitions())
    {
      groups.add(new FieldWrapper(group, schema));
    }
    return groups;
View Full Code Here

    public void doMoveToGroups()
    {
      final XulListbox availableList = (XulListbox) getDocument().getElementById(AVAILABLE_COLUMNS_LIST_ID);
      final int[] selectedIndices = availableList.getSelectedIndices();
      final List<FieldWrapper> groups = getGroupFields();
      final DataSchema schema = getEditorModel().getDataSchema().getDataSchema();
      for (final int i : selectedIndices)
      {
        final SourceFieldDefinition group = getSelectableFields().get(i);
        final GroupDefinition xulGroup = new DefaultGroupDefinition();
        xulGroup.setField(group.getFieldName());
View Full Code Here

    public void doMoveToDetails()
    {
      final XulListbox availableList = (XulListbox) getDocument().getElementById(AVAILABLE_COLUMNS_LIST_ID);
      final int[] selectedIndices = availableList.getSelectedIndices();
      final List<FieldWrapper> details = getDetailFields();
      final DataSchema schema = getEditorModel().getDataSchema().getDataSchema();
      for (final int i : selectedIndices)
      {
        final SourceFieldDefinition field = getSelectableFields().get(i);
        final DetailFieldDefinition xulField = new DefaultDetailFieldDefinition();
        xulField.setField(field.getFieldName());
View Full Code Here

  public List<SourceFieldDefinition> getSelectableFieldsArray()
  {
    final List<SourceFieldDefinition> sourceFields = new ArrayList<SourceFieldDefinition>();
    final DataSchemaModel localSchemaModel = getDataSchema();
    final DataSchema dataSchema = localSchemaModel.getDataSchema();
    final String[] names = dataSchema.getNames();
    for (int i = 0; i < names.length; i++)
    {
      final String name = names[i];
      final SourceFieldDefinition fieldDefinition =
          new SourceFieldDefinition(name, getDataSchema().getDataSchema());
View Full Code Here

      final CloseableTableModel tableModel = (CloseableTableModel) pmdDataFactory.queryData("default", new ParameterDataRow());
      try
      {
        final DefaultDataSchemaDefinition def = new DefaultDataSchemaDefinition();
        final DataSchemaCompiler compiler = new DataSchemaCompiler(def, new DefaultDataAttributeContext());
        final DataSchema dataSchema = compiler.compile(tableModel);
        final String[] names = dataSchema.getNames();
        assertEquals(4, names.length);
        assertEquals("BC_EMPLOYEES_FIRSTNAME", names[0]);
        assertEquals("BC_EMPLOYEES_LASTNAME", names[1]);
        assertEquals("BC_EMPLOYEES_EMPLOYEENUMBER", names[2]);
        assertEquals("BC_EMPLOYEES_EMAIL", names[3]);

        final DataAttributes attributes = dataSchema.getAttributes(names[2]);
        // assert that formatting-label is not a default mapper
        final ConceptQueryMapper mapper = attributes.getMetaAttributeMapper(MetaAttributeNames.Formatting.NAMESPACE,
            MetaAttributeNames.Formatting.LABEL);
        if (mapper instanceof DefaultConceptQueryMapper)
        {
          fail("Formatting::label should be a LocalizedString instead of a default-mapper");
        }

        final Object value = attributes.getMetaAttribute(MetaAttributeNames.Formatting.NAMESPACE,
            MetaAttributeNames.Formatting.LABEL, null, new DefaultDataAttributeContext());
        if (value instanceof LocalizedString == false)
        {
          fail("Formatting::label should be a LocalizedString");
        }

        final Object label = attributes.getMetaAttribute(MetaAttributeNames.Formatting.NAMESPACE,
            MetaAttributeNames.Formatting.LABEL, String.class, new DefaultDataAttributeContext(Locale.US));
        if (label instanceof String == false)
        {
          fail("Formatting::label should be a String");
        }

        final Object elementAlignment = attributes.getMetaAttribute(MetaAttributeNames.Style.NAMESPACE,
            MetaAttributeNames.Style.HORIZONTAL_ALIGNMENT, null, new DefaultDataAttributeContext(Locale.US));
        if ("right".equals(elementAlignment) == false)
        {
          fail("Style::horizontal-alignment should be a String of value 'right'");
        }

        final DataAttributes attributes2 = dataSchema.getAttributes(names[0]);
        final Object elementAlignment2 = attributes2.getMetaAttribute(MetaAttributeNames.Style.NAMESPACE,
            MetaAttributeNames.Style.HORIZONTAL_ALIGNMENT, null, new DefaultDataAttributeContext(Locale.US));
        if ("left".equals(elementAlignment2) == false)
        {
          fail("Style::horizontal-alignment should be a String of value 'right'");
View Full Code Here

      final CloseableTableModel tableModel = (CloseableTableModel) pmdDataFactory.queryData("default", new ParameterDataRow());
      try
      {
        final DefaultDataSchemaDefinition def = new DefaultDataSchemaDefinition();
        final DataSchemaCompiler compiler = new DataSchemaCompiler(def, new DefaultDataAttributeContext());
        final DataSchema dataSchema = compiler.compile(tableModel);
        final String[] names = dataSchema.getNames();
        assertEquals(3, names.length);
        assertEquals("BC_CUSTOMER_W_TER_TERRITORY", names[0]);
        assertEquals("BC_ORDERDETAILS_QUANTITYORDERED", names[1]);
        assertEquals("BC_ORDERDETAILS_QUANTITYORDERED:AVERAGE", names[2]);
        final ByteArrayOutputStream sw = new ByteArrayOutputStream();
View Full Code Here

      try
      {
        List<SortConstraint> sortConstraints = new SortOrderReportPreProcessor().computeSortConstraints(parent);
        final TableModel reportData = queryReportData
            (parent.getQuery(), parent.getQueryTimeout(), dataFactory, sortConstraints);
        final DataSchema dataSchema = dataSchemaCompiler.compile
            (reportData, expressions, parameterRow, parameterDefinitions, masterReport.getReportEnvironment());
        // this.columnNames = collectColumnNames(reportData, parameterRow, expressions);
        if (reportData instanceof CloseableTableModel)
        {
          final CloseableTableModel ctm = (CloseableTableModel) reportData;
          ctm.close();
        }
        return dataSchema;
      }
      finally
      {
        dataFactory.close();
      }
    }
    catch (final ReportProcessingException e)
    {
      final TableModel reportData = new DefaultTableModel();
      final DataSchema dataSchema = dataSchemaCompiler.compile
          (reportData, expressions, parameterRow, parameterDefinitions, getMasterReportElement().getReportEnvironment());
      this.dataFactoryException = e;
      return dataSchema;
    }
  }
View Full Code Here

    final int cols = names.length;
    this.dataAttributes = new HashMap<String,DataAttributes>();
    this.outerNames = new String[cols];
    this.innerNames = outerNames;
    final Object[] values = new Object[cols];
    final DataSchema dataSchema = innerRow.getDataSchema();
    for (int i = 0; i < cols; i++)
    {
      final String name = names[i];
      if (name == null)
      {
        throw new IllegalStateException("Every column must have a name.");
      }
      outerNames[i] = name;
      values[i] = globalView.get(name);

      dataAttributes.put(name, dataSchema.getAttributes(name));
    }
    setData(outerNames, values);
  }
View Full Code Here

TOP

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

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.