use of org.pentaho.di.core.Condition in project pdi-dataservice-server-plugin by pentaho.
the class ParameterGeneration method getPushDownCondition.
private Condition getPushDownCondition(SQL query) {
// Get user query conditions
Condition whereCondition;
if (query.getWhereCondition() != null) {
whereCondition = query.getWhereCondition().getCondition();
} else {
return null;
}
// Attempt to map fields to where clause
Condition pushDownCondition = mapConditionFields(whereCondition);
if (pushDownCondition == null || StringUtils.isBlank(getParameterName())) {
return null;
}
return pushDownCondition;
}
use of org.pentaho.di.core.Condition in project pdi-dataservice-server-plugin by pentaho.
the class ParameterGeneration method mapConditionFields.
protected Condition mapConditionFields(Condition condition) {
Condition clone = (Condition) condition.clone();
HashMap<String, SourceTargetFields> sourceMap;
sourceMap = new HashMap<String, SourceTargetFields>();
for (SourceTargetFields fieldMapping : fieldMappings) {
sourceMap.put(fieldMapping.getSourceFieldName(), fieldMapping);
}
if (applyMapping(clone, sourceMap)) {
clone.simplify();
return clone;
} else {
return null;
}
}
Aggregations