Пример #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 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);
        }
Пример #3
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, "");
            }
        }
Пример #4
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);
        }