Usagerecords can read the records of one contract from the database and stores them internally.
ToDo: This class will be an ABC with the following functionality being defined by the base class:
Definition at line 214 of file usagerecord.h.
size_t OSB_LIB::Usagerecords::cdr2Ur | ( | const CdrList & | cdrContainer | ) |
size_t OSB_LIB::Usagerecords::cdr2Ur | ( | const Cdr & | cdr | ) |
Converts the Cdr into appropriate usage records.
This function parses through the Cdr and creates usage records.
Since the usage record tracking mechanism is in my ToDo list I have adopted the below mechanism to generate a call id: The set of usage records created from a Cdr is identified by the callId (a running number generated at the time the usage record is written into the DB)
Note: The usage records needs to be "sorted" according to the call id and record id while inserting into the DB. Since the call id concept is not yet implemented I have not taken care of maintaining the sort order.
Each of these so-called sub-usage records will have a corresponding record Id.
cdr | The Cdr which contains the details of the call. |
long OSB_LIB::Usagerecords::read | ( | const OSB_DB::Session & | session, | |
long | size, | |||
const Contract::Oid & | contractId, | |||
const Date & | from, | |||
const Date & | upto | |||
) |
Load usage records for a contract and a given time period from the database.
This method is just a wrapper around the database gateway OSB_DB::UsagerecordGw::fetch function which does the real work.
session | Database session. | |
size | Database host array size. | |
contractId | Contract identifier. | |
from | Load all records starting from this date. | |
upto | Load all records up to (excluding) this date. |
void OSB_LIB::Usagerecords::write | ( | const OSB_DB::Session & | session, | |
bool | keepRecords = false | |||
) |
Write the usagerecords in the database.
This method calls the database gateway function OSB_DB::UsagerecordGw::insUsagerecord which does the actual work of writing to the database.
session | Database session to use. | |
keepRecords | Flag not to delete usage records that are successfully stored in the database. |