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();
}
}
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);
}
}
}
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);
}
}
}
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);
}
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);
}
}
}
Aggregations