@Override
public void readRep( Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters ) throws KettleException {
try {
String name = rep.getStepAttributeString( id_step, 0, "value_name" );
String typedesc = rep.getStepAttributeString( id_step, 0, "value_type" );
String text = rep.getStepAttributeString( id_step, 0, "value_text" );
boolean isnull = rep.getStepAttributeBoolean( id_step, 0, "value_null" );
int length = (int) rep.getStepAttributeInteger( id_step, 0, "value_length" );
int precision = (int) rep.getStepAttributeInteger( id_step, 0, "value_precision" );
int type = ValueMetaFactory.getIdForValueMeta( typedesc );
value = new ValueMetaAndData( new ValueMeta( name, type ), null );
value.getValueMeta().setLength( length );
value.getValueMeta().setPrecision( precision );
if ( isnull ) {
value.setValueData( null );
} else {
ValueMetaInterface stringMeta = new ValueMetaString( name );
if ( type != ValueMetaInterface.TYPE_STRING ) {
text = Const.trim( text );
}
value.setValueData( value.getValueMeta().convertData( stringMeta, text ) );
}
} catch ( KettleDatabaseException dbe ) {
throw new KettleException( "error reading step with id_step=" + id_step + " from the repository", dbe );
} catch ( Exception e ) {
throw new KettleException( "Unexpected error reading step with id_step=" + id_step + " from the repository", e );
}
}