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); }
private MocaNode processEPackage(SQLPackage eaPackage) { SQLTaggedValue mocaTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(eaPackage, Main.MoflonExportTreeTaggedValueName); if (mocaTreeTag != null) { EPackage ePackage = new EPackage(eaPackage, repository); MocaNode ePackageMocaNode = MocaTreeUtil.mocaNodeFromXmlString(mocaTreeTag.Notes); SQLTaggedValue changesTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(eaPackage, Main.MoflonChangesTreeTaggedValueName); if (changesTreeTag != null) { MocaNode ePackageChangesMocaNode = MocaTreeUtil.mocaNodeFromXmlString(changesTreeTag.Notes); if (ePackageChangesMocaNode.hasAllAttributes(new List <string>( new string[] { ChangesTreeConstants.ATTRIBUTE_KEY_PACKAGE_NAME, ChangesTreeConstants.ATTRIBUTE_KEY_PROJECT_NAME }))) { ePackage.addChangesAttributesDuringExport(ePackageMocaNode, changesTreeTag); CachedPackage temp = new CachedPackage(); temp.getPackage(eaPackage.PackageGUID, repository); temp.name = eaPackage.Name; temp.previousName = eaPackage.Name; temp.packageName = ePackageChangesMocaNode.getAttribute(ChangesTreeConstants.ATTRIBUTE_KEY_PACKAGE_NAME).Value; temp.projectName = ePackageChangesMocaNode.getAttribute(ChangesTreeConstants.ATTRIBUTE_KEY_PROJECT_NAME).Value; temp.savePackageToEATaggedValue(true); } } ePackage.addAttributesDuringExport(ePackageMocaNode); this.currentNode.appendChildNode(ePackageMocaNode); foreach (SQLElement childClass in eaPackage.Elements) { this.currentNode = ePackageMocaNode.getChildNodeWithName(EPackageHelper.ClassesChildNodeName); if (childClass.Stereotype.ToLower() == ECOREModelingMain.EClassStereotype.ToLower()) { processEClass(childClass); } } foreach (SQLPackage childPackage in eaPackage.Packages) { this.currentNode = ePackageMocaNode.getChildNodeWithName(EPackageHelper.PackagesChildNodeName); processEPackage(childPackage); } return(ePackageMocaNode); } return(null); }
public void addChangesAttributesDuringExport(MocaNode pkgNode, SQLTaggedValue changesTreeTag) { MocaNode ePackageMocaNode = MocaTreeUtil.mocaNodeFromXmlString(changesTreeTag.Notes); string[] expectedAttributes = { ChangesTreeConstants.ATTRIBUTE_KEY_NAME, ChangesTreeConstants.ATTRIBUTE_KEY_PREVIOUS_NAME, ChangesTreeConstants.ATTRIBUTE_KEY_PACKAGE_NAME, ChangesTreeConstants.ATTRIBUTE_KEY_PROJECT_NAME }; if (ePackageMocaNode.hasAllAttributes(new List <string>(expectedAttributes))) { pkgNode.appendChildAttribute("Changes::Name", ePackageMocaNode.getAttribute(ChangesTreeConstants.ATTRIBUTE_KEY_NAME).Value); pkgNode.appendChildAttribute("Changes::PreviousName", ePackageMocaNode.getAttribute(ChangesTreeConstants.ATTRIBUTE_KEY_PREVIOUS_NAME).Value); pkgNode.appendChildAttribute("Changes::PackageName", ePackageMocaNode.getAttribute(ChangesTreeConstants.ATTRIBUTE_KEY_PACKAGE_NAME).Value); pkgNode.appendChildAttribute("Changes::ProjectName", ePackageMocaNode.getAttribute(ChangesTreeConstants.ATTRIBUTE_KEY_PROJECT_NAME).Value); //pkgNode.appendChildAttribute("Changes::IsTLP", ePackageMocaNode.getAttribute("isTLP").Value); } }