public void startImport(MocaNode importNode, List <String> mmsToImport, Boolean gui)
        {
            this.MocaTree             = importNode;
            hasGui                    = gui;
            checkedMetamodelsToImport = mmsToImport;
            try
            {
                doImport();
            }
            catch
            {
                int modelroot = 0;

                if (hasGui)
                {
                    MessageBox.Show("Import was not successfull. The Moca XMI file seems to be invalid");
                }
                else
                {
                    Console.Out.WriteLine("ERROR:Import was not successfull. The Moca XMI file seems to be invalid#");
                }
                repository.RefreshModelView(modelroot);
            }
            finally
            {
                singleObject = null;
            }
        }
        private void getSourceAndClient(EA.Element parent, MocaNode referencesNode, ref EA.Element client, ref EA.Element supp)
        {
            try
            {
                if (referencesNode.Children[0].getAttributeOrCreate(Main.GuidStringName).Value.Contains("Client"))
                {
                    client = MainImport.getInstance().ElementGuidToElement[referencesNode.Children[0].getAttributeOrCreate("typeGuid").Value];
                }
                else
                {
                    client = MainImport.getInstance().ElementGuidToElement[referencesNode.Children[1].getAttributeOrCreate("typeGuid").Value];
                }
            }
            catch
            {
                client = parent;
            }

            try
            {
                if (referencesNode.Children[0].getAttributeOrCreate(Main.GuidStringName).Value.Contains("Supplier"))
                {
                    supp = MainImport.getInstance().ElementGuidToElement[referencesNode.Children[0].getAttributeOrCreate("typeGuid").Value];
                }
                else
                {
                    supp = MainImport.getInstance().ElementGuidToElement[referencesNode.Children[1].getAttributeOrCreate("typeGuid").Value];
                }
            }
            catch
            {
                supp = parent;
            }
        }
        /// <summary>
        /// create Inheritance connectors
        /// </summary>
        public void setInheritances()
        {
            foreach (EA.Element element in MainImport.getInstance().ElementToBaseClassGuids.Keys)
            {
                if (MainImport.hasGui)
                {
                    MainImport.getInstance().ImportWorker.ReportProgress(3, new ProgressObject(ProgressBarType.Current, "Create Inheritance", MainImport.getInstance().ElementToBaseClassGuids.Count));
                }

                String[] guids = MainImport.getInstance().ElementToBaseClassGuids[element].Split(" ".ToCharArray());
                foreach (String baseClassGuid in guids)
                {
                    if (baseClassGuid != "")
                    {
                        EA.Element baseClass = MainImport.getInstance().ElementGuidToElement[MainImport.getInstance().OldGuidToNewGuid[baseClassGuid]];

                        String result = repository.SQLQuery("select Connector_ID from t_connector where Connector_Type ='Generalization' AND Start_Object_ID = " + element.ElementID + " AND End_Object_ID = " + baseClass.ElementID);

                        if (EAUtil.getXMLNodeContentFromSQLQueryString(result, "Connector_ID")[0] == "")
                        {
                            EA.Connector inhCon = element.Connectors.AddNew("", "Generalization") as EA.Connector;
                            inhCon.SupplierID = baseClass.ElementID;
                            inhCon.Update();
                        }
                    }
                }
            }
        }
Beispiel #4
0
        public ObjectVariable importObjectVariable(SQLElement storyNode, MocaNode ovNode)
        {
            EA.Element ovElement = MainImport.getInstance().EcoreImport.getOrCreateElement(storyNode, ovNode, Main.EAObjectType);

            MocaNode outgoingLinksNode = ovNode.getChildNodeWithName(ObjectVariable.OutgoingLinksNodeName);

            if (outgoingLinksNode != null)
            {
                foreach (MocaNode outgoingLinkNode in outgoingLinksNode.Children)
                {
                    MainImport.getInstance().ConnectorNodeToParent.Add(outgoingLinkNode, ovElement);
                }
            }

            ObjectVariable ov = new ObjectVariable(sqlRep.GetElementByID(ovElement.ElementID), sqlRep);

            ov.deserializeFromMocaTree(ovNode);

            MainImport.getInstance().MocaTaggableElements.Add(ov);
            MainImport.getInstance().ElementGuidToElement.Add(ovElement.ElementGUID, ovElement);
            MainImport.getInstance().OldGuidToNewGuid.Add(ov.Guid, ovElement.ElementGUID);
            MainImport.getInstance().ObjectToTypeGuid.Add(ovElement, ov.TypeGuid);

            return(ov);
        }
Beispiel #5
0
        public void importTGGLinkVariable(MocaNode refNode, SQLElement parent)
        {
            LinkVariable lv = MainImport.getInstance().SdmImport.importLinkVariable(parent, refNode);

            MainImport.getInstance().MocaTaggableElements.Remove(lv);
            lv = new TGGLinkVariable(lv.LinkVariableEA, sqlRep);
            lv.deserializeFromMocaTree(refNode);
            MainImport.getInstance().MocaTaggableElements.Add(lv);
        }
Beispiel #6
0
        private void importCorrespondenceType(SQLPackage parentPackage, MocaNode eClassNode)
        {
            EClass eclass = MainImport.getInstance().EcoreImport.importEClass(parentPackage, eClassNode);

            MainImport.getInstance().MocaTaggableElements.Remove(eclass);
            eclass = new TGGCorrespondenceType(eclass.EaElement, sqlRep);
            eclass.deserializeFromMocaTree(eClassNode);
            MainImport.getInstance().MocaTaggableElements.Add(eclass);
        }
Beispiel #7
0
        private void importActivityNode(SQLElement sdmContainer, MocaNode activityNodeNode)
        {
            EA.Element   activityNodeElement = null;
            ActivityNode aNode = null;

            if (activityNodeNode.getAttributeOrCreate("type").Value == "start")
            {
                activityNodeElement = MainImport.getInstance().EcoreImport.getOrCreateElement(sdmContainer, activityNodeNode, Main.EAStateNodeType, Main.EAStartNodeSubtype);

                aNode = new StartNode(sqlRep, sqlRep.GetElementByID(activityNodeElement.ElementID));
            }
            else if (activityNodeNode.getAttributeOrCreate("type").Value == "stop")
            {
                activityNodeElement = MainImport.getInstance().EcoreImport.getOrCreateElement(sdmContainer, activityNodeNode, Main.EAStateNodeType, Main.EAStopNodeSubtype);

                aNode = new StopNode(sqlRep, sqlRep.GetElementByID(activityNodeElement.ElementID));
            }
            else if (activityNodeNode.getAttributeOrCreate("type").Value == "statement")
            {
                activityNodeElement = MainImport.getInstance().EcoreImport.getOrCreateElement(sdmContainer, activityNodeNode, Main.EAActivityType);

                aNode = new StatementNode(sqlRep, sqlRep.GetElementByID(activityNodeElement.ElementID));
            }
            else if (activityNodeNode.getAttributeOrCreate("type").Value == "story")
            {
                activityNodeElement = MainImport.getInstance().EcoreImport.getOrCreateElement(sdmContainer, activityNodeNode, Main.EAActivityType);
                appendSdmDiagram(activityNodeElement.Name, activityNodeElement);
                aNode = new StoryNode(sqlRep, sqlRep.GetElementByID(activityNodeElement.ElementID));
            }

            MocaNode outgoingEdgesNode = activityNodeNode.getChildNodeWithName(ActivityNode.OutgoingTransitionsNodeName);

            if (outgoingEdgesNode != null)
            {
                foreach (MocaNode outgoingEdgeNode in outgoingEdgesNode.Children)
                {
                    MainImport.getInstance().ConnectorNodeToParent.Add(outgoingEdgeNode, activityNodeElement);
                }
            }

            MocaNode objectVariablesNode = activityNodeNode.getChildNodeWithName(StoryPattern.ObjectVariablesChildNodeName);

            if (objectVariablesNode != null)
            {
                foreach (MocaNode ovNode in objectVariablesNode.Children)
                {
                    importObjectVariable(sqlRep.GetElementByID(activityNodeElement.ElementID), ovNode);
                }
            }

            aNode.deserializeFromMocaTree(activityNodeNode);

            MainImport.getInstance().ElementGuidToElement.Add(activityNodeElement.ElementGUID, activityNodeElement);
            MainImport.getInstance().OldGuidToNewGuid.Add(aNode.EaGuid, activityNodeElement.ElementGUID);
            MainImport.getInstance().MocaTaggableElements.Add(aNode);
        }
Beispiel #8
0
 private static void appendSdmDiagram(String name, EA.Element parentElement)
 {
     if (parentElement.Diagrams.Count == 0)
     {
         EA.Diagram sdmDiagram = parentElement.Diagrams.AddNew(name, SDMModelingMain.SdmDiagramMetatype[0]) as EA.Diagram;
         sdmDiagram.Update();
         parentElement.Diagrams.Refresh();
         MainImport.getInstance().DiagramsToBeFilled.Add(sdmDiagram);
     }
 }
Beispiel #9
0
        private void importTGGCSP(SQLElement ruleElement, MocaNode cspInstanceNode)
        {
            EA.Element  cspElement = MainImport.getInstance().EcoreImport.getOrCreateElement(ruleElement, cspInstanceNode, "Class");
            CSPInstance cspIstance = new CSPInstance(sqlRep, sqlRep.GetElementByID(cspElement.ElementID));

            cspIstance.deserializeFromMocaTree(cspInstanceNode);


            MainImport.getInstance().MocaTaggableElements.Add(cspIstance);
            MainImport.getInstance().ElementGuidToElement.Add(cspElement.ElementGUID, cspElement);
        }
        private void importEDatatype(SQLPackage parentPackage, MocaNode eDatatypeNode)
        {
            EA.Element edatatypeElement = getOrCreateElement(parentPackage, eDatatypeNode, "Class");

            EDatatype edatatype = new EDatatype(sqlRep.GetElementByID(edatatypeElement.ElementID), sqlRep);

            edatatype.deserializeFromMocaTree(eDatatypeNode);

            MainImport.getInstance().ElementGuidToElement.Add(edatatypeElement.ElementGUID, edatatypeElement);
            MainImport.getInstance().MocaTaggableElements.Add(edatatype);
            MainImport.getInstance().OldGuidToNewGuid.Add(edatatype.Guid, edatatypeElement.ElementGUID);
        }
        // private static void appendTaggedValue()

        #endregion

        #region addDiagram methods

        private static void appendDiagram(EA.Package parentPackage, String diagramMetaType, EA.Repository repository)
        {
            if (parentPackage.Diagrams.Count == 0)
            {
                EA.Diagram diag = parentPackage.Diagrams.AddNew(parentPackage.Name, "") as EA.Diagram;
                diag.Update();
                diag.StyleEx = "MDGDgm=" + "eMoflon Ecore Diagrams::Ecore Diagram" + ";";
                diag.Update();
                repository.Execute("UPDATE t_diagram SET Diagram_Type='" + diagramMetaType + "' WHERE Diagram_ID=" + diag.DiagramID);
                MainImport.getInstance().DiagramsToBeFilled.Add(diag);
            }
        }
Beispiel #12
0
 public static MainImport getInstance(SQLRepository sqlRep, BackgroundWorker importWorker)
 {
     if (singleObject == null)
     {
         singleObject = new MainImport(sqlRep);
     }
     if (importWorker != null)
     {
         singleObject.ImportWorker = importWorker;
     }
     return(singleObject);
 }
Beispiel #13
0
        public void importActivityEdge(SQLElement activityNodeElement, MocaNode activityEdgeNode)
        {
            String targetgGuid = MainImport.getInstance().OldGuidToNewGuid[activityEdgeNode.getAttributeOrCreate("targetGuid").Value];

            EA.Element targetElement = MainImport.getInstance().ElementGuidToElement[targetgGuid];

            EA.Connector activityEdgeConnector = MainImport.getInstance().EcoreImport.getOrCreateConnector(activityNodeElement, sqlRep.GetElementByID(targetElement.ElementID), activityEdgeNode.getAttributeOrCreate(Main.GuidStringName).Value, Main.EAControlFlowType);

            ActivityEdge actEdge = new ActivityEdge(sqlRep, sqlRep.GetConnectorByID(activityEdgeConnector.ConnectorID));

            actEdge.deserializeFromMocaTree(activityEdgeNode);
            MainImport.getInstance().MocaTaggableElements.Add(actEdge);
        }
Beispiel #14
0
        private void importRulePackage(SQLPackage modelPackage, MocaNode packageNode)
        {
            EPackage ePackage = MainImport.getInstance().EcoreImport.importEPackage(packageNode, modelPackage);

            MainImport.getInstance().MocaTaggableElements.Remove(ePackage);
            ePackage = new TGGRulePackage(ePackage.EaPackage, sqlRep);
            MainImport.getInstance().MocaTaggableElements.Add(ePackage);

            foreach (MocaNode ruleNode in packageNode.getChildNodeWithName(TGGRulePackage.RulesChildNodeName).Children)
            {
                importRule(ePackage.EaPackage, ruleNode);
            }
        }
        public EPackage importEPackage(MocaNode ePackageNode, SQLPackage parentPackage)
        {
            EA.Package modelPackage = getOrCreatePackage(parentPackage, ePackageNode);

            EPackage ePkg = new EPackage(sqlRep.GetPackageByID(modelPackage.PackageID), sqlRep);

            ePkg.deserializeFromMocaTree(ePackageNode);

            MainImport.getInstance().MocaTaggableElements.Add(ePkg);
            MainImport.getInstance().OldGuidToNewGuid.Add(ePkg.Guid, modelPackage.PackageGUID);

            appendDiagram(modelPackage, "eMoflon Ecore Diagrams::Ecore Diagram", repository);// ECOREModelingMain.EcoreDiagramMetatype[0]);

            importEPackageFeatures(ePackageNode, sqlRep.GetPackageByID(modelPackage.PackageID));

            return(ePkg);
        }
Beispiel #16
0
        public void importSDMActivity(SQLElement parentEClass, SQLMethod owningOperation, MocaNode activityNode)
        {
            EA.Element activityElement = MainImport.getInstance().EcoreImport.getOrCreateElement(parentEClass, activityNode, Main.EAClassType);

            appendSdmDiagram(owningOperation.Name, activityElement);

            Activity sdmActivity = new Activity(sqlRep.GetElementByID(activityElement.ElementID), sqlRep);

            sdmActivity.OwningOperation = new Modeling.ECOREModeling.ECOREExportWrapper.EOperation(sqlRep.GetMethodByID(owningOperation.MethodID), sqlRep);

            MainImport.getInstance().MocaTaggableElements.Add(sdmActivity);

            foreach (MocaNode activityNodeNode in activityNode.Children)
            {
                if (activityNodeNode.Name == "ActivityNode")
                {
                    importActivityNode(sqlRep.GetElementByID(activityElement.ElementID), activityNodeNode);
                }
            }
        }
        internal void fillEcoreDiagram(EA.Diagram diagram)
        {
            EA.Collection elementCollection = null;
            EA.Collection packageCollection = null;
            if (diagram.PackageID != 0)
            {
                EA.Package pkg = (repository.GetPackageByID(diagram.PackageID) as EA.Package);
                elementCollection = pkg.Elements;
                packageCollection = pkg.Packages;
            }
            else if (diagram.ParentID != 0)
            {
                EA.Element ele = (repository.GetElementByID(diagram.ParentID) as EA.Element);
                elementCollection = ele.Elements;
            }

            MainImport.fillDiagramFromCollections(diagram, elementCollection, packageCollection);

            repository.GetProjectInterface().LayoutDiagramEx(diagram.DiagramGUID, EA.ConstLayoutStyles.lsDiagramDefault, 4, 20, 20, true);
        }
Beispiel #18
0
        public LinkVariable importLinkVariable(SQLElement ovElement, MocaNode lvNode)
        {
            String oldTargetGuid = lvNode.getAttributeOrCreate("targetGuid").Value;
            String newTargetGuid = MainImport.getInstance().OldGuidToNewGuid[oldTargetGuid];

            EA.Element targetElement = MainImport.getInstance().ElementGuidToElement[newTargetGuid];

            EA.Connector newLinkConnector = MainImport.getInstance().EcoreImport.getOrCreateConnector(ovElement, sqlRep.GetElementByID(targetElement.ElementID), lvNode.getAttributeOrCreate(Main.GuidStringName).Value, Main.EAAssociationType);


            LinkVariable lv = new LinkVariable(sqlRep.GetConnectorByID(newLinkConnector.ConnectorID), sqlRep);

            lv.deserializeFromMocaTree(lvNode);
            if (lv.linkDialogueEntry.clientRoleName != "" && lv.linkDialogueEntry.supplierRoleName != "")
            {
                lv.linkDialogueEntry.direction = LinkDialogueEntryDirection.BI;
            }
            MainImport.getInstance().MocaTaggableElements.Add(lv);

            return(lv);
        }
        private void importEEnum(SQLPackage parentPackage, MocaNode eEnumNode)
        {
            EA.Element eenumElement = getOrCreateElement(parentPackage, eEnumNode, "Enumeration");

            foreach (MocaNode literalNode in eEnumNode.getChildNodeWithName("literals").Children)
            {
                String literalName = literalNode.getAttributeOrCreate("name").Value;
                if (literalName != "" && !literalExist(eenumElement, literalName))
                {
                    EA.Attribute literalAtt = eenumElement.Attributes.AddNew(literalName, "") as EA.Attribute;
                    literalAtt.Update();
                }
            }
            eenumElement.Attributes.Refresh();
            EEnum eenum = new EEnum(sqlRep.GetElementByID(eenumElement.ElementID), sqlRep);

            eenum.deserializeFromMocaTree(eEnumNode);

            MainImport.getInstance().ElementGuidToElement.Add(eenumElement.ElementGUID, eenumElement);
            MainImport.getInstance().MocaTaggableElements.Add(eenum);
            MainImport.getInstance().OldGuidToNewGuid.Add(eenum.Guid, eenumElement.ElementGUID);
        }
Beispiel #20
0
        public void importTGGPackageModel(MocaNode tggPackageNode)
        {
            EA.Package rootPackage = MainImport.getInstance().EcoreImport.findOrCreateRoot(tggPackageNode);

            EA.Package modelPackage = MainImport.getInstance().EcoreImport.getOrCreatePackage(sqlRep.GetPackageByID(rootPackage.PackageID), tggPackageNode);

            TGG tggPkg = new TGG(sqlRep, sqlRep.GetPackageByID(modelPackage.PackageID));

            tggPkg.deserializeFromMocaTree(tggPackageNode);

            MainImport.getInstance().MocaTaggableElements.Add(tggPkg);
            MainImport.getInstance().OldGuidToNewGuid.Add(tggPkg.Guid, modelPackage.PackageGUID);
            MainImport.getInstance().importedPackages.Add(modelPackage);

            if (modelPackage.Diagrams.Count == 0)
            {
                EA.Diagram diag = modelPackage.Diagrams.AddNew(modelPackage.Name, TGGModelingMain.TggSchemaDiagramMetatype[0]) as EA.Diagram;
                diag.Update();
                MainImport.getInstance().DiagramsToBeFilled.Add(diag);
            }
            MainImport.getInstance().EcoreImport.importEPackageFeatures(tggPackageNode, sqlRep.GetPackageByID(modelPackage.PackageID));
            importTGGFeatures(tggPackageNode, sqlRep.GetPackageByID(modelPackage.PackageID));
        }
        public void importERef(SQLElement parent, MocaNode referencesNode)
        {
            foreach (MocaNode refNode in referencesNode.Children)
            {
                String refGuid = refNode.getAttributeOrCreate(Main.GuidStringName).Value;

                String oppositeGuid = refNode.getAttributeOrCreate("oppositeGuid").Value;

                bool containment = refNode.getAttributeOrCreate("containment").Value == "true";
                bool hasOpposite = oppositeGuid != "";

                SQLElement client  = parent;
                String     supGuid = refNode.getAttributeOrCreate("typeGuid").Value;

                EA.Connector con = null;
                if (MainImport.getInstance().ElementGuidToElement.ContainsKey(supGuid))
                {
                    EA.Element supplier = MainImport.getInstance().ElementGuidToElement[supGuid];
                    if (hasOpposite)
                    {
                        if (!oppositeGuid.EndsWith("Client") && !oppositeGuid.EndsWith("Supplier"))
                        {
                        }
                        if (MainImport.getInstance().ReferenceGuidToReference.ContainsKey(oppositeGuid))
                        {
                            con = MainImport.getInstance().ReferenceGuidToReference[oppositeGuid];
                            refNode.getAttributeOrCreate(Main.GuidStringName).Value = "Client";
                        }
                        else
                        {
                            int supplierAggregation = 0;
                            int clientAggregation   = 0;
                            if (containment)
                            {
                                if (oppositeGuid.EndsWith("Client"))
                                {
                                    clientAggregation = 2;
                                }
                                else
                                {
                                    supplierAggregation = 2;
                                }
                            }

                            con = createConnector(client, sqlRep.GetElementByID(supplier.ElementID), refGuid, Main.EAAssociationType, supplierAggregation, clientAggregation, hasOpposite);
                            refNode.getAttributeOrCreate(Main.GuidStringName).Value = "Supplier";
                        }
                    }
                    else
                    {
                        con = createConnector(sqlRep.GetElementByID(client.ElementID), sqlRep.GetElementByID(supplier.ElementID), refGuid, Main.EAAssociationType, 0, 0, hasOpposite);
                        refNode.getAttributeOrCreate(Main.GuidStringName).Value = "Supplier";
                    }
                }
                if (con != null)
                {
                    if (!MainImport.getInstance().ReferenceGuidToReference.ContainsKey(refGuid))
                    {
                        MainImport.getInstance().ReferenceGuidToReference.Add(refGuid, con);
                    }

                    refGuid = refGuid.Replace("Client", "").Replace("Supplier", "");

                    if (!MainImport.getInstance().OldGuidToNewGuid.ContainsKey(refGuid))
                    {
                        MainImport.getInstance().OldGuidToNewGuid.Add(refGuid, con.ConnectorGUID);
                    }



                    if (!MainImport.getInstance().ReferenceGuidToReference.ContainsKey(con.ConnectorGUID))
                    {
                        MainImport.getInstance().ReferenceGuidToReference.Add(con.ConnectorGUID, con);
                    }

                    MocaNode referencesNodeSet = new MocaNode("references");


                    if (MainImport.getInstance().ReferenceGuidToClientTarget.ContainsKey(con.ConnectorGUID))
                    {
                        referencesNodeSet = MainImport.getInstance().ReferenceGuidToClientTarget[con.ConnectorGUID];
                    }
                    else
                    {
                        MainImport.getInstance().ReferenceGuidToClientTarget.Add(con.ConnectorGUID, referencesNodeSet);
                    }



                    referencesNodeSet.appendChildNode(refNode);
                }
            }
        }
Beispiel #22
0
        private void importRule(SQLPackage modelPackage, MocaNode ruleNode)
        {
            EA.Element ruleElement = MainImport.getInstance().EcoreImport.getOrCreateElement(modelPackage, ruleNode, Main.EAClassType);

            if (ruleElement.Diagrams.Count == 0)
            {
                EA.Diagram ruleDiagram = ruleElement.Diagrams.AddNew(ruleElement.Name, TGGModelingMain.TggRuleDiagramMetatype[0]) as EA.Diagram;
                ruleDiagram.Update();
                MainImport.getInstance().DiagramsToBeFilled.Add(ruleDiagram);
            }

            EA.Method mainMethod = MainImport.getInstance().EcoreImport.getOrCreateMethod(sqlRep.GetElementByID(ruleElement.ElementID), ruleNode.getAttributeOrCreate("mainMethodGuid").Value, ruleElement.Name, "");

            MocaNode parametersNode = ruleNode.getChildNodeWithName(EOperation.ParametersChildNodeName);

            if (parametersNode != null)
            {
                foreach (MocaNode paramNode in parametersNode.Children)
                {
                    EA.Parameter parameter = MainImport.getInstance().EcoreImport.getOrCreateParameter(mainMethod, paramNode);

                    MainImport.getInstance().OldGuidToNewGuid.Add(paramNode.getAttributeOrCreate(Main.GuidStringName).Value, parameter.ParameterGUID);
                }
            }

            EClass eClass = MainImport.getInstance().EcoreImport.importEClassFeatures(ruleNode, sqlRep.GetElementByID(ruleElement.ElementID));

            MainImport.getInstance().MocaTaggableElements.Remove(eClass);
            TGGRule rule = new TGGRule(sqlRep, sqlRep.GetElementByID(ruleElement.ElementID));

            rule.deserializeFromMocaTree(ruleNode);

            MainImport.getInstance().MocaTaggableElements.Add(rule);

            foreach (MocaNode ovNode in ruleNode.getChildNodeWithName(StoryPattern.ObjectVariablesChildNodeName).Children)
            {
                if (ovNode.Name == TGGModelingMain.TggObjectVariableStereotype)
                {
                    ObjectVariable ov = MainImport.getInstance().SdmImport.importObjectVariable(sqlRep.GetElementByID(ruleElement.ElementID), ovNode);
                    MainImport.getInstance().MocaTaggableElements.Remove(ov);
                    ov = new TGGObjectVariable(ov.sqlElement, sqlRep);
                    ov.deserializeFromMocaTree(ovNode);
                    MainImport.getInstance().MocaTaggableElements.Add(ov);
                }
                else if (ovNode.Name == TGGCorrespondence.CorrespondenceNodeName)
                {
                    ObjectVariable ov = MainImport.getInstance().SdmImport.importObjectVariable(sqlRep.GetElementByID(ruleElement.ElementID), ovNode);
                    MainImport.getInstance().MocaTaggableElements.Remove(ov);
                    ov = new TGGCorrespondence(ov.sqlElement, sqlRep);
                    ov.deserializeFromMocaTree(ovNode);
                    MainImport.getInstance().MocaTaggableElements.Add(ov);
                }
            }

            MocaNode cspsNode = ruleNode.getChildNodeWithName(TGGRule.CspsChildNodeName);

            if (cspsNode != null)
            {
                foreach (MocaNode cspInstanceNode in cspsNode.Children)
                {
                    importTGGCSP(sqlRep.GetElementByID(ruleElement.ElementID), cspInstanceNode);
                }
            }
            else
            {
                if (ruleNode.getAttributeOrCreate(TGGRule.CspSpecAttributeName).Value != "")
                {
                    EA.Element constraintElement = ruleElement.Elements.AddNew("", Main.EAClassType) as EA.Element;
                    constraintElement.Stereotype = TGGModelingMain.CSPConstraintStereotype;
                    constraintElement.Notes      = ruleNode.getAttributeOrCreate(TGGRule.CspSpecAttributeName).Value;
                    constraintElement.Update();

                    CSPInstance cspInstance = new CSPInstance(sqlRep, sqlRep.GetElementByID(constraintElement.ElementID));
                    cspInstance.CspStringValueFromImport = ruleNode.getAttributeOrCreate(TGGRule.CspSpecAttributeName).Value;
                    MainImport.getInstance().MocaTaggableElements.Add(cspInstance);
                }
            }
        }
        public EClass importEClassFeatures(MocaNode eClassNode, SQLElement eclassElem)
        {
            MocaNode operationsNode = eClassNode.getChildNodeWithName(EClass.OperationsChildNodeName);
            MocaNode attributesNode = eClassNode.getChildNodeWithName(EClass.AttributesChildNodeName);
            MocaNode refsNode       = eClassNode.getChildNodeWithName(EClass.ReferencesChildNodeName);

            foreach (MocaNode eOpNode in operationsNode.Children)
            {
                EA.Method eaMethod = getOrCreateMethod(eclassElem, eOpNode);

                foreach (MocaNode eParamNode in eOpNode.getChildNodeWithName(EOperation.ParametersChildNodeName).Children)
                {
                    if (eParamNode.Name == "EParameter")
                    {
                        EA.Parameter eaParam = getOrCreateParameter(eaMethod, eParamNode);
                    }
                }
                eaMethod.Parameters.Refresh();

                MocaNode sdmActivityNode = eOpNode.getChildNodeWithName("Activity");
                if (sdmActivityNode != null)
                {
                    MainImport.getInstance().SdmImport.importSDMActivity(eclassElem, sqlRep.GetMethodByID(eaMethod.MethodID), sdmActivityNode);
                }
            }
            foreach (MocaNode eAttrNode in attributesNode.Children)
            {
                EA.Attribute eAttribute = getOrCreateAttribute(eclassElem, eAttrNode);;
                eAttribute.Update();
            }

            if (refsNode.Children.Count != 0)
            {
                MainImport.getInstance().ConnectorNodeToParent.Add(refsNode, eclassElem.getRealElement());
            }

            eclassElem.Attributes.Refresh();
            eclassElem.Methods.Refresh();

            EClass eclass = new EClass(sqlRep.GetElementByID(eclassElem.ElementID), sqlRep);

            eclass.deserializeFromMocaTree(eClassNode);
            foreach (EAttribute eattr in eclass.EAttributes)
            {
                if (eattr.typeGuid != "")
                {
                    MainImport.getInstance().ObjectToTypeGuid.Add(eattr.EaAttribute.getRealAttribute(), eattr.typeGuid);
                }
                MainImport.getInstance().OldGuidToNewGuid.Add(eattr.guid, eattr.EaAttribute.AttributeGUID);
            }

            foreach (EOperation eOp in eclass.EOperations)
            {
                if (eOp.typeGuid != "")
                {
                    MainImport.getInstance().ObjectToTypeGuid.Add(eOp.EaMethod.getRealMethod(), eOp.typeGuid);
                }
                MainImport.getInstance().OldGuidToNewGuid.Add(eOp.guid, eOp.EaMethod.MethodGUID);
                foreach (EParameter eParam in eOp.EParameters)
                {
                    if (eParam.typeGuid != "")
                    {
                        MainImport.getInstance().ObjectToTypeGuid.Add(eParam.EaParameter.getRealParameter(), eParam.typeGuid);
                    }
                    MainImport.getInstance().OldGuidToNewGuid.Add(eParam.Guid, eParam.EaParameter.ParameterGUID);
                }
            }

            if (eClassNode.getAttributeOrCreate("baseClasses").Value != "")
            {
                MainImport.getInstance().ElementToBaseClassGuids.Add(eclassElem.getRealElement(), eClassNode.getAttributeOrCreate("baseClasses").Value);
            }
            MainImport.getInstance().ElementGuidToElement.Add(eclassElem.ElementGUID, eclassElem.getRealElement());
            MainImport.getInstance().MocaTaggableElements.Add(eclass);
            MainImport.getInstance().OldGuidToNewGuid.Add(eclass.Guid, eclassElem.ElementGUID);

            return(eclass);
        }