Ejemplo n.º 1
0
        public override Serialization.MocaTree.MocaNode serializeToMocaTree()
        {
            this.domain = TGGModelingUtil.getDomainOfObjectVariable(Repository, this);

            MocaNode ovNode = base.serializeToMocaTree();

            ovNode.appendChildAttribute("metamodelGuid", this.metamodelGuid);
            ovNode.appendChildAttribute("domain", this.domain.ToString().ToLower());
            ovNode.Name = "TGGObjectVariable";
            return(ovNode);
        }
Ejemplo n.º 2
0
        public override List <String> doRule(SQLElement eaElement, SQLWrapperClasses.SQLRepository repository)
        {
            List <String> results = new List <string>();

            if (eaElement.Stereotype == TGGModelingMain.TggObjectVariableStereotype || eaElement.Stereotype == TGGModelingMain.TggCorrespondenceStereotype)
            {
                TGGObjectVariable tggOV  = new TGGObjectVariable(eaElement, repository);
                DomainType        domain = TGGModelingUtil.getDomainOfObjectVariable(repository, tggOV);
                if (domain == DomainType.UNDEFINED)
                {
                    results.Add("Domain of the Object Variable (source or target) cannot be defined. Prefix the name of this object variable with \"src__\" or \"trg__\".");
                }
            }
            return(results);
        }
Ejemplo n.º 3
0
 public override void addAttributesDuringExport(MocaNode actNode)
 {
     base.addAttributesDuringExport(actNode);
     actNode.appendChildAttribute("domain", TGGModelingUtil.getDomainOfObjectVariable(Repository, this).ToString().ToLower());
 }
Ejemplo n.º 4
0
        private Boolean createCorrespondenceObjectWithLinks(EA.Repository Repositorya, EA.EventProperties Info)
        {
            DateTime      t1         = DateTime.Now;
            SQLRepository Repository = new SQLRepository(Repositorya, false);

            EA.Diagram curDiagram = Repository.GetCurrentDiagram();

            int tggPackageId = EAUtil.getOutermostPackage(curDiagram, Repository).PackageID;

            BindingOperator newBindingOperator = BindingOperator.CHECK_ONLY;

            SQLElement clientOv   = Repository.GetElementByID(int.Parse(Info.Get("ClientID").Value.ToString()));
            SQLElement supplierOv = Repository.GetElementByID(int.Parse(Info.Get("SupplierID").Value.ToString()));

            EA.Element ruleClass = Repository.GetOriginalRepository().GetElementByID(clientOv.ParentID);

            SQLElement clientClassifier   = Repository.GetElementByID(clientOv.ClassifierID);
            SQLElement supplierClassifier = Repository.GetElementByID(supplierOv.ClassifierID);

            //compute domains of source and target classifiers
            DomainType clientDomain   = TGGModelingUtil.getDomainOfObjectVariable(Repository, new TGGObjectVariable(clientOv, Repository));
            DomainType supplierDomain = TGGModelingUtil.getDomainOfObjectVariable(Repository, new TGGObjectVariable(supplierOv, Repository));

            //get possible correspondence classes with connectors
            Dictionary <int, List <SQLConnector> > possibleCorrespondencesLinkWithConnectors = computeCorrespondencesWithLinks(clientClassifier, supplierClassifier, Repository, tggPackageId);

            //check for existing bindingOperator
            SQLTaggedValue bindingOperatorTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(clientOv, ObjectVariable.BindingOperatorTaggedValueName);

            if (bindingOperatorTag != null)
            {
                newBindingOperator = (BindingOperator)Enum.Parse(typeof(BindingOperator), bindingOperatorTag.Value.ToUpper());
            }

            //create new correspondence ov
            EA.Element tggCorrespondenceObject = ruleClass.Elements.AddNew("", Main.EAObjectType) as EA.Element;
            tggCorrespondenceObject.Update();

            //dont know what this line does :)
            EA_OnNotifyContextItemModified(Repository.GetOriginalRepository(), tggCorrespondenceObject.ElementGUID, EA.ObjectType.otElement);

            //create connector from correspondence object to client ov
            EA.Connector connectorToClient = tggCorrespondenceObject.Connectors.AddNew("", ECOREModelingMain.EReferenceConnectorType) as EA.Connector;
            connectorToClient.SupplierID = clientOv.ElementID;

            connectorToClient.Direction = "Unspecified";
            connectorToClient.Update();
            tggCorrespondenceObject.Connectors.Refresh();

            //create connector from correspondence object to supplier ov
            EA.Connector connectorToTarget = tggCorrespondenceObject.Connectors.AddNew("", ECOREModelingMain.EReferenceConnectorType) as EA.Connector;
            connectorToTarget.SupplierID = supplierOv.ElementID;
            connectorToTarget.Direction  = "Unspecified";
            connectorToTarget.Update();
            tggCorrespondenceObject.Connectors.Refresh();

            createCorrespondenceDiagramObject(curDiagram, Repository.GetOriginalRepository(), clientOv.getRealElement(), supplierOv.getRealElement(), tggCorrespondenceObject);

            SelectCorrespondenceObject selectCorr = new SelectCorrespondenceObject(possibleCorrespondencesLinkWithConnectors, Repository.GetElementByID(tggCorrespondenceObject.ElementID), Repository, newBindingOperator, clientClassifier, supplierClassifier, clientOv, supplierOv);

            if (selectCorr.DialogResult == DialogResult.Cancel)
            {
                return(true);
            }

            //compute correct linkDialogueEntries so the rolenames can be set correctly

            LinkDialogueEntry sourceEntry = computeLinkDialogEntry("source", possibleCorrespondencesLinkWithConnectors[selectCorr.selectedCorrespondenceLinkId]);
            LinkDialogueEntry targetEntry = computeLinkDialogEntry("target", possibleCorrespondencesLinkWithConnectors[selectCorr.selectedCorrespondenceLinkId]);

            TGGLinkVariable sourceLv = new TGGLinkVariable(Repository.GetConnectorByID(connectorToClient.ConnectorID), Repository);

            sourceLv.BindingOperator = newBindingOperator;

            TGGLinkVariable targetLv = new TGGLinkVariable(Repository.GetConnectorByID(connectorToTarget.ConnectorID), Repository);

            targetLv.BindingOperator = newBindingOperator;

            if (clientDomain == DomainType.SOURCE && supplierDomain == DomainType.TARGET)
            {
                sourceLv.linkDialogueEntry = sourceEntry;
                targetLv.linkDialogueEntry = targetEntry;
            }
            else if (clientDomain == DomainType.TARGET && supplierDomain == DomainType.SOURCE)
            {
                sourceLv.linkDialogueEntry = targetEntry;
                targetLv.linkDialogueEntry = sourceEntry;
            }
            else
            {
                sourceLv.linkDialogueEntry = sourceEntry;
                targetLv.linkDialogueEntry = targetEntry;
            }
            sourceLv.saveTreeToEATaggedValue(true);
            targetLv.saveTreeToEATaggedValue(true);


            Repository.ReloadDiagram(curDiagram.DiagramID);



            return(true);
        }