org.sqlproc.engine.validation
Interface SqlValidator


public interface SqlValidator

The vehicle interface definition, which can be used to validate input values in INSERT or UPDATE statements. The SQL Processor knows, which input values have to be validated in CRUD statements. For this purpose the injected validator is invoked. On the other side, the validator knows, how to validate the input values.

The implementation can be based for example on the Hibernate library. The working sample implementation can be seen at Sample validator. This validator in based on JSR 303. The annotated POJO (=dynamic input forms) can be seen at Annotated Person POJO. In the case the validation is failed, the SqlValidationException is thrown.

For more info please see the Tutorials.

Author:
Vladimir Hudec

Method Summary
<T> SqlValidationResult<?>
finish(SqlValidationContext<T> context)
          The SqlValidator visitor method called from inside the main execution methods in SqlCrudEngine.
<T> SqlValidationContext<T>
start(Class<T> parentType)
          The SqlValidator visitor method called from inside the main execution methods in SqlCrudEngine.
<T> void
validate(SqlValidationContext<T> context, Class<T> parentType, String propertyName, Object value)
          The SqlValidator visitor method called from inside the main execution methods in SqlCrudEngine.
 

Method Detail

start

<T> SqlValidationContext<T> start(Class<T> parentType)
The SqlValidator visitor method called from inside the main execution methods in SqlCrudEngine. This is the first step to establish the validation context.

Parameters:
parentType - the dynamic or static input form type
Returns:
the validation context

validate

<T> void validate(SqlValidationContext<T> context,
                  Class<T> parentType,
                  String propertyName,
                  Object value)
The SqlValidator visitor method called from inside the main execution methods in SqlCrudEngine. This is the validation step devoted for one input value.

Parameters:
context - the validation context
parentType - the dynamic or static input form type
propertyName - the name of the input attribute (in input form)
value - the input value (= the value of the input attribute)

finish

<T> SqlValidationResult<?> finish(SqlValidationContext<T> context)
The SqlValidator visitor method called from inside the main execution methods in SqlCrudEngine. This is the final step to return the overall validation result.

Parameters:
context - the validation context
Returns:
overall validation result. In the case it's not null, the SQL Processor throws SqlValidationException.


Copyright © 2014. All rights reserved.