@EventDriven @SideEffectFree @SupportsBatching @InputRequirement(value=INPUT_REQUIRED) @Tags(value={"update","record","generic","schema","json","csv","avro","log","logs","freeform","text"}) @CapabilityDescription(value="Updates the contents of a FlowFile that contains Record-oriented data (i.e., data that can be read via a RecordReader and written by a RecordWriter). This Processor requires that at least one user-defined Property be added. The name of the Property should indicate a RecordPath that determines the field that should be updated. The value of the Property is either a replacement value (optionally making use of the Expression Language) or is itself a RecordPath that extracts a value from the Record. Whether the Property value is determined to be a RecordPath or a literal value depends on the configuration of the <Replacement Value Strategy> Property.") @WritesAttribute(attribute="record.index",description="This attribute provides the current row index and is only available inside the literal value expression.") @WritesAttribute(attribute="record.error.message",description="This attribute provides on failure the error message encountered by the Reader or Writer.") @DynamicProperty(name="A RecordPath.", value="The value to use to replace fields in the record that match the RecordPath", description="Allows users to specify values to use to replace fields in the record that match the RecordPath.", expressionLanguageScope=FLOWFILE_ATTRIBUTES) @SeeAlso(value=ConvertRecord.class) public class UpdateRecord extends AbstractRecordProcessor
| Modifier and Type | Field and Description |
|---|---|
private static String |
FIELD_NAME |
private static String |
FIELD_TYPE |
private static String |
FIELD_VALUE |
(package private) static AllowableValue |
LITERAL_VALUES |
private static String |
RECORD_INDEX |
(package private) static AllowableValue |
RECORD_PATH_VALUES |
private RecordPathCache |
recordPathCache |
private List<String> |
recordPaths |
(package private) static PropertyDescriptor |
REPLACEMENT_VALUE_STRATEGY |
INCLUDE_ZERO_RECORD_FLOWFILES, RECORD_READER, RECORD_WRITER, REL_FAILURE, REL_SUCCESS| Constructor and Description |
|---|
UpdateRecord() |
getRelationships, onTriggeronTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueequals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateprivate static final String FIELD_NAME
private static final String FIELD_VALUE
private static final String FIELD_TYPE
private static final String RECORD_INDEX
private volatile RecordPathCache recordPathCache
static final AllowableValue LITERAL_VALUES
static final AllowableValue RECORD_PATH_VALUES
static final PropertyDescriptor REPLACEMENT_VALUE_STRATEGY
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractRecordProcessorprotected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor in class AbstractConfigurableComponentprotected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate in class AbstractConfigurableComponent@OnScheduled public void createRecordPaths(ProcessContext context)
protected Record process(Record record, FlowFile flowFile, ProcessContext context, long count)
process in class AbstractRecordProcessorprivate Record processAbsolutePath(RecordPath replacementRecordPath, Stream<FieldValue> destinationFields, Record record)
private boolean isReplacingRoot(List<FieldValue> destinationFields)
private Record processRelativePath(RecordPath replacementRecordPath, Stream<FieldValue> destinationFields, Record record)
private Record updateRecord(List<FieldValue> destinationFields, List<FieldValue> selectedFields, Record record)
private void updateFieldValue(FieldValue fieldValue, Object replacement)
private List<FieldValue> getSelectedFields(RecordPath replacementRecordPath, FieldValue fieldValue, Record record)
private Object getReplacementObject(List<FieldValue> selectedFields)
Copyright © 2023 Apache NiFi Project. All rights reserved.