Package org.pentaho.di.core.row.value
Class ValueMetaTimestamp
- java.lang.Object
-
- org.pentaho.di.core.row.value.ValueMetaBase
-
- org.pentaho.di.core.row.value.ValueMetaDate
-
- org.pentaho.di.core.row.value.ValueMetaTimestamp
-
- All Implemented Interfaces:
Cloneable
,ValueMetaInterface
public class ValueMetaTimestamp extends ValueMetaDate
-
-
Field Summary
-
Fields inherited from class org.pentaho.di.core.row.value.ValueMetaBase
bigNumberFormatting, caseInsensitive, collator, collatorDisabled, collatorLocale, collatorStrength, comments, comparator, COMPATIBLE_DATE_FORMAT_PATTERN, compatibleDateFormat, conversionMask, conversionMetadata, currencySymbol, dateFormat, dateFormatChanged, dateFormatLenient, dateFormatLocale, dateFormatTimeZone, decimalFormat, decimalFormatChanged, decimalSymbol, DEFAULT_BIG_NUMBER_FORMAT_MASK, DEFAULT_BIGNUMBER_PARSE_MASK, DEFAULT_DATE_FORMAT_MASK, DEFAULT_DATE_PARSE_MASK, DEFAULT_INTEGER_FORMAT_MASK, DEFAULT_INTEGER_PARSE_MASK, DEFAULT_NUMBER_FORMAT_MASK, DEFAULT_NUMBER_PARSE_MASK, DEFAULT_TIMESTAMP_FORMAT_MASK, DEFAULT_TIMESTAMP_PARSE_MASK, emptyStringAndNullAreDifferent, groupingSymbol, identicalFormat, ignoreTimezone, ignoreWhitespace, index, largeTextField, length, lenientStringToNumber, name, numberOfBinaryStringConversions, origin, originalAutoIncrement, originalColumnType, originalColumnTypeName, originalNullable, originalPrecision, originalScale, originalSigned, outputPaddingEnabled, PKG, precision, SINGLE_BYTE_ENCODINGS, sortedDescending, storageMetadata, storageType, stringEncoding, trimType, trimTypeCode, trimTypeDesc, type, XML_DATA_TAG, XML_META_TAG
-
Fields inherited from interface org.pentaho.di.core.row.ValueMetaInterface
DEFAULT_INTEGER_LENGTH, SORT_TYPE_ASCENDING, SORT_TYPE_DESCENDING, SORT_TYPE_NOT_SORTED, sortTypeCodes, STORAGE_TYPE_BINARY_STRING, STORAGE_TYPE_INDEXED, STORAGE_TYPE_NORMAL, storageTypeCodes, TRIM_TYPE_BOTH, TRIM_TYPE_LEFT, TRIM_TYPE_NONE, TRIM_TYPE_RIGHT, TYPE_BIGNUMBER, TYPE_BINARY, TYPE_BOOLEAN, TYPE_DATE, TYPE_INET, TYPE_INTEGER, TYPE_NONE, TYPE_NUMBER, TYPE_SERIALIZABLE, TYPE_STRING, TYPE_TIMESTAMP, typeCodes
-
-
Constructor Summary
Constructors Constructor Description ValueMetaTimestamp()
ValueMetaTimestamp(String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
cloneValueData(Object object)
Clones the data.int
compare(Object data1, Object data2)
Compare 2 values of the same data typeprotected Timestamp
convertBigNumberToTimestamp(BigDecimal bd)
Object
convertData(ValueMetaInterface meta2, Object data2)
Convert the specified data to the data type specified in this object.Object
convertDataFromString(String pol, ValueMetaInterface convertMeta, String nullIf, String ifNull, int trimType)
Convert the specified string to the data type specified in this object.Object
convertDataUsingConversionMetaData(Object data2)
Convert an object to the data type specified in the conversion metadataTimestamp
convertDateToTimestamp(Date date)
protected Timestamp
convertIntegerToTimestamp(Long longValue)
protected Timestamp
convertNumberToTimestamp(Double d)
protected Timestamp
convertStringToTimestamp(String string)
protected String
convertTimestampToString(Timestamp timestamp)
BigDecimal
getBigNumber(Object object)
Convert the supplied data to a BigNumberbyte[]
getBinaryString(Object object)
convert the supplied data to a binary string representation (for writing text)Boolean
getBoolean(Object object)
Convert the supplied data to a BooleanDate
getDate(Object object)
Convert the supplied data to a DateSimpleDateFormat
getDateFormat()
Gets the date format.String
getFormatMask()
Gets a formatting mask using this value's meta information.Long
getInteger(Object object)
Convert the supplied data to an IntegerValueMetaInterface
getMetadataPreview(DatabaseMeta databaseMeta, ResultSet rs)
This is a similar method to getValueFromSQLType, but it uses a ResultSet from a call to DatabaseMetaData#getColumns(String, String, String, String) The ResultSet must be positioned correctly on the row to read.Class<?>
getNativeDataTypeClass()
Return the Java class that represents the "native" storage type of this ValueMetaDouble
getNumber(Object object)
Convert the supplied data to a NumberString
getString(Object object)
Convert the supplied data to a StringTimestamp
getTimestamp(Object object)
Object
getValueFromResultSet(DatabaseInterface databaseInterface, ResultSet resultSet, int index)
Get a value from a result set column based on the current value metadataValueMetaInterface
getValueFromSQLType(DatabaseMeta databaseMeta, String name, ResultSetMetaData rm, int index, boolean ignoreLength, boolean lazyConversion)
Investigate JDBC result set metadata at the specified index.boolean
isDate()
Checks whether or not this value is a DateObject
readData(DataInputStream inputStream)
De-serialize data from an inputstream.void
setPreparedStatementValue(DatabaseMeta databaseMeta, PreparedStatement preparedStatement, int index, Object data)
Set a value on a JDBC prepared statement on the specified positionvoid
writeData(DataOutputStream outputStream, Object object)
Serialize the content of the specified data object to the outputStream.-
Methods inherited from class org.pentaho.di.core.row.value.ValueMetaDate
getNativeDataType
-
Methods inherited from class org.pentaho.di.core.row.value.ValueMetaBase
clone, compare, compareStorageAndActualFormat, convertBigNumberToBoolean, convertBigNumberToDate, convertBigNumberToString, convertBinaryStringToNativeType, convertBinaryStringToString, convertBooleanToBigNumber, convertBooleanToInteger, convertBooleanToNumber, convertBooleanToString, convertDataCompatible, convertDateToBigNumber, convertDateToCompatibleString, convertDateToInteger, convertDateToNumber, convertDateToString, convertIntegerToBoolean, convertIntegerToCompatibleString, convertIntegerToDate, convertIntegerToString, convertNormalStorageTypeToBinaryString, convertNumberToBoolean, convertNumberToCompatibleString, convertNumberToDate, convertNumberToString, convertStringToBigNumber, convertStringToBinaryString, convertStringToBoolean, convertStringToDate, convertStringToInteger, convertStringToNumber, convertToBinaryStringStorageType, convertToNormalStorageType, createOriginalValue, determineSingleByteEncoding, drawValue, getAllTypes, getBinary, getCollatorLocale, getCollatorStrength, getComments, getCompatibleString, getConversionMask, getConversionMetadata, getCurrencySymbol, getDatabaseColumnTypeDefinition, getDataXML, getDateFormatLocale, getDateFormatTimeZone, getDecimalFormat, getDecimalFormat, getDecimalSymbol, getGroupingSymbol, getIndex, getLength, getMetaXML, getName, getNumberOfBinaryStringConversions, getOrigin, getOriginalColumnMetadata, getOriginalColumnType, getOriginalColumnTypeName, getOriginalNullable, getOriginalPrecision, getOriginalScale, getOriginalSigned, getPrecision, getQuotesBeforeSymbol, getStorageMetadata, getStorageType, getStorageType, getStorageTypeCode, getStorageTypeDesc, getStringEncoding, getTrimType, getTrimTypeByCode, getTrimTypeByDesc, getTrimTypeCode, getTrimTypeCodes, getTrimTypeDesc, getTrimTypeDescriptions, getType, getType, getTypeDesc, getTypeDesc, getTypes, getValue, getValueData, hashCode, isBigNumber, isBigNumberFormatting, isBinary, isBoolean, isCaseInsensitive, isCollatorDisabled, isDateFormatLenient, isIgnoreWhitespace, isInteger, isLargeTextField, isLenientStringToNumber, isNull, isNumber, isNumeric, isNumeric, isOriginalAutoIncrement, isOriginalNullable, isOriginalSigned, isOutputPaddingEnabled, isSerializableType, isSingleByteEncoding, isSortedAscending, isSortedDescending, isStorageBinaryString, isStorageIndexed, isStorageNormal, isString, readBigNumber, readBinary, readBinaryString, readBoolean, readDate, readInteger, readMetaData, readNumber, readSmallInteger, readString, requiresRealClone, setBigNumberFormatting, setCaseInsensitive, setCollatorDisabled, setCollatorLocale, setCollatorStrength, setComments, setConversionMask, setConversionMetadata, setCurrencySymbol, setDateFormatLenient, setDateFormatLocale, setDateFormatTimeZone, setDecimalSymbol, setDefaultConversionMask, setGroupingSymbol, setIgnoreWhitespace, setIndex, setLargeTextField, setLength, setLength, setLenientStringToNumber, setName, setNumberOfBinaryStringConversions, setOrigin, setOriginalAutoIncrement, setOriginalColumnType, setOriginalColumnTypeName, setOriginalNullable, setOriginalPrecision, setOriginalScale, setOriginalSigned, setOutputPaddingEnabled, setPrecision, setSortedDescending, setStorageMetadata, setStorageType, setStringEncoding, setTrimType, setType, toString, toStringMeta, trim, writeBigNumber, writeBinary, writeBinaryString, writeBoolean, writeDate, writeInteger, writeInteger, writeMeta, writeNumber, writeString
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.pentaho.di.core.row.ValueMetaInterface
clone, compare, convertBinaryStringToNativeType, convertDataCompatible, convertNormalStorageTypeToBinaryString, convertToBinaryStringStorageType, convertToNormalStorageType, createOriginalValue, drawValue, getBinary, getCollatorLocale, getCollatorStrength, getComments, getCompatibleString, getConversionMask, getConversionMetadata, getCurrencySymbol, getDatabaseColumnTypeDefinition, getDataXML, getDateFormatLocale, getDateFormatTimeZone, getDecimalFormat, getDecimalFormat, getDecimalSymbol, getGroupingSymbol, getIndex, getLength, getMetaXML, getName, getNumberOfBinaryStringConversions, getOrigin, getOriginalColumnType, getOriginalColumnTypeName, getOriginalNullable, getOriginalPrecision, getOriginalScale, getOriginalSigned, getPrecision, getStorageMetadata, getStorageType, getStringEncoding, getTrimType, getType, getTypeDesc, getValue, getValueData, hashCode, isBigNumber, isBinary, isBoolean, isCaseInsensitive, isCollatorDisabled, isDateFormatLenient, isIgnoreWhitespace, isInteger, isLargeTextField, isLenientStringToNumber, isNull, isNumber, isNumeric, isOriginalAutoIncrement, isOriginalNullable, isOriginalSigned, isOutputPaddingEnabled, isSerializableType, isSingleByteEncoding, isSortedDescending, isStorageBinaryString, isStorageIndexed, isStorageNormal, isString, readMetaData, requiresRealClone, setCaseInsensitive, setCollatorDisabled, setCollatorLocale, setCollatorStrength, setComments, setConversionMask, setConversionMetadata, setCurrencySymbol, setDateFormatLenient, setDateFormatLocale, setDateFormatTimeZone, setDecimalSymbol, setGroupingSymbol, setIgnoreWhitespace, setIndex, setLargeTextField, setLength, setLength, setLenientStringToNumber, setName, setNumberOfBinaryStringConversions, setOrigin, setOriginalAutoIncrement, setOriginalColumnType, setOriginalColumnTypeName, setOriginalNullable, setOriginalPrecision, setOriginalScale, setOriginalSigned, setOutputPaddingEnabled, setPrecision, setSortedDescending, setStorageMetadata, setStorageType, setStringEncoding, setTrimType, setType, toStringMeta, writeMeta
-
-
-
-
Constructor Detail
-
ValueMetaTimestamp
public ValueMetaTimestamp()
-
ValueMetaTimestamp
public ValueMetaTimestamp(String name)
-
-
Method Detail
-
isDate
public boolean isDate()
Description copied from class:ValueMetaBase
Checks whether or not this value is a Date- Specified by:
isDate
in interfaceValueMetaInterface
- Overrides:
isDate
in classValueMetaBase
- Returns:
- true if the value is a Date
-
getDate
public Date getDate(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterface
Convert the supplied data to a Date- Specified by:
getDate
in interfaceValueMetaInterface
- Overrides:
getDate
in classValueMetaDate
- Throws:
KettleValueException
-
getInteger
public Long getInteger(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterface
Convert the supplied data to an Integer- Specified by:
getInteger
in interfaceValueMetaInterface
- Overrides:
getInteger
in classValueMetaBase
- Throws:
KettleValueException
-
getNumber
public Double getNumber(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterface
Convert the supplied data to a Number- Specified by:
getNumber
in interfaceValueMetaInterface
- Overrides:
getNumber
in classValueMetaBase
- Throws:
KettleValueException
-
getBigNumber
public BigDecimal getBigNumber(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterface
Convert the supplied data to a BigNumber- Specified by:
getBigNumber
in interfaceValueMetaInterface
- Overrides:
getBigNumber
in classValueMetaBase
- Throws:
KettleValueException
-
getBoolean
public Boolean getBoolean(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterface
Convert the supplied data to a Boolean- Specified by:
getBoolean
in interfaceValueMetaInterface
- Overrides:
getBoolean
in classValueMetaBase
- Throws:
KettleValueException
-
getString
public String getString(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterface
Convert the supplied data to a String- Specified by:
getString
in interfaceValueMetaInterface
- Overrides:
getString
in classValueMetaBase
- Throws:
KettleValueException
-
getTimestamp
public Timestamp getTimestamp(Object object) throws KettleValueException
- Throws:
KettleValueException
-
compare
public int compare(Object data1, Object data2) throws KettleValueException
Description copied from class:ValueMetaBase
Compare 2 values of the same data type- Specified by:
compare
in interfaceValueMetaInterface
- Overrides:
compare
in classValueMetaBase
- Parameters:
data1
- the first valuedata2
- the second value- Returns:
- 0 if the values are equal, -1 if data1 is smaller than data2 and +1 if it's larger.
- Throws:
KettleValueException
- In case we get conversion errors
-
convertBigNumberToTimestamp
protected Timestamp convertBigNumberToTimestamp(BigDecimal bd)
-
convertStringToTimestamp
protected Timestamp convertStringToTimestamp(String string) throws KettleValueException
- Throws:
KettleValueException
-
convertTimestampToString
protected String convertTimestampToString(Timestamp timestamp) throws KettleValueException
- Throws:
KettleValueException
-
convertDataFromString
public Object convertDataFromString(String pol, ValueMetaInterface convertMeta, String nullIf, String ifNull, int trimType) throws KettleValueException
Description copied from class:ValueMetaBase
Convert the specified string to the data type specified in this object.- Specified by:
convertDataFromString
in interfaceValueMetaInterface
- Overrides:
convertDataFromString
in classValueMetaBase
- Parameters:
pol
- the string to be convertedconvertMeta
- the metadata of the object (only string type) to be convertednullIf
- set the object to null if pos equals nullif (IgnoreCase)ifNull
- set the object to ifNull when pol is empty or nulltrimType
- the trim type to be used (ValueMetaInterface.TRIM_TYPE_XXX)- Returns:
- the object in the data type of this value metadata object
- Throws:
KettleValueException
- in case there is a data conversion error
-
convertDateToTimestamp
public Timestamp convertDateToTimestamp(Date date) throws KettleValueException
- Throws:
KettleValueException
-
convertData
public Object convertData(ValueMetaInterface meta2, Object data2) throws KettleValueException
Convert the specified data to the data type specified in this object.- Specified by:
convertData
in interfaceValueMetaInterface
- Overrides:
convertData
in classValueMetaBase
- Parameters:
meta2
- the metadata of the object to be converteddata2
- the data of the object to be converted- Returns:
- the object in the data type of this value metadata object
- Throws:
KettleValueException
- in case there is a data conversion error
-
cloneValueData
public Object cloneValueData(Object object) throws KettleValueException
Description copied from class:ValueMetaBase
Clones the data. Normally, we don't have to do anything here, but just for arguments and safety, we do a little extra work in case of binary blobs and Date objects. We should write a programmers manual later on to specify in all clarity that "we always overwrite/replace values in the Object[] data rows, we never modify them" .- Specified by:
cloneValueData
in interfaceValueMetaInterface
- Overrides:
cloneValueData
in classValueMetaBase
- Parameters:
object
- the object- Returns:
- a cloned data object if needed
- Throws:
KettleValueException
- the kettle value exception
-
getMetadataPreview
public ValueMetaInterface getMetadataPreview(DatabaseMeta databaseMeta, ResultSet rs) throws KettleDatabaseException
Description copied from interface:ValueMetaInterface
This is a similar method to getValueFromSQLType, but it uses a ResultSet from a call to DatabaseMetaData#getColumns(String, String, String, String) The ResultSet must be positioned correctly on the row to read.Note that the ValueMeta returned by this RowMeta may not contain actual values. This is a lightweight call using only JDBC metadata and does not make use of SQL statements.
- Specified by:
getMetadataPreview
in interfaceValueMetaInterface
- Overrides:
getMetadataPreview
in classValueMetaBase
- Parameters:
databaseMeta
- the database metadata to reference capabilities and so on.rs
- A ResultSet from getColumns, positioned correctly on a column to read.- Throws:
KettleDatabaseException
-
getValueFromSQLType
public ValueMetaInterface getValueFromSQLType(DatabaseMeta databaseMeta, String name, ResultSetMetaData rm, int index, boolean ignoreLength, boolean lazyConversion) throws KettleDatabaseException
Description copied from interface:ValueMetaInterface
Investigate JDBC result set metadata at the specified index. If this value metadata is interested in handling this SQL type, it should return the value meta. Otherwise it should return null.- Specified by:
getValueFromSQLType
in interfaceValueMetaInterface
- Overrides:
getValueFromSQLType
in classValueMetaBase
- Parameters:
databaseMeta
- the database metadata to reference capabilities and so on.name
- The name of the new valuerm
- The result metadata to investigateindex
- The index to look at (1-based)ignoreLength
- Don't look at the lengthlazyConversion
- use lazy conversion- Returns:
- The value metadata if this value should handle the SQL type at the specified index.
- Throws:
KettleDatabaseException
- In case something went wrong.
-
getValueFromResultSet
public Object getValueFromResultSet(DatabaseInterface databaseInterface, ResultSet resultSet, int index) throws KettleDatabaseException
Description copied from class:ValueMetaBase
Get a value from a result set column based on the current value metadata- Specified by:
getValueFromResultSet
in interfaceValueMetaInterface
- Overrides:
getValueFromResultSet
in classValueMetaBase
- Parameters:
databaseInterface
- the database metadata to useresultSet
- The JDBC result set to read fromindex
- The column index (1-based)- Returns:
- The Kettle native data type based on the value metadata
- Throws:
KettleDatabaseException
- in case something goes wrong.
-
setPreparedStatementValue
public void setPreparedStatementValue(DatabaseMeta databaseMeta, PreparedStatement preparedStatement, int index, Object data) throws KettleDatabaseException
Description copied from interface:ValueMetaInterface
Set a value on a JDBC prepared statement on the specified position- Specified by:
setPreparedStatementValue
in interfaceValueMetaInterface
- Overrides:
setPreparedStatementValue
in classValueMetaBase
- Parameters:
databaseMeta
- the database metadata to referencepreparedStatement
- The prepared statementindex
- the column index (1-based)data
- the value to set- Throws:
KettleDatabaseException
- in case something goes wrong
-
convertDataUsingConversionMetaData
public Object convertDataUsingConversionMetaData(Object data2) throws KettleValueException
Description copied from class:ValueMetaBase
Convert an object to the data type specified in the conversion metadata- Specified by:
convertDataUsingConversionMetaData
in interfaceValueMetaInterface
- Overrides:
convertDataUsingConversionMetaData
in classValueMetaBase
- Parameters:
data2
- The data- Returns:
- The data converted to the storage data type
- Throws:
KettleValueException
- in case there is a conversion error.
-
getBinaryString
public byte[] getBinaryString(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterface
convert the supplied data to a binary string representation (for writing text)- Specified by:
getBinaryString
in interfaceValueMetaInterface
- Overrides:
getBinaryString
in classValueMetaBase
- Throws:
KettleValueException
-
writeData
public void writeData(DataOutputStream outputStream, Object object) throws KettleFileException
Description copied from interface:ValueMetaInterface
Serialize the content of the specified data object to the outputStream. No metadata is written.- Specified by:
writeData
in interfaceValueMetaInterface
- Overrides:
writeData
in classValueMetaBase
- Parameters:
outputStream
- the outputstream to write toobject
- the data object to serialize- Throws:
KettleFileException
- in case a I/O error occurs
-
readData
public Object readData(DataInputStream inputStream) throws KettleFileException, KettleEOFException, SocketTimeoutException
Description copied from interface:ValueMetaInterface
De-serialize data from an inputstream. No metadata is read or changed.- Specified by:
readData
in interfaceValueMetaInterface
- Overrides:
readData
in classValueMetaBase
- Parameters:
inputStream
- the input stream to read from- Returns:
- a new data object
- Throws:
KettleFileException
- in case a I/O error occursKettleEOFException
- When we have read all the data there is to readSocketTimeoutException
- In case there is a timeout (when set on a socket) during reading
-
getDateFormat
public SimpleDateFormat getDateFormat()
Description copied from interface:ValueMetaInterface
Gets the date format.- Specified by:
getDateFormat
in interfaceValueMetaInterface
- Overrides:
getDateFormat
in classValueMetaBase
- Returns:
- the date format
-
getFormatMask
public String getFormatMask()
Description copied from interface:ValueMetaInterface
Gets a formatting mask using this value's meta information.- Specified by:
getFormatMask
in interfaceValueMetaInterface
- Overrides:
getFormatMask
in classValueMetaDate
- Returns:
- the format mask.
-
getNativeDataTypeClass
public Class<?> getNativeDataTypeClass() throws KettleValueException
Description copied from interface:ValueMetaInterface
Return the Java class that represents the "native" storage type of this ValueMeta- Specified by:
getNativeDataTypeClass
in interfaceValueMetaInterface
- Overrides:
getNativeDataTypeClass
in classValueMetaDate
- Returns:
- A Java class
- Throws:
KettleValueException
-
-