Interface IWorkflowBeanValidator
-
- All Known Implementing Classes:
WorkflowBeanValidator
public interface IWorkflowBeanValidator
Interface for the bean validator that can be accessed during validation viaIWorkflowLocalHandlerValidationContext.getBeanValidator()
. Grants access to theValidator
, and contains a few utility methods for performing a validation with that validator.This bean validator ensures that the appropriate resource bundle as indicated by
IElementHandler.getResourceBundle(java.util.Locale)
is available during the call toIElementHandler.validateLocal(de.xima.fc.interfaces.workflow.params.IElementLocalValidationParams)
.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Class<?>[]
findAllValidationGroups(Class<?> beanClass)
Finds all validation groups defined on any property, method, or constructor of the given bean class.javax.validation.Validator
getBeanValidator()
String
interpolateMessage(javax.validation.ConstraintViolation<?> violation)
Given a constraint violation, creates the localized message for that constraint.IWorkflowElementValidationResult
validateModel(Object workflowElement, Class<?>... groups)
Uses thegetBeanValidator()
to perform a validation of bean instance, usually the properties model of a workflow node or trigger.
-
-
-
Method Detail
-
findAllValidationGroups
Class<?>[] findAllValidationGroups(Class<?> beanClass) throws WorkflowValidationException
Finds all validation groups defined on any property, method, or constructor of the given bean class. Walks the entire object graph, i.e. also finds validation groups on referenced elements.- Parameters:
beanClass
- Bean class to analyze.- Returns:
- All validation groups of the given bean class.
- Throws:
WorkflowValidationException
- When the class could not be analyzed.
-
getBeanValidator
javax.validation.Validator getBeanValidator()
- Returns:
- A bean validator instance that may be used to validate workflow elements. Usually you should just use
validateModel(Object, Class...)
.
-
interpolateMessage
String interpolateMessage(javax.validation.ConstraintViolation<?> violation)
Given a constraint violation, creates the localized message for that constraint. Uses the localized message of the constraint, and adds the label for the property from the current resource bundle. Usually you should just usevalidateModel(Object, Class...)
.- Parameters:
violation
- Violation for which to create the localized validation message.- Returns:
- The localized validation message.
-
validateModel
IWorkflowElementValidationResult validateModel(Object workflowElement, Class<?>... groups) throws WorkflowValidationException
Uses thegetBeanValidator()
to perform a validation of bean instance, usually the properties model of a workflow node or trigger.- Parameters:
workflowElement
- The bean instance to validate, must not benull
groups
- A list of validation groups to validate, see the second argument ofValidator.validate(Object, Class...)
.- Returns:
- The validation result with all error and warning messages.
- Throws:
WorkflowValidationException
- When an error occurred during validation; or when the given model isnull
.
-
-