use of org.pentaho.metaverse.api.StepFieldOperations in project pdi-dataservice-server-plugin by pentaho.
the class AutoParameterGenerationService method generateOptimizationList.
private List<PushDownOptimizationMeta> generateOptimizationList(SourceLineageMap sourceLineageMap) {
Map<String, Set<List<StepFieldOperations>>> inputSteps = Multimaps.asMap(sourceLineageMap);
List<PushDownOptimizationMeta> optimizationList = Lists.newArrayListWithExpectedSize(inputSteps.size());
for (Map.Entry<String, Set<List<StepFieldOperations>>> inputStepLineage : inputSteps.entrySet()) {
String inputStep = inputStepLineage.getKey();
Set<List<StepFieldOperations>> lineageSet = inputStepLineage.getValue();
PushDownOptimizationMeta pushDownOptimizationMeta = new PushDownOptimizationMeta();
ParameterGeneration parameterGeneration = serviceProvider.createPushDown();
pushDownOptimizationMeta.setName(MessageFormat.format("Parameter Generator: {0}", inputStep));
pushDownOptimizationMeta.setStepName(inputStep);
pushDownOptimizationMeta.setType(parameterGeneration);
parameterGeneration.setParameterName("DATA_SERVICE_QUERY_" + inputStep.replaceAll("\\s", "_").toUpperCase());
for (List<StepFieldOperations> fieldLineage : lineageSet) {
StepFieldOperations origin = fieldLineage.get(0);
StepFieldOperations last = Iterables.getLast(fieldLineage);
parameterGeneration.createFieldMapping(last.getFieldName(), origin.getFieldName());
}
optimizationList.add(pushDownOptimizationMeta);
}
return optimizationList;
}
Aggregations