Search in sources :

Example 1 with SchemaField

use of org.apache.nifi.schema.access.SchemaField in project nifi by apache.

the class SchemaRegistryService method getSuppliedSchemaFields.

protected Set<SchemaField> getSuppliedSchemaFields(final ValidationContext validationContext) {
    final String accessStrategyValue = validationContext.getProperty(getSchemaAcessStrategyDescriptor()).getValue();
    final SchemaRegistry schemaRegistry = validationContext.getProperty(SCHEMA_REGISTRY).asControllerService(SchemaRegistry.class);
    final SchemaAccessStrategy accessStrategy = getSchemaAccessStrategy(accessStrategyValue, schemaRegistry, validationContext);
    if (accessStrategy == null) {
        return EnumSet.noneOf(SchemaField.class);
    }
    final Set<SchemaField> suppliedFields = accessStrategy.getSuppliedSchemaFields();
    return suppliedFields;
}
Also used : SchemaField(org.apache.nifi.schema.access.SchemaField) SchemaAccessStrategy(org.apache.nifi.schema.access.SchemaAccessStrategy) SchemaRegistry(org.apache.nifi.schemaregistry.services.SchemaRegistry)

Example 2 with SchemaField

use of org.apache.nifi.schema.access.SchemaField in project nifi by apache.

the class SchemaRegistryRecordSetWriter method getRequiredSchemaFields.

protected Set<SchemaField> getRequiredSchemaFields(final ValidationContext validationContext) {
    final String writeStrategyValue = validationContext.getProperty(getSchemaWriteStrategyDescriptor()).getValue();
    final SchemaAccessWriter writer = getSchemaWriteStrategy(writeStrategyValue);
    if (writer == null) {
        return EnumSet.noneOf(SchemaField.class);
    }
    final Set<SchemaField> requiredFields = writer.getRequiredSchemaFields();
    return requiredFields;
}
Also used : SchemaAccessWriter(org.apache.nifi.schema.access.SchemaAccessWriter) NopSchemaAccessWriter(org.apache.nifi.schema.access.NopSchemaAccessWriter) SchemaField(org.apache.nifi.schema.access.SchemaField)

Aggregations

SchemaField (org.apache.nifi.schema.access.SchemaField)2 NopSchemaAccessWriter (org.apache.nifi.schema.access.NopSchemaAccessWriter)1 SchemaAccessStrategy (org.apache.nifi.schema.access.SchemaAccessStrategy)1 SchemaAccessWriter (org.apache.nifi.schema.access.SchemaAccessWriter)1 SchemaRegistry (org.apache.nifi.schemaregistry.services.SchemaRegistry)1