Esempio n. 1
0
        public MocaNode processEClass(SQLElement eaClass)
        {
            SQLTaggedValue changesTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(eaClass, Main.MoflonChangesTreeTaggedValueName);

            if (changesTreeTag != null)
            {
                EClass eClass = new EClass(eaClass, repository);
                eClass.loadTreeFromTaggedValue();
                MocaNode eClassMocaNode = MocaTreeUtil.mocaNodeFromXmlString(changesTreeTag.Notes);

                eClass.addMocaAttributesDuringExport(eClassMocaNode);

                this.currentNode.appendChildNode(eClassMocaNode);

                if (eClassMocaNode.hasAllAttributes(new List <string>(
                                                        new string[] { ChangesTreeConstants.ATTRIBUTE_KEY_PACKAGE_NAME, ChangesTreeConstants.ATTRIBUTE_KEY_PROJECT_NAME })))
                {
                    String packageName = eClassMocaNode.getAttribute(ChangesTreeConstants.ATTRIBUTE_KEY_PACKAGE_NAME).Value;
                    String projectName = eClassMocaNode.getAttribute(ChangesTreeConstants.ATTRIBUTE_KEY_PROJECT_NAME).Value;

                    CachedClass temp = new CachedClass();
                    temp.getElement(eaClass.ElementGUID, repository);
                    temp.name         = eClass.Name;
                    temp.previousName = eClass.Name;
                    temp.packageName  = packageName;
                    temp.projectName  = projectName;
                    temp.saveElementToEATaggedValue(true);

                    return(eClassMocaNode);
                }
            }
            return(null);
        }
Esempio n. 2
0
        public MocaNode processEClass(SQLElement eaClass)
        {
            SQLTaggedValue refactorTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(eaClass, Main.MoflonRefactorTreeTaggedValueName);

            if (refactorTreeTag != null)
            {
                EClass eClass = new EClass(eaClass, repository);
                eClass.loadTreeFromTaggedValue();
                MocaNode eClassMocaNode = MocaTreeUtil.mocaNodeFromXmlString(refactorTreeTag.Notes);

                eClass.addMocaAttributesDuringExport(eClassMocaNode);

                //add baseclass dependencies

                /*foreach (var baseClass in eClassMocaNode.getAttributeOrCreate("baseClasses").Value.Split(" ".ToArray()))
                 * {
                 *  if (baseClass != "")
                 *  {
                 *      SQLElement baseclass = repository.GetElementByGuid(baseClass);
                 *      Export.computeAndAddToDependencies(repository, baseclass);
                 *  }
                 * }*/

                this.currentNode.appendChildNode(eClassMocaNode);

                return(eClassMocaNode);
            }
            return(null);
        }
Esempio n. 3
0
        public MocaNode processEClass(SQLElement eaClass)
        {
            //this.exportProgressBar.invokePerformNext("Exporting EClass: " + eaClass.Name);

            SQLTaggedValue changesTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(eaClass, Main.MoflonChangesTreeTaggedValueName);


            SQLTaggedValue mocaTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(eaClass, Main.MoflonExportTreeTaggedValueName);

            if (mocaTreeTag != null)
            {
                EClass eClass = new EClass(eaClass, repository);
                eClass.loadTreeFromTaggedValue();
                MocaNode eClassMocaNode = MocaTreeUtil.mocaNodeFromXmlString(mocaTreeTag.Notes);

                eClass.addMocaAttributesDuringExport(eClassMocaNode);

                if (changesTreeTag != null)
                {
                    MocaNode eClassChangesNode = MocaTreeUtil.mocaNodeFromXmlString(changesTreeTag.Notes);
                    eClass.addMocaAttributesDuringExport(eClassChangesNode);
                }
                //add baseclass dependencies
                foreach (var baseClass in eClassMocaNode.getAttributeOrCreate("baseClasses").Value.Split(" ".ToArray()))
                {
                    if (baseClass != "")
                    {
                        SQLElement baseclass = repository.GetElementByGuid(baseClass);
                        Export.computeAndAddToDependencies(repository, baseclass);
                    }
                }

                this.currentNode.appendChildNode(eClassMocaNode);

                //process SDM Container Objects
                int counter = 0;
                foreach (SQLElement possibleSDMContainer in eaClass.Elements)
                {
                    if (possibleSDMContainer.Stereotype == SDMModelingMain.SdmContainerStereotype || possibleSDMContainer.Stereotype == "SDM_Container")
                    {
                        String   associatedMethodguid = EAEcoreAddin.Util.EAUtil.findTaggedValue(possibleSDMContainer, SDMModelingMain.SDMContainerAssociatedMethodTaggedValueName).Value;
                        MocaNode operationsNode       = eClassMocaNode.getChildNodeWithName(EClass.OperationsChildNodeName);
                        MocaNode owningOperationNode  = null;
                        if (!Export.showStatusBar)
                        {
                            Console.Out.WriteLine("SCALE:Export SDM '" + possibleSDMContainer.Name + "' %" + counter + "/" + eaClass.Elements.Count + "#");
                        }
                        counter++;
                        foreach (MocaNode EOperationNode in operationsNode.Children)
                        {
                            MocaAttribute guidAttribute = EOperationNode.getAttributeOrCreate(Main.GuidStringName);
                            if (guidAttribute != null && guidAttribute.Value == associatedMethodguid)
                            {
                                owningOperationNode = EOperationNode;
                            }
                        }

                        if (owningOperationNode != null)
                        {
                            MocaNode sdmActivityNode = this.sdmExport.processActivity(possibleSDMContainer);
                            owningOperationNode.appendChildNode(sdmActivityNode);
                        }
                    }
                }

                foreach (SQLAttribute element in eaClass.Attributes)
                {
                    string     t           = element.Type;
                    int        cid         = element.ClassifierID;
                    SQLElement typeElement = repository.GetElementByIDNullable(cid);
                    Export.computeAndAddToDependencies(repository, typeElement);
                }

                counter = 0;
                foreach (SQLConnector ereference in eaClass.Connectors)
                {
                    if (ereference.Type == Main.EAAssociationType)
                    {
                        if (!Export.showStatusBar)
                        {
                            Console.Out.WriteLine("SCALE:Export EReference '" + ereference.Name + "' %" + counter + "/" + eaClass.Connectors.Count + "#");
                        }
                        counter++;
                        MocaNode referencesNode = eClassMocaNode.getChildNodeWithName(EClass.ReferencesChildNodeName);

                        if (ereference.ClientID != eaClass.ElementID && ereference.ClientEnd.IsNavigable)
                        {
                            this.currentNode = referencesNode;
                            processEReference(ereference, ereference.ClientEnd.End);
                        }
                        else if (ereference.SupplierID != eaClass.ElementID && ereference.SupplierEnd.IsNavigable)
                        {
                            this.currentNode = referencesNode;
                            processEReference(ereference, ereference.SupplierEnd.End);
                        }

                        if (ereference.SupplierID == eaClass.ElementID && ereference.ClientID == eaClass.ElementID && ereference.SupplierEnd.IsNavigable)
                        {
                            this.currentNode = referencesNode;
                            processEReference(ereference, ereference.SupplierEnd.End);
                        }
                        if (ereference.SupplierID == eaClass.ElementID && ereference.ClientID == eaClass.ElementID && ereference.ClientEnd.IsNavigable)
                        {
                            this.currentNode = referencesNode;
                            processEReference(ereference, ereference.ClientEnd.End);
                        }
                    }
                }
                return(eClassMocaNode);
            }
            return(null);
        }