Search in sources :

Example 1 with DataSetField

use of org.apache.hop.testing.DataSetField in project hop by apache.

the class DataSetEditor method setWidgetsContent.

@Override
public void setWidgetsContent() {
    DataSet dataSet = getMetadata();
    wName.setText(Const.NVL(dataSet.getName(), ""));
    wDescription.setText(Const.NVL(dataSet.getDescription(), ""));
    wFolderName.setText(Const.NVL(dataSet.getFolderName(), ""));
    wBaseFilename.setText(Const.NVL(dataSet.getBaseFilename(), ""));
    for (int i = 0; i < dataSet.getFields().size(); i++) {
        DataSetField field = dataSet.getFields().get(i);
        int colNr = 1;
        wFieldMapping.setText(Const.NVL(field.getFieldName(), ""), colNr++, i);
        wFieldMapping.setText(ValueMetaFactory.getValueMetaName(field.getType()), colNr++, i);
        wFieldMapping.setText(Const.NVL(field.getFormat(), ""), colNr++, i);
        wFieldMapping.setText(field.getLength() >= 0 ? Integer.toString(field.getLength()) : "", colNr++, i);
        wFieldMapping.setText(field.getPrecision() >= 0 ? Integer.toString(field.getPrecision()) : "", colNr++, i);
        wFieldMapping.setText(Const.NVL(field.getComment(), ""), colNr++, i);
    }
}
Also used : DataSetField(org.apache.hop.testing.DataSetField) DataSet(org.apache.hop.testing.DataSet)

Example 2 with DataSetField

use of org.apache.hop.testing.DataSetField in project hop by apache.

the class DataSetEditor method getWidgetsContent.

@Override
public void getWidgetsContent(DataSet dataSet) {
    dataSet.setName(wName.getText());
    dataSet.setDescription(wDescription.getText());
    dataSet.setFolderName(wFolderName.getText());
    dataSet.setBaseFilename(wBaseFilename.getText());
    dataSet.getFields().clear();
    int nrFields = wFieldMapping.nrNonEmpty();
    for (int i = 0; i < nrFields; i++) {
        TableItem item = wFieldMapping.getNonEmpty(i);
        int colnr = 1;
        String fieldName = item.getText(colnr++);
        int type = ValueMetaFactory.getIdForValueMeta(item.getText(colnr++));
        String format = item.getText(colnr++);
        int length = Const.toInt(item.getText(colnr++), -1);
        int precision = Const.toInt(item.getText(colnr++), -1);
        String comment = item.getText(colnr++);
        DataSetField field = new DataSetField(fieldName, type, length, precision, comment, format);
        dataSet.getFields().add(field);
    }
}
Also used : DataSetField(org.apache.hop.testing.DataSetField)

Aggregations

DataSetField (org.apache.hop.testing.DataSetField)2 DataSet (org.apache.hop.testing.DataSet)1