#include <RelationalMapping.h>
Public Member Functions | |
ObjectMapping (const Reflex::Type &attributeType, TableRegister &tableRegister) | |
void | process (MappingElement &parentElement, const std::string &attributeName, const std::string &attributeNameForSchema, const std::string &scopeNameForSchema) |
~ObjectMapping () | |
Private Attributes | |
TableRegister & | m_tableRegister |
Reflex::Type | m_type |
Definition at line 157 of file RelationalMapping.h.
ora::ObjectMapping::ObjectMapping | ( | const Reflex::Type & | attributeType, |
TableRegister & | tableRegister | ||
) |
Definition at line 526 of file RelationalMapping.cc.
: m_type(attributeType), m_tableRegister( tableRegister ){ }
ora::ObjectMapping::~ObjectMapping | ( | ) |
Definition at line 530 of file RelationalMapping.cc.
{ }
void ora::ObjectMapping::process | ( | MappingElement & | parentElement, |
const std::string & | attributeName, | ||
const std::string & | attributeNameForSchema, | ||
const std::string & | scopeNameForSchema | ||
) | [virtual] |
Implements ora::IRelationalMapping.
Definition at line 585 of file RelationalMapping.cc.
References ora::MappingElement::appendSubElement(), className(), ora::MappingElement::columnNames(), i, ora::isLoosePersistencyOnWriting(), ora::MappingRules::isMappedToBlob(), ora::MappingRules::mappingPropertyNameInDictionary(), ora::RelationalMappingFactory::newProcessor(), ora::MappingElement::objectMappingElementType(), ora::processBaseClasses(), ora::ClassUtils::resolvedType(), ora::MappingElement::setColumnNames(), ora::MappingElement::tableName(), and ora::throwException().
{ std::string className = m_type.Name(Reflex::SCOPED); std::string elementType = ora::MappingElement::objectMappingElementType(); ora::MappingElement& me = parentElement.appendSubElement( elementType, attributeName, className, parentElement.tableName() ); me.setColumnNames( parentElement.columnNames() ); // resolve possible typedef chains Reflex::Type objectType = ClassUtils::resolvedType(m_type); // process base class data members processBaseClasses( me, m_type, scopeNameForSchema, m_tableRegister ); RelationalMappingFactory mappingFactory( m_tableRegister ); std::string scope = attributeName; std::string objectScopeNameForSchema = scopeNameForSchema; if( !objectScopeNameForSchema.empty() ) objectScopeNameForSchema +="_"; objectScopeNameForSchema += attributeNameForSchema; // loop over the data members for ( size_t i=0; i< objectType.DataMemberSize(); i++){ Reflex::Member objectMember = m_type.DataMemberAt(i); // Skip the transient and the static ones if ( objectMember.IsTransient() || objectMember.IsStatic() || isLoosePersistencyOnWriting( objectMember )) continue; // Retrieve the field type Reflex::Type type = ClassUtils::resolvedType( objectMember.TypeOf() ); // Check for the existence of the dictionary information if ( !type ){ throwException( "Type for data member \""+objectMember.Name()+"\" of class \""+className+ "\" has not been found in the dictionary.", "ObjectMapping::process"); } // check if the member is from a class in the inheritance tree Reflex::Type declaringType = ClassUtils::resolvedType( objectMember.DeclaringType()); if( declaringType != objectType ){ continue; } // Retrieve the field name std::string objectMemberName = objectMember.Name(); std::string objectNameForSchema = objectMember.Name(); std::string mappingType(""); Reflex::PropertyList memberProps = objectMember.Properties(); if( memberProps.HasProperty(ora::MappingRules::mappingPropertyNameInDictionary())){ mappingType = memberProps.PropertyAsString(ora::MappingRules::mappingPropertyNameInDictionary()); } bool blobStreaming = ora::MappingRules::isMappedToBlob( mappingType ); std::auto_ptr<IRelationalMapping> processor( mappingFactory.newProcessor( type, blobStreaming ) ); processor->process( me, objectMemberName, objectNameForSchema, objectScopeNameForSchema ); } }
TableRegister& ora::ObjectMapping::m_tableRegister [private] |
Definition at line 167 of file RelationalMapping.h.
Reflex::Type ora::ObjectMapping::m_type [private] |
Definition at line 166 of file RelationalMapping.h.