CMS 3D CMS Logo

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

#include <RelationalMapping.h>

Inheritance diagram for ora::UniqueReferenceMapping:
ora::IRelationalMapping

Public Member Functions

void process (MappingElement &parentElement, const std::string &attributeName, const std::string &attributeNameForSchema, const std::string &scopeNameForSchema)
 
 UniqueReferenceMapping (const Reflex::Type &attributeType, TableRegister &tableRegister)
 
 ~UniqueReferenceMapping ()
 
- Public Member Functions inherited from ora::IRelationalMapping
virtual ~IRelationalMapping ()
 

Private Attributes

TableRegisterm_tableRegister
 
Reflex::Type m_type
 

Detailed Description

Definition at line 88 of file RelationalMapping.h.

Constructor & Destructor Documentation

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

Definition at line 254 of file RelationalMapping.cc.

254  :
255  m_type(attributeType),m_tableRegister( tableRegister ){
256 }
ora::UniqueReferenceMapping::~UniqueReferenceMapping ( )

Definition at line 258 of file RelationalMapping.cc.

258  {
259 }

Member Function Documentation

void ora::UniqueReferenceMapping::process ( MappingElement parentElement,
const std::string &  attributeName,
const std::string &  attributeNameForSchema,
const std::string &  scopeNameForSchema 
)
virtual

Implements ora::IRelationalMapping.

Definition at line 261 of file RelationalMapping.cc.

References ora::MappingElement::appendSubElement(), ora::MappingRules::columnNameForRefId(), ora::MappingRules::columnNameForRefMetadata(), i, ora::MappingRules::MaxColumnNameLength, ora::MappingRules::newNameForSchemaObject(), ora::MappingElement::setColumnNames(), ora::MappingElement::tableName(), ora::throwException(), and ora::MappingElement::uniqueReferenceMappingElementType().

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

264  {
265 
266  std::string typeName = m_type.Name(Reflex::SCOPED);
267  if(!m_tableRegister.checkTable( parentElement.tableName())){
268  throwException("Table \""+parentElement.tableName()+"\" has not been allocated.",
269  "UniqueReferenceMapping::process");
270  }
271  ora::MappingElement& me = parentElement.appendSubElement( ora::MappingElement::uniqueReferenceMappingElementType(), attributeName, typeName, parentElement.tableName() );
272 
273  std::vector< std::string > cols;
274  std::string inputCol = ora::MappingRules::columnNameForRefMetadata( attributeNameForSchema, scopeNameForSchema );
275  std::string columnName(inputCol);
276  unsigned int i=0;
277  while(m_tableRegister.checkColumn(parentElement.tableName(),columnName)){
279  i++;
280  }
281  m_tableRegister.insertColumn(parentElement.tableName(),columnName);
282  cols.push_back(columnName);
283 
284  std::string idCol = ora::MappingRules::columnNameForRefId( attributeNameForSchema, scopeNameForSchema);
285  columnName = idCol;
286  i=0;
287  while(m_tableRegister.checkColumn(parentElement.tableName(),columnName)){
289  i++;
290  }
291  m_tableRegister.insertColumn(parentElement.tableName(),columnName);
292  cols.push_back(columnName);
293 
294  me.setColumnNames( cols );
295 }
int i
Definition: DBlmapReader.cc:9
static std::string columnNameForRefId(const std::string &variableName, const std::string &scope)
bool insertColumn(const std::string &tableName, const std::string &columnName)
MappingElement & appendSubElement(const std::string &elementType, const std::string &variableName, const std::string &variableType, const std::string &tableName)
static std::string uniqueReferenceMappingElementType()
Returns the name of the ORA polymorphic pointer mapping element type.
static std::string columnNameForRefMetadata(const std::string &variableName, const std::string &scope)
bool checkColumn(const std::string &tableName, const std::string &columnName)
static const size_t MaxColumnNameLength
Definition: MappingRules.h:20
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
bool checkTable(const std::string &tableName)
static std::string newNameForSchemaObject(const std::string &initialName, unsigned int index, size_t maxLength, char indexTrailer=0)
functions for new schema object name generation
void setColumnNames(const std::vector< std::string > &columns)

Member Data Documentation

TableRegister& ora::UniqueReferenceMapping::m_tableRegister
private

Definition at line 98 of file RelationalMapping.h.

Reflex::Type ora::UniqueReferenceMapping::m_type
private

Definition at line 97 of file RelationalMapping.h.