OSB_DB::BalanceSheetGw Class Reference

List of all members.

Detailed Description

Database gateway for the class BalanceSheet and BsPage.

Definition at line 59 of file balancesheet-gw.h.

Support for BalanceSheet:

Private Member Functions

Support for BsPage, read operations:
Support for BsPage, change status:
Support for BsPage, insert and delete:
Support for BsPage, update operations:
Internal supporting functions:

Friends

Access for supported classes only:

Member Function Documentation

OSB_LIB::ObjectStatus OSB_DB::BalanceSheetGw::checkObjVs ( const Session session,
const OSB_LIB::BalanceSheet bs 
) [private]

Verify the object version of a balance sheet.

Parameters:
session Database session to use.
bs Balance sheet to verify: its object version is not modified.
Returns:
The object status of the balance sheet.

bool OSB_DB::BalanceSheetGw::close ( const Session session,
const OSB_LIB::BsPage page 
) [private]

Close a balance sheet.

The function updates BS_PAGE.CLOSED and, if not yet set, BS_PAGE.END_DATE.

Parameters:
session Database session.
page Balance page to close.
Exceptions:
OSB_LIB::BsPage::PageClosed 
Returns:
true if the page is updated, false if the page is not found.

long OSB_DB::BalanceSheetGw::fetchAdvanceCharges ( const Session session,
OSB_LIB::BsPage page 
) [private]

Get the advanced charges from database.

This function will retrieve all advanced charges applicable to a contract within the time period provided.

Parameters:
session Database session.
page Balance page for which to retrieve the advance charges.
Returns:
Number of advance charges read.

long OSB_DB::BalanceSheetGw::fetchOnetimeCharges ( const Session session,
OSB_LIB::BsPage page 
) [private]

Get the one time charges from database.

This function reads all one time charges of a balance page.

Parameters:
session Database session.
page Balance page for which to retrieve the onetime charges.
Exceptions:
OsbException in case of a database error.
Returns:
Number of onetime charges read.

bool OSB_DB::BalanceSheetGw::incrAdvTotal ( const Session session,
const OSB_LIB::BsPage::Oid pageId,
const OSB_LIB::BsTotal::SubTotal st 
) [private]

Update the advance charge of a subtotal.

Wraps to incrSubTotal(), see there.

bool OSB_DB::BalanceSheetGw::incrOtcTotal ( const Session session,
const OSB_LIB::BsPage::Oid pageId,
const OSB_LIB::BsTotal::SubTotal st 
) [private]

Update the onetime charge of a subtotal.

Wraps to incrSubTotal(), see there.

bool OSB_DB::BalanceSheetGw::incrSubTotal ( const Session session,
const std::string &  column,
const OSB_LIB::BsPage::Oid pageId,
const OSB_LIB::Currency::Oid cc,
const OSB_LIB::Decimal delta 
) [private]

Update one amount in a subtotal.

For pageId and cc the function tries to add delta to BS_PAGE_TOTAL.column. If this fails a new entry is created using insert and the update is tried again. If this 2nd try fails, the function return false.

Parameters:
session Database session to use.
column Name of column to update.
pageId Balance page to update.
cc Currency code to update.
delta Amount to add.
Returns:
true in case of success, else false.
Note:
It is not that I (vb) like this function ... but it avoids duplicate source code.

bool OSB_DB::BalanceSheetGw::incrUsgTotal ( const Session session,
const OSB_LIB::BsPage::Oid pageId,
const OSB_LIB::BsTotal::SubTotal st 
) [private]

Update the usage charge of a subtotal.

Wraps to incrSubTotal(), see there.

bool OSB_DB::BalanceSheetGw::insert ( const Session session,
const OSB_LIB::BsPage::Oid pageId,
const OSB_LIB::Currency::Oid cc 
) [private]

Create an entry in BS_PAGE_TOTAL.

bool OSB_DB::BalanceSheetGw::insert ( const Session session,
OSB_LIB::OnetimeCharge otc 
) [private]

Insert a onetime charge.

Parameters:
session Database session to use.
otc Onetime charge to insert.
Returns:
true in case of success, else false.
On successful return, the object id of otc is set.

bool OSB_DB::BalanceSheetGw::insert ( const Session session,
OSB_LIB::BsPage page 
) [private]

Create a new balance page.

Parameters:
session Database session.
page Balance page to insert (see below).
Exceptions:
OsbException in case of a database error.
Returns:
true if success else false.
The function creates an entry in BS_PAGE using its members contract id, billcycle, start and end date.
If successful the function sets the object id and the open timestamp of the page.

bool OSB_DB::BalanceSheetGw::insert ( const Session session,
OSB_LIB::BalanceSheet bs 
) [private]

Create a balance sheet in the database.

Parameters:
session Database session to use.
bs Balance sheet to insert, on successful return its object version is 1.
Returns:
true if a row was inserted, else false.

OSB_LIB::ObjectStatus OSB_DB::BalanceSheetGw::lock ( const Session session,
OSB_LIB::BalanceSheet bs,
bool  noWait 
) [private]

Lock a balance sheet entry in database.

This function implements OSB_LIB::BalanceSheet::lock as specified there. It locks the balance sheet by its contract id.

Parameters:
session Database session to use.
bs Balance sheet to lock.
noWait Set to true if the function should not wait for other process to unlock the balance sheet. If waiting is required, set to false.
Exceptions:
OSB_LIB::BalanceSheet::LockFailed 
OSB_LIB::BalanceSheet::Deadlock 
OsbException in case of a database error
Returns:
The object status of the balance sheet.

long OSB_DB::BalanceSheetGw::nextVal ( const Session session,
const std::string &  seqName 
) [private]

Get the next number of a database sequence.

bool OSB_DB::BalanceSheetGw::read ( const Session session,
OSB_LIB::BalanceSheet bs 
) [private]

Read balance sheet data.

The function determines the data members of a balance page using the contract id as selection criteria. It does not read the individual pages, use readBsPages for this.

Parameters:
session Database session to use.
bs Balance sheet to read.
Returns:
true in case of success, else false.
Exceptions:
BalanceSheet::NoBillcycle if billcycle of the balance sheet has an illegal type.

void OSB_DB::BalanceSheetGw::readBsPages ( const Session session,
OSB_LIB::BalanceSheet bs,
bool  incClosed 
) [private]

Read the pages of a balance sheet.

Parameters:
session Database session to use.
bs Balance sheet to read for.
incClosed Flag if closed pages should be read too.

bool OSB_DB::BalanceSheetGw::readInfo ( const Session session,
OSB_LIB::BsPage page 
) [private]

Read basic balance page information.

The function used the object and the contract id of page to read data from BS_PAGE. If successful it calls readTotals to read the charge summary of the balance page.

Parameters:
session Database session to use.
page Balance page to read.
Exceptions:
OsbException in case of a database error.
Returns:
true if the page was found, else false.

bool OSB_DB::BalanceSheetGw::readRerate ( const Session session,
std::deque< OSB_LIB::Contract::Oid > &  dest 
)

Read balance sheets whose pages need to be re-rated.

Only opened pages with status bpRerate are read into the balance sheets.

Parameters:
session Database session to use.
dest List to store the result.

void OSB_DB::BalanceSheetGw::readTotals ( const Session session,
OSB_LIB::BsPage page 
) [private]

Get the charge totals of a balance page.

bool OSB_DB::BalanceSheetGw::remove ( const Session session,
OSB_LIB::OnetimeCharge otc 
) [private]

Delete a onetime charge.

Parameters:
session Database session to use.
otc Onetime charge to delete.
Returns:
true in case of success, false if the onetime charge is not found.
The function uses the object id of otc to delete it from the database. The object id is unset if the function returns successful.

bool OSB_DB::BalanceSheetGw::remove ( const Session session,
OSB_LIB::BsPage page 
) [private]

Delete a balance page from database.

Parameters:
session Database session to use.
page Balance page to delete, on successful return its object id is unset.
Exceptions:
OsbException 
  • if dependent entries exist.
  • in case of a database error.
Returns:
true if the page does no more exist in the database after the function returns, else false.
This function deletes the entry in BS_PAGE of page. In normal operation a balance page that has charges assigned should never be deleted.

bool OSB_DB::BalanceSheetGw::setStatus ( const Session session,
OSB_LIB::BsPage bs,
OSB_LIB::BsPage::Status  status 
) [private]

Change status of balance page.

OSB_LIB::DateTime OSB_DB::BalanceSheetGw::sysDate ( const Session session  )  [private]

Get SYSDATE of the database.

bool OSB_DB::BalanceSheetGw::updLastCharged ( const Session session,
OSB_LIB::BsPage page 
) [private]

Set the last charged timestamp of a balance page.

Parameters:
session Database session to use.
page Balance page to update.
Exceptions:
OsbException in case of a database error.
Returns:
true in case of success, false if the page does not exist in the database.
The function updates the last charge modification timestamp of the balance page with SYSDATE and writes the result back to the page.

bool OSB_DB::BalanceSheetGw::updRecoveryId ( const Session session,
const OSB_LIB::BsPage::Oid pageId,
long  recoveryId 
) [private]

Set the recovery id.

Parameters:
session Database session to use.
pageId Balance page to update.
recoveryId New recovery id of the page, 0 maps to NULL in the database.


Friends And Related Function Documentation

friend class OSB_LIB::BalanceSheet [friend]

Definition at line 63 of file balancesheet-gw.h.

friend class OSB_LIB::BsPage [friend]

Definition at line 62 of file balancesheet-gw.h.


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