internal static ISet <MatchDomainC> CheckDomainC(LL.MDE.DataModels.SimpleUML.Class c) { ISet <MatchDomainC> result = new HashSet <MatchDomainC>(); if (c != null) { foreach (LL.MDE.DataModels.SimpleUML.Attribute a in c.attribute.OfType <LL.MDE.DataModels.SimpleUML.Attribute>()) { if (a != null) { string an = (string)a.name; LL.MDE.DataModels.SimpleUML.PrimitiveDataType p = (LL.MDE.DataModels.SimpleUML.PrimitiveDataType)a.type; if (p != null) { string pn = (string)p.name; MatchDomainC match = new MatchDomainC() { c = c, a = a, an = an, p = p, pn = pn, }; result.Add(match); } } } } return(result); }
internal static ISet <CheckResultPrimitiveAttributeToColumn> Check(LL.MDE.DataModels.SimpleUML.Class c, string prefix) { ISet <CheckResultPrimitiveAttributeToColumn> result = new HashSet <CheckResultPrimitiveAttributeToColumn>(); ISet <MatchDomainC> matchDomainCs = CheckDomainC(c); foreach (MatchDomainC matchDomainC in matchDomainCs) { LL.MDE.DataModels.SimpleUML.Attribute a = matchDomainC.a; string an = matchDomainC.an; LL.MDE.DataModels.SimpleUML.PrimitiveDataType p = matchDomainC.p; string pn = matchDomainC.pn; CheckResultPrimitiveAttributeToColumn checkonlysMatch = new CheckResultPrimitiveAttributeToColumn() { matchDomainC = matchDomainC, }; result.Add(checkonlysMatch); } // End foreach return(result); }
internal MatchDomainT EnforceT(CheckResultPrimitiveAttributeToColumn checkresult, string sqltype, 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.Attribute a = checkresult.matchDomainC.a; LL.MDE.DataModels.SimpleUML.PrimitiveDataType p = checkresult.matchDomainC.p; // Contructing t LL.MDE.DataModels.SimpleRDBMS.Column cl = null; cl = (LL.MDE.DataModels.SimpleRDBMS.Column)editor.CreateNewObjectInField(t, "column"); // Contructing cl editor.AddOrSetInField(cl, "type", sqltype); editor.AddOrSetInField(cl, "name", cn); // Return newly binded variables match.t = t; match.cl = cl; return(match); }
internal void Enforce(ISet <CheckResultPrimitiveAttributeToColumn> result, LL.MDE.DataModels.SimpleRDBMS.Table t, string prefix) { foreach (CheckResultPrimitiveAttributeToColumn match in result) { // Extracting variables binded in source domains LL.MDE.DataModels.SimpleUML.Class c = match.matchDomainC.c; LL.MDE.DataModels.SimpleUML.Attribute a = match.matchDomainC.a; string an = match.matchDomainC.an; LL.MDE.DataModels.SimpleUML.PrimitiveDataType p = match.matchDomainC.p; string pn = match.matchDomainC.pn; // Assigning variables binded in the where clause string cn = ((prefix == "") ? an : prefix + '_' + an); string sqltype = transformation.Functions.PrimitiveTypeToSqlType(pn); // Enforcing each enforced domain MatchDomainT targetMatchDomainT = EnforceT(match, sqltype, cn, t); // Retrieving variables binded in the enforced domains LL.MDE.DataModels.SimpleRDBMS.Column cl = targetMatchDomainT.cl; // Calling other relations as defined in the where clause } }