Search in sources :

Example 1 with ParameterPushdownModel

use of org.pentaho.di.trans.dataservice.optimization.pushdown.ui.ParameterPushdownModel in project pdi-dataservice-server-plugin by pentaho.

the class ParameterPushdownFactory method createModel.

public ParameterPushdownModel createModel(final DataServiceModel dialogModel) {
    List<PushDownOptimizationMeta> optimizations = dialogModel.getPushDownOptimizations(ParameterPushdown.class);
    ParameterPushdown parameterPushdown;
    if (optimizations.isEmpty()) {
        parameterPushdown = createPushDown();
        PushDownOptimizationMeta optimizationMeta = new PushDownOptimizationMeta();
        optimizationMeta.setStepName(dialogModel.getServiceStep());
        optimizationMeta.setType(parameterPushdown);
        dialogModel.add(optimizationMeta);
    } else {
        parameterPushdown = (ParameterPushdown) optimizations.get(0).getType();
    }
    if (optimizations.size() > 1) {
        dialogModel.removeAll(optimizations.subList(1, optimizations.size()));
    }
    final ParameterPushdownModel parameterPushdownModel = new ParameterPushdownModel(parameterPushdown);
    parameterPushdownModel.setFieldList(dialogModel.getStepFields());
    dialogModel.addPropertyChangeListener("serviceStep", new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
            parameterPushdownModel.setFieldList(dialogModel.getStepFields());
        }
    });
    return parameterPushdownModel;
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) PushDownOptimizationMeta(org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta) ParameterPushdownModel(org.pentaho.di.trans.dataservice.optimization.pushdown.ui.ParameterPushdownModel)

Aggregations

PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 PushDownOptimizationMeta (org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)1 ParameterPushdownModel (org.pentaho.di.trans.dataservice.optimization.pushdown.ui.ParameterPushdownModel)1