Search in sources :

Example 16 with ColumnInfo

use of org.pentaho.platform.dataaccess.datasource.wizard.models.ColumnInfo in project data-access by pentaho.

the class CsvTransformGenerator method createSelectStep.

protected StepMeta createSelectStep(TransMeta transMeta, String stepName) {
    SelectValuesMeta meta = new SelectValuesMeta();
    // find out which columns need to be deleted
    List<String> deleteNameList = new ArrayList<String>();
    for (ColumnInfo column : getModelInfo().getColumns()) {
        if (column.isIgnore()) {
            deleteNameList.add(column.getId());
        }
    }
    if (deleteNameList.size() == 0) {
        return null;
    }
    String[] deleteName = deleteNameList.toArray(new String[deleteNameList.size()]);
    meta.setDeleteName(deleteName);
    // meta.setID(3);
    StepMeta stepMeta = new StepMeta(stepName, stepName, meta);
    transMeta.addStep(stepMeta);
    return stepMeta;
}
Also used : SelectValuesMeta(org.pentaho.di.trans.steps.selectvalues.SelectValuesMeta) ArrayList(java.util.ArrayList) ColumnInfo(org.pentaho.platform.dataaccess.datasource.wizard.models.ColumnInfo) StepMeta(org.pentaho.di.trans.step.StepMeta)

Aggregations

ColumnInfo (org.pentaho.platform.dataaccess.datasource.wizard.models.ColumnInfo)16 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 StepMeta (org.pentaho.di.trans.step.StepMeta)3 ModelInfo (org.pentaho.platform.dataaccess.datasource.wizard.models.ModelInfo)3 List (java.util.List)2 CalculatorMetaFunction (org.pentaho.di.trans.steps.calculator.CalculatorMetaFunction)2 Column (org.pentaho.metadata.model.thin.Column)2 CsvFileInfo (org.pentaho.platform.dataaccess.datasource.wizard.models.CsvFileInfo)2 DataRow (org.pentaho.platform.dataaccess.datasource.wizard.models.DataRow)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 DecimalFormat (java.text.DecimalFormat)1 Locale (java.util.Locale)1 Vector (java.util.Vector)1 Before (org.junit.Before)1