Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 by executing the SQL script configured via corresponding XML_DOCUMENT_DEF record.  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:

...

Description

...

Mandatory

...

Root Node: FILE_PROCESSING.XML

...

 String

...

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>' 
  • The SQL_LOAD_RECORDS column of the above created XML_DOCUMENT_DEF record must contain the SQL query to obtain the records that should be exported to the file. This SQL string can contain the label <BILLING_SOURCE_ID> which will be replaced with appropriate value at run-time.
    If

...

  • this 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.

...

RECORD_RETRIEVE_SQL_WITH_ID_GREATERTHAN_CLAUSE

...

  •  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

...

  • The SQL_RELOAD_RECORDS column of the above created XML_DOCUMENT_DEF record must contain the 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

  • 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 Parameter Tree entries for XML generation with GenericXMLFiller

 

Important Note: It is mandatory to setup both parameter tree entries RECORD_RETRIEVE_SQL and RECORD_RETRIEVE_SQL_WITH_ID_GREATERTHAN_CLAUSEconfigure both XML_DOCUMENT_DEF.SQL_LOAD_RECORDS and  XML_DOCUMENT_DEF.SQL_RELOAD_RECORDS columns with appropriate SQL queries, because the File processor XML filler classes are configured to load only a maximum 10000 records in one select. If there are more records in that database table, and we want to add them to the XML file, the reload_method  column of the relevant xml_tag_def entry must be set to 'reloadRecords'. In that case, after printing the first set of 10000 records, the GenericXMLFiller tries to load next batch of records, having the ID greater than the ID of the last retrieved record in the previous step.  For example:

Example value for XML_DOCUMENT_DEF.SQL_LOAD_RECORDS column can be:

Select vr.* from VOUCHER_EXPORT_RECORD vr where vr.VOUCHER_EXPORT_SOURCE_ID = <BILLING_SOURCE_ID> order by vr.id

Example value for XML_DOCUMENT_DEF.SQL_RELOAD_RECORDS column can be:

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

If there are 20000 records, then the GenericXMLFiller uses the SQL queries configured in the above parameter tree entries like this:

  • 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 Parameter Tree entries for XML generation with GenericXMLFiller 

3.3.2 - XmlFillerBillingRecords and XmlFillerIdl

...