...
The GenericXMLfiller class contains the logic for creating an XML file from a list of records obtained by executing the SQL script configured via Parameter tree entries. This class can be used for generating the XML files from data obtained by joining some database tables by a query, configured in parameter tree as described below. If the required XML file needs to execute multiple SQL queries to get the data that is to be placed in the XML document in different levels, the GenericXMLfiller cannot be used. A new subclass of XmlFiller need to be created, if the GenericXMLFiller cannot produce the XML file in required format.
Parameter Tree entries used to configure the SQL script(s) used by GenericXMLFiller class:
Parameter Path/ Type | Description | Value | Mandatory | Default Value used if not mandatory |
---|---|---|---|---|
Root Node: FILE_PROCESSING.XML | ||||
RECORD_RETRIEVE_SQL | ||||
String | SQL query to load the records from the Database tables, which are to be exported into the XML file. This SQL string can contain the label <BILLING_SOURCE_ID> which will be replaced with appropriate value at run-time. If the SQL query string contains the label <BILLING_SOURCE_ID>, it will be replaced with the ID of the current source record currently being processed to create the XML file. Note: The billing source table name is configured in the column BILLING_SOURCE_TABLE_NAME of the table CDR_FILE_DEF. <BILLING_SOURCE_ID> will be replaced with the ID of the current row being processed from the table configured in the column CDR_FILE_DEF.BILLING_SOURCE_TABLE_NAME. | Example: Select vr.* from VOUCHER_EXPORT_RECORD vr where vr.VOUCHER_EXPORT_SOURCE_ID = <BILLING_SOURCE_ID> order by vr.id | YES | |
RECORD_RETRIEVE_SQL_WITH_ID_GREATERTHAN_CLAUSE | ||||
String | SQL query to load the next batch of records with ID greater than the last loaded maximum ID, which are to be exported into the XML file. This SQL query can contain the tags <BILLING_SOURCE_ID> and <MAX_LOADED_ID> labels which will be replaced with appropriate values at run-time
| Example: Select vr.* from VOUCHER_EXPORT_RECORD vr where vr.VOUCHER_EXPORT_SOURCE_ID = <BILLING_SOURCE_ID> and vr.id > <MAX_LOADED_ID> order by vr.id | YES |
...
- The query from RECORD_RETRIEVE_SQL parameter is used to load the first batch of records (10000) .
- If there are more records to be added to the same XML file and the reload_method on one of the XML_TAG_DEF entries is set to 'reloadRecords', The SQL from RECORD_RETRIEVE_SQL_WITH_ID_GREATERTHAN_CLAUSE parameter is used to load the next batches , with 10000 max rows selected in each subsequent batch, until all pending records have been added to the file.
Instructions to set up file processor configuration for XML file generation with GenericXMLFiller:
- Create XML_TAG_DEF entries for the required XML file format: A record in the xml_tag_def defines a single tag of the resulting xml. It is possible to define parent tag for the XML_TAG_DEF entry, and thus it is possible to define the full hierarchy of the XML elements.
- Create an XML_DOCUMENT_DEF record with FILLER_CLASS = 'com.CDRator.billing.dataloader.cdrdata.xml.GenericXMLFiller', XML_ROOT_TAG_ID = '<Id of the XML Root Tag entry from XML_TAG_DEF entries created for this XML file format>'
- Create a CDR_FILE_DEF record with CODE ='XML' , BILLING_SOURCE_TABLE_NAME = <Source table name>, BILLING_SOURCE_CLASS= <Java class for Billing Source>, EXPORT_TYPE = '<The Export_Type for the Customer this XML file is generated for>', XML_DOCUMENT_DEF_ID = '<ID of the XML_DOCUMENT_DEF record created in above step>'.
- Create a CDR_RECORD_DEF record with CODE ='DETAIL' , RECORD_TABLE_NAME = <DB table name for the records to be exported>, RECORD_CLASS = <Java class name for the Records to be exported>, CDR_FILE_DEF_ID = '<ID of the CDR_FILE_DEF created in above step>'. The XML file processing engine will only need a CDR_RECORD_DEF entry for DETAIL records. So HEADER, TRAILER record definitions are not needed.
- Create a CDR_FILE_PROCESSOR entry with CODE='GENERATOR', CDR_FILE_DEF_ID = '<ID of the CDR_FILE_DEF created in earlier step>', FILE_TRANSMITTER_ID= '<Id of the corresponding FILE_TRANSMITTER entry>' and BRAND_ID = '<Corresponding brandId>'
- Make sure that the parameter tree entries for XML generation are created and contain proper values: See
3.3.2 - XmlFillerBillingRecords and XmlFillerIdl
...