OSB_LIB::PersProduct Class Reference

Collaboration diagram for OSB_LIB::PersProduct:

Collaboration graph
[legend]
List of all members.

Detailed Description

Contracted, personalized product.

PersProduct models a product that is assigned to a contract.

Definition at line 513 of file persproduct.h.

Locking and object version maintenance

Public Types

Public Member Functions

Read access to data members
Modify data members
Maintain personalized product node
Pers part
Status changes:
Maintain personalized product item
Status changes of pers. nodes:

Public Attributes

Private Types

Private Member Functions

Apply status requests and changes:

Private Attributes

Friends


Member Typedef Documentation

typedef Id<Contract> OSB_LIB::PersProduct::ContractId [private]

Internal type of identify the related contract.

Definition at line 529 of file persproduct.h.

typedef Id<PersProduct> OSB_LIB::PersProduct::Oid

Typesave unique object identification, database link.

Definition at line 533 of file persproduct.h.

typedef Id<Product> OSB_LIB::PersProduct::ProductId [private]

Internal type to identify the related product.

Definition at line 527 of file persproduct.h.

typedef Id<Associate> OSB_LIB::PersProduct::UserId

Type to identify a product users.

Definition at line 535 of file persproduct.h.


Constructor & Destructor Documentation

OSB_LIB::PersProduct::PersProduct ( const Oid oid  )  [inline]

Constructor with object id.

Definition at line 539 of file persproduct.h.

OSB_LIB::PersProduct::PersProduct ( const Oid oid,
const ProductId productId,
const ContractId contractId,
const UserId userId 
) [inline]

Constructor with subscribed product, contract and user.

Parameters:
oid Unique object identifier.
productId Product of the personalized product.
contractId Contract of the personalized product.
userId User of the personalized product.

Definition at line 553 of file persproduct.h.

OSB_LIB::PersProduct::PersProduct ( const PersProduct rhs  ) 

Copy constructor.


Member Function Documentation

PersProductItem::Oid OSB_LIB::PersProduct::addPersItem ( OSB_DB::Session session,
PersProductItem::AutoPtr  apPpi,
const ProductNode::Oid pnId 
)

Add an item to the personalized product node.

Add a personalized item entry to the database. Also add it to the persParts_ list. Pers. item id and pers. node id of the item will be set and session will be commit if successful.
The action is not allowed when the node is deactivated.

Parameters:
session Database session to use.
apPpi Auto pointer of the pers. item to add.
pnId Id of the related product node.
Returns:
The object id of the added pers. item,
It is not set if apPpi can not be added.
Exceptions:
OsbException 

bool OSB_LIB::PersProduct::addPersNode ( OSB_DB::Session session,
const ProductNode::Oid pnId 
)

Add a node to the personalized product.

Parameters:
session Database session to use,
transactions are commited or rolled back.
pnId The id of the product node to add.
Returns:
true for success.
Exceptions:
OsbException from lock(const OSB_DB::Session&, bool) const, see there.
OsbException if the pers. product status is deactivated.
OsbException if the node does not belong the subscribed product.

bool OSB_LIB::PersProduct::applyChange ( const OSB_DB::Session session,
const StatusChange change,
OsbErrors errors 
) [private]

Apply a change of the effective status to all parts.

Parameters:
session Database session to use.
change Status change to process, it contains the old and new effective status.
errors Gets errors and warnings.
Returns:
true if no error occurred during processing, else false.
Note:
Strictly private.

void OSB_LIB::PersProduct::buildPersParts ( PersParts partList,
const ProductNodeParts parts,
bool  parentSubscribed 
) [private]

Build a tree of pers parts for a personalized product.

This function is called by the public member function buildPersParts(). For each pers part in persParts_ that is available for the personalized product the function calls itself recursively.

Parameters:
partList List to add the pers parts.
parts List of product nodes attached to the parent.
parentSubscribed Flag if the parent is subscribed.

bool OSB_LIB::PersProduct::buildPersParts (  ) 

Build a tree of pers parts for a personalized product.

Before calling this function, the personalized nodes of the personzalized product and product catalogue must have been loaded.
Each pers part is added to `persParts_'.

Returns:
true in case of success, currently no other value.
Exceptions:
OsbException 
  • if the product of the personalized product is not found in the product catalogue
  • as specified by the gateway class.

bool OSB_LIB::PersProduct::changeStatus ( const OSB_DB::Session session,
const ProductNode::Oid pnId,
StatusChange change,
OsbErrors errors 
) [private]

Change the effective status of a pers. node.

Parameters:
session Database session to use.
pnId The id of the pers. node to change.
change Copy of the status change to process, it contains the max. allowed effective status.
errors Gets errors and warnings.
Returns:
true if no error occurred during processing, else false.
Note:
Even if the function returns true, errors still may contain warnings.

bool OSB_LIB::PersProduct::changeStatus ( const OSB_DB::Session session,
StatusChange change,
OsbErrors errors 
) [private]

Change the effective status of the pers. product.

Parameters:
session Database session to use.
change Copy of the status change to process, it contains the max. allowed effective status.
errors Gets errors and warnings.
Returns:
true if no error occurred during processing, else false.
Note:
Even if the function returns true, errors still may contain warnings.

Called only by RequestHandler or Contract.

ObjectStatus OSB_LIB::PersProduct::checkObjVs ( const OSB_DB::Session session  )  const

Check the current object version.

Parameters:
session Database session to use.
Returns:
The object status of the pers. product.

bool OSB_LIB::PersProduct::childSubscribed ( const Product product,
const ProductNode::Oid pnId 
) const [private]

Check if any descendants of a product part are subscribed by the pers. product.

Parameters:
product Reference to the product.
pnId Id of the product node to check.
Returns:
false if no direct or indirect children of the product part pnId are subscribed,
else true.
Exceptions:
OsbException if a descendant of the product part is subscribed.

void OSB_LIB::PersProduct::constructFrom ( const PersProduct rhs  )  [private]

Support for copy construction and assignment.

const PersProduct::ContractId & OSB_LIB::PersProduct::contractId (  )  const [inline]

Get contract id.

Definition at line 1449 of file persproduct.h.

References contractId_.

const DateTime & OSB_LIB::PersProduct::created (  )  const [inline]

Get the creating date of the personalized product.

Definition at line 1459 of file persproduct.h.

References created_.

bool OSB_LIB::PersProduct::delPersItem ( OSB_DB::Session session,
const PersProductItem::Oid ppiId,
const ProductNode::Oid pnId 
)

Remove a personalized product item.

Remove pers item and the pers node as well if the product node is mandatory. Else remove pers item only.
This method will remove the entry from database, also will maintain the relevant list.
Session will be commited if success.

Parameters:
session Database session to use.
ppiId Object id of pers item to remove.
pnId Product node this pers item belongs to.
Returns:
true for the pers node still exists,
false for removes the pers node also.
Exceptions:
OsbException 
  • object version of pers product conflict
  • pers node is not found in the list
  • as specified by PersProductNode.delPersItem
  • as specified by delPersNode
  • as specified by the gateway class (see there).

bool OSB_LIB::PersProduct::delPersNode ( OSB_DB::Session session,
const ProductNode::Oid oid 
)

Remove a node from the personalized product.

Delete the entry of pers product node from database, also delete it from the persNodes_ list. Session will be committed if successful.

Parameters:
session Database session to use.
oid Object id of the product node.
Returns:
true for success.
Exceptions:
OsbException from lock(const OSB_DB::Session&, bool) const, see there.
OsbException if the pers. node does not exist.
OsbException if the status of the pers. node is not created.

bool OSB_LIB::PersProduct::delPpn ( const OSB_DB::Session session,
const ProductNode::Oid oid 
) [private]

Remove a node from the personalized product.

Delete the entry of pers product node from database, also delete it from persNodes_.

Parameters:
session Database session to use.
oid Object id of the product node.
Returns:
true for success.
Exceptions:
OsbException 
  • object version of pers prduct conflict
  • status of this pers product node is not in created
  • this pers product node not found in list.

const Status & OSB_LIB::PersProduct::effStatus (  )  const [inline]

Get effective status.

Definition at line 1464 of file persproduct.h.

References effStatus_.

const DateTime & OSB_LIB::PersProduct::effStatusDate (  )  const [inline]

Get the date when effective status was (last) set.

Definition at line 1469 of file persproduct.h.

References effStatusDate_.

const PersProductNode* OSB_LIB::PersProduct::findPersNode ( const ProductNode::Oid pnId  )  const

Find a personalized product node by id.

Parameters:
pnId Id of product node to search for.
Returns:
Pointer to personalized product node or
NULL if no personalized node exists.

const PersPart* OSB_LIB::PersProduct::findPersPart ( const PersParts persParts,
const ProductNode::Oid oid 
) const [private]

find pers part in list of pers parts.

This function is called by the public member function `findPersPart(oid)'.

Parameters:
persParts Pers part list.
oid Product node to search for.
Returns:
Pointer to the found pers part,
NULL pointer if pers part can not be found.

const PersPart* OSB_LIB::PersProduct::findPersPart ( const ProductNode::Oid pnId  )  const

find pers part base on a given product node id.

Parameters:
pnId Oid of the product node.
Returns:
Pointer to the found pers part,
NULL pointer if pers part can not be found.

PersCredit* OSB_LIB::PersProduct::getCredit ( const DateTime dt = DateTime::now()  ) 

Get the credit of this personalized product.

The function gets the pointer to the credit of this personalized product. User does not need to delete the pointer.

Parameters:
dt Time stamp, default is current date.
Returns:
Pointer to credit in case of success,
Null for not found.

const PersProductNode& OSB_LIB::PersProduct::getPersNode ( const ProductNode::Oid pnId  )  const

Find a personalized product node by id.

Parameters:
pnId Id of product node to search for.
Returns:
Reference to the found personalized product node.
Exceptions:
OsbException 
  • pers node not found.

const PersPart& OSB_LIB::PersProduct::getPersPart ( const ProductNode::Oid pnId  )  const

Find the pers part based on the given oid.

Parameters:
pnId Oid of the product node.
Returns:
Reference to the found pers part.
Exceptions:
OsbException 
  • if pers part is not found.

const Product& OSB_LIB::PersProduct::getProduct (  )  const

Get the related product.

Exceptions:
OsbException if the product can not be found.

Id<TariffSystem> OSB_LIB::PersProduct::getTariffSystem ( const DateTime dt = DateTime::now()  )  const

Get the oid of tariff system of this personalized product.

This method will search the persParts_ if it is built. Otherwise it will search the persNode_.

Parameters:
dt Time stamp, default is current date.
Returns:
Oid of tariff system,
id will be ID_NOT_SET if not found.

static void OSB_LIB::PersProduct::handleObjectStatus ( ObjectStatus  os,
const PersProduct::Oid id 
) [static, private]

Evalute the object status of a pers. product.

Parameters:
os Object status to evaluate.
id The id of the pers. product for which os is valid.
Exceptions:
ObjectDeleted 
ObjectModified 
ObjectBusy if noWait is true and the pers. product is locked by another database session.

void OSB_LIB::PersProduct::incObjVs ( const OSB_DB::Session session  )  [private]

Increment the object version by 1.

Parameters:
session Database session to use.
Exceptions:
OsbException (internal error) if the update of the object version fails in the database.
The function should be used only after a successful call of a lock() function.

Remarks:
The object version has to be changed whenever there was a change in the pers. product itself or one of its parts.

bool OSB_LIB::PersProduct::insert ( const OSB_DB::Session session  )  [private]

Insert a pers. product to database.

This method will only be called by contract.
The object id will be set if success.

Parameters:
session database session.
Returns:
true if success else false.
Exceptions:
OsbException 
  • as specified by the gateway class.

void OSB_LIB::PersProduct::lock ( const OSB_DB::Session session,
bool  noWait 
) const [private]

Lock the pers. product in the database.

Parameters:
session Database session to use.
noWait Don't wait for database locks?
Exceptions:
OsbException from handleObjectStatus().

static void OSB_LIB::PersProduct::lock ( const OSB_DB::Session session,
const PersProduct::Oid id,
bool  noWait 
) [static, private]

Lock a pers. product in the database.

Parameters:
session Database session to use.
id The object id of the pers. product to lock.
noWait Don't wait for database locks?
Exceptions:
OsbException from handleObjectStatus(), (ObjectModified is not applicable).

long OSB_LIB::PersProduct::objVs (  )  const [inline]

Get object version.

Definition at line 1439 of file persproduct.h.

References objVs_.

const PersProduct::Oid & OSB_LIB::PersProduct::oid (  )  const [inline]

Get object id.

Definition at line 1434 of file persproduct.h.

References oid_.

PersProduct& OSB_LIB::PersProduct::operator= ( const PersProduct rhs  ) 

Assignment operator.

bool OSB_LIB::PersProduct::parentNodeAvail ( const Product product,
const ProductNode::Oid pnId 
) const [private]

Check if the parent of a product part is available for the pers. product.

Parameters:
product Reference to the product.
pnId Id of the product node to check.
Returns:
true if the product node is available or if it has no parent itself,
else false.
Exceptions:
OsbException 
  • no parent available.

PersProductNode* OSB_LIB::PersProduct::persNode ( const ProductNode::Oid pnId  ) 

Find a personalized product node by id.

Parameters:
pnId Id of product node to search for.
Returns:
Pointer to personalized product node or
NULL if no personalized node exists.

const PersProductNodes & OSB_LIB::PersProduct::persNodes (  )  const [inline]

Read access to personalized product nodes.

Definition at line 1494 of file persproduct.h.

References persNodes_.

PersPart* OSB_LIB::PersProduct::persPart ( const ProductNode::Oid pnId  ) 

Get a writable pers part base on a given product node id.

Parameters:
pnId Oid of the product node.
Returns:
Pointer to the found pers part,
NULL pointer if pers part can not be found.

const PersParts & OSB_LIB::PersProduct::persParts (  )  const [inline]

Read access to pers parts.

Definition at line 1499 of file persproduct.h.

References persParts_.

const Status & OSB_LIB::PersProduct::prefStatus (  )  const [inline]

Get prefer status.

Definition at line 1474 of file persproduct.h.

References prefStatus_.

const DateTime & OSB_LIB::PersProduct::prefStatusDate (  )  const [inline]

Get the date when the perferred status was (first) requested.

Definition at line 1479 of file persproduct.h.

References prefStatusDate_.

const PersProduct::ProductId & OSB_LIB::PersProduct::productId (  )  const [inline]

Get product id.

Definition at line 1444 of file persproduct.h.

References productId_.

bool OSB_LIB::PersProduct::read ( const OSB_DB::Session session  ) 

Read the pers. product from the database.

Parameters:
session Database session to use.
Returns:
true if successul, else false.
Reads the pers. product, its pers. nodes and their pers. items.

Note:
Previously it was possible to exclude the pers. items from reading. This caused problems in the status request handler.
As of Apr-06 it seems that only billing may not want the items, but what about E.164 number (and the like) then?
If we have performance problems in billing because the items are now always read, introduce a sticky flag.

void OSB_LIB::PersProduct::readItems ( const OSB_DB::Session session  )  [private]

Read all persproduct items for the persproduct from the database.

Note that this function only can be called once. Otherwise the pointer to the item may be changed.

Parameters:
session Database session to use.

void OSB_LIB::PersProduct::readStatusChanges ( const OSB_DB::Session session,
const Period period 
)

Read status changes for a time period.

The function gets the status changes for a personalized product and its personalized nodes.

Parameters:
session Database session to use.
period Time period covered by the status requests,
the upper boundary is not included.

void OSB_LIB::PersProduct::readStatusRequests ( const OSB_DB::Session session,
const Period period 
)

Get status requests for a period of time.

The function reads the status requests for a personalized product and its personalized nodes.

Parameters:
session Database session to use.
period Time period covered by the status requests,
the upper boundary is not included.

bool OSB_LIB::PersProduct::remove ( const OSB_DB::Session session  )  [private]

Remove a pers product from database.

This method will only be called by contract.

Parameters:
session database session.
Returns:
true if success else false.
Exceptions:
OsbException 
  • as specified by the gateway class.

bool OSB_LIB::PersProduct::requestStatus ( const OSB_DB::Session session,
const ProductNode::Oid pnId,
StatusRequest request,
OsbErrors errors,
bool  noWait 
)

Change the preferred status of a pers. node.

Parameters:
session Database session to use.
pnId Id of the pers. node to change.
request Preferred status to set, see below.
errors Get warnings and errors during processing.
noWait Don't wait for database locks?
Returns:
true if the request is accepted, else false.
Exceptions:
OsbException if the pers. product was modified in the database.
OsbException if the pers. product is locked and noWait is true.
When calling the function, status must have the requested status set; if the status date is not set the system date is used.
If successful the request id, the requested date/time and the entry timestamp will be set.

bool OSB_LIB::PersProduct::requestStatus ( const OSB_DB::Session session,
StatusRequest request,
OsbErrors errors,
bool  noWait 
)

Set the preferred status of the pers. product.

Parameters:
session Database session to use.
request Preferred status to set, see below.
errors Get warnings and errors during processing.
noWait Don't wait for database locks?
Returns:
true if the request is accepted, else false.
Exceptions:
OsbException if the pers. product was modified in the database.
OsbException if the pers. product is locked and noWait is true.
When calling the function, status must have the requested status set; if the status date is not set the system date is used.
If successful the request id, the requested date/time and the entry timestamp will be set.

bool OSB_LIB::PersProduct::schTsInPersParts ( const DateTime dt,
const PersParts persParts,
Id< TariffSystem > &  oid 
) const [private]

Search tariff system of this pers product in pers part.

Parameters:
dt Date and time to search for.
persParts List of product nodes attached to the parent.
oid Gets the id of the tariff system.
Returns:
true if the tariff system valid at dt can be determined, else false.

void OSB_LIB::PersProduct::setNodePointers ( PersParts parts  )  [private]

Adjust pers. node pointers in pers. parts.

The function set the pers. node pointer in persParts_ and recursively calls itself for the parts' parts.

void OSB_LIB::PersProduct::setNodePointers (  )  [private]

Adjust the pers. node pointers.

Sets the pointers to the pers. nodes in persParts_.

void OSB_LIB::PersProduct::setPersPart ( const ProductNode::Oid pnId,
bool  add 
) [private]

Set a pers part.

Set the pers node pointer of pers part. Point to the newly pers node if add a new pers node. Point to zero if remove a pers node.

Parameters:
pnId The object id of the product node.
add Signal for add(true)/remove(false) a pers node.
Exceptions:
OsbException 
  • the pers part for this node not found.

OsbError OSB_LIB::PersProduct::setPrefStatus ( const OSB_DB::Session session,
const ProductNode::Oid pnId,
const StatusRequest request 
) [private]

Set the preferred status of a pers. node.

Parameters:
session Database session to use.
pnId The id of the pers. node to change.
request Status request that triggered the change of the preferred status.
Returns:
The first encountered error.
Note:
Called by RequestHandler only.

OsbError OSB_LIB::PersProduct::setPrefStatus ( const OSB_DB::Session session,
const StatusRequest request 
) [private]

Set the preferred status of the pers. product.

Parameters:
session Database session to use.
request Status request that triggered the change of the preferred status.
Returns:
The first encountered error.
Note:
Called by RequestHandler only.

void OSB_LIB::PersProduct::setUserId ( const UserId userId  ) 

Set product user id.

void OSB_LIB::PersProduct::sortPersPartByName ( PersParts persParts,
bool  desc = false 
)

Sort pers parts by name.

Parameters:
persParts Pers parts.
desc Flag to sort in descending (true) or ascending (false) order.

void OSB_LIB::PersProduct::sortPersPartByName ( bool  desc = false  ) 

Sort pers parts by name.

Parameters:
desc Flag to sort in descending (true) or ascending (false) order.

const StatusChanges* OSB_LIB::PersProduct::statusChanges ( const ProductNode::Oid pnId,
const StatusChanges pParentChanges,
const PersParts persParts 
) const [private]

Read access to status changes for a given product node.

const StatusChanges& OSB_LIB::PersProduct::statusChanges ( const ProductNode::Oid pnId  )  const

Read access to status changes for a given product node.

Before calling this function, the status changes of the personzalized product and of its children must have been loaded.

Parameters:
pnId Id of product node to search for.
Returns:
Reference to the found status changes.

const StatusChanges & OSB_LIB::PersProduct::statusChanges (  )  const [inline]

Read access to status changes.

Definition at line 1484 of file persproduct.h.

References chngs_.

const StatusRequests & OSB_LIB::PersProduct::statusRequests (  )  const [inline]

List of status requests.

Definition at line 1489 of file persproduct.h.

References reqs_.

bool OSB_LIB::PersProduct::subscribe ( OSB_DB::Session session,
const ProductNode::Oid nodeId 
)

Subscribe the product node.

Subscribe this product node and all its mandatory children.

Parameters:
session Database session to use.
nodeId Id of the product node to subscribe.
Returns:
true if product node was sucessfully subscribed, else false.
Exceptions:
OsbException if the pers. part for nodeId does not exist.

PersProductItem::Oid OSB_LIB::PersProduct::updPersItem ( OSB_DB::Session session,
PersProductItem ppi,
const ProductNode::Oid pnId 
)

Update a pers product item.

It will update a pers product item if the status of the node is created. Otherwise the old pers product item will be deassigned, a new pers product item create instead.
Session will be commited if success.

Parameters:
session Database session to use.
ppi Pers product item to update.
pnId Product node this pers item belongs to.
Returns:
The object id of the newly added pers. item,
It is not set if apPpi can not be added.
Exceptions:
OsbException 

void OSB_LIB::PersProduct::updProductUser ( OSB_DB::Session session  ) 

Update the user of the pers. product to the database.

Parameters:
session Database session to use.
Exceptions:
OsbException from lock(const OSB_DB::Session&, bool) const, see there.

const PersProduct::UserId & OSB_LIB::PersProduct::userId (  )  const [inline]

Get product user id.

Definition at line 1454 of file persproduct.h.

References userId_.


Friends And Related Function Documentation

friend class Contract [friend]

Allow to insert or remove pers. product and to call changeStatus().

Definition at line 520 of file persproduct.h.

friend class OSB_DB::PersProductGw [friend]

Allow to set the data members.

Definition at line 515 of file persproduct.h.

friend class RequestHandler [friend]

Allow to call setPrefStatus() and changeStatus().

Definition at line 524 of file persproduct.h.


Member Data Documentation

StatusChanges OSB_LIB::PersProduct::chngs_ [private]

List of status changes.

Definition at line 1397 of file persproduct.h.

Referenced by statusChanges().

ContractId OSB_LIB::PersProduct::contractId_ [private]

Id of the contract.

Definition at line 1380 of file persproduct.h.

Referenced by contractId().

DateTime OSB_LIB::PersProduct::created_ [private]

Creation date of the personalized product.

Definition at line 1385 of file persproduct.h.

Referenced by created().

Status OSB_LIB::PersProduct::effStatus_ [private]

Effective status of the personalized product.

Definition at line 1392 of file persproduct.h.

Referenced by effStatus().

DateTime OSB_LIB::PersProduct::effStatusDate_ [private]

Date when the effective status was set.

Definition at line 1394 of file persproduct.h.

Referenced by effStatusDate().

long OSB_LIB::PersProduct::objVs_

Object version. Object version.

Remarks:
This member is public because PersCredit::deduct must be called with the modifyable object version of the personalized product.

Definition at line 1375 of file persproduct.h.

Referenced by objVs().

Oid OSB_LIB::PersProduct::oid_ [private]

Unique object id, database link.

Definition at line 1365 of file persproduct.h.

Referenced by oid().

PersProductNodes OSB_LIB::PersProduct::persNodes_ [private]

List of personalized product nodes.

Definition at line 1402 of file persproduct.h.

Referenced by persNodes().

PersParts OSB_LIB::PersProduct::persParts_ [private]

List of pers parts.

Definition at line 1404 of file persproduct.h.

Referenced by persParts().

Status OSB_LIB::PersProduct::prefStatus_ [private]

The preferred status of the personalized product.

Definition at line 1387 of file persproduct.h.

Referenced by prefStatus().

DateTime OSB_LIB::PersProduct::prefStatusDate_ [private]

Date when the preferre status was requested.

Definition at line 1389 of file persproduct.h.

Referenced by prefStatusDate().

ProductId OSB_LIB::PersProduct::productId_ [private]

Id of contract product.

Definition at line 1378 of file persproduct.h.

Referenced by productId().

StatusRequests OSB_LIB::PersProduct::reqs_ [private]

List of status requests.

Definition at line 1399 of file persproduct.h.

Referenced by statusRequests().

UserId OSB_LIB::PersProduct::userId_ [private]

Id of the product user.

Definition at line 1382 of file persproduct.h.

Referenced by userId().


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