org.apache.nifi.components.Validator Java Examples
The following examples show how to use
org.apache.nifi.components.Validator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestStandardValidators.java From nifi with Apache License 2.0 | 6 votes |
@Test public void testURIListValidator() { Validator val = StandardValidators.URI_LIST_VALIDATOR; ValidationContext vc = mock(ValidationContext.class); ValidationResult vr = val.validate("foo", null, vc); assertFalse(vr.isValid()); vr = val.validate("foo", "", vc); assertFalse(vr.isValid()); vr = val.validate("foo", "/no_scheme", vc); assertTrue(vr.isValid()); vr = val.validate("foo", "http://localhost 8080, https://host2:8080 ", vc); assertFalse(vr.isValid()); vr = val.validate("foo", "http://localhost , https://host2:8080 ", vc); assertTrue(vr.isValid()); }
Example #2
Source File: StandardValidators.java From localization_nifi with Apache License 2.0 | 6 votes |
public static Validator createLongValidator(final long minimum, final long maximum, final boolean inclusive) { return new Validator() { @Override public ValidationResult validate(final String subject, final String input, final ValidationContext context) { if (context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(input)) { return new ValidationResult.Builder().subject(subject).input(input).explanation("Expression Language Present").valid(true).build(); } String reason = null; try { final long longVal = Long.parseLong(input); if (longVal < minimum || (!inclusive && longVal == minimum) | longVal > maximum || (!inclusive && longVal == maximum)) { reason = "Value must be between " + minimum + " and " + maximum + " (" + (inclusive ? "inclusive" : "exclusive") + ")"; } } catch (final NumberFormatException e) { reason = "not a valid integer"; } return new ValidationResult.Builder().subject(subject).input(input).explanation(reason).valid(reason == null).build(); } }; }
Example #3
Source File: TestStandardValidators.java From localization_nifi with Apache License 2.0 | 6 votes |
@Test public void testTimePeriodValidator() { Validator val = StandardValidators.createTimePeriodValidator(1L, TimeUnit.SECONDS, Long.MAX_VALUE, TimeUnit.NANOSECONDS); ValidationResult vr; final ValidationContext validationContext = Mockito.mock(ValidationContext.class); vr = val.validate("TimePeriodTest", "0 sense made", validationContext); assertFalse(vr.isValid()); vr = val.validate("TimePeriodTest", null, validationContext); assertFalse(vr.isValid()); vr = val.validate("TimePeriodTest", "0 secs", validationContext); assertFalse(vr.isValid()); vr = val.validate("TimePeriodTest", "999 millis", validationContext); assertFalse(vr.isValid()); vr = val.validate("TimePeriodTest", "999999999 nanos", validationContext); assertFalse(vr.isValid()); vr = val.validate("TimePeriodTest", "1 sec", validationContext); assertTrue(vr.isValid()); }
Example #4
Source File: StandardValidators.java From localization_nifi with Apache License 2.0 | 6 votes |
public static Validator createListValidator(boolean trimEntries, boolean excludeEmptyEntries, Validator validator) { return (subject, input, context) -> { if (context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(input)) { return new ValidationResult.Builder().subject(subject).input(input).explanation("Expression Language Present").valid(true).build(); } try { if (input == null) { return new ValidationResult.Builder().subject(subject).input(null).explanation("List must have at least one non-empty element").valid(false).build(); } final String[] list = input.split(","); for (String item : list) { String itemToValidate = trimEntries ? item.trim() : item; if (!isEmpty(itemToValidate) || !excludeEmptyEntries) { ValidationResult result = validator.validate(subject, itemToValidate, context); if (!result.isValid()) { return result; } } } return new ValidationResult.Builder().subject(subject).input(input).explanation("Valid List").valid(true).build(); } catch (final Exception e) { return new ValidationResult.Builder().subject(subject).input(input).explanation("Not a valid list").valid(false).build(); } }; }
Example #5
Source File: StandardValidators.java From localization_nifi with Apache License 2.0 | 6 votes |
private static Validator createURLValidator() { return new Validator() { @Override public ValidationResult validate(final String subject, final String input, final ValidationContext context) { if (context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(input)) { return new ValidationResult.Builder().subject(subject).input(input).explanation("Expression Language Present").valid(true).build(); } try { final String evaluatedInput = context.newPropertyValue(input).evaluateAttributeExpressions().getValue(); new URL(evaluatedInput); return new ValidationResult.Builder().subject(subject).input(input).explanation("Valid URL").valid(true).build(); } catch (final Exception e) { return new ValidationResult.Builder().subject(subject).input(input).explanation("Not a valid URL").valid(false).build(); } } }; }
Example #6
Source File: ProcessorLifecycleIT.java From nifi with Apache License 2.0 | 6 votes |
@Override protected List<PropertyDescriptor> getSupportedPropertyDescriptors() { PropertyDescriptor PROP = new PropertyDescriptor.Builder() .name("P") .description("Blah Blah") .required(true) .addValidator(new Validator() { @Override public ValidationResult validate(final String subject, final String value, final ValidationContext context) { return new ValidationResult.Builder().subject(subject).input(value).valid(value != null && !value.isEmpty()).explanation(subject + " cannot be empty").build(); } }) .build(); PropertyDescriptor SERVICE = new PropertyDescriptor.Builder() .name("S") .description("Blah Blah") .required(true) .identifiesControllerService(ITestservice.class) .build(); return this.withService ? Arrays.asList(PROP, SERVICE) : Arrays.asList(PROP); }
Example #7
Source File: StandardValidators.java From localization_nifi with Apache License 2.0 | 6 votes |
public static Validator createAttributeExpressionLanguageValidator(final ResultType expectedResultType, final boolean allowExtraCharacters) { return new Validator() { @Override public ValidationResult validate(final String subject, final String input, final ValidationContext context) { final String syntaxError = context.newExpressionLanguageCompiler().validateExpression(input, allowExtraCharacters); if (syntaxError != null) { return new ValidationResult.Builder().subject(subject).input(input).valid(false).explanation(syntaxError).build(); } final ResultType resultType = allowExtraCharacters ? ResultType.STRING : context.newExpressionLanguageCompiler().getResultType(input); if (!resultType.equals(expectedResultType)) { return new ValidationResult.Builder() .subject(subject) .input(input) .valid(false) .explanation("Expected Attribute Query to return type " + expectedResultType + " but query returns type " + resultType) .build(); } return new ValidationResult.Builder().subject(subject).input(input).valid(true).build(); } }; }
Example #8
Source File: StandardValidators.java From localization_nifi with Apache License 2.0 | 6 votes |
public static Validator createRegexMatchingValidator(final Pattern pattern) { return new Validator() { @Override public ValidationResult validate(final String subject, final String input, final ValidationContext context) { if (context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(input)) { return new ValidationResult.Builder().subject(subject).input(input).explanation("Expression Language Present").valid(true).build(); } final boolean matches = pattern.matcher(input).matches(); return new ValidationResult.Builder() .input(input) .subject(subject) .valid(matches) .explanation(matches ? null : "Value does not match regular expression: " + pattern.pattern()) .build(); } }; }
Example #9
Source File: StandardValidators.java From localization_nifi with Apache License 2.0 | 6 votes |
public static Validator createDataSizeBoundsValidator(final long minBytesInclusive, final long maxBytesInclusive) { return new Validator() { @Override public ValidationResult validate(final String subject, final String input, final ValidationContext context) { if (context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(input)) { return new ValidationResult.Builder().subject(subject).input(input).explanation("Expression Language Present").valid(true).build(); } final ValidationResult vr = DATA_SIZE_VALIDATOR.validate(subject, input, context); if (!vr.isValid()) { return vr; } final long dataSizeBytes = DataUnit.parseDataSize(input, DataUnit.B).longValue(); if (dataSizeBytes < minBytesInclusive) { return new ValidationResult.Builder().subject(subject).input(input).valid(false).explanation("Cannot be smaller than " + minBytesInclusive + " bytes").build(); } if (dataSizeBytes > maxBytesInclusive) { return new ValidationResult.Builder().subject(subject).input(input).valid(false).explanation("Cannot be larger than " + maxBytesInclusive + " bytes").build(); } return new ValidationResult.Builder().subject(subject).input(input).valid(true).build(); } }; }
Example #10
Source File: TestStandardValidators.java From localization_nifi with Apache License 2.0 | 6 votes |
@Test public void testNonEmptyELValidator() { Validator val = StandardValidators.NON_EMPTY_EL_VALIDATOR; ValidationContext vc = mock(ValidationContext.class); Mockito.when(vc.isExpressionLanguageSupported("foo")).thenReturn(true); ValidationResult vr = val.validate("foo", "", vc); assertFalse(vr.isValid()); vr = val.validate("foo", " h", vc); assertTrue(vr.isValid()); Mockito.when(vc.isExpressionLanguagePresent("${test}")).thenReturn(true); vr = val.validate("foo", "${test}", vc); assertTrue(vr.isValid()); vr = val.validate("foo", "${test", vc); assertTrue(vr.isValid()); }
Example #11
Source File: AbstractFlumeProcessor.java From nifi with Apache License 2.0 | 6 votes |
protected static Validator createSinkValidator() { return new Validator() { @Override public ValidationResult validate(final String subject, final String value, final ValidationContext context) { String reason = null; try { ExecuteFlumeSink.SINK_FACTORY.create("NiFi Sink", value); } catch (Exception ex) { reason = ex.getLocalizedMessage(); reason = Character.toLowerCase(reason.charAt(0)) + reason.substring(1); } return new ValidationResult.Builder().subject(subject) .input(value) .explanation(reason) .valid(reason == null) .build(); } }; }
Example #12
Source File: PutHDFS.java From localization_nifi with Apache License 2.0 | 6 votes |
static Validator createPositiveShortValidator() { return new Validator() { @Override public ValidationResult validate(final String subject, final String value, final ValidationContext context) { String reason = null; try { final short shortVal = Short.parseShort(value); if (shortVal <= 0) { reason = "short integer must be greater than zero"; } } catch (final NumberFormatException e) { reason = "[" + value + "] is not a valid short integer"; } return new ValidationResult.Builder().subject(subject).input(value).explanation(reason).valid(reason == null) .build(); } }; }
Example #13
Source File: PutHDFS.java From localization_nifi with Apache License 2.0 | 6 votes |
static Validator createUmaskValidator() { return new Validator() { @Override public ValidationResult validate(final String subject, final String value, final ValidationContext context) { String reason = null; try { final short shortVal = Short.parseShort(value, 8); if (shortVal < 0) { reason = "octal umask [" + value + "] cannot be negative"; } else if (shortVal > 511) { // HDFS umask has 9 bits: rwxrwxrwx ; the sticky bit cannot be umasked reason = "octal umask [" + value + "] is not a valid umask"; } } catch (final NumberFormatException e) { reason = "[" + value + "] is not a valid short octal number"; } return new ValidationResult.Builder().subject(subject).input(value).explanation(reason).valid(reason == null) .build(); } }; }
Example #14
Source File: AbstractFlumeProcessor.java From localization_nifi with Apache License 2.0 | 6 votes |
protected static Validator createSourceValidator() { return new Validator() { @Override public ValidationResult validate(final String subject, final String value, final ValidationContext context) { String reason = null; try { ExecuteFlumeSource.SOURCE_FACTORY.create("NiFi Source", value); } catch (Exception ex) { reason = ex.getLocalizedMessage(); reason = Character.toLowerCase(reason.charAt(0)) + reason.substring(1); } return new ValidationResult.Builder().subject(subject) .input(value) .explanation(reason) .valid(reason == null) .build(); } }; }
Example #15
Source File: AbstractFlumeProcessor.java From localization_nifi with Apache License 2.0 | 6 votes |
protected static Validator createSinkValidator() { return new Validator() { @Override public ValidationResult validate(final String subject, final String value, final ValidationContext context) { String reason = null; try { ExecuteFlumeSink.SINK_FACTORY.create("NiFi Sink", value); } catch (Exception ex) { reason = ex.getLocalizedMessage(); reason = Character.toLowerCase(reason.charAt(0)) + reason.substring(1); } return new ValidationResult.Builder().subject(subject) .input(value) .explanation(reason) .valid(reason == null) .build(); } }; }
Example #16
Source File: TestProcessorLifecycle.java From localization_nifi with Apache License 2.0 | 6 votes |
@Override protected List<PropertyDescriptor> getSupportedPropertyDescriptors() { PropertyDescriptor PROP = new PropertyDescriptor.Builder() .name("P") .description("Blah Blah") .required(true) .addValidator(new Validator() { @Override public ValidationResult validate(final String subject, final String value, final ValidationContext context) { return new ValidationResult.Builder().subject(subject).input(value).valid(value != null && !value.isEmpty()).explanation(subject + " cannot be empty").build(); } }) .build(); PropertyDescriptor SERVICE = new PropertyDescriptor.Builder() .name("S") .description("Blah Blah") .required(true) .identifiesControllerService(ITestservice.class) .build(); return this.withService ? Arrays.asList(new PropertyDescriptor[]{PROP, SERVICE}) : Arrays.asList(new PropertyDescriptor[]{PROP}); }
Example #17
Source File: AbstractFlumeProcessor.java From nifi with Apache License 2.0 | 6 votes |
protected static Validator createSourceValidator() { return new Validator() { @Override public ValidationResult validate(final String subject, final String value, final ValidationContext context) { String reason = null; try { ExecuteFlumeSource.SOURCE_FACTORY.create("NiFi Source", value); } catch (Exception ex) { reason = ex.getLocalizedMessage(); reason = Character.toLowerCase(reason.charAt(0)) + reason.substring(1); } return new ValidationResult.Builder().subject(subject) .input(value) .explanation(reason) .valid(reason == null) .build(); } }; }
Example #18
Source File: ExtractText.java From nifi with Apache License 2.0 | 6 votes |
@Override protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) { final List<ValidationResult> problems = new ArrayList<>(super.customValidate(validationContext)); // If the capture group zero is not going to be included, each dynamic property must have at least one group final boolean includeCaptureGroupZero = validationContext.getProperty(INCLUDE_CAPTURE_GROUP_ZERO).getValue().equalsIgnoreCase("true"); getLogger().debug("Include capture group zero is " + includeCaptureGroupZero); if (!includeCaptureGroupZero) { final Validator oneGroupMinimumValidator = StandardValidators.createRegexValidator(1, 40, true); for (Map.Entry<PropertyDescriptor, String> prop : validationContext.getProperties().entrySet()) { PropertyDescriptor pd = prop.getKey(); if (pd.isDynamic()) { String value = validationContext.getProperty(pd).getValue(); getLogger().debug("Evaluating dynamic property " + pd.getDisplayName() + " (" + pd.getName() + ") with value " + value); ValidationResult result = oneGroupMinimumValidator.validate(pd.getDisplayName(), value, validationContext); getLogger().debug("Validation result: " + result.toString()); if (!result.isValid()) { problems.add(result); } } } } return problems; }
Example #19
Source File: StandardValidators.java From nifi with Apache License 2.0 | 6 votes |
private static Validator createURLValidator() { return new Validator() { @Override public ValidationResult validate(final String subject, final String input, final ValidationContext context) { if (context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(input)) { return new ValidationResult.Builder().subject(subject).input(input).explanation("Expression Language Present").valid(true).build(); } try { final String evaluatedInput = context.newPropertyValue(input).evaluateAttributeExpressions().getValue(); new URL(evaluatedInput); return new ValidationResult.Builder().subject(subject).input(input).explanation("Valid URL").valid(true).build(); } catch (final Exception e) { return new ValidationResult.Builder().subject(subject).input(input).explanation("Not a valid URL").valid(false).build(); } } }; }
Example #20
Source File: ForkRecord.java From nifi with Apache License 2.0 | 6 votes |
@Override protected Collection<ValidationResult> customValidate(ValidationContext validationContext) { final List<ValidationResult> results = new ArrayList<>(super.customValidate(validationContext)); Validator validator = new RecordPathValidator(); Map<PropertyDescriptor, String> processorProperties = validationContext.getProperties(); for (final Map.Entry<PropertyDescriptor, String> entry : processorProperties.entrySet()) { PropertyDescriptor property = entry.getKey(); if (property.isDynamic() && property.isExpressionLanguageSupported()) { String dynamicValue = validationContext.getProperty(property).getValue(); if(!validationContext.isExpressionLanguagePresent(dynamicValue)) { results.add(validator.validate(property.getDisplayName(), dynamicValue, validationContext)); } } } return results; }
Example #21
Source File: StandardValidators.java From nifi with Apache License 2.0 | 6 votes |
public static Validator createDataSizeBoundsValidator(final long minBytesInclusive, final long maxBytesInclusive) { return new Validator() { @Override public ValidationResult validate(final String subject, final String input, final ValidationContext context) { if (context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(input)) { return new ValidationResult.Builder().subject(subject).input(input).explanation("Expression Language Present").valid(true).build(); } final ValidationResult vr = DATA_SIZE_VALIDATOR.validate(subject, input, context); if (!vr.isValid()) { return vr; } final long dataSizeBytes = DataUnit.parseDataSize(input, DataUnit.B).longValue(); if (dataSizeBytes < minBytesInclusive) { return new ValidationResult.Builder().subject(subject).input(input).valid(false).explanation("Cannot be smaller than " + minBytesInclusive + " bytes").build(); } if (dataSizeBytes > maxBytesInclusive) { return new ValidationResult.Builder().subject(subject).input(input).valid(false).explanation("Cannot be larger than " + maxBytesInclusive + " bytes").build(); } return new ValidationResult.Builder().subject(subject).input(input).valid(true).build(); } }; }
Example #22
Source File: StandardValidators.java From nifi with Apache License 2.0 | 6 votes |
public static Validator createRegexMatchingValidator(final Pattern pattern) { return new Validator() { @Override public ValidationResult validate(final String subject, final String input, final ValidationContext context) { if (context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(input)) { return new ValidationResult.Builder().subject(subject).input(input).explanation("Expression Language Present").valid(true).build(); } final boolean matches = pattern.matcher(input).matches(); return new ValidationResult.Builder() .input(input) .subject(subject) .valid(matches) .explanation(matches ? null : "Value does not match regular expression: " + pattern.pattern()) .build(); } }; }
Example #23
Source File: StandardValidators.java From nifi with Apache License 2.0 | 6 votes |
public static Validator createAttributeExpressionLanguageValidator(final ResultType expectedResultType, final boolean allowExtraCharacters) { return new Validator() { @Override public ValidationResult validate(final String subject, final String input, final ValidationContext context) { final String syntaxError = context.newExpressionLanguageCompiler().validateExpression(input, allowExtraCharacters); if (syntaxError != null) { return new ValidationResult.Builder().subject(subject).input(input).valid(false).explanation(syntaxError).build(); } final ResultType resultType = allowExtraCharacters ? ResultType.STRING : context.newExpressionLanguageCompiler().getResultType(input); if (!resultType.equals(expectedResultType)) { return new ValidationResult.Builder() .subject(subject) .input(input) .valid(false) .explanation("Expected Attribute Query to return type " + expectedResultType + " but query returns type " + resultType) .build(); } return new ValidationResult.Builder().subject(subject).input(input).valid(true).build(); } }; }
Example #24
Source File: StandardValidators.java From nifi with Apache License 2.0 | 6 votes |
public static Validator createLongValidator(final long minimum, final long maximum, final boolean inclusive) { return new Validator() { @Override public ValidationResult validate(final String subject, final String input, final ValidationContext context) { if (context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(input)) { return new ValidationResult.Builder().subject(subject).input(input).explanation("Expression Language Present").valid(true).build(); } String reason = null; try { final long longVal = Long.parseLong(input); if (longVal < minimum || (!inclusive && longVal == minimum) | longVal > maximum || (!inclusive && longVal == maximum)) { reason = "Value must be between " + minimum + " and " + maximum + " (" + (inclusive ? "inclusive" : "exclusive") + ")"; } } catch (final NumberFormatException e) { reason = "not a valid integer"; } return new ValidationResult.Builder().subject(subject).input(input).explanation(reason).valid(reason == null).build(); } }; }
Example #25
Source File: TestStandardValidators.java From nifi with Apache License 2.0 | 6 votes |
@Test public void testNonEmptyELValidator() { Validator val = StandardValidators.NON_EMPTY_EL_VALIDATOR; ValidationContext vc = mock(ValidationContext.class); Mockito.when(vc.isExpressionLanguageSupported("foo")).thenReturn(true); ValidationResult vr = val.validate("foo", "", vc); assertFalse(vr.isValid()); vr = val.validate("foo", " h", vc); assertTrue(vr.isValid()); Mockito.when(vc.isExpressionLanguagePresent("${test}")).thenReturn(true); vr = val.validate("foo", "${test}", vc); assertTrue(vr.isValid()); vr = val.validate("foo", "${test", vc); assertTrue(vr.isValid()); }
Example #26
Source File: FakeDynamicPropertiesProcessor.java From nifi with Apache License 2.0 | 6 votes |
@Override protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(final String propertyDescriptorName) { if (propertyDescriptorName.startsWith("CS.")) { return new PropertyDescriptor.Builder() .name(propertyDescriptorName) .required(false) .dynamic(true) .identifiesControllerService(ControllerService.class) .build(); } if (propertyDescriptorName.startsWith("FCS.")) { return new PropertyDescriptor.Builder() .name(propertyDescriptorName) .required(false) .dynamic(true) .identifiesControllerService(FakeControllerService1.class) .build(); } return new PropertyDescriptor.Builder() .name(propertyDescriptorName) .required(false) .addValidator(Validator.VALID) .dynamic(true) .build(); }
Example #27
Source File: TestStandardValidators.java From nifi with Apache License 2.0 | 6 votes |
@Test public void testTimePeriodValidator() { Validator val = StandardValidators .createTimePeriodValidator(1L, TimeUnit.SECONDS, Long.MAX_VALUE, TimeUnit.NANOSECONDS); ValidationResult vr; final ValidationContext validationContext = Mockito.mock(ValidationContext.class); vr = val.validate("TimePeriodTest", "0 sense made", validationContext); assertFalse(vr.isValid()); vr = val.validate("TimePeriodTest", null, validationContext); assertFalse(vr.isValid()); vr = val.validate("TimePeriodTest", "0 secs", validationContext); assertFalse(vr.isValid()); vr = val.validate("TimePeriodTest", "999 millis", validationContext); assertFalse(vr.isValid()); vr = val.validate("TimePeriodTest", "999999999 nanos", validationContext); assertFalse(vr.isValid()); vr = val.validate("TimePeriodTest", "1 sec", validationContext); assertTrue(vr.isValid()); }
Example #28
Source File: ListS3.java From nifi with Apache License 2.0 | 6 votes |
private static Validator createRequesterPaysValidator() { return new Validator() { @Override public ValidationResult validate(final String subject, final String input, final ValidationContext context) { boolean requesterPays = Boolean.valueOf(input); boolean useVersions = context.getProperty(USE_VERSIONS).asBoolean(); boolean valid = !requesterPays || !useVersions; return new ValidationResult.Builder() .input(input) .subject(subject) .valid(valid) .explanation(valid ? null : "'Requester Pays' cannot be used when listing object versions.") .build(); } }; }
Example #29
Source File: TestStandardValidators.java From nifi with Apache License 2.0 | 5 votes |
@Test public void testNonBlankValidator() { Validator val = StandardValidators.NON_BLANK_VALIDATOR; ValidationContext vc = mock(ValidationContext.class); ValidationResult vr = val.validate("foo", "", vc); assertFalse(vr.isValid()); vr = val.validate("foo", " ", vc); assertFalse(vr.isValid()); vr = val.validate("foo", " h", vc); assertTrue(vr.isValid()); }
Example #30
Source File: ControlRate.java From nifi with Apache License 2.0 | 5 votes |
@Override protected Collection<ValidationResult> customValidate(final ValidationContext context) { final List<ValidationResult> validationResults = new ArrayList<>(super.customValidate(context)); final Validator rateValidator; switch (context.getProperty(RATE_CONTROL_CRITERIA).getValue().toLowerCase()) { case DATA_RATE: rateValidator = StandardValidators.DATA_SIZE_VALIDATOR; break; case ATTRIBUTE_RATE: rateValidator = StandardValidators.POSITIVE_LONG_VALIDATOR; final String rateAttr = context.getProperty(RATE_CONTROL_ATTRIBUTE_NAME).getValue(); if (rateAttr == null) { validationResults.add(new ValidationResult.Builder() .subject(RATE_CONTROL_ATTRIBUTE_NAME.getName()) .explanation("<Rate Controlled Attribute> property must be set if using <Rate Control Criteria> of 'attribute value'") .build()); } break; case FLOWFILE_RATE: default: rateValidator = StandardValidators.POSITIVE_LONG_VALIDATOR; break; } final ValidationResult rateResult = rateValidator.validate("Maximum Rate", context.getProperty(MAX_RATE).getValue(), context); if (!rateResult.isValid()) { validationResults.add(rateResult); } return validationResults; }