Search in sources :

Example 1 with FormValidators

use of org.camunda.bpm.engine.impl.form.validator.FormValidators in project camunda-bpm-platform by camunda.

the class ProcessEngineConfigurationImpl method initFormFieldValidators.

protected void initFormFieldValidators() {
    if (formValidators == null) {
        formValidators = new FormValidators();
        formValidators.addValidator("min", MinValidator.class);
        formValidators.addValidator("max", MaxValidator.class);
        formValidators.addValidator("minlength", MinLengthValidator.class);
        formValidators.addValidator("maxlength", MaxLengthValidator.class);
        formValidators.addValidator("required", RequiredValidator.class);
        formValidators.addValidator("readonly", ReadOnlyValidator.class);
    }
    if (customFormFieldValidators != null) {
        for (Entry<String, Class<? extends FormFieldValidator>> validator : customFormFieldValidators.entrySet()) {
            formValidators.addValidator(validator.getKey(), validator.getValue());
        }
    }
}
Also used : FormFieldValidator(org.camunda.bpm.engine.impl.form.validator.FormFieldValidator) FormValidators(org.camunda.bpm.engine.impl.form.validator.FormValidators)

Example 2 with FormValidators

use of org.camunda.bpm.engine.impl.form.validator.FormValidators in project camunda-bpm-platform by camunda.

the class BuiltInValidatorsTest method testDefaultFormFieldValidators.

public void testDefaultFormFieldValidators() {
    // assert default validators are registered
    FormValidators formValidators = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration().getFormValidators();
    Map<String, Class<? extends FormFieldValidator>> validators = formValidators.getValidators();
    assertEquals(RequiredValidator.class, validators.get("required"));
    assertEquals(ReadOnlyValidator.class, validators.get("readonly"));
    assertEquals(MinValidator.class, validators.get("min"));
    assertEquals(MaxValidator.class, validators.get("max"));
    assertEquals(MaxLengthValidator.class, validators.get("maxlength"));
    assertEquals(MinLengthValidator.class, validators.get("minlength"));
}
Also used : FormFieldValidator(org.camunda.bpm.engine.impl.form.validator.FormFieldValidator) FormValidators(org.camunda.bpm.engine.impl.form.validator.FormValidators)

Aggregations

FormFieldValidator (org.camunda.bpm.engine.impl.form.validator.FormFieldValidator)2 FormValidators (org.camunda.bpm.engine.impl.form.validator.FormValidators)2