OSB_DB::ContractGw Class Reference

List of all members.

Detailed Description

Database-gateway class for Contract.

Definition at line 62 of file contract-gw.h.

Public Types

Public Member Functions

Private Member Functions

Friends


Member Typedef Documentation

typedef OSB_LIB::Id<OSB_LIB::Contract> OSB_DB::ContractGw::ContractId

Just a shorthand.

Definition at line 74 of file contract-gw.h.

typedef std::set<ContractId> OSB_DB::ContractGw::ContractIds

STL container for contract object ids.

Definition at line 78 of file contract-gw.h.

typedef std::map<ContractId, OSB_LIB::Contract> OSB_DB::ContractGw::ContractList

STL container for contracts.

Definition at line 76 of file contract-gw.h.


Constructor & Destructor Documentation

OSB_DB::ContractGw::ContractGw ( const ContractGw rhs  )  [private]

Prevent copying: not implemented.

OSB_DB::ContractGw::ContractGw (  )  [inline]

Definition at line 80 of file contract-gw.h.


Member Function Documentation

bool OSB_DB::ContractGw::delContract ( const Session session,
const OSB_LIB::Contract co 
) [private]

Delete a contract from database.

The contract to be deleted must already exist in the database. Besides that, the object version of the contract object to be deleted must match the object version in the database. This is to ensure that the object to be deleted truly represents the entry in the databse.

Parameters:
session Database session.
co contract object to be deleted.
Returns:
true if deletion is successful else false.
Exceptions:
OsbException for the following errors:
  • Object not found.
  • Object has been modified.

long OSB_DB::ContractGw::fetch ( const Session session,
const OSB_LIB::Associate::Oid asId,
ContractIds idList 
)

Load all contract ids for an associate.

Parameters:
session Database session to use.
asId Object id of associate.
idList Ref of list of contract ids.
Returns:
Number of objects populated.

long OSB_DB::ContractGw::fetch ( const Session session,
const OSB_LIB::Associate::Oid asId,
ContractList dest 
)

Load all contracts for an associate.

It will also fetch all pers products and pers nodes for each contract.

Parameters:
session Database session to use.
asId Object id of associate.
dest List of contract to populate
Exceptions:
OsbException in case of an illegal effective or preferred status of the contract in the database.
Returns:
Number of objects populated.

bool OSB_DB::ContractGw::fetch ( const Session session,
OSB_LIB::Contract co 
)

Read a contract from the database.

Parameters:
session Database session to use.
co Contract to read.
Exceptions:
OsbException in case of an illegal effective or preferred status of the contract in the database.
Returns:
True for found, else false.
It will populate to contract if success.
It will also fetch all its pers products and pers nodes.

bool OSB_DB::ContractGw::incObjVs ( const Session session,
OSB_LIB::Contract co 
) [private]

Increment the object version of a contract.

Parameters:
session Database session to use.
co The contract who's object version is increased.
Returns:
true if the object version of co was increased by 1, else false.

bool OSB_DB::ContractGw::insContract ( const Session session,
OSB_LIB::Contract co 
) [private]

Add a new contract object.

Before the function call, the object must have all its member attributes assigned (except oid, object version and createDate). After the function call, the object will have its id_, objVs_ and createdDate_ set.

Parameters:
session Database session.
co New contract object to be added into database.
Returns:
true if success else false.
Exceptions:
OsbException for the following errors:
  • Database error.

OSB_LIB::ObjectStatus OSB_DB::ContractGw::lock ( const Session session,
const OSB_LIB::Contract co,
bool  noWait 
) [private]

Lock a contract in the database.

Parameters:
session Database session to use.
co The contract to lock.
noWait Don't wait if locked by another session?
Returns:
The object status of the contract.

OSB_LIB::ObjectStatus OSB_DB::ContractGw::lock ( const Session session,
const OSB_LIB::Contract::Oid coId,
bool  noWait 
) [private]

Lock a contract entry in database.

Parameters:
session Database session to use.
coId Id of the contract to lock.
noWait Don't wait if locked by another session?
Returns:
The object status of the contract, (modified is not applicable).

void OSB_DB::ContractGw::lockPersProducts ( const Session session,
const OSB_LIB::Contract::Oid coId,
bool  noWait 
) [private]

Lock all pers product of a contract in database.

Parameters:
session Database session.
coId Contract id.
noWait Set to true if the function should not wait for other process to unlock the resource. If waiting is required, set to false.

ContractGw& OSB_DB::ContractGw::operator= ( const ContractGw rhs  )  [private]

Prevent assignment: not implemented.

bool OSB_DB::ContractGw::setEffStatus ( const Session session,
const OSB_LIB::Contract co 
) [private]

Save the effective status of a contract.

Parameters:
session Database session to use.
co Contract to process.
Returns:
true if the effective status was updated, else false.

bool OSB_DB::ContractGw::setPrefStatus ( const Session session,
const OSB_LIB::Contract co 
) [private]

Save the preferred status of a contract.

Parameters:
session Database session to use.
co Contract to process.
Returns:
true if the preferred status was updated, else false.

void OSB_DB::ContractGw::storeChange ( const Session session,
const OSB_LIB::Contract::Oid coId,
OSB_LIB::StatusChange change 
) [private]

Store status change for a contract in the database.

Parameters:
session Database session to use.
coId Contract object id.
change Status change to store.

void OSB_DB::ContractGw::storeRequest ( const Session session,
const OSB_LIB::Contract::Oid coId,
OSB_LIB::StatusRequest status 
) [private]

Store status request for a contract in the database.

Parameters:
session Database session to use.
coId Contract object id.
status Status request to store.

bool OSB_DB::ContractGw::updContract ( const Session session,
const OSB_LIB::Contract co 
) [private]

Update a contract object.

The function will modify the data of a contract in the database with the data contained within the input object. The contract object entry in the database will only be updated if the input object truly represent the current entry in the database (the object version is the same).

Parameters:
session Database session.
co contract object to be updated.
Returns:
true if updated successfully else false.
Exceptions:
OsbException for the following errors:
  • Object not found.
  • Object has been modified.


Friends And Related Function Documentation

friend class OSB_LIB::Contract [friend]

Allow the contract to use its gateway.

Definition at line 64 of file contract-gw.h.

friend class OSB_LIB::PersProduct [friend]

Only allow PersProduct to access lock(...).

Definition at line 66 of file contract-gw.h.


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