OBPIH-7777 Add validation support for bulk data imports#6019
Conversation
|
|
||
| errors.add(new BulkDataError( | ||
| row: null, // We rely on customValidate to set this later | ||
| column: null, // TODO: we can get this from the config using fieldName! |
There was a problem hiding this comment.
I'm going to address this TODO in the next (and final?) PR
| * A simple configurer of custom validation for use in tests. | ||
| * The validation itself is arbitrary. We just define something so that we can make assertions on it. | ||
| */ | ||
| class BulkDataValidatorConfigurerForTest implements ConfiguresBulkDataValidator<ImportableForTest> { |
There was a problem hiding this comment.
This class is an example of how we'd add custom validation behaviour to an importer. You create a new ConfiguresBulkDataValidator and override customValidateRow. Then you call errors.addFieldError to add new errors. It works similarly to the new Validator trait that I added a few months ago.
My next PR will make it much clearer how this all ties in together. Essentially to set up a new importer all you need to do is add a component like:
@Component
class ProductImportConfigurer implements ConfiguresBulkDataBinder<Product>,
ConfiguresBulkDataValidator<Product> {
<...override all the methods to configure the importer...>
}
and then we can start importing Products via the generic import API
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## feature/receiving-redesign #6019 +/- ##
=============================================================
Coverage ? 11.16%
Complexity ? 1787
=============================================================
Files ? 862
Lines ? 48550
Branches ? 11367
=============================================================
Hits ? 5420
Misses ? 42247
Partials ? 883 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
FYI, i'm working on this and will finalize the review tomorrow. |
✨ Description of Change
Link to GitHub issue or Jira ticket: https://pihemr.atlassian.net/browse/OBPIH-7777
Description: Add support for validating imported bulk data rows during the new import process (that uses apache POI).