PersProduct models a product that is assigned to a contract.
Definition at line 513 of file persproduct.h.
typedef Id<Contract> OSB_LIB::PersProduct::ContractId [private] |
typedef Id<PersProduct> OSB_LIB::PersProduct::Oid |
typedef Id<Product> OSB_LIB::PersProduct::ProductId [private] |
typedef Id<Associate> OSB_LIB::PersProduct::UserId |
OSB_LIB::PersProduct::PersProduct | ( | const Oid & | oid | ) | [inline] |
OSB_LIB::PersProduct::PersProduct | ( | const Oid & | oid, | |
const ProductId & | productId, | |||
const ContractId & | contractId, | |||
const UserId & | userId | |||
) | [inline] |
Constructor with subscribed product, contract and user.
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.
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.
session | Database session to use. | |
apPpi | Auto pointer of the pers. item to add. | |
pnId | Id of the related product node. |
OsbException |
|
bool OSB_LIB::PersProduct::addPersNode | ( | OSB_DB::Session & | session, | |
const ProductNode::Oid & | pnId | |||
) |
Add a node to the personalized product.
session | Database session to use, transactions are commited or rolled back. | |
pnId | The id of the product node to add. |
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.
session | Database session to use. | |
change | Status change to process, it contains the old and new effective status. | |
errors | Gets errors and warnings. |
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.
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_'.
OsbException |
|
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.
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. |
bool OSB_LIB::PersProduct::changeStatus | ( | const OSB_DB::Session & | session, | |
StatusChange & | change, | |||
OsbErrors & | errors | |||
) | [private] |
Change the effective status of the pers. product.
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. |
Called only by RequestHandler or Contract.
ObjectStatus OSB_LIB::PersProduct::checkObjVs | ( | const OSB_DB::Session & | session | ) | const |
Check the current object version.
session | Database session to use. |
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.
product | Reference to the product. | |
pnId | Id of the product node to check. |
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] |
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.
session | Database session to use. | |
ppiId | Object id of pers item to remove. | |
pnId | Product node this pers item belongs to. |
OsbException |
|
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.
session | Database session to use. | |
oid | Object id of the product node. |
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_.
session | Database session to use. | |
oid | Object id of the product node. |
OsbException |
|
const Status & OSB_LIB::PersProduct::effStatus | ( | ) | const [inline] |
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.
pnId | Id of product node to search for. |
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)'.
persParts | Pers part list. | |
oid | Product node to search for. |
const PersPart* OSB_LIB::PersProduct::findPersPart | ( | const ProductNode::Oid & | pnId | ) | const |
find pers part base on a given product node id.
pnId | Oid of the product node. |
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.
dt | Time stamp, default is current date. |
const PersProductNode& OSB_LIB::PersProduct::getPersNode | ( | const ProductNode::Oid & | pnId | ) | const |
Find a personalized product node by id.
pnId | Id of product node to search for. |
OsbException |
|
const PersPart& OSB_LIB::PersProduct::getPersPart | ( | const ProductNode::Oid & | pnId | ) | const |
Find the pers part based on the given oid.
pnId | Oid of the product node. |
OsbException |
|
const Product& OSB_LIB::PersProduct::getProduct | ( | ) | const |
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_.
dt | Time stamp, default is current date. |
static void OSB_LIB::PersProduct::handleObjectStatus | ( | ObjectStatus | os, | |
const PersProduct::Oid & | id | |||
) | [static, private] |
Evalute the object status of a pers. product.
os | Object status to evaluate. | |
id | The id of the pers. product for which os is valid. |
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.
session | Database session to use. |
OsbException | (internal error) if the update of the object version fails in the database. |
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.
session | database session. |
OsbException |
|
void OSB_LIB::PersProduct::lock | ( | const OSB_DB::Session & | session, | |
bool | noWait | |||
) | const [private] |
Lock the pers. product in the database.
session | Database session to use. | |
noWait | Don't wait for database locks? |
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.
session | Database session to use. | |
id | The object id of the pers. product to lock. | |
noWait | Don't wait for database locks? |
OsbException | from handleObjectStatus(), (ObjectModified is not applicable). |
long OSB_LIB::PersProduct::objVs | ( | ) | const [inline] |
const PersProduct::Oid & OSB_LIB::PersProduct::oid | ( | ) | const [inline] |
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.
product | Reference to the product. | |
pnId | Id of the product node to check. |
OsbException |
|
PersProductNode* OSB_LIB::PersProduct::persNode | ( | const ProductNode::Oid & | pnId | ) |
Find a personalized product node by id.
pnId | Id of product node to search for. |
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.
pnId | Oid of the product node. |
const PersParts & OSB_LIB::PersProduct::persParts | ( | ) | const [inline] |
const Status & OSB_LIB::PersProduct::prefStatus | ( | ) | const [inline] |
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] |
bool OSB_LIB::PersProduct::read | ( | const OSB_DB::Session & | session | ) |
Read the pers. product from the database.
session | Database session to use. |
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.
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.
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.
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.
session | database session. |
OsbException |
|
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.
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? |
OsbException | if the pers. product was modified in the database. | |
OsbException | if the pers. product is locked and noWait is true. |
bool OSB_LIB::PersProduct::requestStatus | ( | const OSB_DB::Session & | session, | |
StatusRequest & | request, | |||
OsbErrors & | errors, | |||
bool | noWait | |||
) |
Set the preferred status of the pers. product.
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? |
OsbException | if the pers. product was modified in the database. | |
OsbException | if the pers. product is locked and noWait is true. |
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.
dt | Date and time to search for. | |
persParts | List of product nodes attached to the parent. | |
oid | Gets the id of the tariff system. |
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.
pnId | The object id of the product node. | |
add | Signal for add(true)/remove(false) a pers node. |
OsbException |
|
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.
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. |
OsbError OSB_LIB::PersProduct::setPrefStatus | ( | const OSB_DB::Session & | session, | |
const StatusRequest & | request | |||
) | [private] |
Set the preferred status of the pers. product.
session | Database session to use. | |
request | Status request that triggered the change of the preferred status. |
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.
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.
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.
pnId | Id of product node to search for. |
const StatusChanges & OSB_LIB::PersProduct::statusChanges | ( | ) | const [inline] |
const StatusRequests & OSB_LIB::PersProduct::statusRequests | ( | ) | const [inline] |
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.
session | Database session to use. | |
nodeId | Id of the product node to subscribe. |
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.
session | Database session to use. | |
ppi | Pers product item to update. | |
pnId | Product node this pers item belongs to. |
OsbException |
|
void OSB_LIB::PersProduct::updProductUser | ( | OSB_DB::Session & | session | ) |
Update the user of the pers. product to the database.
session | Database session to use. |
OsbException | from lock(const OSB_DB::Session&, bool) const, see there. |
const PersProduct::UserId & OSB_LIB::PersProduct::userId | ( | ) | const [inline] |
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] |
friend class RequestHandler [friend] |
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] |
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().
Object version. Object version.
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().
List of personalized product nodes.
Definition at line 1402 of file persproduct.h.
Referenced by persNodes().
PersParts OSB_LIB::PersProduct::persParts_ [private] |
Status OSB_LIB::PersProduct::prefStatus_ [private] |
The preferred status of the personalized product.
Definition at line 1387 of file persproduct.h.
Referenced by prefStatus().
Date when the preferre status was requested.
Definition at line 1389 of file persproduct.h.
Referenced by prefStatusDate().
ProductId OSB_LIB::PersProduct::productId_ [private] |
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] |