Package com.illumon.iris.importers
Class ImportFieldWriter
java.lang.Object
com.illumon.iris.importers.ImportFieldWriter
- Direct Known Subclasses:
BaseCsvFieldWriter
,CsvColumnDataTransformer
,JdbcFieldWriter
This class encapsulates common transformations that can be used in ImportSource elements. This class includes
methods for code generation, and all internal protected methods are intended for use with dynamic code generation/
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic double
accountingDouble
(String value) static int
accountingInt
(String value) static long
accountingLong
(String value) static LongFunction<DBDateTime>
dbDateTimeFromLong
(ImporterColumnDefinition col, boolean strict) static DBDateTime
dbDateTimeFromTimestamp
(Timestamp sourceDateTime) static DBDateTime
dbDateTimeFromTimestamp
(Timestamp sourceDateTime, String sourceColumnName, boolean strict) protected BigDecimal[]
getBigDecimalArray
(String value, boolean strict) protected BigDecimal[]
getBigDecimalArray
(String value, boolean strict, String arrayDelimiter) protected BigDecimal[]
getBigDecimalArray
(String value, String arrayDelimiter) protected BigInteger[]
getBigIntegerArray
(String value, boolean strict) protected BigInteger[]
getBigIntegerArray
(String value, boolean strict, String arrayDelimiter) protected BigInteger[]
getBigIntegerArray
(String value, String arrayDelimiter) protected Boolean[]
getBooleanArray
(String value, boolean strict) protected Boolean[]
getBooleanArray
(String value, boolean strict, String arrayDelimiter) protected Boolean[]
getBooleanArray
(String value, String arrayDelimiter) protected byte[]
getByteArray
(String value, boolean strict) protected byte[]
getByteArray
(String value, boolean strict, String arrayDelimiter) protected byte[]
getByteArray
(String value, String arrayDelimiter) protected char[]
getCharArray
(String value, boolean strict) protected char[]
getCharArray
(String value, boolean strict, String arrayDelimiter) protected char[]
getCharArray
(String value, String arrayDelimiter) getConstantColumnValue
(String columnName) Returns the value for the requested constant value column or nullprotected DBDateTime[]
getDBDateTimeArray
(String value, boolean strict) protected double[]
getDoubleArray
(String value, boolean strict) protected double[]
getDoubleArray
(String value, boolean strict, String arrayDelimiter) double[]
getDoubleArray
(String value, String arrayDelimiter) static IntFunction<String>
getEnumFormatter
(ImporterColumnDefinition col, boolean strict) protected float[]
getFloatArray
(String value, boolean strict) protected float[]
getFloatArray
(String value, boolean strict, String arrayDelimiter) protected float[]
getFloatArray
(String value, String arrayDelimiter) protected int[]
getIntArray
(String value, boolean strict) protected int[]
getIntArray
(String value, boolean strict, String arrayDelimiter) protected int[]
getIntArray
(String value, String arrayDelimiter) protected LocalDate[]
getLocalDateArray
(String value, boolean strict) protected LocalDate[]
getLocalDateArray
(String value, boolean strict, String arrayDelimiter) protected LocalDate[]
getLocalDateArray
(String value, String arrayDelimiter) protected LocalTime[]
getLocalTimeArray
(String value, boolean strict) protected LocalTime[]
getLocalTimeArray
(String value, boolean strict, String arrayDelimiter) protected LocalTime[]
getLocalTimeArray
(String value, String arrayDelimiter) protected long[]
getLongArray
(String value, boolean strict) protected long[]
getLongArray
(String value, boolean strict, String arrayDelimiter) long[]
getLongArray
(String value, String arrayDelimiter) protected short[]
getShortArray
(String value, boolean strict) protected short[]
getShortArray
(String value, boolean strict, String arrayDelimiter) protected short[]
getShortArray
(String value, String arrayDelimiter) protected String[]
getStringArray
(String value, boolean strict) protected String[]
getStringArray
(String value, boolean strict, String arrayDelimiter) static LocalDate
static Boolean
parseBoolean
(String value) void
void
setImportProperties
(Map<String, String> importProperties) The setter to update the importProperties field in the FieldWriter.static String
stripFirstCharacter
(String value) static long
toISONanos
(String value) updateWithConstantColumnValue
(org.jdom2.Element sourceElement, String constantValue, Map<String, String> importProperties) Utility method that verifies if the givenElement
includes an Import Column attribute for a constant column.
-
Field Details
-
log
protected final com.fishlib.io.logger.Logger log -
constantColumnValue
-
-
Method Details
-
processField
- Throws:
IOException
-
parseBoolean
-
getLongArray
-
getLongArray
-
getLongArray
-
getDoubleArray
-
getDoubleArray
-
getDoubleArray
-
getBooleanArray
-
getBooleanArray
-
getBooleanArray
@DynamicUse protected Boolean[] getBooleanArray(String value, boolean strict, String arrayDelimiter) -
getByteArray
-
getByteArray
-
getByteArray
-
getCharArray
-
getCharArray
-
getCharArray
-
getFloatArray
-
getFloatArray
-
getFloatArray
-
getIntArray
-
getIntArray
-
getIntArray
-
getShortArray
-
getShortArray
-
getShortArray
-
getBigDecimalArray
-
getBigDecimalArray
-
getBigDecimalArray
@DynamicUse protected BigDecimal[] getBigDecimalArray(String value, boolean strict, String arrayDelimiter) -
getBigIntegerArray
-
getBigIntegerArray
-
getBigIntegerArray
@DynamicUse protected BigInteger[] getBigIntegerArray(String value, boolean strict, String arrayDelimiter) -
getLocalTimeArray
-
getLocalTimeArray
-
getLocalTimeArray
@DynamicUse protected LocalTime[] getLocalTimeArray(String value, boolean strict, String arrayDelimiter) -
getLocalDateArray
-
getLocalDateArray
-
getLocalDateArray
@DynamicUse protected LocalDate[] getLocalDateArray(String value, boolean strict, String arrayDelimiter) -
getStringArray
-
getStringArray
-
dbDateTimeFromTimestamp
-
dbDateTimeFromTimestamp
@DynamicUse public static DBDateTime dbDateTimeFromTimestamp(Timestamp sourceDateTime, String sourceColumnName, boolean strict) -
dbDateTimeFromLong
@DynamicUse public static LongFunction<DBDateTime> dbDateTimeFromLong(ImporterColumnDefinition col, boolean strict) -
localDateFromString
-
getEnumFormatter
@DynamicUse public static IntFunction<String> getEnumFormatter(ImporterColumnDefinition col, boolean strict) -
accountingInt
-
accountingLong
-
stripFirstCharacter
-
accountingDouble
-
getDBDateTimeArray
-
toISONanos
-
updateWithConstantColumnValue
public static Map<String,String> updateWithConstantColumnValue(org.jdom2.Element sourceElement, String constantValue, @NotNull Map<String, String> importProperties) Utility method that verifies if the givenElement
includes an Import Column attribute for a constant column. If found identifies the appropriate value associated for the column and returns a new unmodifiable Map that includes the (const column) to (constant column value) mapping.- Parameters:
sourceElement
- The source in which to look for constant column attributesconstantValue
- The global constant value for the csv importimportProperties
- The custom import properties map- Returns:
- Returns an unmodifiable map that may include a constant column to constant column value mapping
-
setImportProperties
The setter to update the importProperties field in the FieldWriter. This is used while instantiating a customCsvFieldWriter
, for a column using a custom setter Having access to the importProperties allows a Custom setter to access custom import properties along with access to constant column value using the methodgetConstantColumnValue(String)
- Parameters:
importProperties
- The custom properties map passed in csv import method
-
getConstantColumnValue
Returns the value for the requested constant value column or null- Parameters:
columnName
- The constant value column name- Returns:
- the value of the constant column if found in importer properties or null
-