class DimensionLookupMeta extends BaseTransformMeta implements ITransformMeta<DimensionLookup, DimensionLookupData>, IProvidesModelerMeta {

  @Override
  public void getFields( IRowMeta row, String name, IRowMeta[] info, TransformMeta nextTransform,
                         IVariables variables, IHopMetadataProvider metadataProvider ) throws HopTransformException {

    // Change all the fields to normal storage, this is the fastest way to handle lazy conversion.
    // It doesn't make sense to use it in the SCD context but people try it anyway
    //
    for ( IValueMeta valueMeta : row.getValueMetaList() ) {
      valueMeta.setStorageType( IValueMeta.STORAGE_TYPE_NORMAL );

      // Also change the trim type to "None" as this can cause trouble
      // during compare of the data when there are leading/trailing spaces in the target table
      //
      valueMeta.setTrimType( IValueMeta.TRIM_TYPE_NONE );
    }

    // technical key can't be null

    if ( Utils.isEmpty( keyField ) ) {
      String message =
        BaseMessages.getString( PKG, "DimensionLookupMeta.Error.NoTechnicalKeySpecified" );

      logError( message );
      throw new HopTransformException( message );
    }

    IValueMeta v = new ValueMetaInteger( keyField );
    if ( keyRename != null && keyRename.length() > 0 ) {
      v.setName( keyRename );
    }

    v.setLength( 9 );
    v.setPrecision( 0 );
    v.setOrigin( name );
    row.addValueMeta( v );

    // retrieve extra fields on lookup?
    // Don't bother if there are no return values specified.
    if ( !update && fieldLookup.length > 0 ) {
      Database db = null;
      try {
        // Get the rows from the table...
        if ( databaseMeta != null ) {
          db = createDatabaseObject();

          IRowMeta extraFields = getDatabaseTableFields( db, schemaName, tableName );

          for ( int i = 0; i < fieldLookup.length; i++ ) {
            v = extraFields.searchValueMeta( fieldLookup[ i ] );
            if ( v == null ) {
              String message =
                BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToFindReturnField",
                  fieldLookup[ i ] );
              logError( message );
              throw new HopTransformException( message );
            }

            // If the field needs to be renamed, rename
            if ( fieldStream[ i ] != null && fieldStream[ i ].length() > 0 ) {
              v.setName( fieldStream[ i ] );
            }
            v.setOrigin( name );
            row.addValueMeta( v );
          }
        } else {
          String message =
            BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField" );
          logError( message );
          throw new HopTransformException( message );
        }
      } catch ( Exception e ) {
        String message =
          BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField2" );
        logError( message );
        throw new HopTransformException( message, e );
      } finally {
        if ( db != null ) {
          db.disconnect();
        }
      }
    }
  }

  public  DimensionLookupMeta();

}