コード例 #1
0
        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
            }
        }
コード例 #2
0
        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 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);
        }
コード例 #4
0
        internal MatchDomainT EnforceT(CheckResultSuperAttributeToColumn checkresult, LL.MDE.DataModels.SimpleRDBMS.Table t)
        {
            MatchDomainT match = new MatchDomainT(); LL.MDE.DataModels.SimpleUML.Class c = checkresult.matchDomainC.c;

            LL.MDE.DataModels.SimpleUML.Class sc = checkresult.matchDomainC.sc;

            // Contructing t

            // Return newly binded variables
            match.t = t;
            return(match);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        internal static ISet <CheckResultAttributeToColumn> Check(LL.MDE.DataModels.SimpleUML.Class c, string prefix)
        {
            ISet <CheckResultAttributeToColumn> result = new HashSet <CheckResultAttributeToColumn>(); ISet <MatchDomainC> matchDomainCs = CheckDomainC(c);

            foreach (MatchDomainC matchDomainC in matchDomainCs)
            {
                CheckResultAttributeToColumn checkonlysMatch = new CheckResultAttributeToColumn()
                {
                    matchDomainC = matchDomainC,
                };
                result.Add(checkonlysMatch);
            }                                                             // End foreach
            return(result);
        }
コード例 #7
0
        internal static ISet <MatchDomainC> CheckDomainC(LL.MDE.DataModels.SimpleUML.Class c)
        {
            ISet <MatchDomainC> result = new HashSet <MatchDomainC>();

            if (c != null)
            {
                MatchDomainC match = new MatchDomainC()
                {
                    c = c,
                };
                result.Add(match);
            }

            return(result);
        }
コード例 #8
0
        internal void CheckAndEnforce(LL.MDE.DataModels.SimpleUML.Class c, LL.MDE.DataModels.SimpleRDBMS.Table t, string prefix)
        {
            CheckOnlyDomains input  = new CheckOnlyDomains(c, prefix);
            EnforceDomains   output = new EnforceDomains(t);

            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 <CheckResultSuperAttributeToColumn> result = Check(c, prefix);
                Enforce(result, t, prefix);
                traceabilityMap[input] = output;
            }
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        internal void Enforce(ISet <CheckResultSuperAttributeToColumn> result, LL.MDE.DataModels.SimpleRDBMS.Table t, string prefix)
        {
            foreach (CheckResultSuperAttributeToColumn match in result)
            {
                // Extracting variables binded in source domains
                LL.MDE.DataModels.SimpleUML.Class c  = match.matchDomainC.c;
                LL.MDE.DataModels.SimpleUML.Class sc = match.matchDomainC.sc;

                // Assigning variables binded in the where clause

                // Enforcing each enforced domain
                MatchDomainT targetMatchDomainT = EnforceT(match, t);

                // Retrieving variables binded in the enforced domains

                // Calling other relations as defined in the where clause
                transformation.RelationAttributeToColumn.CheckAndEnforce(sc, t, prefix);
            }
        }
        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);
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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.Class sc  in c.general.OfType <LL.MDE.DataModels.SimpleUML.Class>())
                {
                    if (sc != null)
                    {
                        MatchDomainC match = new MatchDomainC()
                        {
                            c  = c,
                            sc = sc,
                        };
                        result.Add(match);
                    }
                }
            }

            return(result);
        }
コード例 #14
0
        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, "");
            }
        }
コード例 #15
0
        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);
        }
        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
            }
        }
コード例 #17
0
        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);
        }
コード例 #18
0
        public EnforceDomains FindPreviousResult(LL.MDE.DataModels.SimpleUML.Class c, string prefix)
        {
            CheckOnlyDomains input = new CheckOnlyDomains(c, prefix);

            return(traceabilityMap.ContainsKey(input) ? traceabilityMap[input] : null);
        }
        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);
        }