OSB_LIB::PersProductItem Class Reference

Inheritance diagram for OSB_LIB::PersProductItem:

Inheritance graph
[legend]
Collaboration diagram for OSB_LIB::PersProductItem:

Collaboration graph
[legend]
List of all members.

Detailed Description

Personalized item of a product.

The class stores the personalization of a product item.

Remarks:
Copy constructor and assignment protected to prevent slicing. Virtual destructor by compiler. ToDo: rework assignment operator(s), how can we achieve "typesafe" assignments through pointers/references of the base class? (see Meyers, MeC++, item 33).

Definition at line 79 of file persitem.h.

Public Types

Public Member Functions

Read access to data members
Database operations
All database operations on PersProductItem do not commit or rollback the transactions.

Protected Member Functions

Base class support for database operations:

Protected Attributes

Private Member Functions

Database operations
Type specific database operations.
The functions are used for database operations specific for a given type of a personalized product item.

Remarks:
Derived classes that do not need specific database functions return true.
The implementation in derived classes should not commit or rollback the database transactions.

Private Attributes

Friends


Member Typedef Documentation

typedef std::auto_ptr<PersProductItem> OSB_LIB::PersProductItem::AutoPtr

Short-cut for an auto pointer.

For details see quality manual, implementation patterns: Virtual copy construction.

Reimplemented in OSB_LIB::PersAn, OSB_LIB::PersCallingCard, OSB_LIB::PersCredit, OSB_LIB::PersDevice, OSB_LIB::PersE164Item, OSB_LIB::PersIpGroup, OSB_LIB::PersUimCard, OSB_LIB::PersResource, OSB_LIB::PersService, OSB_LIB::PersTrunk, and OSB_LIB::PersTariffSystem.

Definition at line 108 of file persitem.h.

typedef Id<PersProductItem> OSB_LIB::PersProductItem::Oid

Typesave unique id, database link.

A pers. product item is uniquely identified by it's primary key in the database. Derived classes may reuse this object id as their own unique identifier or alternatively define a proprietary type.

Definition at line 100 of file persitem.h.


Constructor & Destructor Documentation

OSB_LIB::PersProductItem::PersProductItem ( const Oid oid = Oid()  )  [inline, explicit]

Default constructor with optional object id.

Definition at line 113 of file persitem.h.

OSB_LIB::PersProductItem::PersProductItem ( const PersProductItem rhs  )  [protected]

Copying for derived classes only.


Member Function Documentation

const DateTime& OSB_LIB::PersProductItem::assignDate (  )  const [inline]

Assignment date.

Definition at line 142 of file persitem.h.

References assignDate_.

virtual bool OSB_LIB::PersProductItem::canConfig (  )  const [pure virtual]

Personalize item can be config or not.

Returns:
True if this pers. item can be config.

Implemented in OSB_LIB::PersAn, OSB_LIB::PersCallingCard, OSB_LIB::PersCredit, OSB_LIB::PersE164Item, OSB_LIB::PersIpGroup, OSB_LIB::PersUimCard, OSB_LIB::PersService, OSB_LIB::PersTrunk, and OSB_LIB::PersTariffSystem.

virtual bool OSB_LIB::PersProductItem::changeAssignTs ( const OSB_DB::Session session,
const DateTime newTs 
) [private, virtual]

Change the assignment date to a pers. node.

Parameters:
session Database session to use.
newTs Date and time of the new assignment.
Exceptions:
OsbException if the new assignment period would overlap and create a conflict with other assignments, e.g., at any moment in time resources may be assigned to only one pers. product and node.
Returns:
true if the assignment timestamp was updated in the database, else false.
The function just wraps to changeAssignTsBase().

Note:
Derived class overwrite this member function as needed. For this they may make use of the member changeAssignTsBase(), see overwriteBase() for an example.

Reimplemented in OSB_LIB::PersDevice, and OSB_LIB::PersResource.

bool OSB_LIB::PersProductItem::changeAssignTsBase ( const OSB_DB::Session session,
const DateTime newTs 
) [protected]

Change the assignment date to a pers. node, support for derived classes.

Checks the correctness of the new assignment date and updates the datebase and object accordingly.

Parameters:
session Database session to use.
newTs Date and time of the new assignment.
Exceptions:
OsbException as specified for changeAssingTs(), see there, in particular if newTs is greater than deassignDate_.
Returns:
true if the assignment timestamp was updated in the database, else false.
Note:
Caller of the function are reminded that if the function returns true the new assignment date is set in the database and on the object itself.

PersProductItem::AutoPtr OSB_LIB::PersProductItem::changeConfig ( const OSB_DB::Session session  )  [private]

Change the config of a pers. product item.

The function is called when the status of the pers node is not created. It will change the configuration by creating a new pers. product item.
The function first calls deassignOld(...) to deassign the old one, if this is successful, calls insert(...) to create a new item instead.

Parameters:
session Database session to use.
Returns:
True if the configuration changed success.
Exceptions:
OsbException 
  • type specific exceptions out of updSpecific(...)
  • type specific exceptions out of insSpecific(...).

AutoPtr OSB_LIB::PersProductItem::clone (  )  const

Virtual copy construction.

For details see quality manual, implementation patterns.

Reimplemented in OSB_LIB::PersAn, OSB_LIB::PersCallingCard, OSB_LIB::PersCredit, OSB_LIB::PersDevice, OSB_LIB::PersE164Item, OSB_LIB::PersIpGroup, OSB_LIB::PersUimCard, OSB_LIB::PersResource, OSB_LIB::PersService, OSB_LIB::PersTrunk, and OSB_LIB::PersTariffSystem.

virtual PersProductItem* OSB_LIB::PersProductItem::clone_ (  )  const [protected, pure virtual]

Internal virtual copy constructor.

For details see quality manual, implementation patterns.

Implemented in OSB_LIB::PersAn, OSB_LIB::PersCallingCard, OSB_LIB::PersCredit, OSB_LIB::PersE164Item, OSB_LIB::PersIpGroup, OSB_LIB::PersUimCard, OSB_LIB::PersService, OSB_LIB::PersTrunk, and OSB_LIB::PersTariffSystem.

const DateTime& OSB_LIB::PersProductItem::deassignDate (  )  const [inline]

Deassignment date.

Definition at line 144 of file persitem.h.

References deassignDate_.

virtual bool OSB_LIB::PersProductItem::deassignOld ( const OSB_DB::Session session  )  [private, virtual]

Deassign the pers. product item in the database.

The function is called when the status of the pers node is not created.
It calls deassignOldBase() to set the deassign date of the base class.
Derived class may reimplement it if they have specific things to do.

Parameters:
session Database session to use.
Returns:
true in case of success, else false.

Reimplemented in OSB_LIB::PersDevice, and OSB_LIB::PersResource.

bool OSB_LIB::PersProductItem::deassignOldBase ( const OSB_DB::Session session  )  [protected]

Deassign the common pers. product item in the database.

The function is called when the status of the parent(pers node) is not created. See overwriteBase() for detail.

Parameters:
session Database session to use.
Returns:
True in case of success, else false.

virtual bool OSB_LIB::PersProductItem::delSpecific ( const OSB_DB::Session session  )  [private, pure virtual]

Delete type specific entries from the database.

Parameters:
session Database session to use.
Returns:
True if the item was found and deleted from the database, else false.

Implemented in OSB_LIB::PersAn, OSB_LIB::PersCallingCard, OSB_LIB::PersCredit, OSB_LIB::PersE164Item, OSB_LIB::PersIpGroup, OSB_LIB::PersUimCard, OSB_LIB::PersService, OSB_LIB::PersTrunk, and OSB_LIB::PersTariffSystem.

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

Insert a pers. product item to the database.

The function frist calls OSB_DB::PersProductGw::insPersProductItem() to store the base class data members. In the second step the virtual function insSpecific() is called to insert item type specific data.

Exception savety: The item's object id remains unchanged if the product item was not inserted into the database. This is the case when the function returns false or if an exception is thrown.

Parameters:
session Database session to use.
Returns:
True if the pers. item was inserted into the database.
Exceptions:
OsbException 

virtual bool OSB_LIB::PersProductItem::insSpecific ( const OSB_DB::Session session  )  [private, pure virtual]

Insert type specific members to the database.

Parameters:
session Database session to use.
Returns:
True if the item was inserted into the database.

Implemented in OSB_LIB::PersAn, OSB_LIB::PersCallingCard, OSB_LIB::PersCredit, OSB_LIB::PersE164Item, OSB_LIB::PersIpGroup, OSB_LIB::PersUimCard, OSB_LIB::PersService, OSB_LIB::PersTrunk, and OSB_LIB::PersTariffSystem.

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

Object id.

Definition at line 134 of file persitem.h.

References oid_.

PersProductItem& OSB_LIB::PersProductItem::operator= ( const PersProductItem rhs  )  [protected]

Assignment or derived classes only.

virtual bool OSB_LIB::PersProductItem::overwrite ( const OSB_DB::Session session  )  [private, virtual]

Overwrite a pers. product item in the database.

This function is called only when the status of the pers. node is created.
It first calls overwriteBase() to overwrite the members of the base class and, if this is successful, calls the virtual function updSpecific() to update item type specific data members.
Derived class may reimplement it if they have other different things to do.

Parameters:
session Database session to use.
Returns:
true in case of success, else false.

Reimplemented in OSB_LIB::PersDevice, and OSB_LIB::PersResource.

bool OSB_LIB::PersProductItem::overwriteBase ( const OSB_DB::Session session  )  [protected]

Overwrite common pers item data in the database.

This function is call only when the parent(pers node) is created.

Parameters:
session Database session to use.
Returns:
True in case of success, else false.
Derived classes typically use the function as follows if they want to reimplement virtual method overwrite(...):
          class PersResource : public PersProductItem {
              friend class Gateway;
          public:
              bool overwrite(const Session& session)
              {
                   bool rc = overwriteBase(session);
                   if (rc) {
                       Gateway gw(session);
                       rc = gw.overwritePersRes(*this);
                   }
                   return rc;
              }
          };

const Id2<PersProductNode>& OSB_LIB::PersProductItem::persNodeId (  )  const

Object id of the related personalized product node.

virtual std::string OSB_LIB::PersProductItem::personalization (  )  const [pure virtual]

Visual description of the personalization.

Provides the personalization of the product item as string. The content and format depend on the actual, real type of the personalized item.

Implemented in OSB_LIB::PersCredit, OSB_LIB::PersE164Item, OSB_LIB::PersUimCard, OSB_LIB::PersResource, OSB_LIB::PersService, and OSB_LIB::PersTariffSystem.

Id<PersProduct> OSB_LIB::PersProductItem::persProductId (  )  const

Object id of the personalized product.

Id<ProductNode> OSB_LIB::PersProductItem::productNodeId (  )  const

Get id of related product node.

bool OSB_LIB::PersProductItem::read ( const OSB_DB::Session session,
bool  baseRead = false 
)

Read a pers. product item from the database.

If the base part is not already read, the function uses OSB_DB::PersProductGw::fetch(const Session&, PersProductItem&) to read data members of the base class. Afterwards it calls the virtual function readSpecific() to retrieve item type specific data.

Remarks:
Some base class members are not read by the fetch function of the gateway class, e.g.:
  • Object id (oid_)
  • Object id of the pers. node (persNodeId_)
  • Object id of the related product item (itemId_). For details please refer to the documentation of the related fetch function.
Parameters:
session Database session to use.
baseRead Flag if the members of the base class have already been read (from PRODUCT_ITEM).
Returns:
True if the pers. item was read from the database.
Exceptions:
OsbException 

virtual bool OSB_LIB::PersProductItem::readSpecific ( const OSB_DB::Session session  )  [private, pure virtual]

Read type specific data members from database.

Parameters:
session Database session to use.
Returns:
True if the item was found and read from the database, else false.

Implemented in OSB_LIB::PersAn, OSB_LIB::PersCallingCard, OSB_LIB::PersCredit, OSB_LIB::PersE164Item, OSB_LIB::PersIpGroup, OSB_LIB::PersUimCard, OSB_LIB::PersService, OSB_LIB::PersTrunk, and OSB_LIB::PersTariffSystem.

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

Delete a pers. product item from the database.

The function first calls the virtual function delSpecific() to delete item type specific data. Afterwards OSB_DB::PersProductGw::delPersProductItem() is used to remove the personalized item from the database.

On successful deletion, the object id of the pers. product item is unset to indicate that it does no more exist in the database.

Parameters:
session Database session to use.
Returns:
True if the product item was found and deleted from the database.
Exceptions:
OsbException 

void OSB_LIB::PersProductItem::setConfig ( bool  canConfig  )  [protected]

Set the flag of config.

bool OSB_LIB::PersProductItem::update ( const OSB_DB::Session session,
long  objVs,
bool  uptodate 
)

Update a pers. product item in the database.

The function first calls OSB_DB::PersProductGw::updPersProductItem() to update the members of the base class and, if this is successful, calls the virtual function updSpecific() to update item type specific data members.

Remarks:
The gateway function does not update the id of the pers. product node in the database.
Parameters:
session Database session to use.
objVs Old Object version. It will be updated to the new one.
uptodate Return true if the object version is uptodate.
Returns:
True if the pers. item was found and updated in the database.
Exceptions:
OsbException 

virtual bool OSB_LIB::PersProductItem::updSpecific ( const OSB_DB::Session session  )  [private, pure virtual]

Update type specific members in the database.

Parameters:
session Database session to use.
Returns:
True if the item was found and updated in the database, else false.

Implemented in OSB_LIB::PersAn, OSB_LIB::PersCallingCard, OSB_LIB::PersCredit, OSB_LIB::PersE164Item, OSB_LIB::PersIpGroup, OSB_LIB::PersUimCard, OSB_LIB::PersService, OSB_LIB::PersTrunk, and OSB_LIB::PersTariffSystem.


Friends And Related Function Documentation

friend class OSB_DB::PersProductGw [friend]

The database gateway needs to set private members during I/O operations.

Definition at line 84 of file persitem.h.

friend class PersProductNode [friend]

Allow to set the pers. node object id during assignment and to change the assignment date.

Definition at line 89 of file persitem.h.


Member Data Documentation

DateTime OSB_LIB::PersProductItem::assignDate_ [private]

Date and time when the pers. product item was assigned to the personalized product.

Definition at line 509 of file persitem.h.

Referenced by assignDate().

bool OSB_LIB::PersProductItem::canConfig_ [protected]

Flag for whether this object can be configured or not.

Definition at line 494 of file persitem.h.

DateTime OSB_LIB::PersProductItem::deassignDate_ [private]

Date and time when the personalized product item was deassigned or deactivated the last time.

If the deassignment date is not set (NULL in the database) the member is DateTime::notSet().

Definition at line 517 of file persitem.h.

Referenced by deassignDate().

ProductItem::Oid OSB_LIB::PersProductItem::itemId_ [private]

Object id of the underlying product item.

Definition at line 504 of file persitem.h.

Oid OSB_LIB::PersProductItem::oid_ [private]

Object id, database link.

Definition at line 497 of file persitem.h.

Referenced by oid().

Id2<PersProductNode> OSB_LIB::PersProductItem::persNodeId_ [private]

Object id of the personalized product node to which the item belongs.

Definition at line 502 of file persitem.h.


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