protected DB2TableTransformer addDB2Table(UTF_EA.Class classElement) { DB2TableTransformer transformer = null; if (classElement.owningPackage.Equals(this.logicalPackage)) { if (!this._tableTransformers.Any(x => x.logicalClasses.Any(y => y.Equals(classElement)))) { transformer = new DB2TableTransformer(this._newDatabase, _nameTranslator); this._tableTransformers.Add(transformer); } } else { if (!this.externalTableTransformers.Any(x => x.logicalClasses.Any(y => y.Equals(classElement)))) { transformer = new DB2TableTransformer(this._externalDatabase, _nameTranslator); this.externalTableTransformers.Add(transformer); } } if (transformer != null) { //transform to table transformer.transformLogicalClass(classElement); //now do the external tables linked to this classElement foreach (var dependingAssociationEnd in transformer.getDependingAssociationEnds()) { transformer.dependingTransformers.Add(addDB2Table(dependingAssociationEnd)); } //add the remote columns and primary and foreign keys transformer.addRemoteColumnsAndKeys(); } return(transformer); }
protected DB2TableTransformer addDB2Table(AssociationEnd associationEnd) { DB2TableTransformer transformer = addDB2Table(associationEnd.type as Class); if (transformer == null) { transformer = this.tableTransformers.OfType <DB2TableTransformer>().FirstOrDefault(x => x.logicalClass.Equals(associationEnd.type)); } if (transformer == null) { transformer = this.externalTableTransformers.FirstOrDefault(x => x.logicalClass.Equals(associationEnd.type)); } return(transformer); }
public DB2ColumnTransformer(Table table, Column involvedColumn, DB2TableTransformer dependingTransformer, NameTranslator nameTranslator) : this(table, nameTranslator) { this._involvedColumn = involvedColumn; this._dependingTransformer = dependingTransformer; _column = new Column((DB_EA.Table)table, involvedColumn.name); _column.type = involvedColumn.type; _column.logicalAttribute = ((DB_EA.Column)involvedColumn).logicalAttribute; if (dependingTransformer.associationEnd != null) { if (dependingTransformer.associationEnd.lower > 0) { _column.isNotNullable = true; } } }
public DB2ColumnTransformer(Table table, Column involvedColumn,DB2TableTransformer dependingTransformer,NameTranslator nameTranslator) : this(table,nameTranslator) { this._involvedColumn = involvedColumn; this._dependingTransformer = dependingTransformer; _column = new Column((DB_EA.Table)table, involvedColumn.name); _column.type = involvedColumn.type; _column.logicalAttribute = ((DB_EA.Column)involvedColumn).logicalAttribute; if (dependingTransformer.associationEnd != null) { if (dependingTransformer.associationEnd.lower > 0 ) { _column.isNotNullable = true; } } }
public DB2ForeignKeyTransformer(Table table, List <Column> FKInvolvedColumns, DB2TableTransformer dependingTransformer, UTF_EA.AssociationEnd associationEnd, NameTranslator nameTranslator) : base(nameTranslator) { this._foreignKey = new ForeignKey((Table)table, FKInvolvedColumns); this._foreignKey.foreignTable = dependingTransformer.table; this._logicalAssociationEnd = associationEnd; //get the association on which this foreign key is based if (associationEnd != null) { this._foreignKey.logicalAssociation = (UTF_EA.Association)associationEnd.association; } table.constraints.Add(this._foreignKey); //reset the name of the foreign key resetName(); //make sure we get the correct override settings for the FK and the involved columns var dummy = this._foreignKey.isOverridden; }
public DB2ForeignKeyTransformer(Table table, List <Column> FKInvolvedColumns, DB2TableTransformer dependingTransformer, NameTranslator nameTranslator) : base(nameTranslator) { this._foreignKey = new ForeignKey((Table)table, FKInvolvedColumns); this._foreignKey.foreignTable = dependingTransformer.table; resetName(); this._foreignKey.logicalAssociation = (UTF_EA.Association)dependingTransformer.associationEnd.association; table.constraints.Add(this._foreignKey); }
protected DB2TableTransformer addDB2Table(UTF_EA.Class classElement) { DB2TableTransformer transformer = null; if (classElement.owningPackage.Equals(this.logicalPackage)) { if ( ! this._tableTransformers.Any(x => x.logicalClasses.Any(y => y.Equals(classElement)))) { transformer = new DB2TableTransformer(this._newDatabase,_nameTranslator); this._tableTransformers.Add(transformer); } } else { if (!this.externalTableTransformers.Any(x => x.logicalClasses.Any(y => y.Equals(classElement)))) { transformer = new DB2TableTransformer(this._externalDatabase,_nameTranslator); this.externalTableTransformers.Add(transformer); } } if (transformer != null) { //transform to table transformer.transformLogicalClass(classElement); //now do the external tables linked to this classElement foreach (var dependingAssociationEnd in transformer.getDependingAssociationEnds()) { var dependingEndTransformer = addDB2Table(dependingAssociationEnd); if (dependingEndTransformer != null)transformer.dependingTransformers.Add(dependingEndTransformer); } //add the remote columns and primary and foreign keys transformer.addRemoteColumnsAndKeys(); } return transformer; }