CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ora::ObjectMapping Class Reference

#include <RelationalMapping.h>

Inheritance diagram for ora::ObjectMapping:
ora::IRelationalMapping

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 ()
 
- Public Member Functions inherited from ora::IRelationalMapping
virtual ~IRelationalMapping ()
 

Private Attributes

TableRegisterm_tableRegister
 
Reflex::Type m_type
 

Detailed Description

Definition at line 157 of file RelationalMapping.h.

Constructor & Destructor Documentation

ora::ObjectMapping::ObjectMapping ( const Reflex::Type &  attributeType,
TableRegister tableRegister 
)

Definition at line 518 of file RelationalMapping.cc.

518  :
519  m_type(attributeType), m_tableRegister( tableRegister ){
520 }
TableRegister & m_tableRegister
ora::ObjectMapping::~ObjectMapping ( )

Definition at line 522 of file RelationalMapping.cc.

522  {
523 }

Member Function Documentation

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 568 of file RelationalMapping.cc.

References ora::MappingElement::appendSubElement(), className(), ora::MappingElement::columnNames(), i, 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().

Referenced by python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::dumpPython(), python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::open(), python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::outputEventContent(), python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::setProcess(), and python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::setProperty().

571  {
572  std::string className = m_type.Name(Reflex::SCOPED);
573  std::string elementType = ora::MappingElement::objectMappingElementType();
574  ora::MappingElement& me = parentElement.appendSubElement( elementType, attributeName, className, parentElement.tableName() );
575  me.setColumnNames( parentElement.columnNames() );
576 
577  // resolve possible typedef chains
579  // process base class data members
580  processBaseClasses( me, m_type, scopeNameForSchema, m_tableRegister );
581  RelationalMappingFactory mappingFactory( m_tableRegister );
582  std::string scope = attributeName;
583  std::string objectScopeNameForSchema = scopeNameForSchema;
584  if( !objectScopeNameForSchema.empty() ) objectScopeNameForSchema +="_";
585  objectScopeNameForSchema += attributeNameForSchema;
586 
587  // loop over the data members
588  for ( size_t i=0; i< objectType.DataMemberSize(); i++){
589 
590  Reflex::Member objectMember = m_type.DataMemberAt(i);
591  // Skip the transient and the static ones
592  if ( objectMember.IsTransient() || objectMember.IsStatic() ) continue;
593 
594  // Retrieve the field type
595  Reflex::Type type = ClassUtils::resolvedType( objectMember.TypeOf() );
596  // Check for the existence of the dictionary information
597  if ( !type ){
598  throwException( "Type for data member \""+objectMember.Name()+"\" of class \""+className+
599  "\" has not been found in the dictionary.",
600  "ObjectMapping::process");
601  }
602 
603  // check if the member is from a class in the inheritance tree
604  Reflex::Type declaringType = ClassUtils::resolvedType( objectMember.DeclaringType());
605  if( declaringType != objectType ){
606  continue;
607  }
608  // Retrieve the field name
609  std::string objectMemberName = objectMember.Name();
610  std::string objectNameForSchema = objectMember.Name();
611 
612  std::string mappingType("");
613  Reflex::PropertyList memberProps = objectMember.Properties();
614  if( memberProps.HasProperty(ora::MappingRules::mappingPropertyNameInDictionary())){
615  mappingType = memberProps.PropertyAsString(ora::MappingRules::mappingPropertyNameInDictionary());
616  }
617  bool blobStreaming = ora::MappingRules::isMappedToBlob( mappingType );
618 
619  std::auto_ptr<IRelationalMapping> processor( mappingFactory.newProcessor( type, blobStreaming ) );
620  processor->process( me, objectMemberName, objectNameForSchema, objectScopeNameForSchema );
621  }
622 
623 }
type
Definition: HCALResponse.h:22
int i
Definition: DBlmapReader.cc:9
MappingElement & appendSubElement(const std::string &elementType, const std::string &variableName, const std::string &variableType, const std::string &tableName)
static std::string mappingPropertyNameInDictionary()
class related parameters
Definition: MappingRules.cc:34
static std::string objectMappingElementType()
Returns the name of the object mapping element type.
static bool isMappedToBlob(const std::string &mappingProperty)
Definition: MappingRules.cc:41
Reflex::Type resolvedType(const Reflex::Type &typ)
Definition: ClassUtils.cc:380
TableRegister & m_tableRegister
void processBaseClasses(MappingElement &mappingElement, const Reflex::Type &objType, const std::string &scopeNameForSchema, TableRegister &tableRegister)
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
std::string className(const T &t)
Definition: ClassName.h:30
void setColumnNames(const std::vector< std::string > &columns)

Member Data Documentation

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.