How to create a data quality management provider
Objective
The purpose of this document is to explain how to create a Data Quality Management Provider.
![]() | This feature is available starting from 3.0RR20.Q1 |
Data Quality Management project provides a infrastructure in Customer and Customer Address Webpos forms to support integrations to external providers of specialized solutions for optimizing data quality, data such as customer address, phone or email.
This infrastructure allow validations and suggestions, through webservice, a simple code function or a query to the database.
Definition
Add new value to Data Quality Provider List reference
Implements the provider
Create new JavaScript class extending CustomerValidatorProvider class.
1. Define the fields that are going to validate or suggest overriding the functions, using the modelProperty of each component.
/* @Override */ static getValidatedFields() { return ['phone', 'alternativePhone', 'email']; } /* @Override */ static getSuggestedFields() { return []; }
2. Implements the logic overriding suggest and/or validate functions. This logic could call a webservice, a simple code function or a query to the database.
/* @Override */ static validate(property, value, callback) { let result; switch (property) { case 'phone': return (result = validatePhoneFormat(value)); case 'alternativePhone': return (result = validatePhoneFormat(value)); case 'email': return (result = validateEmailFormat(value)); } callback(result); }
3. Configure the previous defined reference list
/* @Override */ static getImplementorSearchKey() { return 'OBPOS_CUSTOMERDETAILSVALIDATIONS'; }
4. Register the provider
OB.DQMController.registerProvider(PosterminalValidations);
Data Quality Management example: Customer Details Validations
(function() { class PosterminalValidations extends OB.DQMController .CustomerValidatorProvider { /* @Override */ static getValidatedFields() { return ['phone', 'alternativePhone', 'email']; } /* @Override */ static getSuggestedFields() { return []; } /* @Override */ static validate(property, value, callback) { let result; switch (property) { case 'phone': return (result = validatePhoneFormat(value)); case 'alternativePhone': return (result = validatePhoneFormat(value)); case 'email': return (result = validateEmailFormat(value)); } callback(result); } /* @Override */ static getImplementorSearchKey() { return 'OBPOS_CUSTOMERDETAILSVALIDATIONS'; } } } OB.DQMController.registerProvider(PosterminalValidations); })();