use of org.pentaho.di.trans.dataservice.optimization.paramgen.ParameterGeneration in project pdi-dataservice-server-plugin by pentaho.
the class BaseStepValidationTest method setupMockedParamGen.
ParameterGeneration setupMockedParamGen(String paramName, String stepName) {
ParameterGeneration pushDownType = mock(ParameterGeneration.class);
when(pushDownType.getParameterName()).thenReturn(paramName);
PushDownOptimizationMeta optMeta = new PushDownOptimizationMeta();
optMeta.setType(pushDownType);
optMeta.setStepName(stepName);
pushDownOptMetas.add(optMeta);
return pushDownType;
}
use of org.pentaho.di.trans.dataservice.optimization.paramgen.ParameterGeneration in project pdi-dataservice-server-plugin by pentaho.
the class ParameterGenerationController method removeParameter.
public void removeParameter() throws XulException {
PushDownOptimizationMeta meta = checkNotNull(model.getSelectedOptimization());
String parameterName = ((ParameterGeneration) meta.getType()).getParameterName();
XulMessageBox messageBox = createMessageBox();
messageBox.setTitle(getString(PKG, "ParameterGenerationController.Delete.Title"));
messageBox.setMessage(getString(PKG, "ParameterGenerationController.Delete.Message", parameterName));
messageBox.setIcon(SWT.ICON_QUESTION);
messageBox.setButtons(new Object[] { SWT.YES, SWT.NO });
if (messageBox.open() == SWT.YES) {
model.setSelectedParameter(null);
model.remove(meta);
}
}
use of org.pentaho.di.trans.dataservice.optimization.paramgen.ParameterGeneration 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