CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::UniqueReferenceMapping Class Reference

#include <RelationalMapping.h>

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

List of all members.

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

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

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

Definition at line 250 of file RelationalMapping.cc.

                                                  {
}

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

                                                                                {
    
  std::string typeName = m_type.Name(Reflex::SCOPED);
  if(!m_tableRegister.checkTable( parentElement.tableName())){
    throwException("Table \""+parentElement.tableName()+"\" has not been allocated.",
                   "UniqueReferenceMapping::process");
  }
  ora::MappingElement& me = parentElement.appendSubElement( ora::MappingElement::uniqueReferenceMappingElementType(), attributeName, typeName, parentElement.tableName() );

  std::vector< std::string > cols;
  std::string inputCol = ora::MappingRules::columnNameForRefMetadata( attributeNameForSchema, scopeNameForSchema );
  std::string columnName(inputCol);
  unsigned int i=0;
  while(m_tableRegister.checkColumn(parentElement.tableName(),columnName)){
    columnName = ora::MappingRules::newNameForSchemaObject( inputCol, i, ora::MappingRules::MaxColumnNameLength );
    i++;
  }
  m_tableRegister.insertColumn(parentElement.tableName(),columnName);
  cols.push_back(columnName);

  std::string idCol = ora::MappingRules::columnNameForRefId( attributeNameForSchema, scopeNameForSchema);
  columnName = idCol;
  i=0;
  while(m_tableRegister.checkColumn(parentElement.tableName(),columnName)){
    columnName = ora::MappingRules::newNameForSchemaObject( inputCol, i, ora::MappingRules::MaxColumnNameLength );
    i++;
  }
  m_tableRegister.insertColumn(parentElement.tableName(),columnName);
  cols.push_back(columnName);

  me.setColumnNames( cols );
}

Member Data Documentation

Definition at line 98 of file RelationalMapping.h.

Reflex::Type ora::UniqueReferenceMapping::m_type [private]

Definition at line 97 of file RelationalMapping.h.