Search in sources :

Example 36 with PushDownOptimizationMeta

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

the class BaseStepValidationTest method before.

@Before
public void before() throws KettleStepException {
    stepMetas[0] = stepMeta;
    space = new Variables();
    checkStepsExtension = new CheckStepsExtension(remarks, space, transMeta, stepMetas, repository, metaStore);
    pushDownOptMetas = new ArrayList<PushDownOptimizationMeta>();
    when(dataServiceMeta.getPushDownOptimizationMeta()).thenReturn(pushDownOptMetas);
    init();
}
Also used : Variables(org.pentaho.di.core.variables.Variables) CheckStepsExtension(org.pentaho.di.trans.CheckStepsExtension) PushDownOptimizationMeta(org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta) Before(org.junit.Before)

Example 37 with PushDownOptimizationMeta

use of org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta 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;
}
Also used : ParameterGeneration(org.pentaho.di.trans.dataservice.optimization.paramgen.ParameterGeneration) PushDownOptimizationMeta(org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)

Example 38 with PushDownOptimizationMeta

use of org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta 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;
}
Also used : HashSet(java.util.HashSet) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) StepFieldOperations(org.pentaho.metaverse.api.StepFieldOperations) PushDownOptimizationMeta(org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta) List(java.util.List) Map(java.util.Map)

Example 39 with PushDownOptimizationMeta

use of org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta 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);
    }
}
Also used : ParameterGeneration(org.pentaho.di.trans.dataservice.optimization.paramgen.ParameterGeneration) XulMessageBox(org.pentaho.ui.xul.components.XulMessageBox) PushDownOptimizationMeta(org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta) BaseMessages.getString(org.pentaho.di.i18n.BaseMessages.getString)

Example 40 with PushDownOptimizationMeta

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

the class ParameterGenerationModel method setSelectedStep.

public void setSelectedStep(String stepName) {
    PushDownOptimizationMeta meta = getSelectedOptimization();
    if (meta != null) {
        String previous = meta.getStepName();
        meta.setStepName(stepName);
        firePropertyChange("selectedStep", previous, stepName);
    }
}
Also used : PushDownOptimizationMeta(org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)

Aggregations

PushDownOptimizationMeta (org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)41 Test (org.junit.Test)23 ParameterGeneration (org.pentaho.di.trans.dataservice.optimization.paramgen.ParameterGeneration)10 DataServiceMeta (org.pentaho.di.trans.dataservice.DataServiceMeta)8 SQL (org.pentaho.di.core.sql.SQL)7 IMetaStore (org.pentaho.metastore.api.IMetaStore)7 Matchers.anyString (org.mockito.Matchers.anyString)5 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)4 ImmutableSet (com.google.common.collect.ImmutableSet)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 DataOutputStream (java.io.DataOutputStream)3 Set (java.util.Set)3 RowProducer (org.pentaho.di.trans.RowProducer)3 PushDownType (org.pentaho.di.trans.dataservice.optimization.PushDownType)3 DataServiceModel (org.pentaho.di.trans.dataservice.ui.model.DataServiceModel)3 XulException (org.pentaho.ui.xul.XulException)3 Shell (org.eclipse.swt.widgets.Shell)2 Before (org.junit.Before)2 InOrder (org.mockito.InOrder)2 KettleException (org.pentaho.di.core.exception.KettleException)2