butterfly icon indicating copy to clipboard operation
butterfly copied to clipboard

Add transformation time TU and TO pre-validation

Open fabiocarvalho777 opened this issue 6 years ago • 0 comments

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:

  1. Using BeanValidations 2.0
  2. Using an abstract method called preValidation. It should be added to TransformationUtility class and be called in the perform method right before execution.

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

  1. Define a transformation time TU and TO pre-validation .
  2. 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.
  3. Update EVERY transformation utility and operation unit test adding pre-validation test cases.
  4. If any new exception type is introduced, the exceptions class diagram in Design Documents should be updated accordingly.
  5. Update README and end user documentation accordingly.

fabiocarvalho777 avatar Nov 03 '17 17:11 fabiocarvalho777