use of org.pentaho.di.trans.steps.numberrange.NumberRangeRule in project pentaho-metaverse by pentaho.
the class NumberRangeStepAnalyzer method getChangeRecords.
@Override
public Set<ComponentDerivationRecord> getChangeRecords(final NumberRangeMeta meta) throws MetaverseAnalyzerException {
Set<ComponentDerivationRecord> changeRecords = new HashSet<>();
ComponentDerivationRecord changeRecord = new ComponentDerivationRecord(meta.getInputField(), meta.getOutputField(), ChangeType.DATA);
List<NumberRangeRule> rules = meta.getRules();
if (rules != null) {
for (NumberRangeRule rule : rules) {
changeRecord.addOperation(new Operation(Operation.MAPPING_CATEGORY, ChangeType.DATA, DictionaryConst.PROPERTY_TRANSFORMS, rule.getLowerBound() + " <= " + meta.getInputField() + " <= " + rule.getUpperBound() + " -> " + rule.getValue()));
}
}
changeRecords.add(changeRecord);
return changeRecords;
}
use of org.pentaho.di.trans.steps.numberrange.NumberRangeRule in project pentaho-kettle by pentaho.
the class NumberRangeDialog method getData.
// Read data from input (TextFileInputInfo)
public void getData() {
// Get fields
wStepname.setText(stepname);
String inputField = input.getInputField();
if (inputField != null) {
inputFieldControl.setText(inputField);
}
String outputField = input.getOutputField();
if (outputField != null) {
outputFieldControl.setText(outputField);
}
String fallBackValue = input.getFallBackValue();
if (fallBackValue != null) {
fallBackValueControl.setText(fallBackValue);
}
for (int i = 0; i < input.getRules().size(); i++) {
NumberRangeRule rule = input.getRules().get(i);
TableItem item = rulesControl.table.getItem(i);
// Empty value is equal to minimal possible value
if (rule.getLowerBound() > -Double.MAX_VALUE) {
String lowerBoundStr = String.valueOf(rule.getLowerBound());
item.setText(1, lowerBoundStr);
}
// Empty value is equal to maximal possible value
if (rule.getUpperBound() < Double.MAX_VALUE) {
String upperBoundStr = String.valueOf(rule.getUpperBound());
item.setText(2, upperBoundStr);
}
item.setText(3, rule.getValue());
}
rulesControl.setRowNums();
rulesControl.optWidth(true);
}
Aggregations