iopc::ORMappingStrategy Class Reference
[iopclib]

Implements attribute-level part of the O/R mapping algorithm for the horizontal, vertical and filtered mapping types. More...

#include <orMappingStrategy.h>

Inheritance diagram for iopc::ORMappingStrategy:

Inheritance graph
[legend]

List of all members.

Public Types

enum  ColSource { COLSOURCE_ATTR = 0, COLSOURCE_INHERITEDPK, COLSOURCE_INHERITED, COLSOURCE_FILTERED }
 Classifies the attributes in the getMappedAttributes() list. More...

Public Member Functions

virtual void init ()
 Validates the associated persistent object.
virtual void postInit ()
 Second phase of the initialization routine.
virtual void loadOne (Connection &conn, DatabaseObject *obj, const KeyValues &keyVals, bool wait, bool lock)
 Loads attributes declared in the associated type from its associated mapping table or type.
virtual OidObjectviewLoadAll (Connection &conn, const OidType &oid, bool wait, bool lock)
 Loads all attributes from the associated types' simple view.
virtual void updateOne (Connection &conn, DatabaseObject &obj)
 Updates columns from attributes declared in the associated type in its associated mapping table or ADT type instance.
virtual void deleteOne (Connection &conn, const OidType &oid)
 Deletes an OidObject identified by OID from the associated table ord deletes the associated ADT type instance.
virtual void deleteOne (Connection &conn, const KeyValues &keyVals)
 Deletes an OidObject identified by @ KeyValues from the associated table or deletes the associated ADT type instance.
virtual void insertOne (Connection &conn, DatabaseObject &obj)
 Inserts values of attributes declared in the associated type to associated table or creates a new associated ADT type instance.
virtual DbTypegetDbType () const
 Returns the associated DbType instance.
virtual const TypegetType () const
 Returns the associated Type instance.
const MappedAttributesList & getMappedAttributes () const
 Returns a list of attributes that are physically mapped into table associated with getType().
bool hasDbTable () const
 Returns true if the type has a database table associated (false for filtered mapping, true for other mapping types).
DbTypegetInsertToType () const
 Returns destination type for filtered-mapping classes.


Detailed Description

Implements attribute-level part of the O/R mapping algorithm for the horizontal, vertical and filtered mapping types.

Member Enumeration Documentation

Classifies the attributes in the getMappedAttributes() list.

Enumerator:
COLSOURCE_ATTR  Persistent attributes of the current class. (PersistentAttributes).
COLSOURCE_INHERITEDPK  Inherited KeyAttributes - even if the class does not employ horizontal mapping.
COLSOURCE_INHERITED  If the current class uses horizontal mapping, the list includes non-key inherited persistent attributes from the InheritedAttributes list. Attributes inherited from the OidObject are excluded as the Oid - classname catalogue (a table associated with OidObject) is accessed even when using horizontal mapping.
COLSOURCE_FILTERED  Persistent attributes from classes that use filtered mapping - persistent attributes from classes in the FilteredTypes list.


Member Function Documentation

void ORMappingStrategy::init (  )  [virtual]

Validates the associated persistent object.

Checks all mapping-related metadata and pre-generates lists of mapped attributes or other data it needs during the mapping algorithm execution.

Implements iopc::MappingStrategy.

void ORMappingStrategy::postInit (  )  [virtual]

Second phase of the initialization routine.

Executed after all strategies and DbType-s have finished the first phase (DbPtr::init(), MappingStrategy::init())

Implements iopc::MappingStrategy.

void ORMappingStrategy::loadOne ( Connection conn,
DatabaseObject obj,
const KeyValues keyVals,
bool  wait,
bool  lock 
) [virtual]

Loads attributes declared in the associated type from its associated mapping table or type.

Parameters:
conn Connection from which to load the attributes
obj Object whose attributes will be loaded from conn
keyVals Identifies the object whose attributes to load
wait Specifies whether the operation should wait for database locks to be unlocked.
lock Specifies whether the persistent copy should be locked in DB exlusively when loaded.

Implements iopc::MappingStrategy.

OidObject * ORMappingStrategy::viewLoadAll ( Connection conn,
const OidType oid,
bool  wait,
bool  lock 
) [virtual]

Loads all attributes from the associated types' simple view.

Parameters:
conn Connection from which to load the attributes
oid OID of the object to be laoded
wait Specifies whether the operation should wait for database locks to be unlocked.
lock Specifies whether the persistent copy should be locked in DB exlusively when loaded.
Returns:
Allocates, loads and returns a new OidObject instance

Implements iopc::MappingStrategy.

void ORMappingStrategy::updateOne ( Connection conn,
DatabaseObject obj 
) [virtual]

Updates columns from attributes declared in the associated type in its associated mapping table or ADT type instance.

Parameters:
conn Connection used to update the values
obj Obj containing attributes that update the database values

Implements iopc::MappingStrategy.

void ORMappingStrategy::deleteOne ( Connection conn,
const OidType oid 
) [virtual]

Deletes an OidObject identified by OID from the associated table ord deletes the associated ADT type instance.

Parameters:
conn Connection used to delete the object
oid OID of the object to delete

Implements iopc::MappingStrategy.

void ORMappingStrategy::deleteOne ( Connection conn,
const KeyValues keyVals 
) [virtual]

Deletes an OidObject identified by @ KeyValues from the associated table or deletes the associated ADT type instance.

Parameters:
conn Connection used to delete the object
keyVals KeyValues of the object to delete

Implements iopc::MappingStrategy.

void ORMappingStrategy::insertOne ( Connection conn,
DatabaseObject obj 
) [virtual]

Inserts values of attributes declared in the associated type to associated table or creates a new associated ADT type instance.

Parameters:
conn Connection used to perform the operation
obj Object containing the values to insert.

Implements iopc::MappingStrategy.

const MappedAttributesList& iopc::ORMappingStrategy::getMappedAttributes (  )  const [inline]

Returns a list of attributes that are physically mapped into table associated with getType().

In fact they represent columns of this table. The list may include attributes from other classes. Attributes are categorized by their origin:

  • Persistent attributes of the current class. (PersistentAttributes)
  • If the current class uses horizontal mapping, the list includes non-key inherited persistent attributes from the InheritedAttributes list. Attributes inherited from the OidObject are excluded as the Oid - classname catalogue (a table associated with OidObject) is accessed even when using horizontal mapping.
  • Persistent attributes from classes that use filtered mapping - persistent attributes from classes in the FilteredTypes list.
  • Inherited KeyAttributes - even if the class does not employ horizontal mapping

DbType& iopc::ORMappingStrategy::getInsertToType (  )  const [inline]

Returns destination type for filtered-mapping classes.

For other mapping types, behaviour of this method is undefined.


The documentation for this class was generated from the following files:

Generated on Tue Apr 14 16:46:52 2009 for IOPC 2 by  doxygen 1.5.6