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 static ISet <MatchDomainC> CheckDomainC(LL.MDE.DataModels.SimpleUML.Class c) { ISet <MatchDomainC> result = new HashSet <MatchDomainC>(); if (c != null) { string cn = (string)c.name; LL.MDE.DataModels.SimpleUML.Package p = (LL.MDE.DataModels.SimpleUML.Package)c.@namespace; if (c.kind == "persistent") { if (p != null) { MatchDomainC match = new MatchDomainC() { c = c, cn = cn, p = p, }; result.Add(match); } } } return(result); }
internal void Enforce(ISet <CheckResultPackageToSchema> result, LL.MDE.DataModels.SimpleRDBMS.Schema s) { foreach (CheckResultPackageToSchema match in result) { // Extracting variables binded in source domains LL.MDE.DataModels.SimpleUML.Package p = match.matchDomainP.p; string pn = match.matchDomainP.pn; // Enforcing each enforced domain MatchDomainS targetMatchDomainS = EnforceS(match, pn, s); // Retrieving variables binded in the enforced domains } }
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); }
internal static ISet <CheckResultPackageToSchema> Check(LL.MDE.DataModels.SimpleUML.Package p) { ISet <CheckResultPackageToSchema> result = new HashSet <CheckResultPackageToSchema>(); ISet <MatchDomainP> matchDomainPs = CheckDomainP(p); foreach (MatchDomainP matchDomainP in matchDomainPs) { string pn = matchDomainP.pn; CheckResultPackageToSchema checkonlysMatch = new CheckResultPackageToSchema() { matchDomainP = matchDomainP, }; result.Add(checkonlysMatch); } // End foreach return(result); }
public void CheckAndEnforce(LL.MDE.DataModels.SimpleUML.Package p, LL.MDE.DataModels.SimpleRDBMS.Schema s) { CheckOnlyDomains input = new CheckOnlyDomains(p); EnforceDomains output = new EnforceDomains(s); if (traceabilityMap.ContainsKey(input) && !traceabilityMap[input].Equals(output)) { throw new Exception("This relation has already been used with different enforced parameters!"); } if (!traceabilityMap.ContainsKey(input)) { ISet <CheckResultPackageToSchema> result = Check(p); Enforce(result, s); traceabilityMap[input] = output; } }
internal static ISet <CheckResultClassToTable> Check(LL.MDE.DataModels.SimpleUML.Class c) { ISet <CheckResultClassToTable> result = new HashSet <CheckResultClassToTable>(); ISet <MatchDomainC> matchDomainCs = CheckDomainC(c); foreach (MatchDomainC matchDomainC in matchDomainCs) { string cn = matchDomainC.cn; LL.MDE.DataModels.SimpleUML.Package p = matchDomainC.p; CheckResultClassToTable checkonlysMatch = new CheckResultClassToTable() { matchDomainC = matchDomainC, }; result.Add(checkonlysMatch); } // End foreach return(result); }
internal static ISet <MatchDomainP> CheckDomainP(LL.MDE.DataModels.SimpleUML.Package p) { ISet <MatchDomainP> result = new HashSet <MatchDomainP>(); if (p != null) { string pn = (string)p.name; MatchDomainP match = new MatchDomainP() { p = p, pn = pn, }; result.Add(match); } return(result); }
internal static ISet <CheckResultAssocToFKey> Check(LL.MDE.DataModels.SimpleUML.Association a) { ISet <CheckResultAssocToFKey> result = new HashSet <CheckResultAssocToFKey>(); ISet <MatchDomainA> matchDomainAs = CheckDomainA(a); foreach (MatchDomainA matchDomainA in matchDomainAs) { string an = matchDomainA.an; LL.MDE.DataModels.SimpleUML.Package p = matchDomainA.p; LL.MDE.DataModels.SimpleUML.Class sc = matchDomainA.sc; string scn = matchDomainA.scn; LL.MDE.DataModels.SimpleUML.Class dc = matchDomainA.dc; string dcn = matchDomainA.dcn; CheckResultAssocToFKey checkonlysMatch = new CheckResultAssocToFKey() { matchDomainA = matchDomainA, }; result.Add(checkonlysMatch); } // End foreach return(result); }
internal void Enforce(ISet <CheckResultClassToTable> result, LL.MDE.DataModels.SimpleRDBMS.Table t) { foreach (CheckResultClassToTable match in result) { // Extracting variables binded in source domains LL.MDE.DataModels.SimpleUML.Class c = match.matchDomainC.c; string cn = match.matchDomainC.cn; LL.MDE.DataModels.SimpleUML.Package p = match.matchDomainC.p; // Assigning variables binded in the where clause // Enforcing each enforced domain MatchDomainT targetMatchDomainT = EnforceT(match, cn, t); // Retrieving variables binded in the enforced domains LL.MDE.DataModels.SimpleRDBMS.Schema s = targetMatchDomainT.s; LL.MDE.DataModels.SimpleRDBMS.Key k = targetMatchDomainT.k; LL.MDE.DataModels.SimpleRDBMS.Column cl = targetMatchDomainT.cl; // Calling other relations as defined in the where clause transformation.RelationAttributeToColumn.CheckAndEnforce(c, t, ""); } }
internal MatchDomainT EnforceT(CheckResultClassToTable checkresult, string cn, LL.MDE.DataModels.SimpleRDBMS.Table t) { MatchDomainT match = new MatchDomainT(); LL.MDE.DataModels.SimpleUML.Class c = checkresult.matchDomainC.c; LL.MDE.DataModels.SimpleUML.Package p = checkresult.matchDomainC.p; // Querying when relations and storing results //var RelationPackageToSchemaResult = transformation.RelationPackageToSchema.FindPreviousResult(p) ; // Contructing t editor.AddOrSetInField(t, "name", cn); LL.MDE.DataModels.SimpleRDBMS.Schema s = null; s = (LL.MDE.DataModels.SimpleRDBMS.Schema)editor.CreateNewObjectInField(t, "schema"); LL.MDE.DataModels.SimpleRDBMS.Key k = null; k = (LL.MDE.DataModels.SimpleRDBMS.Key)editor.CreateNewObjectInField(t, "key"); // Contructing s // Contructing k editor.AddOrSetInField(k, "name", cn + "_pk"); LL.MDE.DataModels.SimpleRDBMS.Column cl = null; cl = (LL.MDE.DataModels.SimpleRDBMS.Column)editor.CreateNewObjectInField(k, "column"); // Contructing cl editor.AddOrSetInField(cl, "type", "NUMBER"); editor.AddOrSetInField(cl, "name", cn + "tid"); editor.AddOrSetInField(cl, "owner", t); // Setting cycling properties editor.AddOrSetInField(t, "column", cl); // Return newly binded variables match.t = t; match.s = s; match.k = k; match.cl = cl; return(match); }
internal static ISet <MatchDomainA> CheckDomainA(LL.MDE.DataModels.SimpleUML.Association a) { ISet <MatchDomainA> result = new HashSet <MatchDomainA>(); if (a != null) { string an = (string)a.name; LL.MDE.DataModels.SimpleUML.Package p = (LL.MDE.DataModels.SimpleUML.Package)a.@namespace; LL.MDE.DataModels.SimpleUML.Class sc = (LL.MDE.DataModels.SimpleUML.Class)a.source; LL.MDE.DataModels.SimpleUML.Class dc = (LL.MDE.DataModels.SimpleUML.Class)a.destination; if (p != null) { if (sc != null) { string scn = (string)sc.name; if (dc != null) { string dcn = (string)dc.name; MatchDomainA match = new MatchDomainA() { a = a, an = an, p = p, sc = sc, scn = scn, dc = dc, dcn = dcn, }; result.Add(match); } } } } return(result); }
public void PackageToSchema(LL.MDE.DataModels.SimpleUML.Package p, LL.MDE.DataModels.SimpleRDBMS.Schema s) { RelationPackageToSchema.CheckAndEnforce(p, s); }
internal MatchDomainS EnforceS(CheckResultPackageToSchema checkresult, string pn, LL.MDE.DataModels.SimpleRDBMS.Schema s) { MatchDomainS match = new MatchDomainS(); LL.MDE.DataModels.SimpleUML.Package p = checkresult.matchDomainP.p; // Contructing s editor.AddOrSetInField(s, "name", pn); // Return newly binded variables match.s = s; return(match); }
public EnforceDomains FindPreviousResult(LL.MDE.DataModels.SimpleUML.Package p) { CheckOnlyDomains input = new CheckOnlyDomains(p); return(traceabilityMap.ContainsKey(input) ? traceabilityMap[input] : null); }