use of org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta in project pdi-dataservice-server-plugin by pentaho.
the class ParameterGenerationController method runAutoGenerate.
public void runAutoGenerate() throws XulException {
DataServiceModel dialogModel = model.getDialogModel();
try {
AutoOptimizationService autoOptimizationService = factory.createAutoOptimizationService();
Collection<PushDownOptimizationMeta> found = autoOptimizationService.apply(dialogModel.getDataService());
if (dialogModel.addAll(found)) {
model.updateParameterMap();
}
info(getString(PKG, "ParameterGenerationController.AutoGen.Title"), getString(PKG, "ParameterGenerationController.AutoGen.Message", found.size()));
} catch (Exception e) {
String message = getString(PKG, "ParameterGenerationController.AutoGen.Error");
getLogChannel().logError(message, e);
error(getString(PKG, "ParameterGenerationController.AutoGen.Title"), message);
}
}
use of org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta in project pdi-dataservice-server-plugin by pentaho.
the class ParameterGenerationController method addParameter.
public void addParameter() throws XulException {
PushDownOptimizationMeta meta = new PushDownOptimizationMeta();
ParameterGeneration parameterGeneration = factory.createPushDown();
meta.setType(parameterGeneration);
meta.setStepName(getStepMenuList().getSelectedItem());
XulPromptBox promptBox = createPromptBox();
promptBox.setTitle(getString(PKG, "ParameterGenerationController.Create.Title"));
promptBox.setMessage(getString(PKG, "ParameterGenerationController.Create.Message"));
ParameterEditor editor = new ParameterEditor(parameterGeneration);
promptBox.addDialogCallback(editor);
if (promptBox.open() == 0 && editor.modified) {
model.add(meta);
model.setSelectedParameter(parameterGeneration.getParameterName());
}
}
use of org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta in project pdi-dataservice-server-plugin by pentaho.
the class ParameterGenerationModel method setEnabled.
public void setEnabled(boolean enabled) {
PushDownOptimizationMeta meta = getSelectedOptimization();
if (meta != null) {
boolean previous = meta.isEnabled();
meta.setEnabled(enabled);
firePropertyChange("enabled", previous, enabled);
}
}
use of org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta in project pdi-dataservice-server-plugin by pentaho.
the class ServiceCacheController method initBindings.
public void initBindings(DataServiceModel model) {
PushDownOptimizationMeta meta = locateServiceCacheMeta(model);
ServiceCache serviceCache = (ServiceCache) meta.getType();
BindingFactory bindingFactory = getBindingFactory();
XulRadio normalModeRadio = getElementById("regular-type-radio");
XulTab serviceCacheTab = getElementById("service-cache-tab");
XulCheckbox serviceCacheCheckBox = getElementById("service-cache-checkbox");
XulTextbox serviceCacheTextBox = getElementById("service-cache-ttl");
bindingFactory.setBindingType(Binding.Type.ONE_WAY);
serviceCacheCheckBox.setChecked(meta.isEnabled());
serviceCacheTab.setVisible(!model.isStreaming());
try {
serviceCacheTextBox.setValue(serviceCache.getConfiguredTimeToLive());
} catch (Exception e) {
getLogChannel().logError("Unable to set default TTL", e);
}
bindingFactory.createBinding(serviceCacheTextBox, "value", serviceCache, "timeToLive");
bindingFactory.createBinding(serviceCacheCheckBox, "checked", meta, "enabled");
bindingFactory.createBinding(serviceCacheCheckBox, "checked", serviceCacheTextBox, "disabled", not());
bindingFactory.createBinding(normalModeRadio, "selected", serviceCacheTab, "visible");
}
use of org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta in project pdi-dataservice-server-plugin by pentaho.
the class ServiceCacheController method locateServiceCacheMeta.
/**
* Locate or create a pushdown optimization for service cache. Only one should exist, others will be removed if found.
*
* @param model Data Service model to update
* @return The ONLY Optimization Meta with a Service Cache type
*/
protected PushDownOptimizationMeta locateServiceCacheMeta(DataServiceModel model) {
List<PushDownOptimizationMeta> cacheOptimizations = model.getPushDownOptimizations(factory.getType());
PushDownOptimizationMeta meta;
if (cacheOptimizations.isEmpty()) {
meta = new PushDownOptimizationMeta();
meta.setStepName(model.getServiceStep());
meta.setType(factory.createPushDown());
model.add(meta);
} else {
meta = cacheOptimizations.get(0);
}
if (cacheOptimizations.size() > 1) {
model.removeAll(cacheOptimizations.subList(1, cacheOptimizations.size()));
}
return meta;
}
Aggregations