CMS 3D CMS Logo

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

#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)
 
MappingElementappendSubElement (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)
 
MappingElementoperator= (const MappingElement &element)
 
void override (const MappingElement &source)
 
const MappingElementparentClassMappingElement () 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
 

Detailed Description

Class describing an element of the object-relational mapping structure.

Definition at line 18 of file MappingElement.h.

Member Typedef Documentation

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.

Member Enumeration Documentation

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.

Constructor & Destructor Documentation

ora::MappingElement::MappingElement ( )
inline

Empty Constructor.

Definition at line 271 of file MappingElement.h.

271  :
273  m_isDependentTree(false),
274  m_scopeName(""),
275  m_variableName(""),
277  m_variableType(""),
278  m_tableName(""),
279  m_columnNames(),
280  m_subElements(){
281 }
std::string m_variableName
std::map< std::string, MappingElement > m_subElements
std::string m_variableNameForSchema
std::vector< std::string > m_columnNames
std::string m_scopeName
std::string m_variableType
std::string m_tableName
ElementType m_elementType
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.

257  :
259  m_isDependentTree(false),
260  m_scopeName( "" ),
265  m_columnNames(),
266  m_subElements()
267 {
268  // Check here the element type
271 }
std::string m_variableName
const std::string & variableName() const
std::map< std::string, MappingElement > m_subElements
std::string m_variableNameForSchema
ElementType elementType() const
std::vector< std::string > m_columnNames
const std::string & variableType() const
static ElementType elementTypeFromString(const std::string &elementType)
Converts a string into an element type.
std::string m_scopeName
const std::string & tableName() const
std::string m_variableType
std::string m_tableName
ElementType m_elementType
ora::MappingElement::MappingElement ( const MappingElement element)
inline

Definition at line 284 of file MappingElement.h.

284  :
285  m_elementType(element.m_elementType),
286  m_isDependentTree(element.m_isDependentTree),
287  m_scopeName(element.m_scopeName),
288  m_variableName(element.m_variableName),
289  m_variableNameForSchema(element.m_variableNameForSchema),
290  m_variableType(element.m_variableType),
291  m_tableName(element.m_tableName),
292  m_columnNames(element.m_columnNames),
293  m_subElements(element.m_subElements){
294 }
std::string m_variableName
std::map< std::string, MappingElement > m_subElements
std::string m_variableNameForSchema
std::vector< std::string > m_columnNames
std::string m_scopeName
std::string m_variableType
std::string m_tableName
ElementType m_elementType
ora::MappingElement::~MappingElement ( )

Destructor.

Definition at line 273 of file MappingElement.cc.

273  {
274 }

Member Function Documentation

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.

Parameters
tableNameThe new table name

Definition at line 412 of file MappingElement.cc.

References alterTableName(), begin, elementType(), end, and HLT_25ns10e33_v2_cff::tableName.

Referenced by alterTableName().

413 {
414  if ( tableName == m_tableName ) return;
415 
416  for ( iterator iElement = this->begin();
417  iElement != this->end(); ++iElement ) {
418  ora::MappingElement& subElement = iElement->second;
419  if ( subElement.elementType() != Array &&
420  subElement.elementType() != CArray &&
421  subElement.elementType() != OraArray ) {
422  subElement.alterTableName( tableName );
423  }
424  }
426 }
ElementType elementType() const
void alterTableName(const std::string &tableName)
iterator begin()
Returns an iterator in the beginning of the sequence.
std::map< std::string, MappingElement >::iterator iterator
Iterator definition.
iterator end()
Returns an iterator in the end of the sequence.
const std::string & tableName() const
std::string m_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.

Parameters
elementTypeThe new type

Definition at line 387 of file MappingElement.cc.

References ora::throwException().

388 {
389  // Check here the element type
391  throwException( "\"" + elementType + "\" is not a supported mapping element type",
392  "MappingElement::alterType");
393  }
394  ElementType elementTypeCode = elementTypeFromString( elementType );
395  if(m_elementType != elementTypeCode){
396  m_elementType = elementTypeCode;
397  // clear sub elements when no supported by the new type specified
398  if ( ! ( m_elementType == Class ||
399  m_elementType == Object ||
401  m_elementType == Array ||
402  m_elementType == CArray ||
405  m_elementType == OraArray ) ) {
406  m_subElements.clear();
407  }
408  }
409 }
std::map< std::string, MappingElement > m_subElements
ElementType elementType() const
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
static ElementType elementTypeFromString(const std::string &elementType)
Converts a string into an element type.
static bool isValidMappingElementType(const std::string &elementType)
Checks if the provided element type is valid.
ElementType m_elementType
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.

Parameters
elementTypeThe element type
variableNameThe variable name
variableTypeThe variable type
tableNameThe 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().

351 {
352  // Check whether the current element type supports other subelements
353  if ( ! ( m_elementType == Class ||
354  m_elementType == Object ||
356  m_elementType == Array ||
357  m_elementType == CArray ||
360  m_elementType == OraArray ) ) {
361  throwException( "Attempted to insert a sub-element under an element of type \"" +
363  "MappingElement::appendSubElement" );
364  }
365  if(m_subElements.find( variableName )!=m_subElements.end()){
366  throwException("Attribute name \""+variableName+"\" is already defined in the mapping element of variable \""+
367  m_variableName+"\".",
368  "MappingElement::appendSubElement");
369  }
370 
371  MappingElement& newElement =
373  variableName,
374  variableType,
375  tableName ) ) ).first->second;
376  newElement.m_isDependentTree = m_isDependentTree;
377  if ( m_scopeName.empty() ) {
378  newElement.m_scopeName = m_variableName;
379  } else {
380  newElement.m_scopeName = m_scopeName + "::" + m_variableName;
381  }
382 
383  return newElement;
384 }
std::string m_variableName
const std::string & variableName() const
std::map< std::string, MappingElement > m_subElements
ElementType elementType() const
MappingElement()
Empty Constructor.
static std::string elementTypeAsString(ElementType elementType)
Converts the enumeration type to a string.
const std::string & variableType() const
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
std::string m_scopeName
const std::string & tableName() const
ElementType m_elementType
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().

37 {
38  static const std::string s_arrayMappingElementType = "Array";
39  return s_arrayMappingElementType;
40 }
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::getTableHierarchyFromMappingElement(), ora::processTableHierarchy(), ora::scanElement(), and ora::MappingDatabase::unfoldElement().

315 {
316  return m_subElements.begin();
317 }
std::map< std::string, MappingElement > m_subElements
ora::MappingElement::const_iterator ora::MappingElement::begin ( void  ) const
inline

Definition at line 320 of file MappingElement.h.

321 {
322  return m_subElements.begin();
323 }
std::map< std::string, MappingElement > m_subElements
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().

100 {
101  static const std::string s_blobMappingElementType = "Blob";
102  return s_blobMappingElementType;
103 }
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().

44 {
45  static const std::string s_CArrayMappingElementType = "CArray";
46  return s_CArrayMappingElementType;
47 }
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().

9 {
10  static const std::string s_classMappingElementType = "Class";
11  return s_classMappingElementType;
12 }
const std::vector< std::string > & ora::MappingElement::columnNames ( ) const
inline
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().

23 {
24  static const std::string s_dependencyMappingElementType = "Dependency";
25  return s_dependencyMappingElementType;
26 }
ora::MappingElement::ElementType ora::MappingElement::elementType ( ) const
inline
std::string ora::MappingElement::elementTypeAsString ( ElementType  elementType)
static

Converts the enumeration type to a string.

Definition at line 133 of file MappingElement.cc.

References AnalysisDataFormats_SUSYBSMObjects::ms, and ora::throwException().

Referenced by appendSubElement(), override(), ora::QVQueryMaker::setQueryCondition(), and ora::MappingDatabase::unfoldElement().

134 {
135  switch ( elementType ) {
136  case Class :
137  return classMappingElementType();
138  break;
139  case Object :
140  return objectMappingElementType();
141  break;
142  case Dependency :
144  break;
145  case Primitive :
147  break;
148  case Array :
149  return arrayMappingElementType();
150  break;
151  case CArray :
152  return CArrayMappingElementType();
153  break;
154  case InlineCArray :
156  break;
157  case OraReference :
159  break;
160  case OraPointer :
162  break;
163  case UniqueReference :
165  break;
166  case OraArray :
168  break;
169  case Reference :
171  break;
172  case Blob :
173  return blobMappingElementType();
174  break;
175  case NamedReference :
177  break;
178  case Pointer :
179  return pointerMappingElementType();
180  break;
181  case Undefined :
182  // This should never appear
183  break;
184  };
185 
186  std::stringstream ms;
187  ms <<"Undefined mapping element type code="<< elementType;
188  throwException( ms.str(),
189  "MappingElement::elementTypeAsString" );
190  return "";
191 }
static std::string namedReferenceMappingElementType()
Returns the name of the named reference element type.
static std::string blobMappingElementType()
Returns the name of the blob mapping element type.
static std::string arrayMappingElementType()
Returns the name of the array mapping element type.
static std::string primitiveMappingElementType()
Returns the name of the primitive mapping element type.
static std::string dependencyMappingElementType()
Returns the name of the dependent class mapping element type.
static std::string OraReferenceMappingElementType()
Returns the name of the ORA reference mapping element type.
ElementType elementType() const
static std::string pointerMappingElementType()
Returns the name of the pointer mapping element type.
static std::string objectMappingElementType()
Returns the name of the object mapping element type.
static std::string uniqueReferenceMappingElementType()
Returns the name of the ORA polymorphic pointer mapping element type.
static std::string referenceMappingElementType()
Returns the name of the reference mapping element type.
static std::string inlineCArrayMappingElementType()
Returns the name of the inline array mapping element type.
susybsm::MuonSegment ms
Definition: classes.h:31
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
static std::string OraPointerMappingElementType()
Returns the name of the ORA pointer mapping element type.
static std::string OraArrayMappingElementType()
Returns the name of the ORA array mapping element type.
static std::string classMappingElementType()
Returns the name of the class mapping element type.
static std::string CArrayMappingElementType()
Returns the name of the array mapping element type.
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 mps_fire::result, and ora::throwException().

Referenced by MappingElement().

196 {
197  // Check here the element type
199  throwException( "\"" + elementType + "\" is not a supported mapping element type",
200  "MappingElement::elementTypeFromString" );
201  }
202 
204 
206  return Class;
207  }
209  return Object;
210  }
212  return Dependency;
213  }
215  return Primitive;
216  }
217  else if ( elementType == arrayMappingElementType() ) {
218  return Array;
219  }
220  else if ( elementType == CArrayMappingElementType() ) {
221  return CArray;
222  }
224  return InlineCArray;
225  }
226  else if ( elementType == pointerMappingElementType() ) {
227  return Pointer;
228  }
229  else if ( elementType == referenceMappingElementType() ) {
230  return Reference;
231  }
233  return OraReference;
234  }
235  else if ( elementType == OraPointerMappingElementType() ) {
236  return OraPointer;
237  }
239  return UniqueReference;
240  }
241  else if ( elementType == OraArrayMappingElementType() ) {
242  return OraArray;
243  }
244  else if ( elementType == blobMappingElementType() ) {
245  return Blob;
246  }
248  return NamedReference;
249  }
250 
251  return result;
252 }
static std::string namedReferenceMappingElementType()
Returns the name of the named reference element type.
static std::string blobMappingElementType()
Returns the name of the blob mapping element type.
static std::string arrayMappingElementType()
Returns the name of the array mapping element type.
static std::string primitiveMappingElementType()
Returns the name of the primitive mapping element type.
static std::string dependencyMappingElementType()
Returns the name of the dependent class mapping element type.
static std::string OraReferenceMappingElementType()
Returns the name of the ORA reference mapping element type.
ElementType elementType() const
tuple result
Definition: mps_fire.py:84
static std::string pointerMappingElementType()
Returns the name of the pointer mapping element type.
static std::string objectMappingElementType()
Returns the name of the object mapping element type.
static std::string uniqueReferenceMappingElementType()
Returns the name of the ORA polymorphic pointer mapping element type.
static std::string referenceMappingElementType()
Returns the name of the reference mapping element type.
static std::string inlineCArrayMappingElementType()
Returns the name of the inline array mapping element type.
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
static std::string OraPointerMappingElementType()
Returns the name of the ORA pointer mapping element type.
static std::string OraArrayMappingElementType()
Returns the name of the ORA array mapping element type.
static bool isValidMappingElementType(const std::string &elementType)
Checks if the provided element type is valid.
static std::string classMappingElementType()
Returns the name of the class mapping element type.
static std::string CArrayMappingElementType()
Returns the name of the array mapping element type.
std::string ora::MappingElement::elementTypeString ( ) const
inline

Definition at line 356 of file MappingElement.h.

357 {
359 }
static std::string elementTypeAsString(ElementType elementType)
Converts the enumeration type to a string.
ElementType m_elementType
ora::MappingElement::iterator ora::MappingElement::end ( void  )
inline
ora::MappingElement::const_iterator ora::MappingElement::end ( void  ) const
inline

Definition at line 332 of file MappingElement.h.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

333 {
334  return m_subElements.end();
335 }
std::map< std::string, MappingElement > m_subElements
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 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().

339 {
340  return m_subElements.find( key );
341 }
std::map< std::string, MappingElement > m_subElements
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
ora::MappingElement::const_iterator ora::MappingElement::find ( const std::string &  key) const
inline

Definition at line 344 of file MappingElement.h.

Referenced by BeautifulSoup.Tag::__getattr__(), and BeautifulSoup.Tag::firstText().

345 {
346  return m_subElements.find( key );
347 }
std::map< std::string, MappingElement > m_subElements
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
std::string ora::MappingElement::idColumn ( ) const

Definition at line 305 of file MappingElement.cc.

References ora::throwException().

305  {
306  if( m_columnNames.empty() ) throwException( "No column names found in the mapping element.",
307  "MappingElement::idColumn");
308  return m_columnNames.front();
309 }
std::vector< std::string > m_columnNames
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
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().

51 {
52  static const std::string s_inlineCArrayMappingElementType = "InlineCArray";
53  return s_inlineCArrayMappingElementType;
54 }
bool ora::MappingElement::isDependent ( ) const
inline

Returns the dependent flag

Definition at line 362 of file MappingElement.h.

362  {
363  return m_isDependentTree;
364 }
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.

114 {
115  return ( elementType == classMappingElementType() ||
130 }
static std::string namedReferenceMappingElementType()
Returns the name of the named reference element type.
static std::string blobMappingElementType()
Returns the name of the blob mapping element type.
static std::string arrayMappingElementType()
Returns the name of the array mapping element type.
static std::string primitiveMappingElementType()
Returns the name of the primitive mapping element type.
static std::string dependencyMappingElementType()
Returns the name of the dependent class mapping element type.
static std::string OraReferenceMappingElementType()
Returns the name of the ORA reference mapping element type.
ElementType elementType() const
static std::string pointerMappingElementType()
Returns the name of the pointer mapping element type.
static std::string objectMappingElementType()
Returns the name of the object mapping element type.
static std::string uniqueReferenceMappingElementType()
Returns the name of the ORA polymorphic pointer mapping element type.
static std::string referenceMappingElementType()
Returns the name of the reference mapping element type.
static std::string inlineCArrayMappingElementType()
Returns the name of the inline array mapping element type.
static std::string OraPointerMappingElementType()
Returns the name of the ORA pointer mapping element type.
static std::string OraArrayMappingElementType()
Returns the name of the ORA array mapping element type.
static std::string classMappingElementType()
Returns the name of the class mapping element type.
static std::string CArrayMappingElementType()
Returns the name of the array mapping element type.
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().

107 {
108  static const std::string s_namedReferenceMappingElementType = "NamedReference";
109  return s_namedReferenceMappingElementType;
110 }
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().

16 {
17  static const std::string s_objectMappingElementType = "Object";
18  return s_objectMappingElementType;
19 }
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.

297  {
298  if(this != &element){
299  m_elementType = element.m_elementType;
300  m_isDependentTree = element.m_isDependentTree;
301  m_scopeName = element.m_scopeName;
302  m_variableName = element.m_variableName;
303  m_variableNameForSchema = element.m_variableNameForSchema;
304  m_variableType = element.m_variableType;
305  m_tableName = element.m_tableName;
306  m_columnNames = element.m_columnNames;
307  m_subElements = element.m_subElements;
308  }
309  return *this;
310 }
std::string m_variableName
std::map< std::string, MappingElement > m_subElements
std::string m_variableNameForSchema
std::vector< std::string > m_columnNames
std::string m_scopeName
std::string m_variableType
std::string m_tableName
ElementType m_elementType
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().

79 {
80  static const std::string s_oraArrayMappingElementType = "OraArray";
81  return s_oraArrayMappingElementType;
82 }
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().

65 {
66  static const std::string s_oraPointerMappingElementType = "OraPointer";
67  return s_oraPointerMappingElementType;
68 }
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().

58 {
59  static const std::string s_oraReferenceMappingElementType = "OraReference";
60  return s_oraReferenceMappingElementType;
61 }
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().

435  {
436  if(variableType()==source.variableType() || elementType()==source.elementType())
437  {
439  alterTableName(source.tableName());
440  setColumnNames(source.columnNames());
441  for(iterator iel=begin();
442  iel!=end();++iel){
443  const_iterator iTarg = source.find(iel->first);
444  if(iTarg!=source.end()){
445  iel->second.override(iTarg->second);
446  }
447  }
448  }
449 
450 }
ElementType elementType() const
void alterTableName(const std::string &tableName)
iterator begin()
Returns an iterator in the beginning of the sequence.
void alterType(const std::string &elementType)
static std::string elementTypeAsString(ElementType elementType)
Converts the enumeration type to a string.
std::map< std::string, MappingElement >::iterator iterator
Iterator definition.
const std::string & variableType() const
std::map< std::string, MappingElement >::const_iterator const_iterator
iterator end()
Returns an iterator in the end of the sequence.
static std::string const source
Definition: EdmProvDump.cc:43
void setColumnNames(const std::vector< std::string > &columns)
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().

311  {
312  size_t ind = 0;
313  if( m_isDependentTree ) ind = 1;
314  if( m_columnNames.size() < ind+1 )
315  throwException( "Column names not found as expected in the mapping element.",
316  "MappingElement::idColumn");
317  return m_columnNames.at( ind );
318 }
std::vector< std::string > m_columnNames
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
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.

86 {
87  static const std::string s_pointerMappingElementType = "Pointer";
88  return s_pointerMappingElementType;
89 }
std::string ora::MappingElement::posColumn ( ) const

Definition at line 337 of file MappingElement.cc.

References ora::throwException().

Referenced by ora::QVQueryMaker::executeAndLoad().

337  {
338  size_t ind = 0;
339  if( m_isDependentTree ) ind = 1;
340  if( m_columnNames.size() < ind+2 )
341  throwException( "Column names not found as expected in the mapping element.",
342  "MappingElement::posColumn");
343  return m_columnNames.back();
344 }
std::vector< std::string > m_columnNames
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
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().

30 {
31  static const std::string s_primitiveMappingElementType = "Primitive";
32  return s_primitiveMappingElementType;
33 }
void ora::MappingElement::printXML ( std::ostream &  outputStream,
std::string  indentation = "" 
) const

Definition at line 452 of file MappingElement.cc.

452  {
453  outputStream << indentation << "<"<<elementTypeString()<<" name=\""<<m_variableName<<"\" type=\""<<m_variableType<<
454  "\" table=\""<<m_tableName<<"\"";
455  if( !m_columnNames.empty()) {
456  outputStream << " columns=\"";
457  for( std::vector<std::string>::const_iterator iC=m_columnNames.begin(); iC != m_columnNames.end(); ++iC ){
458  if( iC != m_columnNames.begin() ) outputStream << ",";
459  outputStream << *iC;
460  }
461  outputStream << "\"";
462  }
463  outputStream << " >"<< std::endl;
464  for( std::map< std::string, MappingElement >::const_iterator iM = m_subElements.begin();
465  iM != m_subElements.end(); ++iM ){
466  iM->second.printXML( outputStream, indentation+" " );
467  }
468  outputStream << indentation << "</"<<elementTypeString()<<">"<< std::endl;
469 }
std::string m_variableName
std::map< std::string, MappingElement > m_subElements
std::vector< std::string > m_columnNames
std::string elementTypeString() const
std::string m_variableType
std::string m_tableName
std::vector< std::string > ora::MappingElement::recordIdColumns ( ) const

Definition at line 320 of file MappingElement.cc.

References i, python.rootplot.argparse::message, runTheMatrix::ret, and ora::throwException().

Referenced by ora::QVQueryMaker::build(), and ora::QVQueryMaker::selectionCount().

320  {
321  size_t ind = 0;
322  if( m_isDependentTree ) ind = 1;
323  size_t cols = m_columnNames.size();
324  if( cols < ind+2 ){
325  std::stringstream message;
326  message <<"Column names for variable=\""<< m_variableName<<"\" of type=\""<<elementTypeAsString( m_elementType )<<"\" are not as expected.";
327  throwException( message.str(),
328  "MappingElement::recordIdColumns");
329  }
330  std::vector<std::string> ret;
331  for( size_t i=ind+1;i<cols;i++){
332  ret.push_back( m_columnNames[i] );
333  }
334  return ret;
335 }
int i
Definition: DBlmapReader.cc:9
tuple ret
prodAgent to be discontinued
std::string m_variableName
std::vector< std::string > m_columnNames
static std::string elementTypeAsString(ElementType elementType)
Converts the enumeration type to a string.
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
ElementType m_elementType
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.

93 {
94  static const std::string s_referenceMappingElementType = "Reference";
95  return s_referenceMappingElementType;
96 }
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().

368 {
369  return m_scopeName;
370 }
std::string 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.

Parameters
columnsThe names of the associated columns.

Definition at line 429 of file MappingElement.cc.

References mps_check::columns.

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().

430 {
432  if ( m_subElements.empty() ) return;
433 }
std::map< std::string, MappingElement > m_subElements
std::vector< std::string > m_columnNames
tuple columns
Definition: mps_check.py:210
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().

298  {
299  std::set<std::string> involvedTables;
300  std::vector<std::pair<std::string,std::string> > tableList;
301  processTableHierarchy( *this, involvedTables,tableList );
302  return tableList;
303 }
void processTableHierarchy(const MappingElement &element, std::set< std::string > &tableRegister, std::vector< std::pair< std::string, std::string > > &tableList)
const std::string & ora::MappingElement::tableName ( ) const
inline
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().

72 {
73  static const std::string s_oraUniqueReferenceMappingElementType = "UniqueReference";
74  return s_oraUniqueReferenceMappingElementType;
75 }
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().

374 {
375  return m_variableName;
376 }
std::string 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.

380 {
382 }
std::string m_variableNameForSchema
const std::string & ora::MappingElement::variableType ( ) const
inline

Member Data Documentation

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=().

ElementType ora::MappingElement::m_elementType
private

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=().