OSB_LIB::Device Class Reference

Inheritance diagram for OSB_LIB::Device:

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

Collaboration graph
[legend]
List of all members.

Detailed Description

Devices: equipment and articles with a serial number.

Definition at line 69 of file device.h.

Public Types

Public Member Functions

Static Public Member Functions

Protected Member Functions

Static Protected Member Functions

Private Member Functions

Private Attributes

Friends


Member Typedef Documentation

typedef Id<Device> OSB_LIB::Device::Oid

Type-safe object identification.

Definition at line 78 of file device.h.

typedef Id<InventoryPool> OSB_LIB::Device::PoolId

Short-hand for an inventory pool.

Definition at line 80 of file device.h.

typedef TypeId<Device> OSB_LIB::Device::Type

The device type.

Definition at line 76 of file device.h.


Member Enumeration Documentation

enum OSB_LIB::Device::Status

The status of device.

Customer care and other on-line application need to assign a device to a pers. product if it contains a DeviceItem.
A device is available if its device status is dvcAvailable.

Remarks:
Additional device status may be added in future to support the purchase order process of devices.
Enumerator:
dvcUnknown  Unknown device status.
dvcCreated  Device is created and reserved,
this is the default status.
dvcAvailable  Device is available.
dvcAssigned  Device is assigned.
dvcDeactivated  Device is deactivated and can not be used again.

Definition at line 93 of file device.h.


Constructor & Destructor Documentation

OSB_LIB::Device::Device ( const Oid oid = Oid()  )  [explicit]

Constructor with optional object id.

virtual OSB_LIB::Device::~Device (  )  [virtual]

Empty virtual destructor.

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

Copying for derived classes only.


Member Function Documentation

static void OSB_LIB::Device::handleObjectStatus ( ObjectStatus  os,
const Oid id 
) [static, protected]

Evalute the object status of a device.

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

void OSB_LIB::Device::incObjVs ( const OSB_DB::Session session  )  [protected]

Increment the object version by 1.

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

void OSB_LIB::Device::insertBase ( const OSB_DB::Session session  )  [protected]

Save device data to the database.

Parameters:
session Database session to use.
Exceptions:
OsbException if the insert fails.

void OSB_LIB::Device::lock ( const OSB_DB::Session session,
bool  noWait 
) const

Lock a device in the database.

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

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

Lock a device in the database.

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

Oid OSB_LIB::Device::oid (  )  const

Get the object id.

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

Assignment for derived classes only.

PoolId OSB_LIB::Device::poolId (  )  const

Get the inventory pool id of the device.

It may not be set.

virtual void OSB_LIB::Device::read ( const OSB_DB::Session session  )  [pure virtual]

@ name Database operations: Read the device from the database.

Parameters:
session Database session to use.
Exceptions:
OsbException if the device as identified by oid() and type() does not exist in the database.

Implemented in OSB_LIB::UimCard.

void OSB_LIB::Device::readBase ( const OSB_DB::Session session  )  [protected]

@ name Database operations, support for derived classes. Read device data from the database.

Parameters:
session Database session to use.
Exceptions:
OsbException if the device as identified by oid() does not exist in the database.

virtual void OSB_LIB::Device::remove ( const OSB_DB::Session session,
bool  noWait 
) [pure virtual]

Delete the device from the database.

Parameters:
session Database session to use.
noWait Don't wait for database locks?
Exceptions:
OsbException from lock().
OsbException if deletion of the device is not allowed.
Todo:
Be more precise about the 2nd throw condition.

Implemented in OSB_LIB::UimCard.

void OSB_LIB::Device::removeBase ( const OSB_DB::Session session  )  [protected]

Delete the device from the database.

Parameters:
session Database session to use.
Exceptions:
OsbException if deletion of the device is not allowed.
Derived class must call lock() before deleting their own data and then calling this function.

virtual void OSB_LIB::Device::saveData ( const OSB_DB::Session session,
bool  noWait 
) [pure virtual]

Save the device data to the database.

Parameters:
session Database session to use.
noWait Don't wait for database locks?
Exceptions:
OsbException from lock().
OsbException if the insert or update fails for other reasons.
Note:
Derived classes may maintain a flag if their data was modified and only call their own update function if needed.
They must however always call updDataBase().

Implemented in OSB_LIB::UimCard.

void OSB_LIB::Device::setAssigned ( const OSB_DB::Session session  )  [private]

Set the status to assigned.

Parameters:
session Database session to use.
Exceptions:
OsbException from lock().
OsbException if the device is not available.

void OSB_LIB::Device::setDeassigned ( const OSB_DB::Session session  )  [private]

Deassign the device.

Set the device status to deactivated.

Parameters:
session Database session to use.
Exceptions:
OsbException from lock().

void OSB_LIB::Device::setPool ( const PoolId  poolId  ) 

Set the inventory pool.

Parameters:
poolId The new inventory pool of the device.
Exceptions:
OsbException if changing to pool is not allowed:
currently none.

virtual void OSB_LIB::Device::setStatus ( const Status  newStatus  )  [virtual]

Set the device status.

Parameters:
newStatus New status of the device.
Exceptions:
OsbException if the current status is assigned.
OsbException if newStatus is assigned or quarantine.
Note:
The function is virtual, derived classes can override this default implementation.

void OSB_LIB::Device::setUnAssigned ( const OSB_DB::Session session  )  [private]

Undo an assignment of the device.

Resets the device status to available.

Parameters:
session Database session to use.
Exceptions:
OsbException from lock().

Status OSB_LIB::Device::status (  )  const

Get the device status.

virtual Type OSB_LIB::Device::type (  )  const [pure virtual]

Get the device type.

Implemented in OSB_LIB::UimCard.

void OSB_LIB::Device::updDataBase ( const OSB_DB::Session session,
bool  noWait 
) [protected]

Save device data to the database.

Parameters:
session Database session to use.
noWait Don't wait for database locks?
Exceptions:
OsbException from lock().
OsbException if the update fails for other reasons.

virtual void OSB_LIB::Device::updStatus ( const OSB_DB::Session session,
bool  noWait 
) [virtual]

Update the status of the device in the database.

Parameters:
session Database session to use.
noWait Don't wait for database locks?
Exceptions:
OsbException from lock().
OsbException from incObjVs().
Note:
The default implementation just updates the status in the table DEVICE.
Derived classes can override this behaviour if needed, they should however always call this function first.

void OSB_LIB::Device::updStatusNoLock ( const OSB_DB::Session session  )  [private]

Update the device status without locking.

Parameters:
session Database session to use.
Exceptions:
OsbException from incObjVs().
The device must be locked in the database before calling this function!


Friends And Related Function Documentation

friend class OSB_DB::DeviceGw [friend]

Allow to set the data members.

Definition at line 71 of file device.h.

friend class PersDevice [friend]

Allow to call the assign/deassign functions.

Definition at line 73 of file device.h.


Member Data Documentation

long OSB_LIB::Device::objVs_ [private]

The object version.

Definition at line 388 of file device.h.

Oid OSB_LIB::Device::oid_ [private]

The object id.

Definition at line 386 of file device.h.

PoolId OSB_LIB::Device::poolId_ [private]

Inventory pool.

Definition at line 392 of file device.h.

Status OSB_LIB::Device::status_ [private]

The device status.

Definition at line 390 of file device.h.


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