This class keeps a collection of rating functions that is applicable to the this tariff.
Definition at line 333 of file tariff.h.
typedef std::set< Id<RatingFn> > OSB_LIB::TfVersion::AssignedRf |
typedef Id2<TfVersion> OSB_LIB::TfVersion::Oid |
Default constructor with optional object id.
OSB_LIB::TfVersion::TfVersion | ( | const Tariff::Oid & | tfOid | ) | [explicit] |
Constructor for a new tariff version.
bool OSB_LIB::TfVersion::addRatingFn | ( | const RatingFn::Oid & | rfId | ) |
Add new rating functions into this tariff version.
This function will add in new rating function to this tariff version. Database will not be modified until update() function is called.
rfId | Rating function to add. |
OsbException | for the following errors:
|
bool OSB_LIB::TfVersion::checkObjVs | ( | const OSB_DB::Session & | session, | |
OsbErrors & | errors | |||
) | [private] |
Compare the object version with the database.
session | Database session to use. | |
errors | Gets error message if the object version does not match the database. |
bool OSB_LIB::TfVersion::freeze | ( | const OSB_DB::Session & | session, | |
OsbErrors & | errors | |||
) | [virtual] |
Set the tariff version from editable to standby.
To check a tariff version object, the following criteria must be fulfilled:
session | Database session to use. | |
errors | Container for errors. |
Implements OSB_LIB::ToCfgBase.
bool OSB_LIB::TfVersion::gracePeriodExpired | ( | ) | const [private] |
This function will determine whether the grace period this tariff version has expired.
bool OSB_LIB::TfVersion::hasReplacement | ( | OSB_LIB::DateTime * | nextVs | ) | const [private] |
This function will determine whether there is a tariff version object that can replace the object passed in.
nextVs | If not 0: Gets the release timestamp of the next version. |
bool OSB_LIB::TfVersion::insert | ( | const OSB_DB::Session & | session | ) | [private] |
This function allow tariff version to insert itself into database.
The object's id is not set before the function call. If the function completed successfully, the object will have it's id set, else the id will still be the same (not set).
session | Database session. |
OsbException | for the following errors:
|
const Oid& OSB_LIB::TfVersion::oid | ( | ) | const |
Get the object id.
bool OSB_LIB::TfVersion::patch | ( | const OSB_DB::Session & | session, | |
OsbErrors & | errors, | |||
TfVersion * | replacing | |||
) |
Patch current tariff version with an existing tariff version.
This function changes the status of the tariff version that is to replace current tariff version from standby to released. Status of current tariff version is then changed to standby. The names of the boths tariff versions are then switched and the current and replacing version number is then logged.
session | Database session. | |
replacing | Tariff version replacing current version. | |
errors | Container for errors. |
void OSB_LIB::TfVersion::rate | ( | SumCdr & | sumCdr | ) | const |
void OSB_LIB::TfVersion::rate | ( | UsedService & | us | ) | const |
Rate a used service.
us | The used service to be rated. |
void OSB_LIB::TfVersion::rate | ( | UsedService & | us, | |
const Money & | money, | |||
Decimal & | volume | |||
) | const |
Find the volume for a given used service and money.
us | The used service to be rated. | |
money | Available money. | |
volume | Total duration available. |
const AssignedRf& OSB_LIB::TfVersion::ratingFns | ( | ) | const |
Get a list of rating functions bind to this tariff version.
bool OSB_LIB::TfVersion::read | ( | const OSB_DB::Session & | session | ) |
This function allow tariff version to read itself from database.
Object id must be set before the function call. The id is used to retrieve other details from database and populate the object.
session | Database session. |
bool OSB_LIB::TfVersion::release | ( | const OSB_DB::Session & | session, | |
OsbErrors & | errors | |||
) | [virtual] |
Set the tariff version from standby to released.
If the released date is not later than current date, send the tariff version for re-rating.
To release a tariff version object, the following criteria must be fulfilled:
session | Database session to use. | |
errors | Container for errors. |
Implements OSB_LIB::ToCfgBase.
bool OSB_LIB::TfVersion::remove | ( | const OSB_DB::Session & | session | ) | [private] |
This function allow tariff version to remove itself from database.
Object id must be set before the function call. The id will be unset if the function completed successfully, else no changes to the object.
session | Database session. |
OsbException | for the following errors:
|
bool OSB_LIB::TfVersion::removeRatingFn | ( | const RatingFn::Oid & | rfId | ) |
Remove rating functions from this tariff version.
This function will remove a rating function from this tariff version. Database will not be modified until update() function is called.
rfId | Rating function to remove. |
OsbException | for the following errors:
|
bool OSB_LIB::TfVersion::revoke | ( | const OSB_DB::Session & | session, | |
OsbErrors & | errors | |||
) | [virtual] |
Set the tariff version from released to standby.
To revoke a tariff version object, the following criteria must be fulfilled:
session | Database session to use. | |
errors | Container for errors. |
Implements OSB_LIB::ToCfgBase.
Tariff::Oid OSB_LIB::TfVersion::tfId | ( | ) | const |
Get the tariff id.
bool OSB_LIB::TfVersion::unfreeze | ( | const OSB_DB::Session & | session, | |
OsbErrors & | errors | |||
) | [virtual] |
Set the tariff version from standby to editable.
To unfreeze a tariff version object, the following criteria must be fulfilled:
session | Database session to use. | |
errors | Container for errors. |
Implements OSB_LIB::ToCfgBase.
bool OSB_LIB::TfVersion::update | ( | const OSB_DB::Session & | session | ) | [private] |
This function allow tariff version to update itself into database.
This function will update an existing tairff version object in the database. If the function completed successfully, the object's objVs will increment by 1.
session | Database session. |
OsbException | for the following errors:
|
long OSB_LIB::TfVersion::vsId | ( | ) | const |
friend struct OSB_DB::TfVersionGw [friend] |
friend class TariffCatalogue [friend] |
Oid OSB_LIB::TfVersion::oid_ [private] |
AssignedRf OSB_LIB::TfVersion::ratingFns_ [private] |