Exemplo n.º 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
            }
        }
Exemplo n.º 2
0
        internal void CheckAndEnforce(LL.MDE.DataModels.SimpleUML.Association a, LL.MDE.DataModels.SimpleRDBMS.ForeignKey fk)
        {
            CheckOnlyDomains input  = new CheckOnlyDomains(a);
            EnforceDomains   output = new EnforceDomains(fk);

            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 <CheckResultAssocToFKey> result = Check(a);
                Enforce(result, fk);
                traceabilityMap[input] = output;
            }
        }
Exemplo n.º 3
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 //var RelationPackageToSchemaResult =  transformation.RelationPackageToSchema.FindPreviousResult(p) ;
            //var RelationClassToTableResult =  transformation.RelationClassToTable.FindPreviousResult(sc) ;
            //var RelationClassToTableResult =  transformation.RelationClassToTable.FindPreviousResult(dc) ;

            // 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);
        }