Search in sources :

Example 6 with FieldMapRecord

use of org.apache.nifi.repository.schema.FieldMapRecord in project nifi by apache.

the class LookupTableEventRecord method createExplicitSameOrNoneValue.

private NamedValue createExplicitSameOrNoneValue(final Record newValue, final Record oldValue, final Supplier<Record> recordSupplier) {
    if (newValue == null || EventFieldNames.NO_VALUE.equals(newValue.getSchema().getFields().get(0).getFieldName())) {
        final Map<RecordField, Object> lookupValues = Collections.singletonMap(LookupTableEventRecordFields.NO_VALUE, EventFieldNames.NO_VALUE);
        final Record record = new FieldMapRecord(lookupValues, LookupTableEventSchema.NO_VALUE_SCHEMA);
        final NamedValue namedValue = new NamedValue(EventFieldNames.NO_VALUE, record);
        return namedValue;
    } else if (newValue.equals(oldValue)) {
        final Map<RecordField, Object> lookupValues = Collections.singletonMap(LookupTableEventRecordFields.UNCHANGED_VALUE, EventFieldNames.UNCHANGED_VALUE);
        final Record record = new FieldMapRecord(lookupValues, LookupTableEventSchema.UNCHANGED_VALUE_SCHEMA);
        final NamedValue namedValue = new NamedValue(EventFieldNames.UNCHANGED_VALUE, record);
        return namedValue;
    }
    final Record record = recordSupplier.get();
    final NamedValue namedValue = new NamedValue(EventFieldNames.EXPLICIT_VALUE, record);
    return namedValue;
}
Also used : FieldMapRecord(org.apache.nifi.repository.schema.FieldMapRecord) RecordField(org.apache.nifi.repository.schema.RecordField) Record(org.apache.nifi.repository.schema.Record) StandardProvenanceEventRecord(org.apache.nifi.provenance.StandardProvenanceEventRecord) FieldMapRecord(org.apache.nifi.repository.schema.FieldMapRecord) ProvenanceEventRecord(org.apache.nifi.provenance.ProvenanceEventRecord) NamedValue(org.apache.nifi.repository.schema.NamedValue) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

FieldMapRecord (org.apache.nifi.repository.schema.FieldMapRecord)6 RecordField (org.apache.nifi.repository.schema.RecordField)5 HashMap (java.util.HashMap)4 Record (org.apache.nifi.repository.schema.Record)4 ProvenanceEventRecord (org.apache.nifi.provenance.ProvenanceEventRecord)3 StandardProvenanceEventRecord (org.apache.nifi.provenance.StandardProvenanceEventRecord)3 RecordSchema (org.apache.nifi.repository.schema.RecordSchema)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 NamedValue (org.apache.nifi.repository.schema.NamedValue)2 SimpleRecordField (org.apache.nifi.repository.schema.SimpleRecordField)2 DataOutputStream (java.io.DataOutputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 FlowFileQueue (org.apache.nifi.controller.queue.FlowFileQueue)1 QueueSize (org.apache.nifi.controller.queue.QueueSize)1