Search in sources :

Example 11 with DatabaseImpact

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

the class Spoon method showLastImpactAnalyses.

public void showLastImpactAnalyses(TransMeta transMeta) {
    if (transMeta == null) {
        return;
    }
    TransGraph transGraph = delegates.trans.findTransGraphOfTransformation(transMeta);
    if (transGraph == null) {
        return;
    }
    List<Object[]> rows = new ArrayList<>();
    RowMetaInterface rowMeta = null;
    for (int i = 0; i < transGraph.getImpact().size(); i++) {
        DatabaseImpact ii = transGraph.getImpact().get(i);
        RowMetaAndData row = ii.getRow();
        rowMeta = row.getRowMeta();
        rows.add(row.getData());
    }
    if (rows.size() > 0) {
        // Display all the rows...
        PreviewRowsDialog prd = new PreviewRowsDialog(shell, Variables.getADefaultVariableSpace(), SWT.NONE, "-", rowMeta, rows);
        prd.setTitleMessage(// "Result of analyses:"
        BaseMessages.getString(PKG, "Spoon.Dialog.ImpactAnalyses.Title"), BaseMessages.getString(PKG, "Spoon.Dialog.ImpactAnalyses.Message"));
        prd.open();
    } else {
        MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
        if (transGraph.isImpactFinished()) {
            // "As far as I can tell, this transformation has no impact on any database."
            mb.setMessage(BaseMessages.getString(PKG, "Spoon.Dialog.TransformationNoImpactOnDatabase.Message"));
        } else {
            // "Please run the impact analyses first on this transformation."
            mb.setMessage(BaseMessages.getString(PKG, "Spoon.Dialog.RunImpactAnalysesFirst.Message"));
        }
        // Impact
        mb.setText(BaseMessages.getString(PKG, "Spoon.Dialog.ImpactAnalyses.Title"));
        mb.open();
    }
}
Also used : DatabaseImpact(org.pentaho.di.trans.DatabaseImpact) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ArrayList(java.util.ArrayList) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 12 with DatabaseImpact

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

the class MySQLBulkLoaderMeta 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)

Example 13 with DatabaseImpact

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

the class GPBulkLoaderMeta 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 {
    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)

Example 14 with DatabaseImpact

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

the class ExecSQLMeta method analyseImpact.

public void analyseImpact(List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta, RowMeta prev, String[] input, String[] output, RowMeta info) throws KettleStepException {
    DatabaseImpact ii = new DatabaseImpact(DatabaseImpact.TYPE_IMPACT_READ_WRITE, transMeta.getName(), stepMeta.getName(), databaseMeta.getDatabaseName(), BaseMessages.getString(PKG, "ExecSQLMeta.DatabaseMeta.Unknown.Label"), BaseMessages.getString(PKG, "ExecSQLMeta.DatabaseMeta.Unknown2.Label"), BaseMessages.getString(PKG, "ExecSQLMeta.DatabaseMeta.Unknown3.Label"), stepMeta.getName(), sql, BaseMessages.getString(PKG, "ExecSQLMeta.DatabaseMeta.Title"));
    impact.add(ii);
}
Also used : DatabaseImpact(org.pentaho.di.trans.DatabaseImpact)

Example 15 with DatabaseImpact

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

the class SQLFileOutputMeta method analyseImpact.

public void analyseImpact(List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository, IMetaStore metaStore) {
    if (truncateTable) {
        DatabaseImpact ii = new DatabaseImpact(DatabaseImpact.TYPE_IMPACT_TRUNCATE, transMeta.getName(), stepMeta.getName(), databaseMeta.getDatabaseName(), tablename, "", "", "", "", "Truncate of table");
        impact.add(ii);
    }
    // The values that are entering this step are in "prev":
    if (prev != null) {
        for (int i = 0; i < prev.size(); i++) {
            ValueMetaInterface v = prev.getValueMeta(i);
            DatabaseImpact ii = new DatabaseImpact(DatabaseImpact.TYPE_IMPACT_WRITE, transMeta.getName(), stepMeta.getName(), databaseMeta.getDatabaseName(), tablename, v.getName(), v.getName(), 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