use of org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta in project pdi-dataservice-server-plugin by pentaho.
the class ParameterGenerationModel method updateParameterMap.
protected void updateParameterMap() {
ImmutableList<PushDownOptimizationMeta> list = dialogModel.getPushDownOptimizations(ParameterGeneration.class);
Map<String, PushDownOptimizationMeta> map = Maps.newHashMapWithExpectedSize(list.size());
for (PushDownOptimizationMeta meta : list) {
ParameterGeneration parameterGeneration = (ParameterGeneration) meta.getType();
String parameterName = parameterGeneration.getParameterName();
// If parameter already exists, add a unique suffix
int offset = 0;
while (map.containsKey(parameterName)) {
parameterName = String.format("%s_%d", parameterGeneration.getParameterName(), ++offset);
}
if (offset > 0) {
parameterGeneration.setParameterName(parameterName);
}
map.put(parameterName, meta);
}
setParameterMap(map);
if (!map.containsKey(getSelectedParameter())) {
setSelectedParameter(null);
}
}
Aggregations