Package org.eobjects.analyzer.data

Examples of org.eobjects.analyzer.data.InputRow


    final List<InputRow> result = new ArrayList<InputRow>();
    final DataSet dataSet = dc.executeQuery(q);
    int rowNumber = 0;
    while (dataSet.next()) {
      Row row = dataSet.getRow();
      InputRow inputRow = new MetaModelInputRow(rowNumber, row);

      TransformedInputRow resultRow;
      if (inputRow instanceof TransformedInputRow) {
        // re-use existing transformed input row.
        resultRow = (TransformedInputRow) inputRow;
      } else {
        resultRow = new TransformedInputRow(inputRow);
      }

      for (TransformerJobBuilder<?> tjb : transformerJobs) {
        List<MutableInputColumn<?>> cols = outputColumns.get(tjb);
        Object[] output = tjb.getConfigurableBean().transform(resultRow);

        assert cols.size() == output.length;

        for (int i = 0; i < output.length; i++) {
          resultRow.addValue(cols.get(i), output[i]);
        }
      }

      result.add(resultRow);
      rowNumber++;
    }

    // close
    for (TransformerJobBuilder<?> tjb : transformerJobs) {
      close(tjb);
    }

    List<MutableInputColumn<?>> ownOutputColumns = outputColumns.get(_transformerJobBuilder);
    String[] columnNames = new String[_transformerJobBuilder.getInputColumns().size() + ownOutputColumns.size()];
    int column = 0;
    for (InputColumn<?> col : _transformerJobBuilder.getInputColumns()) {
      columnNames[column] = col.getName();
      column++;
    }
    for (InputColumn<?> col : outputColumns.get(_transformerJobBuilder)) {
      columnNames[column] = col.getName();
      column++;
    }

    DefaultTableModel tableModel = new DefaultTableModel(columnNames, result.size());
    int row = 0;
    for (InputRow inputRow : result) {
      column = 0;
      for (InputColumn<?> col : _transformerJobBuilder.getInputColumns()) {
        tableModel.setValueAt(inputRow.getValue(col), row, column);
        column++;
      }
      for (InputColumn<?> col : ownOutputColumns) {
        tableModel.setValueAt(inputRow.getValue(col), row, column);
        column++;
      }

      row++;
    }
View Full Code Here

TOP

Related Classes of org.eobjects.analyzer.data.InputRow

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.