#include <MappingElement.h>
Public Types | |
typedef std::map< std::string, MappingElement > ::const_iterator | const_iterator |
enum | ElementType { Undefined = -1, Class, Object, Dependency, Primitive, Array, CArray, InlineCArray, Pointer, Reference, OraReference, OraPointer, UniqueReference, OraArray, Blob, NamedReference } |
typedef std::map< std::string, MappingElement >::iterator | iterator |
Iterator definition. | |
Public Member Functions | |
void | alterTableName (const std::string &tableName) |
void | alterType (const std::string &elementType) |
MappingElement & | appendSubElement (const std::string &elementType, const std::string &variableName, const std::string &variableType, const std::string &tableName) |
const_iterator | begin () const |
iterator | begin () |
Returns an iterator in the beginning of the sequence. | |
const std::vector< std::string > & | columnNames () const |
ElementType | elementType () const |
std::string | elementTypeString () const |
iterator | end () |
Returns an iterator in the end of the sequence. | |
const_iterator | end () const |
const_iterator | find (const std::string &key) const |
iterator | find (const std::string &key) |
Retrieves a sub-element. | |
std::string | idColumn () const |
bool | isDependent () const |
MappingElement (const std::string &elementType, const std::string &variableName, const std::string &variableType, const std::string &tableName) | |
Constructor. | |
MappingElement (const MappingElement &element) | |
MappingElement () | |
Empty Constructor. | |
MappingElement & | operator= (const MappingElement &element) |
void | override (const MappingElement &source) |
const MappingElement & | parentClassMappingElement () const |
std::string | pkColumn () const |
std::string | posColumn () const |
void | printXML (std::ostream &outputStream, std::string indentation="") const |
std::vector< std::string > | recordIdColumns () const |
bool | removeSubElement (const std::string &key) |
Remove a sub-element. | |
const std::string & | scopeName () const |
void | setColumnNames (const std::vector< std::string > &columns) |
std::vector< std::pair < std::string, std::string > > | tableHierarchy () const |
const std::string & | tableName () const |
const std::string & | variableName () const |
const std::string & | variableNameForSchema () const |
const std::string & | variableType () const |
~MappingElement () | |
Destructor. | |
Static Public Member Functions | |
static std::string | arrayMappingElementType () |
Returns the name of the array mapping element type. | |
static std::string | blobMappingElementType () |
Returns the name of the blob mapping element type. | |
static std::string | CArrayMappingElementType () |
Returns the name of the array mapping element type. | |
static std::string | classMappingElementType () |
Returns the name of the class mapping element type. | |
static std::string | dependencyMappingElementType () |
Returns the name of the dependent class mapping element type. | |
static std::string | elementTypeAsString (ElementType elementType) |
Converts the enumeration type to a string. | |
static ElementType | elementTypeFromString (const std::string &elementType) |
Converts a string into an element type. | |
static std::string | inlineCArrayMappingElementType () |
Returns the name of the inline array mapping element type. | |
static bool | isValidMappingElementType (const std::string &elementType) |
Checks if the provided element type is valid. | |
static std::string | namedReferenceMappingElementType () |
Returns the name of the named reference element type. | |
static std::string | objectMappingElementType () |
Returns the name of the object mapping element type. | |
static std::string | OraArrayMappingElementType () |
Returns the name of the ORA array mapping element type. | |
static std::string | OraPointerMappingElementType () |
Returns the name of the ORA pointer mapping element type. | |
static std::string | OraReferenceMappingElementType () |
Returns the name of the ORA reference mapping element type. | |
static std::string | pointerMappingElementType () |
Returns the name of the pointer mapping element type. | |
static std::string | primitiveMappingElementType () |
Returns the name of the primitive mapping element type. | |
static std::string | referenceMappingElementType () |
Returns the name of the reference mapping element type. | |
static std::string | uniqueReferenceMappingElementType () |
Returns the name of the ORA polymorphic pointer mapping element type. | |
Private Attributes | |
std::vector< std::string > | m_columnNames |
ElementType | m_elementType |
bool | m_isDependentTree |
std::string | m_scopeName |
std::map< std::string, MappingElement > | m_subElements |
std::string | m_tableName |
std::string | m_variableName |
std::string | m_variableNameForSchema |
std::string | m_variableType |
Class describing an element of the object-relational mapping structure.
Definition at line 18 of file MappingElement.h.
typedef std::map< std::string, MappingElement >::const_iterator ora::MappingElement::const_iterator |
Definition at line 80 of file MappingElement.h.
typedef std::map< std::string, MappingElement >::iterator ora::MappingElement::iterator |
Iterator definition.
Definition at line 79 of file MappingElement.h.
Undefined | |
Class | |
Object | |
Dependency | |
Primitive | |
Array | |
CArray | |
InlineCArray | |
Pointer | |
Reference | |
OraReference | |
OraPointer | |
UniqueReference | |
OraArray | |
Blob | |
NamedReference |
Definition at line 21 of file MappingElement.h.
{ Undefined = -1, Class, Object, Dependency, Primitive, Array, CArray, InlineCArray, Pointer, Reference, OraReference, OraPointer, UniqueReference, OraArray, Blob, NamedReference } ElementType;
ora::MappingElement::MappingElement | ( | ) | [inline] |
Empty Constructor.
Definition at line 271 of file MappingElement.h.
: m_elementType(ora::MappingElement::Undefined), m_isDependentTree(false), m_scopeName(""), m_variableName(""), m_variableNameForSchema(""), m_variableType(""), m_tableName(""), m_columnNames(), m_subElements(){ }
ora::MappingElement::MappingElement | ( | const std::string & | elementType, |
const std::string & | variableName, | ||
const std::string & | variableType, | ||
const std::string & | tableName | ||
) |
Constructor.
Definition at line 254 of file MappingElement.cc.
References Dependency, elementTypeFromString(), m_elementType, and m_isDependentTree.
: m_elementType( Undefined ), m_isDependentTree(false), m_scopeName( "" ), m_variableName( variableName ), m_variableNameForSchema( "" ), m_variableType( variableType ), m_tableName( tableName ), m_columnNames(), m_subElements() { // Check here the element type m_elementType = elementTypeFromString( elementType ); if(m_elementType == Dependency) m_isDependentTree = true; }
ora::MappingElement::MappingElement | ( | const MappingElement & | element | ) | [inline] |
Definition at line 284 of file MappingElement.h.
: m_elementType(element.m_elementType), m_isDependentTree(element.m_isDependentTree), m_scopeName(element.m_scopeName), m_variableName(element.m_variableName), m_variableNameForSchema(element.m_variableNameForSchema), m_variableType(element.m_variableType), m_tableName(element.m_tableName), m_columnNames(element.m_columnNames), m_subElements(element.m_subElements){ }
ora::MappingElement::~MappingElement | ( | ) |
void ora::MappingElement::alterTableName | ( | const std::string & | tableName | ) |
Changes the name of the associated table and propagates the new information to the sub-elements. Note: It should be called before a call to setColumnNames.
tableName | The new table name |
Definition at line 412 of file MappingElement.cc.
References alterTableName(), begin, elementType(), and end.
Referenced by alterTableName().
{ if ( tableName == m_tableName ) return; for ( iterator iElement = this->begin(); iElement != this->end(); ++iElement ) { ora::MappingElement& subElement = iElement->second; if ( subElement.elementType() != Array && subElement.elementType() != CArray && subElement.elementType() != OraArray ) { subElement.alterTableName( tableName ); } } m_tableName = tableName; }
void ora::MappingElement::alterType | ( | const std::string & | elementType | ) |
Changes the type of the element and propagates the changes to the sub-elements accordingly Note: It should be called before a call to alterTableName and setColumnNames.
elementType | The new type |
Definition at line 387 of file MappingElement.cc.
References ora::throwException().
{ // Check here the element type if ( ! isValidMappingElementType( elementType ) ) { throwException( "\"" + elementType + "\" is not a supported mapping element type", "MappingElement::alterType"); } ElementType elementTypeCode = elementTypeFromString( elementType ); if(m_elementType != elementTypeCode){ m_elementType = elementTypeCode; // clear sub elements when no supported by the new type specified if ( ! ( m_elementType == Class || m_elementType == Object || m_elementType == Dependency || m_elementType == Array || m_elementType == CArray || m_elementType == InlineCArray || m_elementType == OraPointer || m_elementType == OraArray ) ) { m_subElements.clear(); } } }
ora::MappingElement & ora::MappingElement::appendSubElement | ( | const std::string & | elementType, |
const std::string & | variableName, | ||
const std::string & | variableType, | ||
const std::string & | tableName | ||
) |
Appends a new sub-element. In case the current element is not an object or an array, an ObjectRelationalException is thrown.
elementType | The element type |
variableName | The variable name |
variableType | The variable type |
tableName | The name of the associated table |
Definition at line 347 of file MappingElement.cc.
References elementTypeAsString(), m_isDependentTree, m_scopeName, and ora::throwException().
Referenced by ora::MappingDatabase::buildElement(), ora::ArrayMapping::process(), ora::OraReferenceMapping::process(), ora::OraPtrMapping::process(), ora::ObjectMapping::process(), ora::UniqueReferenceMapping::process(), ora::NamedRefMapping::process(), ora::CArrayMapping::process(), and ora::processLeafElement().
{ // Check whether the current element type supports other subelements if ( ! ( m_elementType == Class || m_elementType == Object || m_elementType == Dependency || m_elementType == Array || m_elementType == CArray || m_elementType == InlineCArray || m_elementType == OraPointer || m_elementType == OraArray ) ) { throwException( "Attempted to insert a sub-element under an element of type \"" + ora::MappingElement::elementTypeAsString( m_elementType ) + "\"", "MappingElement::appendSubElement" ); } if(m_subElements.find( variableName )!=m_subElements.end()){ throwException("Attribute name \""+variableName+"\" is already defined in the mapping element of variable \""+ m_variableName+"\".", "MappingElement::appendSubElement"); } MappingElement& newElement = m_subElements.insert( std::make_pair( variableName,ora::MappingElement( elementType, variableName, variableType, tableName ) ) ).first->second; newElement.m_isDependentTree = m_isDependentTree; if ( m_scopeName.empty() ) { newElement.m_scopeName = m_variableName; } else { newElement.m_scopeName = m_scopeName + "::" + m_variableName; } return newElement; }
std::string ora::MappingElement::arrayMappingElementType | ( | ) | [static] |
Returns the name of the array mapping element type.
Definition at line 36 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by ora::ArrayMapping::process().
{ static std::string s_arrayMappingElementType = "Array"; return s_arrayMappingElementType; }
ora::MappingElement::iterator ora::MappingElement::begin | ( | void | ) | [inline] |
Returns an iterator in the beginning of the sequence.
Definition at line 314 of file MappingElement.h.
Referenced by ora::deleteArrayElements(), ora::processTableHierarchy(), ora::scanElement(), and ora::MappingDatabase::unfoldElement().
{ return m_subElements.begin(); }
ora::MappingElement::const_iterator ora::MappingElement::begin | ( | void | ) | const [inline] |
Definition at line 320 of file MappingElement.h.
{ return m_subElements.begin(); }
std::string ora::MappingElement::blobMappingElementType | ( | ) | [static] |
Returns the name of the blob mapping element type.
Definition at line 99 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by ora::BlobMapping::process(), and ora::processLeafElement().
{ static std::string s_blobMappingElementType = "Blob"; return s_blobMappingElementType; }
std::string ora::MappingElement::CArrayMappingElementType | ( | ) | [static] |
Returns the name of the array mapping element type.
Definition at line 43 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by ora::CArrayMapping::process().
{ static std::string s_CArrayMappingElementType = "CArray"; return s_CArrayMappingElementType; }
std::string ora::MappingElement::classMappingElementType | ( | ) | [static] |
Returns the name of the class mapping element type.
Definition at line 8 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by ora::PoolMappingSchema::getMapping(), ora::MappingDatabase::getMappingByVersion(), and ora::MappingTree::setTopElement().
{ static std::string s_classMappingElementType = "Class"; return s_classMappingElementType; }
const std::vector< std::string > & ora::MappingElement::columnNames | ( | ) | const [inline] |
Returns the associated columns
Definition at line 397 of file MappingElement.h.
Referenced by ora::DependentClassReader::build(), ora::DependentClassWriter::build(), ora::MappingGenerator::createNewMapping(), ora::deleteArrayElements(), ora::WriteBuffer::flush(), ora::UpdateBuffer::flush(), ora::IteratorBuffer::IteratorBuffer(), override(), ora::ArrayMapping::process(), ora::OraPtrMapping::process(), ora::ObjectMapping::process(), ora::CArrayMapping::process(), ora::processTableHierarchy(), ora::ReadBuffer::ReadBuffer(), ora::scanElement(), ora::MappingTree::setDependency(), ora::QVQueryMaker::setQueryCondition(), and ora::MappingDatabase::unfoldElement().
{ return m_columnNames; }
std::string ora::MappingElement::dependencyMappingElementType | ( | ) | [static] |
Returns the name of the dependent class mapping element type.
Definition at line 22 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by ora::MappingDatabase::getMappingByVersion(), ora::PoolMappingSchema::getMappingVersionListForContainer(), and ora::MappingTree::setTopElement().
{ static std::string s_dependencyMappingElementType = "Dependency"; return s_dependencyMappingElementType; }
ora::MappingElement::ElementType ora::MappingElement::elementType | ( | ) | const [inline] |
Returns the element type
Definition at line 350 of file MappingElement.h.
Referenced by alterTableName(), ora::deleteArrayElements(), ora::RelationalStreamerFactory::newStreamer(), override(), ora::scanElement(), ora::QVQueryMaker::setQueryCondition(), and ora::MappingDatabase::unfoldElement().
{ return m_elementType; }
std::string ora::MappingElement::elementTypeAsString | ( | ElementType | elementType | ) | [static] |
Converts the enumeration type to a string.
Definition at line 133 of file MappingElement.cc.
References ora::throwException().
Referenced by appendSubElement(), override(), ora::QVQueryMaker::setQueryCondition(), and ora::MappingDatabase::unfoldElement().
{ switch ( elementType ) { case Class : return classMappingElementType(); break; case Object : return objectMappingElementType(); break; case Dependency : return dependencyMappingElementType(); break; case Primitive : return primitiveMappingElementType(); break; case Array : return arrayMappingElementType(); break; case CArray : return CArrayMappingElementType(); break; case InlineCArray : return inlineCArrayMappingElementType(); break; case OraReference : return OraReferenceMappingElementType(); break; case OraPointer : return OraPointerMappingElementType(); break; case UniqueReference : return uniqueReferenceMappingElementType(); break; case OraArray : return OraArrayMappingElementType(); break; case Reference : return referenceMappingElementType(); break; case Blob : return blobMappingElementType(); break; case NamedReference : return namedReferenceMappingElementType(); break; case Pointer : return pointerMappingElementType(); break; case Undefined : // This should never appear break; }; std::stringstream ms; ms <<"Undefined mapping element type code="<< elementType; throwException( ms.str(), "MappingElement::elementTypeAsString" ); return ""; }
ora::MappingElement::ElementType ora::MappingElement::elementTypeFromString | ( | const std::string & | elementType | ) | [static] |
Converts a string into an element type.
Definition at line 195 of file MappingElement.cc.
References query::result, and ora::throwException().
Referenced by MappingElement().
{ // Check here the element type if ( ! isValidMappingElementType( elementType ) ) { throwException( "\"" + elementType + "\" is not a supported mapping element type", "MappingElement::elementTypeFromString" ); } ora::MappingElement::ElementType result = Undefined; if ( elementType == classMappingElementType() ) { return Class; } if ( elementType == objectMappingElementType() ) { return Object; } if ( elementType == dependencyMappingElementType() ) { return Dependency; } if ( elementType == primitiveMappingElementType() ) { return Primitive; } else if ( elementType == arrayMappingElementType() ) { return Array; } else if ( elementType == CArrayMappingElementType() ) { return CArray; } else if ( elementType == inlineCArrayMappingElementType() ) { return InlineCArray; } else if ( elementType == pointerMappingElementType() ) { return Pointer; } else if ( elementType == referenceMappingElementType() ) { return Reference; } else if ( elementType == OraReferenceMappingElementType() ) { return OraReference; } else if ( elementType == OraPointerMappingElementType() ) { return OraPointer; } else if ( elementType == uniqueReferenceMappingElementType() ) { return UniqueReference; } else if ( elementType == OraArrayMappingElementType() ) { return OraArray; } else if ( elementType == blobMappingElementType() ) { return Blob; } else if ( elementType == namedReferenceMappingElementType() ) { return NamedReference; } return result; }
std::string ora::MappingElement::elementTypeString | ( | ) | const [inline] |
Definition at line 356 of file MappingElement.h.
{ return elementTypeAsString( m_elementType ); }
ora::MappingElement::iterator ora::MappingElement::end | ( | void | ) | [inline] |
Returns an iterator in the end of the sequence.
Definition at line 326 of file MappingElement.h.
Referenced by ora::DependentClassReader::build(), ora::DependentClassWriter::build(), ora::deleteArrayElements(), ora::WriteBuffer::flush(), ora::UpdateBuffer::flush(), override(), ora::processTableHierarchy(), ora::ReadBuffer::ReadBuffer(), ora::scanElement(), ora::QVQueryMaker::setQueryCondition(), and ora::MappingDatabase::unfoldElement().
{ return m_subElements.end(); }
ora::MappingElement::const_iterator ora::MappingElement::end | ( | void | ) | const [inline] |
Definition at line 332 of file MappingElement.h.
{ return m_subElements.end(); }
ora::MappingElement::const_iterator ora::MappingElement::find | ( | const std::string & | key | ) | const [inline] |
Definition at line 344 of file MappingElement.h.
{ return m_subElements.find( key ); }
ora::MappingElement::iterator ora::MappingElement::find | ( | const std::string & | key | ) | [inline] |
Retrieves a sub-element.
Definition at line 338 of file MappingElement.h.
Referenced by ora::DependentClassReader::build(), ora::DependentClassWriter::build(), ora::WriteBuffer::flush(), ora::UpdateBuffer::flush(), override(), ora::ReadBuffer::ReadBuffer(), and ora::QVQueryMaker::setQueryCondition().
{ return m_subElements.find( key ); }
std::string ora::MappingElement::idColumn | ( | ) | const |
Definition at line 305 of file MappingElement.cc.
References ora::throwException().
{ if( m_columnNames.empty() ) throwException( "No column names found in the mapping element.", "MappingElement::idColumn"); return m_columnNames.front(); }
std::string ora::MappingElement::inlineCArrayMappingElementType | ( | ) | [static] |
Returns the name of the inline array mapping element type.
Definition at line 50 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by ora::CArrayMapping::process().
{ static std::string s_inlineCArrayMappingElementType = "InlineCArray"; return s_inlineCArrayMappingElementType; }
bool ora::MappingElement::isDependent | ( | ) | const [inline] |
Returns the dependent flag
Definition at line 362 of file MappingElement.h.
{ return m_isDependentTree; }
bool ora::MappingElement::isValidMappingElementType | ( | const std::string & | elementType | ) | [static] |
Checks if the provided element type is valid.
Definition at line 113 of file MappingElement.cc.
{ return ( elementType == classMappingElementType() || elementType == objectMappingElementType() || elementType == dependencyMappingElementType() || elementType == primitiveMappingElementType() || elementType == arrayMappingElementType() || elementType == CArrayMappingElementType() || elementType == inlineCArrayMappingElementType() || elementType == OraReferenceMappingElementType() || elementType == OraPointerMappingElementType() || elementType == uniqueReferenceMappingElementType() || elementType == OraArrayMappingElementType() || elementType == pointerMappingElementType() || elementType == referenceMappingElementType() || elementType == blobMappingElementType() || elementType == namedReferenceMappingElementType() ); }
std::string ora::MappingElement::namedReferenceMappingElementType | ( | ) | [static] |
Returns the name of the named reference element type.
Definition at line 106 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by ora::NamedRefMapping::process().
{ static std::string s_namedReferenceMappingElementType = "NamedReference"; return s_namedReferenceMappingElementType; }
std::string ora::MappingElement::objectMappingElementType | ( | ) | [static] |
Returns the name of the object mapping element type.
Definition at line 15 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by ora::PoolMappingSchema::getMapping(), and ora::ObjectMapping::process().
{ static std::string s_objectMappingElementType = "Object"; return s_objectMappingElementType; }
ora::MappingElement & ora::MappingElement::operator= | ( | const MappingElement & | element | ) | [inline] |
Definition at line 297 of file MappingElement.h.
References m_columnNames, m_elementType, m_isDependentTree, m_scopeName, m_subElements, m_tableName, m_variableName, m_variableNameForSchema, and m_variableType.
{ if(this != &element){ m_elementType = element.m_elementType; m_isDependentTree = element.m_isDependentTree; m_scopeName = element.m_scopeName; m_variableName = element.m_variableName; m_variableNameForSchema = element.m_variableNameForSchema; m_variableType = element.m_variableType; m_tableName = element.m_tableName; m_columnNames = element.m_columnNames; m_subElements = element.m_subElements; } return *this; }
std::string ora::MappingElement::OraArrayMappingElementType | ( | ) | [static] |
Returns the name of the ORA array mapping element type.
Definition at line 78 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by ora::mappingTypeFromPool(), and ora::ArrayMapping::process().
{ static std::string s_oraArrayMappingElementType = "OraArray"; return s_oraArrayMappingElementType; }
std::string ora::MappingElement::OraPointerMappingElementType | ( | ) | [static] |
Returns the name of the ORA pointer mapping element type.
Definition at line 64 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by ora::OraPtrMapping::process().
{ static std::string s_oraPointerMappingElementType = "OraPointer"; return s_oraPointerMappingElementType; }
std::string ora::MappingElement::OraReferenceMappingElementType | ( | ) | [static] |
Returns the name of the ORA reference mapping element type.
Definition at line 57 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by ora::OraReferenceMapping::process().
{ static std::string s_oraReferenceMappingElementType = "OraReference"; return s_oraReferenceMappingElementType; }
void ora::MappingElement::override | ( | const MappingElement & | source | ) |
Definition at line 435 of file MappingElement.cc.
References begin, columnNames(), elementType(), elementTypeAsString(), end(), end, find(), tableName(), and variableType().
{ if(variableType()==source.variableType() || elementType()==source.elementType()) { alterType(MappingElement::elementTypeAsString(source.elementType())); alterTableName(source.tableName()); setColumnNames(source.columnNames()); for(iterator iel=begin(); iel!=end();++iel){ const_iterator iTarg = source.find(iel->first); if(iTarg!=source.end()){ iel->second.override(iTarg->second); } } } }
const MappingElement& ora::MappingElement::parentClassMappingElement | ( | ) | const |
Returns the parent class mapping element
std::string ora::MappingElement::pkColumn | ( | ) | const |
Definition at line 311 of file MappingElement.cc.
References ora::throwException().
{ size_t ind = 0; if( m_isDependentTree ) ind = 1; if( m_columnNames.size() < ind+1 ) throwException( "Column names not found as expected in the mapping element.", "MappingElement::idColumn"); return m_columnNames.at( ind ); }
std::string ora::MappingElement::pointerMappingElementType | ( | ) | [static] |
Returns the name of the pointer mapping element type.
Definition at line 85 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
{ static std::string s_pointerMappingElementType = "Pointer"; return s_pointerMappingElementType; }
std::string ora::MappingElement::posColumn | ( | ) | const |
Definition at line 337 of file MappingElement.cc.
References ora::throwException().
{ size_t ind = 0; if( m_isDependentTree ) ind = 1; if( m_columnNames.size() < ind+2 ) throwException( "Column names not found as expected in the mapping element.", "MappingElement::posColumn"); return m_columnNames.back(); }
std::string ora::MappingElement::primitiveMappingElementType | ( | ) | [static] |
Returns the name of the primitive mapping element type.
Definition at line 29 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by ora::PrimitiveMapping::process().
{ static std::string s_primitiveMappingElementType = "Primitive"; return s_primitiveMappingElementType; }
void ora::MappingElement::printXML | ( | std::ostream & | outputStream, |
std::string | indentation = "" |
||
) | const |
Definition at line 452 of file MappingElement.cc.
{ outputStream << indentation << "<"<<elementTypeString()<<" name=\""<<m_variableName<<"\" type=\""<<m_variableType<< "\" table=\""<<m_tableName<<"\""; if( !m_columnNames.empty()) { outputStream << " columns=\""; for( std::vector<std::string>::const_iterator iC=m_columnNames.begin(); iC != m_columnNames.end(); ++iC ){ if( iC != m_columnNames.begin() ) outputStream << ","; outputStream << *iC; } outputStream << "\""; } outputStream << " >"<< std::endl; for( std::map< std::string, MappingElement >::const_iterator iM = m_subElements.begin(); iM != m_subElements.end(); ++iM ){ iM->second.printXML( outputStream, indentation+" " ); } outputStream << indentation << "</"<<elementTypeString()<<">"<< std::endl; }
std::vector< std::string > ora::MappingElement::recordIdColumns | ( | ) | const |
Definition at line 320 of file MappingElement.cc.
References i, python::rootplot::argparse::message, run_regression::ret, and ora::throwException().
{ size_t ind = 0; if( m_isDependentTree ) ind = 1; size_t cols = m_columnNames.size(); if( cols < ind+2 ){ std::stringstream message; message <<"Column names for variable=\""<< m_variableName<<"\" of type=\""<<elementTypeAsString( m_elementType )<<"\" are not as expected."; throwException( message.str(), "MappingElement::recordIdColumns"); } std::vector<std::string> ret; for( size_t i=ind+1;i<cols;i++){ ret.push_back( m_columnNames[i] ); } return ret; }
std::string ora::MappingElement::referenceMappingElementType | ( | ) | [static] |
Returns the name of the reference mapping element type.
Definition at line 92 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
{ static std::string s_referenceMappingElementType = "Reference"; return s_referenceMappingElementType; }
bool ora::MappingElement::removeSubElement | ( | const std::string & | key | ) |
Remove a sub-element.
const std::string & ora::MappingElement::scopeName | ( | ) | const [inline] |
Returns the scope name
Definition at line 367 of file MappingElement.h.
Referenced by ora::MappingDatabase::unfoldElement().
{ return m_scopeName; }
void ora::MappingElement::setColumnNames | ( | const std::vector< std::string > & | columns | ) |
Sets the column names. It is propagated to objects having the same associated table.
columns | The names of the associated columns. |
Definition at line 429 of file MappingElement.cc.
Referenced by ora::MappingDatabase::buildElement(), ora::MappingGenerator::createNewDependentMapping(), ora::MappingGenerator::createNewMapping(), ora::MappingDatabase::getMappingByVersion(), ora::ArrayMapping::process(), ora::OraReferenceMapping::process(), ora::OraPtrMapping::process(), ora::ObjectMapping::process(), ora::UniqueReferenceMapping::process(), ora::NamedRefMapping::process(), ora::CArrayMapping::process(), and ora::processLeafElement().
{ m_columnNames = columns; if ( m_subElements.empty() ) return; }
std::vector< std::pair< std::string, std::string > > ora::MappingElement::tableHierarchy | ( | ) | const |
Returns the table names and their id columns
Definition at line 298 of file MappingElement.cc.
References ora::processTableHierarchy().
{ std::set<std::string> involvedTables; std::vector<std::pair<std::string,std::string> > tableList; processTableHierarchy( *this, involvedTables,tableList ); return tableList; }
const std::string & ora::MappingElement::tableName | ( | ) | const [inline] |
Returns the associated table name
Definition at line 391 of file MappingElement.h.
Referenced by ora::DependentClassReader::build(), ora::DependentClassWriter::build(), ora::MappingGenerator::createNewDependentMapping(), ora::deleteArrayElements(), ora::WriteBuffer::flush(), ora::UpdateBuffer::flush(), ora::ContainerSchema::getTableHierarchy(), override(), ora::ArrayMapping::process(), ora::OraReferenceMapping::process(), ora::OraPtrMapping::process(), ora::ObjectMapping::process(), ora::UniqueReferenceMapping::process(), ora::CArrayMapping::process(), ora::NamedRefMapping::process(), ora::processLeafElement(), ora::processTableHierarchy(), ora::scanElement(), ora::MappingTree::setDependency(), and ora::MappingDatabase::unfoldElement().
{ return m_tableName; }
std::string ora::MappingElement::uniqueReferenceMappingElementType | ( | ) | [static] |
Returns the name of the ORA polymorphic pointer mapping element type.
Definition at line 71 of file MappingElement.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by ora::UniqueReferenceMapping::process().
{ static std::string s_oraUniqueReferenceMappingElementType = "UniqueReference"; return s_oraUniqueReferenceMappingElementType; }
const std::string & ora::MappingElement::variableName | ( | ) | const [inline] |
Returns the variable name
Definition at line 373 of file MappingElement.h.
Referenced by ora::RelationalStreamerFactory::newStreamer(), ora::processTableHierarchy(), and ora::MappingDatabase::unfoldElement().
{ return m_variableName; }
const std::string & ora::MappingElement::variableNameForSchema | ( | ) | const [inline] |
Returns the variable name for the column-table name generation
Definition at line 379 of file MappingElement.h.
{ return m_variableNameForSchema; }
const std::string & ora::MappingElement::variableType | ( | ) | const [inline] |
Returns the variable C++ type
Definition at line 385 of file MappingElement.h.
Referenced by ora::ObjectStreamerBase::buildBaseDataMembers(), ora::ObjectStreamerBase::buildDataMembers(), ora::RelationalStreamerFactory::newStreamer(), override(), ora::scanElement(), and ora::MappingDatabase::unfoldElement().
{ return m_variableType; }
std::vector<std::string> ora::MappingElement::m_columnNames [private] |
The array of the names of the associated columns. For an object they are the ones defining its identity. A primitive is associated to a single column. For an ORA reference they are two columns corresponding to the two fields of the OID. For a pointer or a reference the first column is the referenced table and the rest refer to the identity columns of the target object. For an array the first column is the "position" column and the rest are the columns forming the foreign key constraint w.r.t. the parent table.
Definition at line 260 of file MappingElement.h.
Referenced by operator=().
The type of this mapping element.
Definition at line 220 of file MappingElement.h.
Referenced by MappingElement(), and operator=().
bool ora::MappingElement::m_isDependentTree [private] |
Flag to recursive mark the mapping trees of depending objects
Definition at line 224 of file MappingElement.h.
Referenced by appendSubElement(), MappingElement(), and operator=().
std::string ora::MappingElement::m_scopeName [private] |
The scope (parent of the given element). In case of top level classes it is an empty string. In case of a field under a top level class it is the fully qualified class name. If the element of the field defines a sub-element then their scope name is the "scope name of the parent" + "::" + "the field name" (m_variableName).
Definition at line 232 of file MappingElement.h.
Referenced by appendSubElement(), and operator=().
std::map< std::string, MappingElement > ora::MappingElement::m_subElements [private] |
The map of sub-elements.
Definition at line 265 of file MappingElement.h.
Referenced by operator=().
std::string ora::MappingElement::m_tableName [private] |
The name of the associated table. For an object it is where it's identity columns are defined. For a primitive and a ORA reference, a reference or a pointer it is the table of the parent object. For an array it is the table where the array elements are stored.
Definition at line 251 of file MappingElement.h.
Referenced by operator=().
std::string ora::MappingElement::m_variableName [private] |
For a top level class this is the same as m_variableType. For a field in a class it is the name of the field itself. For an element in an array, it is the same as the m_variableType.
Definition at line 237 of file MappingElement.h.
Referenced by operator=().
std::string ora::MappingElement::m_variableNameForSchema [private] |
The variable name used for the column-table name generation.
Definition at line 241 of file MappingElement.h.
Referenced by operator=().
std::string ora::MappingElement::m_variableType [private] |
The C++ type of the element.
Definition at line 245 of file MappingElement.h.
Referenced by operator=().