use of org.pentaho.di.trans.DatabaseImpact in project pentaho-kettle by pentaho.
the class GPLoadMeta 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 TableInputMeta 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 ( stepMeta.getName().equalsIgnoreCase( "cdc_cust" ) ) {
// System.out.println( "HERE!" );
// }
// Find the lookupfields...
RowMetaInterface out = new RowMeta();
// TODO: this builds, but does it work in all cases.
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 ii = new DatabaseImpact(DatabaseImpact.TYPE_IMPACT_READ, transMeta.getName(), stepMeta.getName(), databaseMeta.getDatabaseName(), "", outvalue.getName(), outvalue.getName(), stepMeta.getName(), sql, "read from one or more database tables via SQL statement");
impact.add(ii);
}
}
}
use of org.pentaho.di.trans.DatabaseImpact in project pentaho-kettle by pentaho.
the class TableOutputMeta 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);
}
}
}
use of org.pentaho.di.trans.DatabaseImpact in project pentaho-kettle by pentaho.
the class InsertUpdateMeta 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);
}
}
}
use of org.pentaho.di.trans.DatabaseImpact in project pentaho-kettle by pentaho.
the class DimensionLookupMeta 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) {
if (prev != null) {
if (!update) {
// Lookup: we do a lookup on the natural keys + the return fields!
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() : "?", "", v == null ? "" : "Type = " + v.toStringMeta());
impact.add(ii);
}
// Return fields...
for (int i = 0; i < fieldLookup.length; i++) {
ValueMetaInterface v = prev.searchValueMeta(fieldStream[i]);
DatabaseImpact ii = new DatabaseImpact(DatabaseImpact.TYPE_IMPACT_READ, transMeta.getName(), stepMeta.getName(), databaseMeta.getDatabaseName(), tableName, fieldLookup[i], fieldLookup[i], v == null ? "" : v != null ? v.getOrigin() : "?", "", v == null ? "" : "Type = " + v.toStringMeta());
impact.add(ii);
}
} else {
// Lookup: we do a lookup on the natural keys + the return fields!
for (int i = 0; i < keyLookup.length; i++) {
ValueMetaInterface v = prev.searchValueMeta(keyStream[i]);
DatabaseImpact ii = new DatabaseImpact(DatabaseImpact.TYPE_IMPACT_READ_WRITE, transMeta.getName(), stepMeta.getName(), databaseMeta.getDatabaseName(), tableName, keyLookup[i], keyStream[i], v == null ? "" : v.getOrigin(), "", v == null ? "" : "Type = " + v.toStringMeta());
impact.add(ii);
}
// Return fields...
for (int i = 0; i < fieldLookup.length; i++) {
ValueMetaInterface v = prev.searchValueMeta(fieldStream[i]);
DatabaseImpact ii = new DatabaseImpact(DatabaseImpact.TYPE_IMPACT_READ_WRITE, transMeta.getName(), stepMeta.getName(), databaseMeta.getDatabaseName(), tableName, fieldLookup[i], fieldLookup[i], v == null ? "" : v.getOrigin(), "", v == null ? "" : "Type = " + v.toStringMeta());
impact.add(ii);
}
}
}
}
Aggregations