internal void Enforce(ISet <CheckResultAssocToFKey> result, LL.MDE.DataModels.SimpleRDBMS.ForeignKey fk) { foreach (CheckResultAssocToFKey match in result) { // Extracting variables binded in source domains LL.MDE.DataModels.SimpleUML.Association a = match.matchDomainA.a; string an = match.matchDomainA.an; LL.MDE.DataModels.SimpleUML.Package p = match.matchDomainA.p; LL.MDE.DataModels.SimpleUML.Class sc = match.matchDomainA.sc; string scn = match.matchDomainA.scn; LL.MDE.DataModels.SimpleUML.Class dc = match.matchDomainA.dc; string dcn = match.matchDomainA.dcn; // Assigning variables binded in the where clause string fkn = scn + "_" + an + "_" + dcn; string fcn = fkn + "_tid"; // Enforcing each enforced domain MatchDomainFk targetMatchDomainFk = EnforceFk(match, fkn, fcn, fk); // Retrieving variables binded in the enforced domains LL.MDE.DataModels.SimpleRDBMS.Table srcTbl = targetMatchDomainFk.srcTbl; LL.MDE.DataModels.SimpleRDBMS.Schema s = targetMatchDomainFk.s; LL.MDE.DataModels.SimpleRDBMS.Key pkey = targetMatchDomainFk.pkey; LL.MDE.DataModels.SimpleRDBMS.Table destTbl = targetMatchDomainFk.destTbl; LL.MDE.DataModels.SimpleRDBMS.Column cl = targetMatchDomainFk.cl; // Calling other relations as defined in the where clause } }
internal MatchDomainFk EnforceFk(CheckResultAssocToFKey checkresult, string fkn, string fcn, LL.MDE.DataModels.SimpleRDBMS.ForeignKey fk) { MatchDomainFk match = new MatchDomainFk(); LL.MDE.DataModels.SimpleUML.Association a = checkresult.matchDomainA.a; LL.MDE.DataModels.SimpleUML.Package p = checkresult.matchDomainA.p; LL.MDE.DataModels.SimpleUML.Class sc = checkresult.matchDomainA.sc; LL.MDE.DataModels.SimpleUML.Class dc = checkresult.matchDomainA.dc; // Querying when relations and storing results LL.MDE.DataModels.SimpleRDBMS.Schema s = transformation.RelationPackageToSchema.FindPreviousResult(p).s; LL.MDE.DataModels.SimpleRDBMS.Table srcTbl = transformation.RelationClassToTable.FindPreviousResult(sc).t; LL.MDE.DataModels.SimpleRDBMS.Table destTbl = transformation.RelationClassToTable.FindPreviousResult(dc).t; // Contructing fk editor.AddOrSetInField(fk, "name", fkn); //LL.MDE.DataModels.SimpleRDBMS.Table srcTbl = null; // srcTbl = (LL.MDE.DataModels.SimpleRDBMS.Table)editor.CreateNewObjectInField(fk, "owner"); LL.MDE.DataModels.SimpleRDBMS.Key pkey = null; pkey = (LL.MDE.DataModels.SimpleRDBMS.Key)editor.CreateNewObjectInField(fk, "key"); LL.MDE.DataModels.SimpleRDBMS.Column cl = null; cl = (LL.MDE.DataModels.SimpleRDBMS.Column)editor.CreateNewObjectInField(fk, "column"); // Contructing srcTbl // LL.MDE.DataModels.SimpleRDBMS.Schema s = null; // s = (LL.MDE.DataModels.SimpleRDBMS.Schema)editor.CreateNewObjectInField(srcTbl, "schema"); // Contructing s // Contructing pkey // LL.MDE.DataModels.SimpleRDBMS.Table destTbl = null; // destTbl = (LL.MDE.DataModels.SimpleRDBMS.Table)editor.CreateNewObjectInField(pkey, "owner"); // Contructing destTbl // Contructing cl editor.AddOrSetInField(cl, "type", "NUMBER"); editor.AddOrSetInField(cl, "name", fcn); // Return newly binded variables match.fk = fk; match.srcTbl = srcTbl; match.s = s; match.pkey = pkey; match.destTbl = destTbl; match.cl = cl; return(match); }