Search in sources :

Example 16 with DatabaseImpact

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

the class DeleteMeta method analyseImpact.

public void analyseImpact(List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository, IMetaStore metaStore) throws KettleStepException {
    if (prev != null) {
        // Lookup: we do a lookup on the natural keys
        for (int i = 0; i < keyLookup.length; i++) {
            ValueMetaInterface v = prev.searchValueMeta(keyStream[i]);
            DatabaseImpact ii = new DatabaseImpact(DatabaseImpact.TYPE_IMPACT_DELETE, transMeta.getName(), stepMeta.getName(), databaseMeta.getDatabaseName(), tableName, keyLookup[i], keyStream[i], v != null ? v.getOrigin() : "?", "", "Type = " + v.toStringMeta());
            impact.add(ii);
        }
    }
}
Also used : DatabaseImpact(org.pentaho.di.trans.DatabaseImpact) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Example 17 with DatabaseImpact

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

the class DatabaseJoinMeta method analyseImpact.

@Override
public void analyseImpact(List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository, IMetaStore metaStore) throws KettleStepException {
    // Find the lookupfields...
    // 
    RowMetaInterface out = prev.clone();
    getFields(out, stepMeta.getName(), new RowMetaInterface[] { info }, null, transMeta, repository, metaStore);
    if (out != null) {
        for (int i = 0; i < out.size(); i++) {
            ValueMetaInterface outvalue = out.getValueMeta(i);
            DatabaseImpact di = new DatabaseImpact(DatabaseImpact.TYPE_IMPACT_READ, transMeta.getName(), stepMeta.getName(), databaseMeta.getDatabaseName(), "", outvalue.getName(), outvalue.getName(), stepMeta.getName(), transMeta.environmentSubstitute(sql), BaseMessages.getString(PKG, "DatabaseJoinMeta.DatabaseImpact.Title"));
            impact.add(di);
        }
    }
}
Also used : DatabaseImpact(org.pentaho.di.trans.DatabaseImpact) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Example 18 with DatabaseImpact

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

the class DynamicSQLRowMeta method analyseImpact.

public void analyseImpact(List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository, IMetaStore metaStore) throws KettleStepException {
    RowMetaInterface out = prev.clone();
    getFields(out, stepMeta.getName(), new RowMetaInterface[] { info }, null, transMeta, repository, metaStore);
    if (out != null) {
        for (int i = 0; i < out.size(); i++) {
            ValueMetaInterface outvalue = out.getValueMeta(i);
            DatabaseImpact di = new DatabaseImpact(DatabaseImpact.TYPE_IMPACT_READ, transMeta.getName(), stepMeta.getName(), databaseMeta.getDatabaseName(), "", outvalue.getName(), outvalue.getName(), stepMeta.getName(), sql, BaseMessages.getString(PKG, "DynamicSQLRowMeta.DatabaseImpact.Title"));
            impact.add(di);
        }
    }
}
Also used : DatabaseImpact(org.pentaho.di.trans.DatabaseImpact) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Example 19 with DatabaseImpact

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

the class SynchronizeAfterMergeMeta method analyseImpact.

public void analyseImpact(List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository, IMetaStore metaStore) throws KettleStepException {
    if (prev != null) {
        // Lookup: we do a lookup on the natural keys
        for (int i = 0; i < keyLookup.length; i++) {
            ValueMetaInterface v = prev.searchValueMeta(keyStream[i]);
            DatabaseImpact ii = new DatabaseImpact(DatabaseImpact.TYPE_IMPACT_READ, transMeta.getName(), stepMeta.getName(), databaseMeta.getDatabaseName(), tableName, keyLookup[i], keyStream[i], v != null ? v.getOrigin() : "?", "", "Type = " + v.toStringMeta());
            impact.add(ii);
        }
        // Insert update fields : read/write
        for (int i = 0; i < updateLookup.length; i++) {
            ValueMetaInterface v = prev.searchValueMeta(updateStream[i]);
            DatabaseImpact ii = new DatabaseImpact(DatabaseImpact.TYPE_IMPACT_READ_WRITE, transMeta.getName(), stepMeta.getName(), databaseMeta.getDatabaseName(), tableName, updateLookup[i], updateStream[i], v != null ? v.getOrigin() : "?", "", "Type = " + v.toStringMeta());
            impact.add(ii);
        }
    }
}
Also used : DatabaseImpact(org.pentaho.di.trans.DatabaseImpact) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Example 20 with DatabaseImpact

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

the class OraBulkLoaderMeta method analyseImpact.

public void analyseImpact(List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository, IMetaStore metaStore) throws KettleStepException {
    if (prev != null) {
        // Insert dateMask fields : read/write
        for (int i = 0; i < fieldTable.length; i++) {
            ValueMetaInterface v = prev.searchValueMeta(fieldStream[i]);
            DatabaseImpact ii = new DatabaseImpact(DatabaseImpact.TYPE_IMPACT_READ_WRITE, transMeta.getName(), stepMeta.getName(), databaseMeta.getDatabaseName(), transMeta.environmentSubstitute(tableName), fieldTable[i], fieldStream[i], v != null ? v.getOrigin() : "?", "", "Type = " + v.toStringMeta());
            impact.add(ii);
        }
    }
}
Also used : DatabaseImpact(org.pentaho.di.trans.DatabaseImpact) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Aggregations

DatabaseImpact (org.pentaho.di.trans.DatabaseImpact)21 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)19 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)4 ArrayList (java.util.ArrayList)1 MessageBox (org.eclipse.swt.widgets.MessageBox)1 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)1 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)1 Point (org.pentaho.di.core.gui.Point)1 RowMeta (org.pentaho.di.core.row.RowMeta)1 PreviewRowsDialog (org.pentaho.di.ui.core.dialog.PreviewRowsDialog)1 TransGraph (org.pentaho.di.ui.spoon.trans.TransGraph)1