butterfly
butterfly copied to clipboard
Add transformation time TU and TO pre-validation
Problem definition
Every Transformation Utility and Operation input parameters need to be validated before execution. These parameters are the fields that are set during transformation definition time or during transformation execution time (usually based on the transformation context).
If an utility pre-validation fails, an exception should be thrown, the execution should be interrupted, and a perform result of type PRE_VALIDATION
should be returned (containing the validation exception).
Potential solutions
There are two potential solutions for this problem:
- Using BeanValidations 2.0
- Using an abstract method called
preValidation
. It should be added toTransformationUtility
class and be called in theperform
method right beforeexecution
.
Which exception to throw, TransformationDefinitionException or PreValidationException?
Some TUs and TOs currently are currently throwing TransformationDefinitionException
.
Other option would be a new type, called PreValidationException
, could be created. It should extend TransformationException
, which should extend ButterflyRuntimeException
. TransformationUtilityException
should also extend TransformationException
.
Acceptance criteria
- Define a transformation time TU and TO pre-validation .
- Implement it for EVERY transformation utility and operation. Move any pre-validation done currently in any utility
execution
methods to the new mechanism. Notice that in many cases there will be a TODO comment referring to it. - Update EVERY transformation utility and operation unit test adding pre-validation test cases.
- If any new exception type is introduced, the exceptions class diagram in Design Documents should be updated accordingly.
- Update README and end user documentation accordingly.