コード例 #1
0
        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);
        }