Search in sources :

Example 1 with XMLInputSaxFieldPosition

use of org.pentaho.di.trans.steps.xmlinputsax.XMLInputSaxFieldPosition in project pentaho-kettle by pentaho.

the class XMLInputSaxDialog method getInfo.

// get metadata from ui to in
private void getInfo(XMLInputSaxMeta in) throws KettleException {
    // return value
    stepname = wStepname.getText();
    // copy info to TextFileInputMeta class (input)
    in.setRowLimit(Const.toLong(wLimit.getText(), 0L));
    in.setFilenameField(wInclFilenameField.getText());
    in.setRowNumberField(wInclRownumField.getText());
    in.setIncludeFilename(wInclFilename.getSelection());
    in.setIncludeRowNumber(wInclRownum.getSelection());
    int nrFiles = wFilenameList.getItemCount();
    int nrAttributes = wAttributes.nrNonEmpty();
    int nrFields = wFields.nrNonEmpty();
    int nrPositions = wPosition.nrNonEmpty();
    in.allocate(nrFiles, nrFields, nrPositions);
    in.setFileName(wFilenameList.getItems(0));
    in.setFileMask(wFilenameList.getItems(1));
    in.clearDefinition();
    for (int i = 0; i < nrAttributes; i++) {
        TableItem item = wAttributes.getNonEmpty(i);
        in.setDefiningAttribute(item.getText(1), item.getText(2));
    }
    for (int i = 0; i < nrFields; i++) {
        XMLInputSaxField field = new XMLInputSaxField();
        TableItem item = wFields.getNonEmpty(i);
        field.setName(item.getText(1));
        field.setType(Value.getType(item.getText(2)));
        field.setFormat(item.getText(3));
        field.setLength(Const.toInt(item.getText(4), -1));
        field.setPrecision(Const.toInt(item.getText(5), -1));
        field.setCurrencySymbol(item.getText(6));
        field.setDecimalSymbol(item.getText(7));
        field.setGroupSymbol(item.getText(8));
        field.setTrimType(XMLInputSaxField.getTrimType(item.getText(9)));
        field.setRepeated("Y".equalsIgnoreCase(item.getText(10)));
        field.setFieldPosition(item.getText(11));
        // CHECKSTYLE:Indentation:OFF
        in.getInputFields()[i] = field;
    }
    for (int i = 0; i < nrPositions; i++) {
        TableItem item = wPosition.getNonEmpty(i);
        String encode = item.getText(1);
        // CHECKSTYLE:Indentation:OFF
        in.getInputPosition()[i] = new XMLInputSaxFieldPosition(encode);
    }
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) XMLInputSaxField(org.pentaho.di.trans.steps.xmlinputsax.XMLInputSaxField) XMLInputSaxFieldPosition(org.pentaho.di.trans.steps.xmlinputsax.XMLInputSaxFieldPosition)

Aggregations

TableItem (org.eclipse.swt.widgets.TableItem)1 XMLInputSaxField (org.pentaho.di.trans.steps.xmlinputsax.XMLInputSaxField)1 XMLInputSaxFieldPosition (org.pentaho.di.trans.steps.xmlinputsax.XMLInputSaxFieldPosition)1