Search in sources :

Example 11 with RecordSchema

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

the class LookupTableEventRecord method createContentClaimRecord.

private static Record createContentClaimRecord(final RecordSchema contentClaimSchema, final String container, final String section, final String identifier, final Long offset, final Long size) {
    if (container == null || section == null || identifier == null) {
        final Map<RecordField, Object> lookupValues = Collections.singletonMap(LookupTableEventRecordFields.NO_VALUE, EventFieldNames.NO_VALUE);
        final List<RecordField> noValueFields = Collections.singletonList(contentClaimSchema.getField(EventFieldNames.NO_VALUE));
        return new FieldMapRecord(lookupValues, new RecordSchema(noValueFields));
    }
    final Map<RecordField, Object> fieldValues = new HashMap<>();
    fieldValues.put(EventRecordFields.CONTENT_CLAIM_CONTAINER, container);
    fieldValues.put(EventRecordFields.CONTENT_CLAIM_SECTION, section);
    fieldValues.put(EventRecordFields.CONTENT_CLAIM_IDENTIFIER, identifier);
    fieldValues.put(EventRecordFields.CONTENT_CLAIM_OFFSET, offset);
    fieldValues.put(EventRecordFields.CONTENT_CLAIM_SIZE, size);
    final List<RecordField> explicitClaimFields = contentClaimSchema.getField(EventFieldNames.EXPLICIT_VALUE).getSubFields();
    final Record explicitClaimRecord = new FieldMapRecord(fieldValues, new RecordSchema(explicitClaimFields));
    return explicitClaimRecord;
}
Also used : FieldMapRecord(org.apache.nifi.repository.schema.FieldMapRecord) RecordField(org.apache.nifi.repository.schema.RecordField) HashMap(java.util.HashMap) 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) RecordSchema(org.apache.nifi.repository.schema.RecordSchema)

Aggregations

RecordSchema (org.apache.nifi.repository.schema.RecordSchema)11 RecordField (org.apache.nifi.repository.schema.RecordField)8 ArrayList (java.util.ArrayList)7 Record (org.apache.nifi.repository.schema.Record)5 SimpleRecordField (org.apache.nifi.repository.schema.SimpleRecordField)4 FlowFileRecord (org.apache.nifi.controller.repository.FlowFileRecord)3 SwapSummary (org.apache.nifi.controller.repository.SwapSummary)3 FieldMapRecord (org.apache.nifi.repository.schema.FieldMapRecord)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 DataOutputStream (java.io.DataOutputStream)2 HashMap (java.util.HashMap)2 List (java.util.List)2 EventRecord (org.apache.nifi.provenance.schema.EventRecord)2 NopTocWriter (org.apache.nifi.provenance.toc.NopTocWriter)2 StandardTocWriter (org.apache.nifi.provenance.toc.StandardTocWriter)2 TocWriter (org.apache.nifi.provenance.toc.TocWriter)2 ComplexRecordField (org.apache.nifi.repository.schema.ComplexRecordField)2 SchemaRecordReader (org.apache.nifi.repository.schema.SchemaRecordReader)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileInputStream (java.io.FileInputStream)1