Search in sources :

Example 1 with IntegerValidator

use of org.graylog2.database.validators.IntegerValidator in project graylog2-server by Graylog2.

the class StreamRuleImpl method getValidations.

@Override
public Map<String, Validator> getValidations() {
    final ImmutableMap.Builder<String, Validator> validators = ImmutableMap.builder();
    validators.put(FIELD_TYPE, new IntegerValidator());
    validators.put(FIELD_STREAM_ID, new ObjectIdValidator());
    validators.put(FIELD_CONTENT_PACK, new OptionalStringValidator());
    if (!EnumSet.of(StreamRuleType.ALWAYS_MATCH).contains(this.getType())) {
        validators.put(FIELD_FIELD, new FilledStringValidator());
    }
    if (!EnumSet.of(StreamRuleType.PRESENCE, StreamRuleType.ALWAYS_MATCH).contains(this.getType())) {
        validators.put(FIELD_VALUE, new FilledStringValidator());
    }
    return validators.build();
}
Also used : IntegerValidator(org.graylog2.database.validators.IntegerValidator) ObjectIdValidator(org.graylog2.database.validators.ObjectIdValidator) FilledStringValidator(org.graylog2.database.validators.FilledStringValidator) OptionalStringValidator(org.graylog2.database.validators.OptionalStringValidator) ImmutableMap(com.google.common.collect.ImmutableMap) OptionalStringValidator(org.graylog2.database.validators.OptionalStringValidator) Validator(org.graylog2.plugin.database.validators.Validator) IntegerValidator(org.graylog2.database.validators.IntegerValidator) ObjectIdValidator(org.graylog2.database.validators.ObjectIdValidator) FilledStringValidator(org.graylog2.database.validators.FilledStringValidator)

Aggregations

ImmutableMap (com.google.common.collect.ImmutableMap)1 FilledStringValidator (org.graylog2.database.validators.FilledStringValidator)1 IntegerValidator (org.graylog2.database.validators.IntegerValidator)1 ObjectIdValidator (org.graylog2.database.validators.ObjectIdValidator)1 OptionalStringValidator (org.graylog2.database.validators.OptionalStringValidator)1 Validator (org.graylog2.plugin.database.validators.Validator)1