Search in sources :

Example 1 with StepMetaChangeListenerInterface

use of org.pentaho.di.trans.step.StepMetaChangeListenerInterface in project pentaho-kettle by pentaho.

the class TransMeta method removeStep.

/**
 * Removes a step from the transformation on a certain location (i.e. the specified index). Also marks that the
 * transformation's steps have changed.
 *
 * @param i
 *          The index
 */
public void removeStep(int i) {
    if (i < 0 || i >= steps.size()) {
        return;
    }
    StepMeta removeStep = steps.get(i);
    StepMetaInterface iface = removeStep.getStepMetaInterface();
    if (iface instanceof StepMetaChangeListenerInterface) {
        removeStepChangeListener((StepMetaChangeListenerInterface) iface);
    }
    steps.remove(i);
    if (removeStep.getStepMetaInterface() instanceof MissingTrans) {
        removeMissingTrans((MissingTrans) removeStep.getStepMetaInterface());
    }
    changed_steps = true;
    clearCaches();
}
Also used : StepMetaChangeListenerInterface(org.pentaho.di.trans.step.StepMetaChangeListenerInterface) StepMetaInterface(org.pentaho.di.trans.step.StepMetaInterface) MissingTrans(org.pentaho.di.trans.steps.missing.MissingTrans) StepMeta(org.pentaho.di.trans.step.StepMeta)

Example 2 with StepMetaChangeListenerInterface

use of org.pentaho.di.trans.step.StepMetaChangeListenerInterface in project pentaho-kettle by pentaho.

the class TransMeta method addOrReplaceStep.

/**
 * Add a new step to the transformation if that step didn't exist yet. Otherwise, replace the step. This method also
 * marks that the transformation's steps have changed.
 *
 * @param stepMeta
 *          The meta-data for the step to be added.
 */
public void addOrReplaceStep(StepMeta stepMeta) {
    int index = steps.indexOf(stepMeta);
    if (index < 0) {
        index = steps.add(stepMeta) ? 0 : index;
    } else {
        StepMeta previous = getStep(index);
        previous.replaceMeta(stepMeta);
    }
    stepMeta.setParentTransMeta(this);
    StepMetaInterface iface = stepMeta.getStepMetaInterface();
    if (index != -1 && iface instanceof StepMetaChangeListenerInterface) {
        addStepChangeListener(index, (StepMetaChangeListenerInterface) iface);
    }
    changed_steps = true;
    clearCaches();
}
Also used : StepMetaChangeListenerInterface(org.pentaho.di.trans.step.StepMetaChangeListenerInterface) StepMetaInterface(org.pentaho.di.trans.step.StepMetaInterface) StepMeta(org.pentaho.di.trans.step.StepMeta) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 3 with StepMetaChangeListenerInterface

use of org.pentaho.di.trans.step.StepMetaChangeListenerInterface in project pentaho-kettle by pentaho.

the class TransMeta method addStep.

/**
 * Add a new step to the transformation. Also marks that the transformation's steps have changed.
 *
 * @param stepMeta
 *          The meta-data for the step to be added.
 */
public void addStep(StepMeta stepMeta) {
    steps.add(stepMeta);
    stepMeta.setParentTransMeta(this);
    StepMetaInterface iface = stepMeta.getStepMetaInterface();
    if (iface instanceof StepMetaChangeListenerInterface) {
        addStepChangeListener((StepMetaChangeListenerInterface) iface);
    }
    changed_steps = true;
    clearCaches();
}
Also used : StepMetaChangeListenerInterface(org.pentaho.di.trans.step.StepMetaChangeListenerInterface) StepMetaInterface(org.pentaho.di.trans.step.StepMetaInterface)

Example 4 with StepMetaChangeListenerInterface

use of org.pentaho.di.trans.step.StepMetaChangeListenerInterface in project pentaho-kettle by pentaho.

the class TransMeta method addStepChangeListener.

public void addStepChangeListener(int p, StepMetaChangeListenerInterface list) {
    int indexListener = -1;
    int indexListenerRemove = -1;
    StepMeta rewriteStep = steps.get(p);
    StepMetaInterface iface = rewriteStep.getStepMetaInterface();
    if (iface instanceof StepMetaChangeListenerInterface) {
        for (StepMetaChangeListenerInterface listener : stepChangeListeners) {
            indexListener++;
            if (listener.equals(iface)) {
                indexListenerRemove = indexListener;
            }
        }
        if (indexListenerRemove >= 0) {
            stepChangeListeners.add(indexListenerRemove, list);
        } else if (stepChangeListeners.size() == 0 && p == 0) {
            stepChangeListeners.add(list);
        }
    }
}
Also used : StepMetaChangeListenerInterface(org.pentaho.di.trans.step.StepMetaChangeListenerInterface) StepMetaInterface(org.pentaho.di.trans.step.StepMetaInterface) StepMeta(org.pentaho.di.trans.step.StepMeta) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 5 with StepMetaChangeListenerInterface

use of org.pentaho.di.trans.step.StepMetaChangeListenerInterface in project pentaho-kettle by pentaho.

the class TransMeta method setStep.

/**
 * Changes the content of a step on a certain position. This is accomplished by setting the step's metadata at the
 * specified index to the specified meta-data object. The new step's parent transformation is updated to be this
 * transformation.
 *
 * @param i
 *          The index into the steps list
 * @param stepMeta
 *          The step meta-data to set
 */
public void setStep(int i, StepMeta stepMeta) {
    StepMetaInterface iface = stepMeta.getStepMetaInterface();
    if (iface instanceof StepMetaChangeListenerInterface) {
        addStepChangeListener(i, (StepMetaChangeListenerInterface) stepMeta.getStepMetaInterface());
    }
    steps.set(i, stepMeta);
    stepMeta.setParentTransMeta(this);
    clearCaches();
}
Also used : StepMetaChangeListenerInterface(org.pentaho.di.trans.step.StepMetaChangeListenerInterface) StepMetaInterface(org.pentaho.di.trans.step.StepMetaInterface)

Aggregations

StepMetaChangeListenerInterface (org.pentaho.di.trans.step.StepMetaChangeListenerInterface)7 StepMetaInterface (org.pentaho.di.trans.step.StepMetaInterface)6 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)3 Point (org.pentaho.di.core.gui.Point)3 StepMeta (org.pentaho.di.trans.step.StepMeta)3 MissingTrans (org.pentaho.di.trans.steps.missing.MissingTrans)1