The OSB rating process uses resources to identify the end user of the network and the services available for the user.
Technically speaking the requirement is as follows:
It must be possible to determine the personalized product that owns the resource at a given time. Then it is the responsibility of the personalized product to provide the information needed for rating: tariff system, services, credits, ... .
The link between a resource and a pers. product is established by PersItem, the base class of PersResource.
All "real-life" resources are derived from this abstract base that defines the functionality needed for rating.
Definition at line 87 of file resource.h.
Non-leaf classes derived from Resource must not implement these pure virtual functions.
typedef Id<Resource> OSB_LIB::Resource::Oid |
typedef ResourceType OSB_LIB::Resource::Type |
The status of resource.
Customer care and other on-line application need to assign a resource to a pers. product if it contains a ResourceItem.
A resource is available if its resource status is either rsAvailable OR rsQuarantine and quarantineEnd_ is less than the current system date.
rsUnknown | Unknown resource status. |
rsCreated |
Resource is created and reserved, this is the default status. |
rsAvailable | Resource is available. |
rsAssigned | Resource is assigned. |
rsQuarantine | Resource is in quarantine time. For this status quarantineEnd_ stores the end of the quarantine period (not included). |
rsDeactivated | Resource is deactivated and can not be used again. |
rsLinked | The resource is linked to a device which determines its status. |
Definition at line 121 of file resource.h.
Default constructor with optional object id.
OSB_LIB::Resource::Resource | ( | const Number & | rn, | |
const Id< Network > & | nw = Id< Network >() | |||
) | [explicit] |
Constructor with resource number and optional network.
rn | Resource number. | |
nw | Id of the network. |
OsbException | if rn is empty or too long. |
OSB_LIB::Resource::Resource | ( | const Number & | rn, | |
const Id2< NetworkElement > & | ne | |||
) |
Constructor with resource number and network element.
rn | Resource number. | |
ne | Id of the network element. |
OsbException | if rn is empty or too long. |
virtual OSB_LIB::Resource::~Resource | ( | ) | [virtual] |
Virtual destructor.
OSB_LIB::Resource::Resource | ( | const Resource & | rhs | ) | [protected] |
Copying for derived classes only.
bool OSB_LIB::Resource::assignResource | ( | const OSB_DB::Session & | session | ) | [protected] |
Handle the assigned resource: set status to assigned.
The resource will be automatically created if it does not exist in the database.
session | database session. |
OsbException | from lock(). | |
OsbException | if the resource is not available (see isAvailable()). |
bool OSB_LIB::Resource::canDel | ( | ) | const |
This resource can be remove?
virtual bool OSB_LIB::Resource::canUpd | ( | ) | const [virtual] |
This resource can be update?
Reimplemented in OSB_LIB::Ip4Address.
bool OSB_LIB::Resource::deassignResource | ( | const OSB_DB::Session & | session | ) | [protected] |
Handle the deassigned resource: set status to deassigned.
session | database session. |
OsbException | if the object has been changed or deleted. |
The device to which the resource is linked.
It is not set if the resource is not linked to a device.
OSB_LIB::Status OSB_LIB::Resource::getPersResourceStatus | ( | const OSB_DB::Session & | session, | |
const DateTime & | ts = DateTime::now() | |||
) | const [protected] |
Determine the status of the pers. node of the resource.
session | Database session to use. | |
ts | Date and time for which the pers. product node should be determined. Default is current date time. |
OsbException | if more than one assignment of the resource for ts exists. |
static void OSB_LIB::Resource::handleObjectStatus | ( | ObjectStatus | os, | |
const Oid & | id | |||
) | [static, protected] |
Evalute the object status of a resource.
os | Object status to evaluate. | |
id | The id of the resource for which os is valid. |
ObjectDeleted | ||
ObjectModified | ||
ObjectBusy | if noWait is true and the resource is locked by another database session. |
void OSB_LIB::Resource::incObjVs | ( | const OSB_DB::Session & | session | ) | [protected] |
Increment the object version in the database.
session | Database session to use. |
OsbException | (internal error) if the update of the object version in the database fails. |
bool OSB_LIB::Resource::insBase | ( | const OSB_DB::Session & | session | ) | [protected] |
Insert common resource data to the database.
session | Database session to use. |
virtual bool OSB_LIB::Resource::insert | ( | const OSB_DB::Session & | session | ) | [pure virtual] |
Insert the resource into the database.
session | Database session to use. |
Implemented in OSB_LIB::AccessNumber, OSB_LIB::CallingCard, OSB_LIB::E164Resource, OSB_LIB::ImsiResource, OSB_LIB::Ip4Address, OSB_LIB::IpGroup, and OSB_LIB::TrunkResource.
virtual bool OSB_LIB::Resource::isAvailable | ( | ) | const [virtual] |
Check if the resource is available.
Reimplemented in OSB_LIB::Ip4Address.
bool OSB_LIB::Resource::isPrepaid | ( | ) | const |
Prepaid resource?
void OSB_LIB::Resource::lock | ( | const OSB_DB::Session & | session, | |
bool | noWait | |||
) | const [protected] |
Lock a resource in the database.
session | Database session to use. | |
noWait | Don't wait for database locks? |
OsbException | from handleObjectStatus(). |
const Id2<NetworkElement>& OSB_LIB::Resource::neId | ( | ) | const |
Network element id of the resource.
Network id of the resource.
long OSB_LIB::Resource::objVs | ( | ) | const |
Object version as in NETWORK_RESOURCE.
Assignment for derived classes only.
const Id<InventoryPool> OSB_LIB::Resource::poolId | ( | ) | const |
The inventory pool of the resource.
It is not set if the resource was not assigned to a pool.
const Date& OSB_LIB::Resource::quarantineEnd | ( | ) | const |
End of quarantine period.
virtual bool OSB_LIB::Resource::read | ( | const OSB_DB::Session & | session | ) | [pure virtual] |
Read the resource from the database.
session | Database session to use. |
Implemented in OSB_LIB::AccessNumber, OSB_LIB::CallingCard, OSB_LIB::E164Resource, OSB_LIB::ImsiResource, OSB_LIB::Ip4Address, OSB_LIB::IpGroup, and OSB_LIB::TrunkResource.
bool OSB_LIB::Resource::readBase | ( | const OSB_DB::Session & | session | ) | [protected] |
Read common resource data from the database.
session | Database session to use. |
virtual bool OSB_LIB::Resource::remove | ( | const OSB_DB::Session & | session | ) | [pure virtual] |
Delete the resource from the database.
session | Database session to use. |
Implemented in OSB_LIB::AccessNumber, OSB_LIB::CallingCard, OSB_LIB::E164Resource, OSB_LIB::ImsiResource, OSB_LIB::Ip4Address, OSB_LIB::IpGroup, and OSB_LIB::TrunkResource.
bool OSB_LIB::Resource::removeBase | ( | const OSB_DB::Session & | session, | |
bool | isLocked | |||
) | [protected] |
Delete common resource data from the database.
session | Database session to use. | |
isLocked | Flag if the resource is already locked in the database. |
OsbException | the resource is already assigned.
|
class TrunkResource : public Resource { friend class Gateway; public: bool remove(const Session& session) { lock(session, false); Gateway gw(session); bool rc = gw.remove(*this); if (rc) { rc = removeBase(session, true); } return rc; } };
const Number& OSB_LIB::Resource::resourceNumber | ( | ) | const |
Read access to unique resource number.
virtual void OSB_LIB::Resource::setAssigned | ( | ) | [protected, virtual] |
Set the status to assigned.
Sets the status of the resource to rsAssigned and clears quarantineEnd_. The assigned_ will be set to current date if it is null.
virtual void OSB_LIB::Resource::setAvailable | ( | ) | [protected, virtual] |
Set the status to available.
Sets the status of the resource to rsAvailable and clears quarantineEnd_.
virtual void OSB_LIB::Resource::setDeassigned | ( | ) | [protected, virtual] |
Set the status to deassigned.
Sets the status of the resource to rsQuarantine and clears quarantineEnd_. If later the status is updated in the database (by calling updStatus), the status and the quarantine end are set as defined by RESOURCE_TYPE.
Set the device to which the resource is linked.
deviceId | The id of the device. |
OsbException | if the resource is already linked to a device. |
void OSB_LIB::Resource::setPool | ( | const Id< InventoryPool > & | poolId | ) |
Set the inventory pool.
poolId | The id of the new inventory pool. |
virtual void OSB_LIB::Resource::setStatus | ( | const Status | newStatus | ) | [virtual] |
Set the resource status.
newStatus | New status of the resource. |
OsbException | if the current status is assigned. | |
OsbException | if newStatus is assigned or quarantine. |
virtual Type OSB_LIB::Resource::typeId | ( | ) | const [pure virtual] |
The type of the concrete resource.
Implemented in OSB_LIB::AccessNumber, OSB_LIB::CallingCard, OSB_LIB::E164Resource, OSB_LIB::ImsiResource, OSB_LIB::Ip4Address, OSB_LIB::IpGroup, and OSB_LIB::TrunkResource.
bool OSB_LIB::Resource::unassignResource | ( | const OSB_DB::Session & | session | ) | [protected] |
Handle the assigned resource: set status to unassigned.
session | database session. |
OsbException | if the object has been changed or deleted. |
void OSB_LIB::Resource::updAssigned | ( | const OSB_DB::Session & | session, | |
const DateTime & | firstAss | |||
) | [protected] |
Set the first assignment date in the database.
session | Database session to use. | |
firstAss | Date of the resource's first assignment. |
OsbException | from lock(). |
virtual void OSB_LIB::Resource::updData | ( | const OSB_DB::Session & | session | ) | [pure virtual] |
Update the resource in the database.
session | Database session to use. |
OsbException | from lock(). | |
OsbException | from incObjVs(). |
Implemented in OSB_LIB::AccessNumber, OSB_LIB::CallingCard, OSB_LIB::E164Resource, OSB_LIB::ImsiResource, OSB_LIB::Ip4Address, OSB_LIB::IpGroup, and OSB_LIB::TrunkResource.
void OSB_LIB::Resource::updDataBase | ( | const OSB_DB::Session & | session | ) | [protected] |
Update common resource data to the database.
session | Database session to use. |
void OSB_LIB::Resource::updStatus | ( | const OSB_DB::Session & | session, | |
bool | isLocked | |||
) |
Update the status of a resource in the database.
session | Database session to use. | |
isLocked | Flag if the resource is already locked in the database. |
OsbException | from lock(). | |
OsbException | from incObjVs(). |
friend class Device [friend] |
friend class OSB_DB::ResourceGw [friend] |
The gateway needs to set (and ev. read) private data members.
Definition at line 92 of file resource.h.
friend class PersResource [friend] |
Allow a personalized resource to update the status in the database.
Definition at line 98 of file resource.h.
Date OSB_LIB::Resource::assigned_ [private] |
Id<Device> OSB_LIB::Resource::deviceId_ [private] |
Id2<NetworkElement> OSB_LIB::Resource::neId_ [protected] |
Id of the network and network element.
The first part identifies the network of the resource, it is not set if the resource is not assigned to a specific network (note that this implies that the 2nd part is not set either).
The second part identifies the network element to which the resource belongs, it is not set if the resource is not assigned to a specific network element.
Definition at line 685 of file resource.h.
long OSB_LIB::Resource::objVs_ [private] |
Oid OSB_LIB::Resource::oid_ [private] |
Id<InventoryPool> OSB_LIB::Resource::poolId_ [private] |
bool OSB_LIB::Resource::prepaid_ [protected] |
Date OSB_LIB::Resource::quarantineEnd_ [private] |
End of quarantine period.
This member should be set if the resource status is rsQuarantine and Date::notSet() in all other cases.
Definition at line 657 of file resource.h.
Number OSB_LIB::Resource::resourceNumber_ [protected] |
Unique resource number.
The resource number must be unique within a network element, a network or world-wide.
Definition at line 673 of file resource.h.
Status OSB_LIB::Resource::status_ [private] |