Class AddFieldsAction
java.lang.Object
com.northconcepts.datapipeline.foundations.core.Bean
com.northconcepts.datapipeline.foundations.core.FoundationObject
com.northconcepts.datapipeline.foundations.pipeline.PipelineObject
com.northconcepts.datapipeline.foundations.pipeline.action.PipelineAction
com.northconcepts.datapipeline.foundations.pipeline.action.transform.AddFieldsAction
- All Implemented Interfaces:
DataExceptionContributor,JsonSerializable,RecordSerializable,XmlSerializable,DataReaderAction,SqlSelectGenerator,JavaCodeGenerator,Serializable
A
PipelineAction that sets fields on every record, replacing existing ones, to a typed constant or the result of an
expression.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe type a field's value is converted to, orEXPRESSIONto evaluate it as an expression.static classA field's value and the type it is converted to. -
Field Summary
Fields inherited from class com.northconcepts.datapipeline.foundations.core.FoundationObject
internalId, internalName, log, TIMESTAMP_FORMATFields inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
SERIALIZED_CLASS_NAME, TYPEFields inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
XML_SERIALIZED_CLASS_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(String fieldName, AddFieldsAction.FieldType fieldType, String value) Sets the field to the value converted to the given type, or evaluated forEXPRESSION; for the other types a blank value sets a typed null.apply(DataReader reader) Returns a reader that applies this action to the records of the given reader, usually by wrapping it.fromRecord(Record source) Loads this instance's state from a record and returnsthis(for fluid API call chaining).fromXmlElement(Element element) voidAppends Java source code representing this object to the given builder.generateSqlSelect(QuerySource... querySources) Generates a SQL SELECT statement from the given query sources.Returns the value and type to set for each field name.booleanIndicates if each added field name in the mappings should be treated as aFieldPathexpression and parsed (when true, the default) or as a literal and used as a name, exactly as-is without parsing (when false).setMapping(Map<String, AddFieldsAction.TypeValue> mapping) Sets the value and type to set for each field name; null clears them.setParseFieldNamesAsFieldPath(boolean parseFieldNamesAsFieldPath) Indicates if each added field name in the mappings should be treated as aFieldPathexpression and parsed (when true, the default) or as a literal and used as a name, exactly as-is without parsing (when false).toRecord()Converts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.toXmlElement(Document document) Returns an element, created withdocument, describing this object; the default implementation throws aDataException.Methods inherited from class com.northconcepts.datapipeline.foundations.pipeline.action.PipelineAction
escapeJavaString, getCode, getDescription, getDisplayText, getPipeline, setDescription, setPipeline, toStringMethods inherited from class com.northconcepts.datapipeline.foundations.core.FoundationObject
addExceptionProperties, assertValid, assertValid, clone, exception, exception, exception, getInternalId, getInternalName, resetInternalIdMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.northconcepts.datapipeline.core.DataExceptionContributor
addExceptionProperties
-
Constructor Details
-
AddFieldsAction
public AddFieldsAction()
-
-
Method Details
-
getMapping
Returns the value and type to set for each field name. -
setMapping
Sets the value and type to set for each field name; null clears them. -
add
Sets the field to the value converted to the given type, or evaluated forEXPRESSION; for the other types a blank value sets a typed null. -
isParseFieldNamesAsFieldPath
public boolean isParseFieldNamesAsFieldPath()Indicates if each added field name in the mappings should be treated as aFieldPathexpression and parsed (when true, the default) or as a literal and used as a name, exactly as-is without parsing (when false). Setting this tofalseallows white spaces and special characters to be used in the added field names without quoting and escaping internal quotes. -
setParseFieldNamesAsFieldPath
Indicates if each added field name in the mappings should be treated as aFieldPathexpression and parsed (when true, the default) or as a literal and used as a name, exactly as-is without parsing (when false). Setting this tofalseallows white spaces and special characters to be used in the added field names without quoting and escaping internal quotes. -
apply
Description copied from interface:DataReaderActionReturns a reader that applies this action to the records of the given reader, usually by wrapping it.- Throws:
Throwable
-
generateSqlSelect
Description copied from interface:SqlSelectGeneratorGenerates a SQL SELECT statement from the given query sources.- Parameters:
querySources- the sources to include in the SELECT statement- Returns:
- a Select object representing the generated SQL statement
-
toRecord
Description copied from interface:RecordSerializableConverts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.- Specified by:
toRecordin interfaceRecordSerializable- Overrides:
toRecordin classPipelineAction
-
fromRecord
Description copied from interface:RecordSerializableLoads this instance's state from a record and returnsthis(for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.- Specified by:
fromRecordin interfaceRecordSerializable- Overrides:
fromRecordin classPipelineAction- Parameters:
source-- Returns:
- this instance.
-
toXmlElement
Description copied from interface:XmlSerializableReturns an element, created withdocument, describing this object; the default implementation throws aDataException.- Specified by:
toXmlElementin interfaceXmlSerializable- Overrides:
toXmlElementin classPipelineAction
-
fromXmlElement
- Specified by:
fromXmlElementin interfaceXmlSerializable- Overrides:
fromXmlElementin classPipelineAction
-
generateJavaCode
Description copied from interface:JavaCodeGeneratorAppends Java source code representing this object to the given builder.- Specified by:
generateJavaCodein interfaceJavaCodeGenerator- Overrides:
generateJavaCodein classPipelineAction
-