OSB_LIB::Product Class Reference

Collaboration diagram for OSB_LIB::Product:

Collaboration graph
[legend]
List of all members.

Detailed Description

Offered products.

Definition at line 204 of file product.h.

Public Types

Public Member Functions

Read access to data members
Modify data members.
Product node maintenance

Private Member Functions

Product node maintenance
Product node tree maintenance
The following functions are used to maintain the product node tree.

Private Attributes

Friends


Member Typedef Documentation

typedef Id<Product> OSB_LIB::Product::Oid

Typesafe unique object identifier, database link.

Definition at line 210 of file product.h.


Constructor & Destructor Documentation

OSB_LIB::Product::Product ( const Oid oid,
const std::string &  name = "",
const std::string &  des = "" 
)

Constructor with object id.

Remarks:
Copy, assignment and destructor by compiler.


Member Function Documentation

ProductNode& OSB_LIB::Product::addNode ( const ProductNode::Oid parentId,
std::auto_ptr< ProductItem item 
)

Insert a product node into the parts list of the proper parent.

The node is not added to the database. A new node is created with edit status `esCreated'. It will be added to the database when the product's saveNodes() method is called.

Parameters:
parentId Id of parent node.
item The product item owned by the node.
Exceptions:
OsbException 
  • in case the item passed in is null.
  • in case the parent node is not found.

int OSB_LIB::Product::buildNodeTree ( const ProductNode::Oid parentId,
ProductNodeParts parts,
ProductNodeParts tmpList,
std::vector< OsbError > &  errors,
int  numErrors 
) [private]

Builds the product's node tree.

int OSB_LIB::Product::buildNodeTree ( const ProductNodeParts nodes,
std::vector< OsbError > &  errors 
) [private]

Builds the product's node tree.

The method iterates iterates the nodes list and populates the appropriate parts list. Checks thast the product item and parent of a node exist.

Parameters:
nodes Nodes list to iterates iterates.
errors Container of errors during build.
Returns:
Number of errors.

void OSB_LIB::Product::creProductNode ( const OSB_DB::Session session,
ProductNode node 
) [private]

Create a new product node in the database.

void OSB_LIB::Product::delNode ( const ProductNode::Oid nodeId  ) 

Remove a product node.

The node is not removed from the database. Its edit status is set to `esDeleted'. It will be removed from the database when the product's saveNodes() method is called.

void OSB_LIB::Product::delNode ( ProductNode node  )  [private]

Mark a product node to be removed.

It is called by delNode(nodeId).

void OSB_LIB::Product::delNodeChildren ( const OSB_DB::Session session,
ProductNode parent 
) [private]

Deletes all the children of a product node from the database.

void OSB_LIB::Product::delProductNode ( const OSB_DB::Session session,
ProductNode node 
) [private]

Deletes a product node from the database.

All its children and product items will be deleted also.

Parameters:
session Database session to use.
node Product node to delete.
Exceptions:
OsbException in case of a database error.

const std::string& OSB_LIB::Product::desc (  )  const

Product description.

const ProductNode* OSB_LIB::Product::findProductNode ( const ProductNode::Oid nodeId  )  const

Get a const product node pointer by its id.

const Id<Pricelist> OSB_LIB::Product::getPricelistId (  )  const

Id of pricelist.

Restrictions: The product will return only the first pricelist that it find if more than 1 pricelist items exist in the product items of the product.

const ProductNode& OSB_LIB::Product::getProductNode ( const ProductNode::Oid nodeId  )  const

Get a const product node reference by its id.

const std::string& OSB_LIB::Product::name (  )  const

Product name.

long OSB_LIB::Product::nextTempNodeId (  )  [private]

Decrement and return the next temporary product node id.

void OSB_LIB::Product::objVsPlus (  )  [private]

Increase object version.

const Oid& OSB_LIB::Product::oid (  )  const

Object id, database link.

ProductNodeParts& OSB_LIB::Product::parts (  ) 

None const 1st generation parts list.

const ProductNodeParts& OSB_LIB::Product::parts (  )  const

1st generation product nodes.

ProductNode* OSB_LIB::Product::productNode ( const ProductNode::Oid nodeId  ) 

Get a non-const product node pointer by its id.

ProductNode* OSB_LIB::Product::productNode ( const ProductNode::Oid nodeId,
ProductNodeParts parts 
) [private]

Get a non-const product node pointer by its id.

It is called by delNode(nodeId).

bool OSB_LIB::Product::read ( const OSB_DB::Session session  )  [private]

Read a product from the database.

void OSB_LIB::Product::saveItem ( const OSB_DB::Session session,
ProductItem item 
) [private]

Save changes made to a product item.

bool OSB_LIB::Product::saveNode ( const OSB_DB::Session session,
ProductNode node 
) [private]

Save changes made to a product node.

Attention:
This function will update the node in database but not the parts list. It is only safe to be called within the function saveNodes().
Parameters:
session Database session to use.
node Product node to save.
Exceptions:
OsbException in case of a database error.
Returns:
True if the node was not deleted.

void OSB_LIB::Product::saveNodes ( const OSB_DB::Session session,
ProductNodeParts parts 
) [private]

Save changes recursively made to all product nodes.

void OSB_LIB::Product::saveNodes ( const OSB_DB::Session session  )  [private]

Save changes made to all product nodes.

void OSB_LIB::Product::setDesc ( std::string &  desc  ) 

Set description.

void OSB_LIB::Product::setName ( std::string &  name  ) 

Set name.

void OSB_LIB::Product::sortNodeByName ( ProductNodeParts parts,
bool  desc = false 
)

Sort product nodes by name.

Parameters:
parts Product node parts.
desc Flag to sort in descending (true) or ascending (false) order.

void OSB_LIB::Product::sortNodeByName ( bool  desc = false  ) 

Sort product nodes by name.

Parameters:
desc Flag to sort in descending (true) or ascending (false) order.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ,
const Product  
) [friend]

friend class OSB_DB::ProductGw [friend]

Definition at line 205 of file product.h.

friend class ProductCatalogue [friend]

Definition at line 206 of file product.h.


Member Data Documentation

std::string OSB_LIB::Product::des_ [private]

Product description.

Definition at line 445 of file product.h.

std::string OSB_LIB::Product::name_ [private]

Product name.

Definition at line 444 of file product.h.

long OSB_LIB::Product::objVs_ [private]

Product object version.

Definition at line 447 of file product.h.

Oid OSB_LIB::Product::oid_ [private]

Product id.

Definition at line 443 of file product.h.

ProductNodeParts OSB_LIB::Product::parts_ [private]

1st generation parts list.

Definition at line 446 of file product.h.

long OSB_LIB::Product::tempNodeId_ [private]

Temporary id for nodes.

Definition at line 448 of file product.h.


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