ProductGw is the database gateway class for Product, ProductItem and ProductNode.
Definition at line 74 of file product-gw.h.
bool OSB_DB::ProductGw::checkName | ( | const Session & | session, | |
const OSB_LIB::Product * | pd | |||
) | [private] |
Check that the product's name is not already used.
Compares the current product's name with the names of products in the database.
session | Database session to use. | |
pd | Pointer to the product. |
bool OSB_DB::ProductGw::checkObjVs | ( | const Session & | session, | |
const OSB_LIB::Product * | pd | |||
) | [private] |
Check that the object versions match.
Compares the current product's object version with the object version in the database.
session | Database session to use. | |
pd | Pointer to the product. |
void OSB_DB::ProductGw::checkPiName | ( | const Session & | session, | |
const std::string & | name, | |||
const OSB_LIB::Product::Oid & | pid | |||
) |
Check that the name of product item is unique in one product.
Compares the current product item's name with the names of product items in the database.
session | Oracle session. | |
name | Product item name. | |
pid | Object id of product this item belongs. |
OsbException | name already exists in the product. |
OSB_LIB::Product::Oid OSB_DB::ProductGw::creProduct | ( | const Session & | session, | |
OSB_LIB::Product & | pd | |||
) |
Create a new product in the database.
session | Database session to use. | |
pd | Product to be created. |
OsbException |
|
void OSB_DB::ProductGw::creProductNode | ( | const Session & | session, | |
const OSB_LIB::Product::Oid & | productId, | |||
OSB_LIB::ProductNode & | productNode | |||
) |
Create a product node in the database.
The function inserts a row into PRODUCT_NODE and sets the new object id of `node'.
session | Database session to use. | |
productId | Product id for this node belongs to. | |
productNode | Product node to create. |
void OSB_DB::ProductGw::delProduct | ( | const Session & | session, | |
const OSB_LIB::Product * | pd | |||
) |
Delete a product from the database.
This includes the deletion of the database entry. The product object will not be deleted by this method. The owner has to do that.
session | Database session to use. | |
pd | Pointer to product to be deleted. |
bool OSB_DB::ProductGw::delProductItem | ( | const Session & | session, | |
OSB_LIB::ProductItem & | item | |||
) | [private] |
Delete a product item from the database.
The function deletes a product item from the table PRODUCT_ITEM. The implementation relies on the foreign key constraints to prevent the deletion of product items that are still in use.
session | Database session to use. | |
item | Product item to update. |
void OSB_DB::ProductGw::delProductNode | ( | const Session & | session, | |
const OSB_LIB::ProductNode & | pNode | |||
) |
Delete a ProductNode from the database.
This includes the deletion of the database entry. The ProductNode object will not be deleted by this method. The owner has to do that. The function is not responsible to delete the ProductNode object from any container! (esp from the master node list of the Product)
ToDo: Implement. ToDo: Obviously all children nodes of the Node to be deleted have to be deleted as well (respectively all grand children etc.) It has to be decided if the gateway does that or the using application!
session | Database session to use. | |
pNode | Product node to delete. |
long OSB_DB::ProductGw::fetch | ( | const Session & | session, | |
OSB_LIB::ProductItemTypes & | dest | |||
) |
Load all product item type.
This function will load all product item type from the database and store them in the product item type list.
session | Oracle session. | |
dest | Product item type list to populate. |
OsbException | for unsupported product item types. |
long OSB_DB::ProductGw::fetch | ( | const Session & | session, | |
const OSB_LIB::Product::Oid & | pid, | |||
OSB_LIB::ProductNodeParts & | pnList | |||
) |
Read all product nodes of a product.
Read all product nodes of a product from the database and store them in the products nodes list.
session | Database session to use. | |
pid | Object id of product. | |
pnList | Product node list to read for. |
bool OSB_DB::ProductGw::fetch | ( | const Session & | session, | |
OSB_LIB::ProductItem & | item | |||
) | [private] |
Read a product item from the database.
The function (re)reads an existing product item from the database. It populates data members if a matching row is found.
session | Database session to use. | |
item | Product item to read. |
std::auto_ptr<OSB_LIB::ProductItem> OSB_DB::ProductGw::fetch | ( | const Session & | session, | |
const OSB_LIB::Id< OSB_LIB::ProductItem > & | oid | |||
) |
Load a product item from the database.
Reads the product item from PRODUCT_ITEM. If a row with the matching object id is found, the function uses ProductItemFactory to allocate a new product item, populates the member of the base class and calls the virtual function OSB_LIB::ProductItem::read(...) to retrieve type specific information.
session | Database session to use. | |
oid | Object id of the product item to read. |
OsbException |
|
bool OSB_DB::ProductGw::fetch | ( | const Session & | session, | |
OSB_LIB::Product * | pd | |||
) |
Read a product.
session | Database session to use. | |
pd | Product to be populated. |
long OSB_DB::ProductGw::fetch | ( | const Session & | session, | |
OSB_LIB::Products * | pds | |||
) |
Load all products into the argument STL containter.
session | Database session to use. | |
pds | Product list to be populated. |
bool OSB_DB::ProductGw::insProductItem | ( | const Session & | session, | |
OSB_LIB::ProductItem & | item | |||
) | [private] |
Create a product item in the database.
The function inserts a row into PRODUCT_ITEM and sets the new object id of `item'.
session | Database session to use. | |
item | Product item to create. |
OsbExcpetion |
|
void OSB_DB::ProductGw::updProduct | ( | const Session & | session, | |
const OSB_LIB::Product * | pd | |||
) |
Update contents of the database for a given product.
The database entry identified by this product's id already exists. The contents of the passed product object will not be changed by this method.
session | Database session to use. | |
pd | Product to be updated. |
OsbException |
|
bool OSB_DB::ProductGw::updProductItem | ( | const Session & | session, | |
OSB_LIB::ProductItem & | item | |||
) | [private] |
Update a product item.
Updates the base part members of a product item in the table PRODUCT_ITEM.
ToDo: On successful update the function should set the item's new object version (not supported yet).
session | Database session to use. | |
item | Product item to update. |
OsbException |
|
void OSB_DB::ProductGw::updProductNode | ( | const Session & | session, | |
const OSB_LIB::Product::Oid & | prodId, | |||
OSB_LIB::ProductNode & | pNode | |||
) |
Update the contents of the database for a given ProductItem.
The database entry identified by this ProductItem's Id has already to exist. The contents of the passed ProductItem object will not be changed by this method. Note: the Product has to be passed, because there is no information within ProductNode to which Product it belongs to. Note: The update method is actually not necessary for the CORBA interface and is therefore not used.
session | Database session to use. | |
prodId | Product id for this node belongs to. | |
pNode | Product node to update. |
friend class OSB_LIB::ProductItem [friend] |