public static ValueMetaInterface cloneValueMeta(ValueMetaInterface source, int targetType)
      throws KettlePluginException {
    ValueMetaInterface target = null;

    // If we're Cloneable and not changing types, call clone()
    if (source instanceof Cloneable && source.getType() == targetType) {
      target = source.clone();
    } else {
      target =
          createValueMeta(source.getName(), targetType, source.getLength(), source.getPrecision());
    }
    target.setConversionMask(source.getConversionMask());
    target.setDecimalSymbol(source.getDecimalSymbol());
    target.setGroupingSymbol(source.getGroupingSymbol());
    target.setStorageType(source.getStorageType());
    if (source.getStorageMetadata() != null) {
      target.setStorageMetadata(
          cloneValueMeta(source.getStorageMetadata(), source.getStorageMetadata().getType()));
    }
    target.setStringEncoding(source.getStringEncoding());
    target.setTrimType(source.getTrimType());
    target.setDateFormatLenient(source.isDateFormatLenient());
    target.setDateFormatLocale(source.getDateFormatLocale());
    target.setDateFormatTimeZone(source.getDateFormatTimeZone());
    target.setLenientStringToNumber(source.isLenientStringToNumber());
    target.setLargeTextField(source.isLargeTextField());
    target.setComments(source.getComments());
    target.setCaseInsensitive(source.isCaseInsensitive());
    target.setIndex(source.getIndex());

    target.setOrigin(source.getOrigin());

    target.setOriginalAutoIncrement(source.isOriginalAutoIncrement());
    target.setOriginalColumnType(source.getOriginalColumnType());
    target.setOriginalColumnTypeName(source.getOriginalColumnTypeName());
    target.setOriginalNullable(source.isOriginalNullable());
    target.setOriginalPrecision(source.getOriginalPrecision());
    target.setOriginalScale(source.getOriginalScale());
    target.setOriginalSigned(source.isOriginalSigned());

    return target;
  }
  private ValueMetaInterface getValueMeta(CalculatorMetaFunction fn, String origin) {
    ValueMetaInterface v = new ValueMeta(fn.getFieldName(), fn.getValueType());
    v.setLength(fn.getValueLength());
    v.setPrecision(fn.getValuePrecision());
    v.setOrigin(origin);
    v.setComments(fn.getCalcTypeDesc());
    v.setConversionMask(fn.getConversionMask());
    v.setDecimalSymbol(fn.getDecimalSymbol());
    v.setGroupingSymbol(fn.getGroupingSymbol());
    v.setCurrencySymbol(fn.getCurrencySymbol());

    // What if the user didn't specify a data type?
    // In that case we look for the default data type
    //
    if (fn.getValueType() == ValueMetaInterface.TYPE_NONE) {
      int defaultResultType = ValueMetaInterface.TYPE_NONE;

      switch (fn.getCalcType()) {
        case CalculatorMetaFunction.CALC_NONE:
          break;
        case CalculatorMetaFunction.CALC_ADD: // A + B
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_SUBTRACT: // A - B
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_MULTIPLY: // A * B
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_DIVIDE: // A / B
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_SQUARE: // A * A
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_SQUARE_ROOT: // SQRT( A )
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_PERCENT_1: // 100 * A / B
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_PERCENT_2: // A - ( A * B / 100 )
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_PERCENT_3: // A + ( A * B / 100 )
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_COMBINATION_1: // A + B * C
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_COMBINATION_2: // SQRT( A*A + B*B )
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_ROUND_1: // ROUND( A )
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_ROUND_2: //  ROUND( A , B )
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_CONSTANT: // Set field to constant value...
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_NVL: // Replace null values with another value
          break;
        case CalculatorMetaFunction.CALC_ADD_DAYS: // Add B days to date field A
          defaultResultType = ValueMetaInterface.TYPE_DATE;
          break;
        case CalculatorMetaFunction.CALC_YEAR_OF_DATE: // What is the year (Integer) of a date?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_MONTH_OF_DATE: // What is the month (Integer) of a date?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction
            .CALC_DAY_OF_YEAR: // What is the day of year (Integer) of a date?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction
            .CALC_DAY_OF_MONTH: // What is the day of month (Integer) of a date?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction
            .CALC_DAY_OF_WEEK: // What is the day of week (Integer) of a date?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction
            .CALC_WEEK_OF_YEAR: // What is the week of year (Integer) of a date?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction
            .CALC_WEEK_OF_YEAR_ISO8601: // What is the week of year (Integer) of a date ISO8601
          // style?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction
            .CALC_YEAR_OF_DATE_ISO8601: // What is the year (Integer) of a date ISO8601 style?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_BYTE_TO_HEX_ENCODE: // Byte to Hex encode string field A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_HEX_TO_BYTE_DECODE: // Hex to Byte decode string field A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_CHAR_TO_HEX_ENCODE: // Char to Hex encode string field A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_HEX_TO_CHAR_DECODE: // Hex to Char decode string field A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_CRC32: // CRC32 of a file A
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_ADLER32: // ADLER32 of a file A
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_MD5: // MD5 of a file A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_SHA1: // SHA1 of a file Al
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction
            .CALC_LEVENSHTEIN_DISTANCE: // LEVENSHTEIN_DISTANCE of string A and string B
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_METAPHONE: // METAPHONE of string A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_DOUBLE_METAPHONE: // Double METAPHONE of string A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_ABS: // ABS( A )
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_REMOVE_TIME_FROM_DATE: // Remove time from field A
          defaultResultType = ValueMetaInterface.TYPE_DATE;
          break;
        case CalculatorMetaFunction.CALC_DATE_DIFF: // DateA - DateB
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_ADD3: // A + B +C
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_INITCAP: // InitCap(A)
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_UPPER_CASE: // UpperCase(A)
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_LOWER_CASE: // LowerCase(A)
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_MASK_XML: // MaskXML(A)
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_USE_CDATA: // CDATA(A)
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_REMOVE_CR: // REMOVE CR FROM string A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_REMOVE_LF: // REMOVE LF FROM string A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_REMOVE_CRLF: // REMOVE CRLF FROM string A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_REMOVE_TAB: // REMOVE TAB FROM string A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_GET_ONLY_DIGITS: // GET ONLY DIGITS FROM string A
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_REMOVE_DIGITS: // REMOVE DIGITS FROM string A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_STRING_LEN: // LENGTH OF string A
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_LOAD_FILE_CONTENT_BINARY: // LOAD FILE CONTENT IN BLOB
          defaultResultType = ValueMetaInterface.TYPE_BINARY;
          break;
        case CalculatorMetaFunction.CALC_ADD_TIME_TO_DATE: // ADD TIME TO A DATE
          defaultResultType = ValueMetaInterface.TYPE_DATE;
          break;
        case CalculatorMetaFunction.CALC_GEOM_UNION: // Calculate geometry union
          defaultResultType = ValueMetaInterface.TYPE_GEOMETRY;
          break;
        case CalculatorMetaFunction.CALC_GEOM_INTERSECTION: // Calculate geometry intersection
          defaultResultType = ValueMetaInterface.TYPE_GEOMETRY;
          break;
        case CalculatorMetaFunction.CALC_GEOM_DIFFERENCE: // Calculate geometry difference
          defaultResultType = ValueMetaInterface.TYPE_GEOMETRY;
          break;
        case CalculatorMetaFunction
            .CALC_GEOM_SYMETRIC_DIFFERENCE: // Calculate geometry symetric difference
          defaultResultType = ValueMetaInterface.TYPE_GEOMETRY;
          break;
        case CalculatorMetaFunction.CALC_GEOM_AREA: // Calculate area
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_GEOM_LENGTH: // Calculate length
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_GEOM_CENTROID: // Calculate centroid
          defaultResultType = ValueMetaInterface.TYPE_GEOMETRY;
          break;
        case CalculatorMetaFunction.CALC_GEOM_POINT_ON_SURFACE: // Calculate random point on surface
          defaultResultType = ValueMetaInterface.TYPE_GEOMETRY;
          break;
        case CalculatorMetaFunction.CALC_GEOM_REVERSE: // Reverse geometry
          defaultResultType = ValueMetaInterface.TYPE_GEOMETRY;
          break;
        case CalculatorMetaFunction.CALC_GEOM_BOUNDARY: // Calculate geometry boundary
          defaultResultType = ValueMetaInterface.TYPE_GEOMETRY;
          break;
        case CalculatorMetaFunction.CALC_GEOM_ENVELOPE: // Calculate geometry envelope
          defaultResultType = ValueMetaInterface.TYPE_GEOMETRY;
          break;
        case CalculatorMetaFunction.CALC_GEOM_CONVEX_HULL: // Calculate geometry convex hull
          defaultResultType = ValueMetaInterface.TYPE_GEOMETRY;
          break;
        case CalculatorMetaFunction.CALC_GEOM_BUFFER: // Calculate geometry buffer
          defaultResultType = ValueMetaInterface.TYPE_GEOMETRY;
          break;
        case CalculatorMetaFunction.CALC_GEOM_DISTANCE: // Calculate distance between geometries
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        default:
          break;
      }

      v.setType(defaultResultType);
    }

    return v;
  }
Beispiel #3
0
  private ValueMetaInterface getValueMeta(CalculatorMetaFunction fn, String origin) {
    ValueMetaInterface v = new ValueMeta(fn.getFieldName(), fn.getValueType());

    // What if the user didn't specify a data type?
    // In that case we look for the default data type
    //
    if (fn.getValueType() == ValueMetaInterface.TYPE_NONE) {
      int defaultResultType = ValueMetaInterface.TYPE_NONE;

      switch (fn.getCalcType()) {
        case CalculatorMetaFunction.CALC_NONE:
          break;
        case CalculatorMetaFunction.CALC_ADD: // A + B
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_SUBTRACT: // A - B
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_MULTIPLY: // A * B
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_DIVIDE: // A / B
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_SQUARE: // A * A
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_SQUARE_ROOT: // SQRT( A )
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_PERCENT_1: // 100 * A / B
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_PERCENT_2: // A - ( A * B / 100 )
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_PERCENT_3: // A + ( A * B / 100 )
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_COMBINATION_1: // A + B * C
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_COMBINATION_2: // SQRT( A*A + B*B )
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_ROUND_1: // ROUND( A )
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_ROUND_2: //  ROUND( A , B )
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_ROUND_STD_1: // STDROUND( A )
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_ROUND_STD_2: //  STDROUND( A , B )
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_CONSTANT: // Set field to constant value...
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_NVL: // Replace null values with another value
          break;
        case CalculatorMetaFunction.CALC_ADD_DAYS: // Add B days to date field A
          defaultResultType = ValueMetaInterface.TYPE_DATE;
          break;
        case CalculatorMetaFunction.CALC_YEAR_OF_DATE: // What is the year (Integer) of a date?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_MONTH_OF_DATE: // What is the month (Integer) of a date?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction
            .CALC_DAY_OF_YEAR: // What is the day of year (Integer) of a date?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction
            .CALC_DAY_OF_MONTH: // What is the day of month (Integer) of a date?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction
            .CALC_DAY_OF_WEEK: // What is the day of week (Integer) of a date?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction
            .CALC_WEEK_OF_YEAR: // What is the week of year (Integer) of a date?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction
            .CALC_WEEK_OF_YEAR_ISO8601: // What is the week of year (Integer) of a date ISO8601
          // style?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction
            .CALC_YEAR_OF_DATE_ISO8601: // What is the year (Integer) of a date ISO8601 style?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_BYTE_TO_HEX_ENCODE: // Byte to Hex encode string field A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_HEX_TO_BYTE_DECODE: // Hex to Byte decode string field A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_CHAR_TO_HEX_ENCODE: // Char to Hex encode string field A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_HEX_TO_CHAR_DECODE: // Hex to Char decode string field A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_CRC32: // CRC32 of a file A
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_ADLER32: // ADLER32 of a file A
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_MD5: // MD5 of a file A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_SHA1: // SHA1 of a file Al
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction
            .CALC_LEVENSHTEIN_DISTANCE: // LEVENSHTEIN_DISTANCE of string A and string B
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_METAPHONE: // METAPHONE of string A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_DOUBLE_METAPHONE: // Double METAPHONE of string A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_ABS: // ABS( A )
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_REMOVE_TIME_FROM_DATE: // Remove time from field A
          defaultResultType = ValueMetaInterface.TYPE_DATE;
          break;
        case CalculatorMetaFunction.CALC_DATE_DIFF: // DateA - DateB
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_ADD3: // A + B +C
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_INITCAP: // InitCap(A)
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_UPPER_CASE: // UpperCase(A)
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_LOWER_CASE: // LowerCase(A)
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_MASK_XML: // MaskXML(A)
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_USE_CDATA: // CDATA(A)
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_REMOVE_CR: // REMOVE CR FROM string A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_REMOVE_LF: // REMOVE LF FROM string A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_REMOVE_CRLF: // REMOVE CRLF FROM string A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_REMOVE_TAB: // REMOVE TAB FROM string A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_GET_ONLY_DIGITS: // GET ONLY DIGITS FROM string A
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_REMOVE_DIGITS: // REMOVE DIGITS FROM string A
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_STRING_LEN: // LENGTH OF string A
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_LOAD_FILE_CONTENT_BINARY: // LOAD FILE CONTENT IN BLOB
          defaultResultType = ValueMetaInterface.TYPE_BINARY;
          break;
        case CalculatorMetaFunction.CALC_ADD_TIME_TO_DATE: // ADD TIME TO A DATE
          defaultResultType = ValueMetaInterface.TYPE_DATE;
          break;
        case CalculatorMetaFunction
            .CALC_QUARTER_OF_DATE: // What is the quarter (Integer) of a date?
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_SUBSTITUTE_VARIABLE: // variable substitution in string
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_ESCAPE_HTML: // escape HTML
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_ESCAPE_SQL: // escape SQL
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_UNESCAPE_HTML: // unEscape HTML
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_UNESCAPE_XML: // unEscape XML
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_DATE_WORKING_DIFF: // Date A - Date B
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_ADD_MONTHS: // Date A - B Months
          defaultResultType = ValueMetaInterface.TYPE_DATE;
          break;
        case CalculatorMetaFunction.CALC_CHECK_XML_FILE_WELL_FORMED: // XML file A well formed
          defaultResultType = ValueMetaInterface.TYPE_BOOLEAN;
          break;
        case CalculatorMetaFunction.CALC_CHECK_XML_WELL_FORMED: // XML string A well formed
          defaultResultType = ValueMetaInterface.TYPE_BOOLEAN;
          break;
        case CalculatorMetaFunction.CALC_GET_FILE_ENCODING: // get file encoding
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_DAMERAU_LEVENSHTEIN:
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_NEEDLEMAN_WUNSH:
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_JARO:
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_JARO_WINKLER:
          defaultResultType = ValueMetaInterface.TYPE_NUMBER;
          break;
        case CalculatorMetaFunction.CALC_SOUNDEX:
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_REFINED_SOUNDEX:
          defaultResultType = ValueMetaInterface.TYPE_STRING;
          break;
        case CalculatorMetaFunction.CALC_CEIL: // CEIL( A )
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_FLOOR: // FLOOR( A )
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_HOUR_OF_DAY:
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_MINUTE_OF_HOUR:
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        case CalculatorMetaFunction.CALC_SECOND_OF_MINUTE:
          defaultResultType = ValueMetaInterface.TYPE_INTEGER;
          break;
        default:
          break;
      }

      v = new ValueMeta(fn.getFieldName(), defaultResultType);
    }

    v.setLength(fn.getValueLength());
    v.setPrecision(fn.getValuePrecision());
    v.setOrigin(origin);
    v.setComments(fn.getCalcTypeDesc());
    v.setConversionMask(fn.getConversionMask());
    v.setDecimalSymbol(fn.getDecimalSymbol());
    v.setGroupingSymbol(fn.getGroupingSymbol());
    v.setCurrencySymbol(fn.getCurrencySymbol());

    return v;
  }