@EventDriven @SideEffectFree @SupportsBatching @InputRequirement(value=INPUT_REQUIRED) @Tags(value={"csv","schema","validation"}) @CapabilityDescription(value="Validates the contents of FlowFiles against a user-specified CSV schema. Take a look at the additional documentation of this processor for some schema examples.") @WritesAttribute(attribute="count.valid.lines",description="If line by line validation, number of valid lines extracted from the source data") @WritesAttribute(attribute="count.invalid.lines",description="If line by line validation, number of invalid lines extracted from the source data") @WritesAttribute(attribute="count.total.lines",description="If line by line validation, total number of lines in the source data") @WritesAttribute(attribute="validation.error.message",description="For flow files routed to invalid, message of the first validation error") public class ValidateCsv extends AbstractProcessor
| Modifier and Type | Class and Description |
|---|---|
private class |
ValidateCsv.NifiCsvListReader
This is required to avoid the side effect of Parse* cell processors.
|
| Modifier and Type | Field and Description |
|---|---|
private static List<String> |
allowedOperators |
static PropertyDescriptor |
DELIMITER_CHARACTER |
static PropertyDescriptor |
END_OF_LINE_CHARACTER |
static PropertyDescriptor |
HEADER |
private List<PropertyDescriptor> |
properties |
static PropertyDescriptor |
QUOTE_CHARACTER |
static Relationship |
REL_INVALID |
static Relationship |
REL_VALID |
private Set<Relationship> |
relationships |
private static String |
routeLinesIndividually |
private static String |
routeWholeFlowFile |
static PropertyDescriptor |
SCHEMA |
static AllowableValue |
VALIDATE_LINES_INDIVIDUALLY |
static AllowableValue |
VALIDATE_WHOLE_FLOWFILE |
static PropertyDescriptor |
VALIDATION_STRATEGY |
| Constructor and Description |
|---|
ValidateCsv() |
| Modifier and Type | Method and Description |
|---|---|
protected Collection<ValidationResult> |
customValidate(ValidationContext context) |
org.supercsv.prefs.CsvPreference |
getPreference(ProcessContext context,
FlowFile flowFile) |
private org.supercsv.cellprocessor.ift.CellProcessor |
getProcessor(String method,
String argument) |
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
private org.supercsv.cellprocessor.ift.CellProcessor[] |
parseSchema(String schema)
Method used to parse the string supplied by the user.
|
private byte[] |
print(String row,
org.supercsv.prefs.CsvPreference csvPref,
boolean isFirstLine) |
private String |
setProcessor(String remaining,
List<org.supercsv.cellprocessor.ift.CellProcessor> processorsList) |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueequals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateprivate static final String routeWholeFlowFile
private static final String routeLinesIndividually
public static final AllowableValue VALIDATE_WHOLE_FLOWFILE
public static final AllowableValue VALIDATE_LINES_INDIVIDUALLY
public static final PropertyDescriptor SCHEMA
public static final PropertyDescriptor HEADER
public static final PropertyDescriptor QUOTE_CHARACTER
public static final PropertyDescriptor DELIMITER_CHARACTER
public static final PropertyDescriptor END_OF_LINE_CHARACTER
public static final PropertyDescriptor VALIDATION_STRATEGY
public static final Relationship REL_VALID
public static final Relationship REL_INVALID
private List<PropertyDescriptor> properties
private Set<Relationship> relationships
protected void init(ProcessorInitializationContext context)
init in class AbstractSessionFactoryProcessorpublic Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentprotected Collection<ValidationResult> customValidate(ValidationContext context)
customValidate in class AbstractConfigurableComponentpublic org.supercsv.prefs.CsvPreference getPreference(ProcessContext context, FlowFile flowFile)
private org.supercsv.cellprocessor.ift.CellProcessor[] parseSchema(String schema)
schema - Schema to parseprivate String setProcessor(String remaining, List<org.supercsv.cellprocessor.ift.CellProcessor> processorsList)
private org.supercsv.cellprocessor.ift.CellProcessor getProcessor(String method, String argument)
public void onTrigger(ProcessContext context, ProcessSession session)
onTrigger in class AbstractProcessorprivate byte[] print(String row, org.supercsv.prefs.CsvPreference csvPref, boolean isFirstLine)
Copyright © 2023 Apache NiFi Project. All rights reserved.