OSB_LIB::Usagerecords Class Reference

Collaboration diagram for OSB_LIB::Usagerecords:

Collaboration graph
[legend]
List of all members.

Detailed Description

Container to hold the usage records of a contract.

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.

Public Member Functions

Public Attributes


Member Function Documentation

size_t OSB_LIB::Usagerecords::cdr2Ur ( const CdrList cdrContainer  ) 

Convert the Cdr container into appropriate usage records.

Parameters:
cdrContainer The Cdr container which contains the details of the call.
Returns:
The number of usage records added to the usage record container when this function is called.
Remarks:
This function just loops thru the Cdr container and calls the Cdr2ur which takes in a Cdr. The usage record container is NOT cleared before starting to add in usage records.

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.

Parameters:
cdr The Cdr which contains the details of the call.
Returns:
The number of usage records added to the usage record container when this function is called.
Remarks:
The usage record container is NOT cleared before starting to add in usage records.
The Cdr should contain atleast one MoneyInfo in the money info container for usage records to be created.

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.

Parameters:
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.
Returns:
Number of records loaded.

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.

Parameters:
session Database session to use.
keepRecords Flag not to delete usage records that are successfully stored in the database.
Remarks:
In the current implementation, if `keepRecords' is false, all usage records will be deleted from the STL container.


Member Data Documentation

UrContainer OSB_LIB::Usagerecords::container

The container which holds the usage records.

Definition at line 308 of file usagerecord.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:10:27 2006 for OSB Library by  doxygen 1.4.7