#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. More... | |
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) |
iterator | begin () |
Returns an iterator in the beginning of the sequence. More... | |
const_iterator | begin () const |
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. More... | |
const_iterator | end () const |
iterator | find (const std::string &key) |
Retrieves a sub-element. More... | |
const_iterator | find (const std::string &key) const |
std::string | idColumn () const |
bool | isDependent () const |
MappingElement () | |
Empty Constructor. More... | |
MappingElement (const std::string &elementType, const std::string &variableName, const std::string &variableType, const std::string &tableName) | |
Constructor. More... | |
MappingElement (const MappingElement &element) | |
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. More... | |
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. More... | |
Static Public Member Functions | |
static std::string | arrayMappingElementType () |
Returns the name of the array mapping element type. More... | |
static std::string | blobMappingElementType () |
Returns the name of the blob mapping element type. More... | |
static std::string | CArrayMappingElementType () |
Returns the name of the array mapping element type. More... | |
static std::string | classMappingElementType () |
Returns the name of the class mapping element type. More... | |
static std::string | dependencyMappingElementType () |
Returns the name of the dependent class mapping element type. More... | |
static std::string | elementTypeAsString (ElementType elementType) |
Converts the enumeration type to a string. More... | |
static ElementType | elementTypeFromString (const std::string &elementType) |
Converts a string into an element type. More... | |
static std::string | inlineCArrayMappingElementType () |
Returns the name of the inline array mapping element type. More... | |
static bool | isValidMappingElementType (const std::string &elementType) |
Checks if the provided element type is valid. More... | |
static std::string | namedReferenceMappingElementType () |
Returns the name of the named reference element type. More... | |
static std::string | objectMappingElementType () |
Returns the name of the object mapping element type. More... | |
static std::string | OraArrayMappingElementType () |
Returns the name of the ORA array mapping element type. More... | |
static std::string | OraPointerMappingElementType () |
Returns the name of the ORA pointer mapping element type. More... | |
static std::string | OraReferenceMappingElementType () |
Returns the name of the ORA reference mapping element type. More... | |
static std::string | pointerMappingElementType () |
Returns the name of the pointer mapping element type. More... | |
static std::string | primitiveMappingElementType () |
Returns the name of the primitive mapping element type. More... | |
static std::string | referenceMappingElementType () |
Returns the name of the reference mapping element type. More... | |
static std::string | uniqueReferenceMappingElementType () |
Returns the name of the ORA polymorphic pointer mapping element type. More... | |
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.
Enumerator | |
---|---|
Undefined | |
Class | |
Object | |
Dependency | |
Primitive | |
Array | |
CArray | |
InlineCArray | |
Pointer | |
Reference | |
OraReference | |
OraPointer | |
UniqueReference | |
OraArray | |
Blob | |
NamedReference |
Definition at line 21 of file MappingElement.h.
|
inline |
Empty Constructor.
Definition at line 271 of file MappingElement.h.
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.
|
inline |
Definition at line 284 of file MappingElement.h.
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().
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().
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::OraReferenceMapping::process(), ora::UniqueReferenceMapping::process(), ora::OraPtrMapping::process(), ora::NamedRefMapping::process(), ora::ArrayMapping::process(), ora::CArrayMapping::process(), ora::ObjectMapping::process(), and ora::processLeafElement().
|
static |
Returns the name of the array mapping element type.
Definition at line 36 of file MappingElement.cc.
Referenced by ora::ArrayMapping::process().
|
inline |
Returns an iterator in the beginning of the sequence.
Definition at line 314 of file MappingElement.h.
Referenced by ora::deleteArrayElements(), ora::getTableHierarchyFromMappingElement(), ora::processTableHierarchy(), ora::scanElement(), and ora::MappingDatabase::unfoldElement().
|
inline |
Definition at line 320 of file MappingElement.h.
|
static |
Returns the name of the blob mapping element type.
Definition at line 99 of file MappingElement.cc.
Referenced by ora::BlobMapping::process(), and ora::processLeafElement().
|
static |
Returns the name of the array mapping element type.
Definition at line 43 of file MappingElement.cc.
Referenced by ora::CArrayMapping::process().
|
static |
Returns the name of the class mapping element type.
Definition at line 8 of file MappingElement.cc.
Referenced by ora::PoolMappingSchema::getMapping(), ora::MappingDatabase::getMappingByVersion(), and ora::MappingTree::setTopElement().
|
inline |
Returns the associated columns
Definition at line 397 of file MappingElement.h.
Referenced by ora::DependentClassWriter::build(), ora::OraPtrReadBuffer::build(), ora::DependentClassReader::build(), ora::MappingGenerator::createNewMapping(), ora::deleteArrayElements(), ora::WriteBuffer::flush(), ora::UpdateBuffer::flush(), ora::IteratorBuffer::IteratorBuffer(), override(), ora::OraPtrMapping::process(), ora::ArrayMapping::process(), ora::CArrayMapping::process(), ora::ObjectMapping::process(), ora::processTableHierarchy(), ora::ReadBuffer::ReadBuffer(), ora::scanElement(), ora::MappingTree::setDependency(), ora::QVQueryMaker::setQueryCondition(), and ora::MappingDatabase::unfoldElement().
|
static |
Returns the name of the dependent class mapping element type.
Definition at line 22 of file MappingElement.cc.
Referenced by ora::MappingDatabase::getMappingByVersion(), ora::PoolMappingSchema::getMappingVersionListForContainer(), and ora::MappingTree::setTopElement().
|
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().
|
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().
|
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().
|
inline |
Definition at line 356 of file MappingElement.h.
|
inline |
Returns an iterator in the end of the sequence.
Definition at line 326 of file MappingElement.h.
Referenced by ora::DependentClassWriter::build(), ora::OraPtrReadBuffer::build(), ora::QVQueryMaker::build(), ora::DependentClassReader::build(), Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), ora::deleteArrayElements(), ora::WriteBuffer::flush(), ora::UpdateBuffer::flush(), ora::getTableHierarchyFromMappingElement(), override(), ora::processTableHierarchy(), ora::ReadBuffer::ReadBuffer(), ora::scanElement(), ora::QVQueryMaker::setQueryCondition(), and ora::MappingDatabase::unfoldElement().
|
inline |
Definition at line 332 of file MappingElement.h.
Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().
|
inline |
Retrieves a sub-element.
Definition at line 338 of file MappingElement.h.
Referenced by BeautifulSoup.Tag::__getattr__(), ora::DependentClassWriter::build(), ora::OraPtrReadBuffer::build(), ora::QVQueryMaker::build(), ora::DependentClassReader::build(), BeautifulSoup.Tag::firstText(), ora::WriteBuffer::flush(), ora::UpdateBuffer::flush(), override(), ora::ReadBuffer::ReadBuffer(), and ora::QVQueryMaker::setQueryCondition().
|
inline |
Definition at line 344 of file MappingElement.h.
Referenced by BeautifulSoup.Tag::__getattr__(), and BeautifulSoup.Tag::firstText().
std::string ora::MappingElement::idColumn | ( | ) | const |
Definition at line 305 of file MappingElement.cc.
References ora::throwException().
|
static |
Returns the name of the inline array mapping element type.
Definition at line 50 of file MappingElement.cc.
Referenced by ora::CArrayMapping::process().
|
inline |
|
static |
Checks if the provided element type is valid.
Definition at line 113 of file MappingElement.cc.
|
static |
Returns the name of the named reference element type.
Definition at line 106 of file MappingElement.cc.
Referenced by ora::NamedRefMapping::process().
|
static |
Returns the name of the object mapping element type.
Definition at line 15 of file MappingElement.cc.
Referenced by ora::PoolMappingSchema::getMapping(), and ora::ObjectMapping::process().
|
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.
|
static |
Returns the name of the ORA array mapping element type.
Definition at line 78 of file MappingElement.cc.
Referenced by ora::mappingTypeFromPool(), and ora::ArrayMapping::process().
|
static |
Returns the name of the ORA pointer mapping element type.
Definition at line 64 of file MappingElement.cc.
Referenced by ora::OraPtrMapping::process().
|
static |
Returns the name of the ORA reference mapping element type.
Definition at line 57 of file MappingElement.cc.
Referenced by ora::OraReferenceMapping::process().
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().
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().
Referenced by ora::QVQueryMaker::build(), ora::QVQueryMaker::select(), and ora::QVQueryMaker::selectionCount().
|
static |
Returns the name of the pointer mapping element type.
Definition at line 85 of file MappingElement.cc.
std::string ora::MappingElement::posColumn | ( | ) | const |
Definition at line 337 of file MappingElement.cc.
References ora::throwException().
Referenced by ora::QVQueryMaker::executeAndLoad().
|
static |
Returns the name of the primitive mapping element type.
Definition at line 29 of file MappingElement.cc.
Referenced by ora::PrimitiveMapping::process().
void ora::MappingElement::printXML | ( | std::ostream & | outputStream, |
std::string | indentation = "" |
||
) | const |
Definition at line 452 of file MappingElement.cc.
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().
Referenced by ora::QVQueryMaker::build(), and ora::QVQueryMaker::selectionCount().
|
static |
Returns the name of the reference mapping element type.
Definition at line 92 of file MappingElement.cc.
bool ora::MappingElement::removeSubElement | ( | const std::string & | key | ) |
Remove a sub-element.
|
inline |
Returns the scope name
Definition at line 367 of file MappingElement.h.
Referenced by ora::MappingDatabase::unfoldElement().
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::OraReferenceMapping::process(), ora::UniqueReferenceMapping::process(), ora::OraPtrMapping::process(), ora::NamedRefMapping::process(), ora::ArrayMapping::process(), ora::CArrayMapping::process(), ora::ObjectMapping::process(), and ora::processLeafElement().
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().
|
inline |
Returns the associated table name
Definition at line 391 of file MappingElement.h.
Referenced by ora::DependentClassWriter::build(), ora::QVQueryMaker::build(), ora::DependentClassReader::build(), ora::MappingGenerator::createNewDependentMapping(), ora::deleteArrayElements(), ora::WriteBuffer::flush(), ora::UpdateBuffer::flush(), ora::ContainerSchema::getTableHierarchy(), ora::getTableHierarchyFromMappingElement(), override(), ora::OraReferenceMapping::process(), ora::UniqueReferenceMapping::process(), ora::OraPtrMapping::process(), ora::NamedRefMapping::process(), ora::ArrayMapping::process(), ora::CArrayMapping::process(), ora::ObjectMapping::process(), ora::processLeafElement(), ora::processTableHierarchy(), ora::scanElement(), ora::QVQueryMaker::selectionCount(), ora::MappingTree::setDependency(), and ora::MappingDatabase::unfoldElement().
|
static |
Returns the name of the ORA polymorphic pointer mapping element type.
Definition at line 71 of file MappingElement.cc.
Referenced by ora::UniqueReferenceMapping::process().
|
inline |
Returns the variable name
Definition at line 373 of file MappingElement.h.
Referenced by ora::RelationalStreamerFactory::newStreamer(), ora::processTableHierarchy(), and ora::MappingDatabase::unfoldElement().
|
inline |
Returns the variable name for the column-table name generation
Definition at line 379 of file MappingElement.h.
|
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().
|
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=().
|
private |
The type of this mapping element.
Definition at line 220 of file MappingElement.h.
Referenced by MappingElement(), and operator=().
|
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=().
|
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=().
|
private |
The map of sub-elements.
Definition at line 265 of file MappingElement.h.
Referenced by operator=().
|
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=().
|
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=().
|
private |
The variable name used for the column-table name generation.
Definition at line 241 of file MappingElement.h.
Referenced by operator=().
|
private |
The C++ type of the element.
Definition at line 245 of file MappingElement.h.
Referenced by operator=().