text
stringlengths
0
2.2M
Licensed under the Apache License, Version 2.0 (const the& "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
* DataSourceMapping.cpp
*
* Created on: 18-May-2014
* Author: sumeetc
*/
#include "DataSourceMapping.h"
const std::string& DataSourceInternalRelation::getClsName() const {
return clsName;
}
void DataSourceInternalRelation::setClsName(const std::string& clsName) {
this->clsName = clsName;
}
const std::string& DataSourceInternalRelation::getField() const {
return field;
}
void DataSourceInternalRelation::setField(const std::string& field) {
this->field = field;
}
const std::string& DataSourceInternalRelation::getDfk() const {
return dfk;
}
void DataSourceInternalRelation::setDfk(const std::string& dfk) {
this->dfk = dfk;
}
const std::string& DataSourceInternalRelation::getDmappedBy() const {
return dmappedBy;
}
void DataSourceInternalRelation::setDmappedBy(const std::string& dmappedBy) {
this->dmappedBy = dmappedBy;
}
int DataSourceInternalRelation::getType() const {
return type;
}
void DataSourceInternalRelation::setType(const int& type) {
this->type = type;
}
std::string Mapping::getClassForTable(const std::string& table) {
if(tableClassMapping.find(table)!=tableClassMapping.end())
{
return tableClassMapping[table];
}
return "";
}
std::string Mapping::getTableForClass(const std::string& clas) {
if(dseMap.find(clas)!=dseMap.end())
{
return dseMap[clas].tableName;
}
return "";
}
const std::string& Mapping::getAppName() const {
return appName;
}
void Mapping::addDataSourceEntityMapping(const DataSourceEntityMapping& dsemp) {
if(dsemp.getClassName()!="" && dseMap.find(dsemp.getClassName())==dseMap.end()) {
dseMap[dsemp.getClassName()] = dsemp;
if(!dsemp.isEmbedded()) {
tableClassMapping[dsemp.getTableName()] = dsemp.getClassName();
}
}
}
std::string Mapping::getPropertyForColumn(const std::string& tableName, const std::string& columnName) {
if(tableClassMapping.find(tableName)!=tableClassMapping.end())
{
DataSourceEntityMapping dsemp = dseMap[tableClassMapping[tableName]];
if(dsemp.columnPropertyMappingCS.find(columnName)!=dsemp.columnPropertyMappingCS.end())
{
return dsemp.columnPropertyMappingCS[columnName];