use of org.pentaho.di.core.row.ValueMetaInterface 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.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class GetPreviousRowFieldMeta method getFields.
@Override
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
// Add new field?
for (int i = 0; i < fieldOutStream.length; i++) {
if (!Utils.isEmpty(fieldOutStream[i])) {
int index = inputRowMeta.indexOfValue(fieldInStream[i]);
if (index >= 0) {
ValueMetaInterface in = inputRowMeta.getValueMeta(index);
try {
ValueMetaInterface v = ValueMetaFactory.createValueMeta(space.environmentSubstitute(fieldOutStream[i]), in.getType());
v.setName(space.environmentSubstitute(fieldOutStream[i]));
v.setLength(in.getLength());
v.setPrecision(in.getPrecision());
v.setConversionMask(in.getConversionMask());
v.setOrigin(name);
inputRowMeta.addValueMeta(v);
} catch (Exception e) {
throw new KettleStepException(e);
}
}
}
}
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class GetPreviousRowFieldDialog method get.
private void get() {
try {
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
TableItemInsertListener listener = new TableItemInsertListener() {
public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
return true;
}
};
BaseStepDialog.getFieldsFromPrevious(r, wFields, 1, new int[] { 1 }, new int[] {}, -1, -1, listener);
}
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "GetPreviousRowFieldDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "GetPreviousRowFieldDialog.FailedToGetFields.DialogMessage"), ke);
}
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class RowMetaAndData method addValue.
public void addValue(String valueName, int valueType, Object valueData) {
ValueMetaInterface v;
try {
v = ValueMetaFactory.createValueMeta(valueName, valueType);
} catch (KettlePluginException e) {
v = new ValueMetaNone(valueName);
}
addValue(v, valueData);
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class RowMetaAndData method isEmptyValue.
public boolean isEmptyValue(String valueName) throws KettleValueException {
int idx = rowMeta.indexOfValue(valueName);
if (idx < 0) {
throw new KettleValueException("Unknown column '" + valueName + "'");
}
ValueMetaInterface metaType = rowMeta.getValueMeta(idx);
// find by source value type
switch(metaType.getType()) {
case ValueMetaInterface.TYPE_STRING:
return rowMeta.getString(data, idx) == null;
case ValueMetaInterface.TYPE_BOOLEAN:
return rowMeta.getBoolean(data, idx) == null;
case ValueMetaInterface.TYPE_INTEGER:
return rowMeta.getInteger(data, idx) == null;
case ValueMetaInterface.TYPE_NUMBER:
return rowMeta.getNumber(data, idx) == null;
case ValueMetaInterface.TYPE_BIGNUMBER:
return rowMeta.getBigNumber(data, idx) == null;
case ValueMetaInterface.TYPE_BINARY:
return rowMeta.getBinary(data, idx) == null;
case ValueMetaInterface.TYPE_DATE:
case ValueMetaInterface.TYPE_TIMESTAMP:
return rowMeta.getDate(data, idx) == null;
case ValueMetaInterface.TYPE_INET:
return rowMeta.getString(data, idx) == null;
}
throw new KettleValueException("Unknown source type: " + metaType.getTypeDesc());
}
Aggregations