Search in sources :

Example 31 with TextFileInputField

use of org.pentaho.di.trans.steps.textfileinput.TextFileInputField in project pentaho-kettle by pentaho.

the class CsvInputMeta method readRep.

@Override
public void readRep(Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases) throws KettleException {
    try {
        filename = rep.getStepAttributeString(id_step, getRepCode("FILENAME"));
        filenameField = rep.getStepAttributeString(id_step, getRepCode("FILENAME_FIELD"));
        rowNumField = rep.getStepAttributeString(id_step, getRepCode("ROW_NUM_FIELD"));
        includingFilename = rep.getStepAttributeBoolean(id_step, getRepCode("INCLUDE_FILENAME"));
        delimiter = rep.getStepAttributeString(id_step, getRepCode("DELIMITER"));
        enclosure = rep.getStepAttributeString(id_step, getRepCode("ENCLOSURE"));
        headerPresent = rep.getStepAttributeBoolean(id_step, getRepCode("HEADER_PRESENT"));
        bufferSize = rep.getStepAttributeString(id_step, getRepCode("BUFFERSIZE"));
        lazyConversionActive = rep.getStepAttributeBoolean(id_step, getRepCode("LAZY_CONVERSION"));
        isaddresult = rep.getStepAttributeBoolean(id_step, getRepCode("ADD_FILENAME_RESULT"));
        runningInParallel = rep.getStepAttributeBoolean(id_step, getRepCode("PARALLEL"));
        newlinePossibleInFields = rep.getStepAttributeBoolean(id_step, 0, getRepCode("NEWLINE_POSSIBLE"), !runningInParallel);
        encoding = rep.getStepAttributeString(id_step, getRepCode("ENCODING"));
        int nrfields = rep.countNrStepAttributes(id_step, getRepCode("FIELD_NAME"));
        allocate(nrfields);
        for (int i = 0; i < nrfields; i++) {
            inputFields[i] = new TextFileInputField();
            inputFields[i].setName(rep.getStepAttributeString(id_step, i, getRepCode("FIELD_NAME")));
            inputFields[i].setType(ValueMetaFactory.getIdForValueMeta(rep.getStepAttributeString(id_step, i, getRepCode("FIELD_TYPE"))));
            inputFields[i].setFormat(rep.getStepAttributeString(id_step, i, getRepCode("FIELD_FORMAT")));
            inputFields[i].setCurrencySymbol(rep.getStepAttributeString(id_step, i, getRepCode("FIELD_CURRENCY")));
            inputFields[i].setDecimalSymbol(rep.getStepAttributeString(id_step, i, getRepCode("FIELD_DECIMAL")));
            inputFields[i].setGroupSymbol(rep.getStepAttributeString(id_step, i, getRepCode("FIELD_GROUP")));
            inputFields[i].setLength((int) rep.getStepAttributeInteger(id_step, i, getRepCode("FIELD_LENGTH")));
            inputFields[i].setPrecision((int) rep.getStepAttributeInteger(id_step, i, getRepCode("FIELD_PRECISION")));
            inputFields[i].setTrimType(ValueMetaString.getTrimTypeByCode(rep.getStepAttributeString(id_step, i, getRepCode("FIELD_TRIM_TYPE"))));
        }
    } catch (Exception e) {
        throw new KettleException("Unexpected error reading step information from the repository", e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TextFileInputField(org.pentaho.di.trans.steps.textfileinput.TextFileInputField) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Example 32 with TextFileInputField

use of org.pentaho.di.trans.steps.textfileinput.TextFileInputField in project pentaho-kettle by pentaho.

the class ParGzipCsvInputMetaTest method setUpLoadSave.

@Before
public void setUpLoadSave() throws Exception {
    KettleEnvironment.init();
    PluginRegistry.init(false);
    List<String> attributes = Arrays.asList("filename", "filenameField", "includingFilename", "rowNumField", "headerPresent", "delimiter", "enclosure", "bufferSize", "lazyConversionActive", "addResultFile", "runningInParallel", "encoding", "inputFields");
    Map<String, String> getterMap = new HashMap<String, String>();
    Map<String, String> setterMap = new HashMap<String, String>();
    Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    attrValidatorMap.put("inputFields", new ArrayLoadSaveValidator<TextFileInputField>(new TextFileInputFieldValidator(), 5));
    Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    loadSaveTester = new LoadSaveTester(testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(), getterMap, setterMap, attrValidatorMap, typeValidatorMap, this);
}
Also used : HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) TextFileInputField(org.pentaho.di.trans.steps.textfileinput.TextFileInputField) ArrayList(java.util.ArrayList) Before(org.junit.Before)

Example 33 with TextFileInputField

use of org.pentaho.di.trans.steps.textfileinput.TextFileInputField in project pentaho-kettle by pentaho.

the class TextFileCSVImportProgressDialog method doScan.

private String doScan(IProgressMonitor monitor) throws KettleException {
    if (samples > 0) {
        monitor.beginTask(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Task.ScanningFile"), samples + 1);
    } else {
        monitor.beginTask(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Task.ScanningFile"), 2);
    }
    String line = "";
    long fileLineNumber = 0;
    DecimalFormatSymbols dfs = new DecimalFormatSymbols();
    int nrfields = meta.getInputFields().length;
    RowMetaInterface outputRowMeta = new RowMeta();
    meta.getFields(outputRowMeta, null, null, null, transMeta, null, null);
    // Remove the storage meta-data (don't go for lazy conversion during scan)
    for (ValueMetaInterface valueMeta : outputRowMeta.getValueMetaList()) {
        valueMeta.setStorageMetadata(null);
        valueMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
    }
    RowMetaInterface convertRowMeta = outputRowMeta.cloneToType(ValueMetaInterface.TYPE_STRING);
    // How many null values?
    // How many times null value?
    int[] nrnull = new int[nrfields];
    // String info
    // min string
    String[] minstr = new String[nrfields];
    // max string
    String[] maxstr = new String[nrfields];
    // first occ. of string?
    boolean[] firststr = new boolean[nrfields];
    // Date info
    // is the field perhaps a Date?
    boolean[] isDate = new boolean[nrfields];
    // How many date formats work?
    int[] dateFormatCount = new int[nrfields];
    // What are the date formats that
    boolean[][] dateFormat = new boolean[nrfields][Const.getDateFormats().length];
    // work?
    // min date value
    Date[][] minDate = new Date[nrfields][Const.getDateFormats().length];
    // max date value
    Date[][] maxDate = new Date[nrfields][Const.getDateFormats().length];
    // Number info
    // is the field perhaps a Number?
    boolean[] isNumber = new boolean[nrfields];
    // How many number formats work?
    int[] numberFormatCount = new int[nrfields];
    // What are the number format
    boolean[][] numberFormat = new boolean[nrfields][Const.getNumberFormats().length];
    // that work?
    // min number value
    double[][] minValue = new double[nrfields][Const.getDateFormats().length];
    // max number value
    double[][] maxValue = new double[nrfields][Const.getDateFormats().length];
    // remember the precision?
    int[][] numberPrecision = new int[nrfields][Const.getNumberFormats().length];
    // remember the length?
    int[][] numberLength = new int[nrfields][Const.getNumberFormats().length];
    for (int i = 0; i < nrfields; i++) {
        TextFileInputField field = meta.getInputFields()[i];
        if (log.isDebug()) {
            debug = "init field #" + i;
        }
        if (replaceMeta) {
            // Clear previous info...
            field.setName(meta.getInputFields()[i].getName());
            field.setType(meta.getInputFields()[i].getType());
            field.setFormat("");
            field.setLength(-1);
            field.setPrecision(-1);
            field.setCurrencySymbol(dfs.getCurrencySymbol());
            field.setDecimalSymbol("" + dfs.getDecimalSeparator());
            field.setGroupSymbol("" + dfs.getGroupingSeparator());
            field.setNullString("-");
            field.setTrimType(ValueMetaInterface.TRIM_TYPE_NONE);
        }
        nrnull[i] = 0;
        minstr[i] = "";
        maxstr[i] = "";
        firststr[i] = true;
        // Init data guess
        isDate[i] = true;
        for (int j = 0; j < Const.getDateFormats().length; j++) {
            dateFormat[i][j] = true;
            minDate[i][j] = Const.MAX_DATE;
            maxDate[i][j] = Const.MIN_DATE;
        }
        dateFormatCount[i] = Const.getDateFormats().length;
        // Init number guess
        isNumber[i] = true;
        for (int j = 0; j < Const.getNumberFormats().length; j++) {
            numberFormat[i][j] = true;
            minValue[i][j] = Double.MAX_VALUE;
            maxValue[i][j] = -Double.MAX_VALUE;
            numberPrecision[i][j] = -1;
            numberLength[i][j] = -1;
        }
        numberFormatCount[i] = Const.getNumberFormats().length;
    }
    InputFileMetaInterface strinfo = (InputFileMetaInterface) meta.clone();
    for (int i = 0; i < nrfields; i++) {
        strinfo.getInputFields()[i].setType(ValueMetaInterface.TYPE_STRING);
    }
    // Sample <samples> rows...
    debug = "get first line";
    StringBuilder lineBuffer = new StringBuilder(256);
    int fileFormatType = meta.getFileFormatTypeNr();
    // If the file has a header we overwrite the first line
    // However, if it doesn't have a header, take a new line
    // 
    line = TextFileInput.getLine(log, reader, encodingType, fileFormatType, lineBuffer);
    fileLineNumber++;
    int skipped = 1;
    if (meta.hasHeader()) {
        while (line != null && skipped < meta.getNrHeaderLines()) {
            line = TextFileInput.getLine(log, reader, encodingType, fileFormatType, lineBuffer);
            skipped++;
            fileLineNumber++;
        }
    }
    int linenr = 1;
    List<StringEvaluator> evaluators = new ArrayList<StringEvaluator>();
    // Allocate number and date parsers
    DecimalFormat df2 = (DecimalFormat) NumberFormat.getInstance();
    DecimalFormatSymbols dfs2 = new DecimalFormatSymbols();
    SimpleDateFormat daf2 = new SimpleDateFormat();
    boolean errorFound = false;
    while (!errorFound && line != null && (linenr <= samples || samples == 0) && !monitor.isCanceled()) {
        monitor.subTask(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Task.ScanningLine", "" + linenr));
        if (samples > 0) {
            monitor.worked(1);
        }
        if (log.isDebug()) {
            debug = "convert line #" + linenr + " to row";
        }
        RowMetaInterface rowMeta = new RowMeta();
        meta.getFields(rowMeta, "stepname", null, null, transMeta, null, null);
        // Remove the storage meta-data (don't go for lazy conversion during scan)
        for (ValueMetaInterface valueMeta : rowMeta.getValueMetaList()) {
            valueMeta.setStorageMetadata(null);
            valueMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
        }
        String delimiter = transMeta.environmentSubstitute(meta.getSeparator());
        String enclosure = transMeta.environmentSubstitute(meta.getEnclosure());
        String escapeCharacter = transMeta.environmentSubstitute(meta.getEscapeCharacter());
        Object[] r = TextFileInput.convertLineToRow(log, new TextFileLine(line, fileLineNumber, null), strinfo, null, 0, outputRowMeta, convertRowMeta, meta.getFilePaths(transMeta)[0], rownumber, delimiter, enclosure, escapeCharacter, null, false, false, false, false, false, false, false, false, null, null, false, null, null, null, null, 0);
        if (r == null) {
            errorFound = true;
            continue;
        }
        rownumber++;
        for (int i = 0; i < nrfields && i < r.length; i++) {
            StringEvaluator evaluator;
            if (i >= evaluators.size()) {
                evaluator = new StringEvaluator(true);
                evaluators.add(evaluator);
            } else {
                evaluator = evaluators.get(i);
            }
            String string = rowMeta.getString(r, i);
            if (i == 0) {
                System.out.println();
            }
            evaluator.evaluateString(string);
        }
        fileLineNumber++;
        if (r != null) {
            linenr++;
        }
        // Grab another line...
        // 
        line = TextFileInput.getLine(log, reader, encodingType, fileFormatType, lineBuffer);
    }
    monitor.worked(1);
    monitor.setTaskName(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Task.AnalyzingResults"));
    // Show information on items using a dialog box
    // 
    StringBuilder message = new StringBuilder();
    message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.ResultAfterScanning", "" + (linenr - 1)));
    message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.HorizontalLine"));
    for (int i = 0; i < nrfields; i++) {
        TextFileInputField field = meta.getInputFields()[i];
        StringEvaluator evaluator = evaluators.get(i);
        List<StringEvaluationResult> evaluationResults = evaluator.getStringEvaluationResults();
        // If we didn't find any matching result, it's a String...
        // 
        StringEvaluationResult result = evaluator.getAdvicedResult();
        if (evaluationResults.isEmpty()) {
            field.setType(ValueMetaInterface.TYPE_STRING);
            field.setLength(evaluator.getMaxLength());
        }
        if (result != null) {
            // Take the first option we find, list the others below...
            // 
            ValueMetaInterface conversionMeta = result.getConversionMeta();
            field.setType(conversionMeta.getType());
            field.setTrimType(conversionMeta.getTrimType());
            field.setFormat(conversionMeta.getConversionMask());
            field.setDecimalSymbol(conversionMeta.getDecimalSymbol());
            field.setGroupSymbol(conversionMeta.getGroupingSymbol());
            field.setLength(conversionMeta.getLength());
            field.setPrecision(conversionMeta.getPrecision());
            nrnull[i] = result.getNrNull();
            minstr[i] = result.getMin() == null ? "" : result.getMin().toString();
            maxstr[i] = result.getMax() == null ? "" : result.getMax().toString();
        }
        message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.FieldNumber", "" + (i + 1)));
        message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.FieldName", field.getName()));
        message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.FieldType", field.getTypeDesc()));
        switch(field.getType()) {
            case ValueMetaInterface.TYPE_NUMBER:
                message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.EstimatedLength", (field.getLength() < 0 ? "-" : "" + field.getLength())));
                message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.EstimatedPrecision", field.getPrecision() < 0 ? "-" : "" + field.getPrecision()));
                message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.NumberFormat", field.getFormat()));
                if (!evaluationResults.isEmpty()) {
                    if (evaluationResults.size() > 1) {
                        message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.WarnNumberFormat"));
                    }
                    for (StringEvaluationResult seResult : evaluationResults) {
                        String mask = seResult.getConversionMeta().getConversionMask();
                        message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.NumberFormat2", mask));
                        message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.TrimType", seResult.getConversionMeta().getTrimType()));
                        message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.NumberMinValue", seResult.getMin()));
                        message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.NumberMaxValue", seResult.getMax()));
                        try {
                            df2.applyPattern(mask);
                            df2.setDecimalFormatSymbols(dfs2);
                            double mn = df2.parse(seResult.getMin().toString()).doubleValue();
                            message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.NumberExample", mask, seResult.getMin(), Double.toString(mn)));
                        } catch (Exception e) {
                            if (log.isDetailed()) {
                                log.logDetailed("This is unexpected: parsing [" + seResult.getMin() + "] with format [" + mask + "] did not work.");
                            }
                        }
                    }
                }
                message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.NumberNrNullValues", "" + nrnull[i]));
                break;
            case ValueMetaInterface.TYPE_STRING:
                message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.StringMaxLength", "" + field.getLength()));
                message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.StringMinValue", minstr[i]));
                message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.StringMaxValue", maxstr[i]));
                message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.StringNrNullValues", "" + nrnull[i]));
                break;
            case ValueMetaInterface.TYPE_DATE:
                message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.DateMaxLength", field.getLength() < 0 ? "-" : "" + field.getLength()));
                message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.DateFormat", field.getFormat()));
                if (dateFormatCount[i] > 1) {
                    message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.WarnDateFormat"));
                }
                if (!Utils.isEmpty(minstr[i])) {
                    for (int x = 0; x < Const.getDateFormats().length; x++) {
                        if (dateFormat[i][x]) {
                            message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.DateFormat2", Const.getDateFormats()[x]));
                            Date mindate = minDate[i][x];
                            Date maxdate = maxDate[i][x];
                            message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.DateMinValue", mindate.toString()));
                            message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.DateMaxValue", maxdate.toString()));
                            daf2.applyPattern(Const.getDateFormats()[x]);
                            try {
                                Date md = daf2.parse(minstr[i]);
                                message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.DateExample", Const.getDateFormats()[x], minstr[i], md.toString()));
                            } catch (Exception e) {
                                if (log.isDetailed()) {
                                    log.logDetailed("This is unexpected: parsing [" + minstr[i] + "] with format [" + Const.getDateFormats()[x] + "] did not work.");
                                }
                            }
                        }
                    }
                }
                message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.DateNrNullValues", "" + nrnull[i]));
                break;
            default:
                break;
        }
        if (nrnull[i] == linenr - 1) {
            message.append(BaseMessages.getString(PKG, "TextFileCSVImportProgressDialog.Info.AllNullValues"));
        }
        message.append(Const.CR);
    }
    monitor.worked(1);
    monitor.done();
    return message.toString();
}
Also used : RowMeta(org.pentaho.di.core.row.RowMeta) DecimalFormat(java.text.DecimalFormat) TextFileInputField(org.pentaho.di.trans.steps.textfileinput.TextFileInputField) ArrayList(java.util.ArrayList) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) TextFileLine(org.pentaho.di.trans.steps.textfileinput.TextFileLine) StringEvaluationResult(org.pentaho.di.core.util.StringEvaluationResult) InputFileMetaInterface(org.pentaho.di.trans.steps.textfileinput.InputFileMetaInterface) DecimalFormatSymbols(java.text.DecimalFormatSymbols) Date(java.util.Date) KettleException(org.pentaho.di.core.exception.KettleException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) StringEvaluator(org.pentaho.di.core.util.StringEvaluator) SimpleDateFormat(java.text.SimpleDateFormat)

Example 34 with TextFileInputField

use of org.pentaho.di.trans.steps.textfileinput.TextFileInputField in project pentaho-kettle by pentaho.

the class TextFileImportWizardPage2 method createControl.

public void createControl(Composite parent) {
    shell = parent.getShell();
    int margin = Const.MARGIN;
    int left = props.getMiddlePct() / 2;
    int middle = props.getMiddlePct();
    int right = middle + left;
    // create the composite to hold the widgets
    Composite composite = new Composite(parent, SWT.NONE);
    props.setLook(composite);
    FormLayout compLayout = new FormLayout();
    compLayout.marginHeight = Const.FORM_MARGIN;
    compLayout.marginWidth = Const.FORM_MARGIN;
    composite.setLayout(compLayout);
    wFields = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    props.setLook(wFields);
    fdFields = new FormData();
    fdFields.top = new FormAttachment(0, 0);
    fdFields.left = new FormAttachment(0, 0);
    fdFields.right = new FormAttachment(left, 0);
    fdFields.bottom = new FormAttachment(100, 0);
    wFields.setLayoutData(fdFields);
    refreshFields();
    // Fieldname line
    wlFieldname = new Label(composite, SWT.RIGHT);
    wlFieldname.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.Fieldname.Label"));
    props.setLook(wlFieldname);
    fdlFieldname = new FormData();
    fdlFieldname.left = new FormAttachment(wFields, 0);
    fdlFieldname.top = new FormAttachment(0, 0);
    fdlFieldname.right = new FormAttachment(middle, 0);
    wlFieldname.setLayoutData(fdlFieldname);
    wFieldname = new Text(composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFieldname);
    fdFieldname = new FormData();
    fdFieldname.left = new FormAttachment(middle, margin);
    fdFieldname.right = new FormAttachment(right, 0);
    fdFieldname.top = new FormAttachment(0, 0);
    wFieldname.setLayoutData(fdFieldname);
    // Position line
    wlPosition = new Label(composite, SWT.RIGHT);
    wlPosition.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.FieldPosition.Label"));
    props.setLook(wlPosition);
    fdlPosition = new FormData();
    fdlPosition.left = new FormAttachment(wFields, 0);
    fdlPosition.top = new FormAttachment(wFieldname, margin);
    fdlPosition.right = new FormAttachment(middle, 0);
    wlPosition.setLayoutData(fdlPosition);
    wPosition = new Text(composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPosition);
    fdPosition = new FormData();
    fdPosition.left = new FormAttachment(middle, margin);
    fdPosition.top = new FormAttachment(wFieldname, margin);
    fdPosition.right = new FormAttachment(right, 0);
    wPosition.setLayoutData(fdPosition);
    wPosition.setEnabled(false);
    // Topos line
    wlLength = new Label(composite, SWT.RIGHT);
    wlLength.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.FieldLength.Label"));
    props.setLook(wlLength);
    fdlLength = new FormData();
    fdlLength.left = new FormAttachment(wFields, 0);
    fdlLength.top = new FormAttachment(wPosition, margin);
    fdlLength.right = new FormAttachment(middle, 0);
    wlLength.setLayoutData(fdlLength);
    wLength = new Text(composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLength);
    fdLength = new FormData();
    fdLength.left = new FormAttachment(middle, margin);
    fdLength.top = new FormAttachment(wPosition, margin);
    fdLength.right = new FormAttachment(right, 0);
    wLength.setLayoutData(fdLength);
    wLength.setEnabled(false);
    // Fieldtype line
    wlFieldtype = new Label(composite, SWT.RIGHT);
    wlFieldtype.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.FieldType.Label"));
    props.setLook(wlFieldtype);
    fdlFieldtype = new FormData();
    fdlFieldtype.left = new FormAttachment(wFields, 0);
    fdlFieldtype.top = new FormAttachment(wLength, margin);
    fdlFieldtype.right = new FormAttachment(middle, 0);
    wlFieldtype.setLayoutData(fdlFieldtype);
    wFieldtype = new CCombo(composite, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wFieldtype);
    for (int i = 0; i < ValueMetaFactory.getValueMetaNames().length; i++) {
        wFieldtype.add(ValueMetaFactory.getValueMetaNames()[i]);
    }
    fdFieldtype = new FormData();
    fdFieldtype.left = new FormAttachment(middle, margin);
    fdFieldtype.top = new FormAttachment(wLength, margin);
    fdFieldtype.right = new FormAttachment(right, 0);
    wFieldtype.setLayoutData(fdFieldtype);
    // Format line
    wlFormat = new Label(composite, SWT.RIGHT);
    wlFormat.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.FieldFormatter.Label"));
    props.setLook(wlFormat);
    fdlFormat = new FormData();
    fdlFormat.left = new FormAttachment(wFields, 0);
    fdlFormat.top = new FormAttachment(wFieldtype, margin);
    fdlFormat.right = new FormAttachment(middle, 0);
    wlFormat.setLayoutData(fdlFormat);
    wFormat = new Text(composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFormat);
    fdFormat = new FormData();
    fdFormat.left = new FormAttachment(middle, margin);
    fdFormat.top = new FormAttachment(wFieldtype, margin);
    fdFormat.right = new FormAttachment(right, 0);
    wFormat.setLayoutData(fdFormat);
    // Ignore checkbox
    wlIgnore = new Label(composite, SWT.RIGHT);
    wlIgnore.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.Ignore.Label"));
    props.setLook(wlIgnore);
    fdlIgnore = new FormData();
    fdlIgnore.left = new FormAttachment(wFields, 0);
    fdlIgnore.top = new FormAttachment(wFormat, margin);
    fdlIgnore.right = new FormAttachment(middle, 0);
    wlIgnore.setLayoutData(fdlIgnore);
    wIgnore = new Button(composite, SWT.CHECK);
    props.setLook(wIgnore);
    fdIgnore = new FormData();
    fdIgnore.left = new FormAttachment(middle, margin);
    fdIgnore.top = new FormAttachment(wFormat, margin);
    fdIgnore.right = new FormAttachment(right, 0);
    wIgnore.setLayoutData(fdIgnore);
    // Trimtype line
    wlTrimtype = new Label(composite, SWT.RIGHT);
    wlTrimtype.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.TrimType.Label"));
    props.setLook(wlTrimtype);
    fdlTrimtype = new FormData();
    fdlTrimtype.left = new FormAttachment(wFields, 0);
    fdlTrimtype.top = new FormAttachment(wIgnore, margin);
    fdlTrimtype.right = new FormAttachment(middle, 0);
    wlTrimtype.setLayoutData(fdlTrimtype);
    wTrimtype = new CCombo(composite, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wTrimtype);
    for (int i = 0; i < ValueMetaString.trimTypeDesc.length; i++) {
        wTrimtype.add(ValueMetaString.trimTypeDesc[i]);
    }
    fdTrimtype = new FormData();
    fdTrimtype.left = new FormAttachment(middle, margin);
    fdTrimtype.top = new FormAttachment(wIgnore, margin);
    fdTrimtype.right = new FormAttachment(right, 0);
    wTrimtype.setLayoutData(fdTrimtype);
    // Precision line
    wlPrecision = new Label(composite, SWT.RIGHT);
    wlPrecision.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.Precision.Label"));
    props.setLook(wlPrecision);
    fdlPrecision = new FormData();
    fdlPrecision.left = new FormAttachment(wFields, 0);
    fdlPrecision.top = new FormAttachment(wTrimtype, margin);
    fdlPrecision.right = new FormAttachment(middle, 0);
    wlPrecision.setLayoutData(fdlPrecision);
    wPrecision = new Text(composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPrecision);
    fdPrecision = new FormData();
    fdPrecision.left = new FormAttachment(middle, margin);
    fdPrecision.top = new FormAttachment(wTrimtype, margin);
    fdPrecision.right = new FormAttachment(right, 0);
    wPrecision.setLayoutData(fdPrecision);
    // Currency line
    wlCurrency = new Label(composite, SWT.RIGHT);
    wlCurrency.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.Currency.Label"));
    props.setLook(wlCurrency);
    fdlCurrency = new FormData();
    fdlCurrency.left = new FormAttachment(wFields, 0);
    fdlCurrency.top = new FormAttachment(wPrecision, margin);
    fdlCurrency.right = new FormAttachment(middle, 0);
    wlCurrency.setLayoutData(fdlCurrency);
    wCurrency = new Text(composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wCurrency);
    fdCurrency = new FormData();
    fdCurrency.left = new FormAttachment(middle, margin);
    fdCurrency.top = new FormAttachment(wPrecision, margin);
    fdCurrency.right = new FormAttachment(right, 0);
    wCurrency.setLayoutData(fdCurrency);
    // Decimal line
    wlDecimal = new Label(composite, SWT.RIGHT);
    wlDecimal.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.Decimal.Label"));
    props.setLook(wlDecimal);
    fdlDecimal = new FormData();
    fdlDecimal.left = new FormAttachment(wFields, 0);
    fdlDecimal.top = new FormAttachment(wCurrency, margin);
    fdlDecimal.right = new FormAttachment(middle, 0);
    wlDecimal.setLayoutData(fdlDecimal);
    wDecimal = new Text(composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wDecimal);
    fdDecimal = new FormData();
    fdDecimal.left = new FormAttachment(middle, margin);
    fdDecimal.top = new FormAttachment(wCurrency, margin);
    fdDecimal.right = new FormAttachment(right, 0);
    wDecimal.setLayoutData(fdDecimal);
    // Group line
    wlGroup = new Label(composite, SWT.RIGHT);
    wlGroup.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.Group.Label"));
    props.setLook(wlGroup);
    fdlGroup = new FormData();
    fdlGroup.left = new FormAttachment(wFields, 0);
    fdlGroup.top = new FormAttachment(wDecimal, margin);
    fdlGroup.right = new FormAttachment(middle, 0);
    wlGroup.setLayoutData(fdlGroup);
    wGroup = new Text(composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wGroup);
    fdGroup = new FormData();
    fdGroup.left = new FormAttachment(middle, margin);
    fdGroup.top = new FormAttachment(wDecimal, margin);
    fdGroup.right = new FormAttachment(right, 0);
    wGroup.setLayoutData(fdGroup);
    // Ignore checkbox
    wlRepeat = new Label(composite, SWT.RIGHT);
    wlRepeat.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.Repeat.Label"));
    props.setLook(wlRepeat);
    fdlRepeat = new FormData();
    fdlRepeat.left = new FormAttachment(wFields, 0);
    fdlRepeat.top = new FormAttachment(wGroup, margin);
    fdlRepeat.right = new FormAttachment(middle, 0);
    wlRepeat.setLayoutData(fdlRepeat);
    wRepeat = new Button(composite, SWT.CHECK);
    props.setLook(wRepeat);
    fdRepeat = new FormData();
    fdRepeat.left = new FormAttachment(middle, margin);
    fdRepeat.top = new FormAttachment(wGroup, margin);
    fdRepeat.right = new FormAttachment(right, 0);
    wRepeat.setLayoutData(fdRepeat);
    // Null line
    wlNull = new Label(composite, SWT.RIGHT);
    wlNull.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.Null.Label"));
    props.setLook(wlNull);
    fdlNull = new FormData();
    fdlNull.left = new FormAttachment(wFields, 0);
    fdlNull.top = new FormAttachment(wRepeat, margin);
    fdlNull.right = new FormAttachment(middle, 0);
    wlNull.setLayoutData(fdlNull);
    wNull = new Text(composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wNull);
    fdNull = new FormData();
    fdNull.left = new FormAttachment(middle, margin);
    fdNull.top = new FormAttachment(wRepeat, margin);
    fdNull.right = new FormAttachment(right, 0);
    wNull.setLayoutData(fdNull);
    // The buttons
    wPrev = new Button(composite, SWT.PUSH);
    wPrev.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.Previous.Button"));
    fdPrev = new FormData();
    fdPrev.left = new FormAttachment(left, margin);
    fdPrev.bottom = new FormAttachment(100, 0);
    wPrev.setLayoutData(fdPrev);
    // Guess button
    wGuess = new Button(composite, SWT.PUSH);
    wGuess.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.Guess.Button"));
    fdGuess = new FormData();
    fdGuess.left = new FormAttachment(wPrev, margin);
    fdGuess.bottom = new FormAttachment(100, 0);
    wGuess.setLayoutData(fdGuess);
    // GuessAll button
    wGuessAll = new Button(composite, SWT.PUSH);
    wGuessAll.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.GuessAll.Button"));
    fdGuessAll = new FormData();
    fdGuessAll.left = new FormAttachment(wGuess, 0);
    fdGuessAll.bottom = new FormAttachment(100, 0);
    wGuessAll.setLayoutData(fdGuessAll);
    wNext = new Button(composite, SWT.PUSH);
    wNext.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.Next.Button"));
    fdNext = new FormData();
    fdNext.left = new FormAttachment(wGuessAll, 0);
    fdNext.bottom = new FormAttachment(100, 0);
    wNext.setLayoutData(fdNext);
    // Sample list on the right...
    wSamples = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    props.setLook(wSamples, Props.WIDGET_STYLE_FIXED);
    fdSamples = new FormData();
    fdSamples.top = new FormAttachment(0, 0);
    fdSamples.left = new FormAttachment(right, 0);
    fdSamples.right = new FormAttachment(100, 0);
    fdSamples.bottom = new FormAttachment(100, 0);
    wSamples.setLayoutData(fdSamples);
    wFields.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            showInfo();
        }
    });
    if (wFields.getItemCount() > 0) {
        wFields.select(0);
        showInfo();
    }
    wFieldtype.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0) {
                int valtype = ValueMetaFactory.getIdForValueMeta(wFieldtype.getText());
                TextFileInputField field = (TextFileInputField) fields.get(idx);
                field.setType(valtype);
            }
        }
    });
    wFieldname.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0) {
                TextFileInputField field = (TextFileInputField) fields.get(idx);
                field.setName(wFieldname.getText());
                wFields.setItem(idx, wFieldname.getText());
            }
        }
    });
    wFormat.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0) {
                TextFileInputField field = (TextFileInputField) fields.get(idx);
                field.setFormat(wFormat.getText());
            }
        }
    });
    wNext.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0 && idx < wFields.getItemCount() - 1) {
                wFields.select(idx + 1);
                wFields.showSelection();
                showInfo();
            }
        }
    });
    wPrev.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            int idx = wFields.getSelectionIndex();
            if (idx > 0) {
                wFields.select(idx - 1);
                wFields.showSelection();
                showInfo();
            }
        }
    });
    wIgnore.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0) {
                TextFileInputField field = (TextFileInputField) fields.get(idx);
                field.flipIgnored();
            }
        }
    });
    wGuess.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0) {
                TextFileInputField field = (TextFileInputField) fields.get(idx);
                field.setSamples(wSamples.getItems());
                field.guess();
                showInfo();
            }
        }
    });
    wGuessAll.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            MessageBox mb = new MessageBox(shell, SWT.YES | SWT.NO | SWT.ICON_QUESTION);
            mb.setMessage(BaseMessages.getString(PKG, "TextFileImportWizardPage2.OverwriteTypeSettings.DialogMessage"));
            mb.setText(BaseMessages.getString(PKG, "TextFileImportWizardPage2.OverwriteTypeSettings.DialogTitle"));
            int answer = mb.open();
            if (answer == SWT.YES) {
                for (int i = 0; i < fields.size(); i++) {
                    TextFileInputField field = (TextFileInputField) fields.get(i);
                    field.setSamples(getRowSamples(field.getPosition(), field.getLength()));
                    field.guess();
                    wFields.select(i);
                    wFields.showSelection();
                    showInfo();
                }
            }
            if (wFields.getItemCount() > 0) {
                wFields.select(0);
                wFields.showSelection();
            }
            showInfo();
        }
    });
    wRepeat.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0) {
                TextFileInputField field = (TextFileInputField) fields.get(idx);
                field.flipRepeated();
            }
        }
    });
    wCurrency.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0) {
                TextFileInputField field = (TextFileInputField) fields.get(idx);
                field.setCurrencySymbol(wCurrency.getText());
            }
        }
    });
    wGroup.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0) {
                TextFileInputField field = (TextFileInputField) fields.get(idx);
                field.setGroupSymbol(wGroup.getText());
            }
        }
    });
    wDecimal.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0) {
                TextFileInputField field = (TextFileInputField) fields.get(idx);
                field.setDecimalSymbol(wDecimal.getText());
            }
        }
    });
    wNull.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0) {
                TextFileInputField field = (TextFileInputField) fields.get(idx);
                field.setNullString(wNull.getText());
            }
        }
    });
    wTrimtype.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0) {
                int trimType = ValueMetaString.getTrimTypeByDesc(wTrimtype.getText());
                TextFileInputField field = (TextFileInputField) fields.get(idx);
                field.setTrimType(trimType);
            }
        }
    });
    // set the composite as the control for this page
    setControl(composite);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) TextFileInputField(org.pentaho.di.trans.steps.textfileinput.TextFileInputField) Text(org.eclipse.swt.widgets.Text) MessageBox(org.eclipse.swt.widgets.MessageBox) ModifyEvent(org.eclipse.swt.events.ModifyEvent) CCombo(org.eclipse.swt.custom.CCombo) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) List(org.eclipse.swt.widgets.List) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 35 with TextFileInputField

use of org.pentaho.di.trans.steps.textfileinput.TextFileInputField in project pentaho-kettle by pentaho.

the class TextFileInputDialog method getInfo.

private void getInfo(TextFileInputMeta meta) {
    // return value
    stepname = wStepname.getText();
    // copy info to TextFileInputMeta class (input)
    meta.setAcceptingFilenames(wAccFilenames.getSelection());
    meta.setPassingThruFields(wPassThruFields.getSelection());
    meta.setAcceptingField(wAccField.getText());
    meta.setAcceptingStepName(wAccStep.getText());
    meta.setAcceptingStep(transMeta.findStep(wAccStep.getText()));
    meta.setFileType(wFiletype.getText());
    meta.setFileFormat(wFormat.getText());
    meta.setSeparator(wSeparator.getText());
    meta.setEnclosure(wEnclosure.getText());
    meta.setEscapeCharacter(wEscape.getText());
    meta.setRowLimit(Const.toLong(wLimit.getText(), 0L));
    meta.setFilenameField(wInclFilenameField.getText());
    meta.setRowNumberField(wInclRownumField.getText());
    meta.setAddResultFile(wAddResult.getSelection());
    meta.setIncludeFilename(wInclFilename.getSelection());
    meta.setIncludeRowNumber(wInclRownum.getSelection());
    meta.setRowNumberByFile(wRownumByFile.getSelection());
    meta.setHeader(wHeader.getSelection());
    meta.setNrHeaderLines(Const.toInt(wNrHeader.getText(), 1));
    meta.setFooter(wFooter.getSelection());
    meta.setNrFooterLines(Const.toInt(wNrFooter.getText(), 1));
    meta.setLineWrapped(wWraps.getSelection());
    meta.setNrWraps(Const.toInt(wNrWraps.getText(), 1));
    meta.setLayoutPaged(wLayoutPaged.getSelection());
    meta.setNrLinesPerPage(Const.toInt(wNrLinesPerPage.getText(), 80));
    meta.setNrLinesDocHeader(Const.toInt(wNrLinesDocHeader.getText(), 0));
    meta.setFileCompression(wCompression.getText());
    meta.setDateFormatLenient(wDateLenient.getSelection());
    meta.setNoEmptyLines(wNoempty.getSelection());
    meta.setEncoding(wEncoding.getText());
    int nrfiles = wFilenameList.getItemCount();
    int nrfields = wFields.nrNonEmpty();
    int nrfilters = wFilter.nrNonEmpty();
    meta.allocate(nrfiles, nrfields, nrfilters);
    meta.setFileName(wFilenameList.getItems(0));
    meta.setFileMask(wFilenameList.getItems(1));
    meta.setExcludeFileMask(wFilenameList.getItems(2));
    meta.setFileRequired(wFilenameList.getItems(3));
    meta.setIncludeSubFolders(wFilenameList.getItems(4));
    for (int i = 0; i < nrfields; i++) {
        TextFileInputField field = new TextFileInputField();
        TableItem item = wFields.getNonEmpty(i);
        field.setName(item.getText(1));
        field.setType(ValueMetaFactory.getIdForValueMeta(item.getText(2)));
        field.setFormat(item.getText(3));
        field.setPosition(Const.toInt(item.getText(4), -1));
        field.setLength(Const.toInt(item.getText(5), -1));
        field.setPrecision(Const.toInt(item.getText(6), -1));
        field.setCurrencySymbol(item.getText(7));
        field.setDecimalSymbol(item.getText(8));
        field.setGroupSymbol(item.getText(9));
        field.setNullString(item.getText(10));
        field.setIfNullValue(item.getText(11));
        field.setTrimType(ValueMetaString.getTrimTypeByDesc(item.getText(12)));
        field.setRepeated(BaseMessages.getString(PKG, "System.Combo.Yes").equalsIgnoreCase(item.getText(13)));
        // CHECKSTYLE:Indentation:OFF
        meta.getInputFields()[i] = field;
    }
    for (int i = 0; i < nrfilters; i++) {
        TableItem item = wFilter.getNonEmpty(i);
        TextFileFilter filter = new TextFileFilter();
        // CHECKSTYLE:Indentation:OFF
        meta.getFilter()[i] = filter;
        filter.setFilterString(item.getText(1));
        filter.setFilterPosition(Const.toInt(item.getText(2), -1));
        filter.setFilterLastLine(BaseMessages.getString(PKG, "System.Combo.Yes").equalsIgnoreCase(item.getText(3)));
        filter.setFilterPositive(BaseMessages.getString(PKG, "System.Combo.Yes").equalsIgnoreCase(item.getText(4)));
    }
    // Error handling fields...
    meta.setErrorIgnored(wErrorIgnored.getSelection());
    meta.setSkipBadFiles(wSkipBadFiles.getSelection());
    meta.setFileErrorField(wBadFileField.getText());
    meta.setFileErrorMessageField(wBadFileMessageField.getText());
    meta.setErrorLineSkipped(wSkipErrorLines.getSelection());
    meta.setErrorCountField(wErrorCount.getText());
    meta.setErrorFieldsField(wErrorFields.getText());
    meta.setErrorTextField(wErrorText.getText());
    meta.setWarningFilesDestinationDirectory(wWarnDestDir.getText());
    meta.setWarningFilesExtension(wWarnExt.getText());
    meta.setErrorFilesDestinationDirectory(wErrorDestDir.getText());
    meta.setErrorLineFilesExtension(wErrorExt.getText());
    meta.setLineNumberFilesDestinationDirectory(wLineNrDestDir.getText());
    meta.setLineNumberFilesExtension(wLineNrExt.getText());
    // Date format Locale
    Locale locale = EnvUtil.createLocale(wDateLocale.getText());
    if (!locale.equals(Locale.getDefault())) {
        meta.setDateFormatLocale(locale);
    } else {
        meta.setDateFormatLocale(Locale.getDefault());
    }
    meta.setShortFileNameField(wShortFileFieldName.getText());
    meta.setPathField(wPathFieldName.getText());
    meta.setIsHiddenField(wIsHiddenName.getText());
    meta.setLastModificationDateField(wLastModificationTimeName.getText());
    meta.setUriField(wUriName.getText());
    meta.setRootUriField(wRootUriName.getText());
    meta.setExtensionField(wExtensionFieldName.getText());
    meta.setSizeField(wSizeFieldName.getText());
}
Also used : Locale(java.util.Locale) TableItem(org.eclipse.swt.widgets.TableItem) TextFileFilter(org.pentaho.di.trans.steps.textfileinput.TextFileFilter) TextFileInputField(org.pentaho.di.trans.steps.textfileinput.TextFileInputField)

Aggregations

TextFileInputField (org.pentaho.di.trans.steps.textfileinput.TextFileInputField)47 KettleException (org.pentaho.di.core.exception.KettleException)13 KettleStepException (org.pentaho.di.core.exception.KettleStepException)11 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)11 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)11 TableItem (org.eclipse.swt.widgets.TableItem)9 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)4 S3ServiceException (org.jets3t.service.S3ServiceException)3 Node (org.w3c.dom.Node)3 HashMap (java.util.HashMap)2 Before (org.junit.Before)2 TextFileInputFieldInterface (org.pentaho.di.core.gui.TextFileInputFieldInterface)2 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)2 StepInjectionMetaEntry (org.pentaho.di.trans.step.StepInjectionMetaEntry)2 StepMeta (org.pentaho.di.trans.step.StepMeta)2 File (java.io.File)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1