From 97ad4eb8fc75c2cf0c7c303194041bdcbf461521 Mon Sep 17 00:00:00 2001 From: Daniel Siegl Date: Mon, 6 Feb 2023 10:58:24 +0100 Subject: [PATCH 1/3] Refactoring of Attribute Constants --- .gitignore | 417 ++++++++++++++++++++++- MTIP/Constants/AttributeConstants.cs | 103 ++---- MTIP/Constants/HUDSConstants.cs | 2 + MTIP/MTIP.csproj | 1 + MTIP/Translations/MTIPCommon.cs | 36 ++ MTIP/Translations/MTIPExportFunctions.cs | 173 ++++------ MTIP/Translations/MTIPImportFunctions.cs | 262 +++++++------- 7 files changed, 686 insertions(+), 308 deletions(-) create mode 100644 MTIP/Translations/MTIPCommon.cs diff --git a/.gitignore b/.gitignore index e340492..0af9992 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,414 @@ -.vs/**/*.* -MTIP/obj/**/*.* -MTIP/bin/**/*.* +# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,dotnetcore +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,dotnetcore + +### DotnetCore ### +# .NET Core build folders +bin/ +obj/ + +# Common node modules locations +/node_modules +/wwwroot/node_modules + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +### VisualStudio Patch ### +# Additional files built by Visual Studio + +# End of https://www.toptal.com/developers/gitignore/api/visualstudio,dotnetcore \ No newline at end of file diff --git a/MTIP/Constants/AttributeConstants.cs b/MTIP/Constants/AttributeConstants.cs index 6e799bc..f2d4f59 100644 --- a/MTIP/Constants/AttributeConstants.cs +++ b/MTIP/Constants/AttributeConstants.cs @@ -8,80 +8,39 @@ * */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace MTIP.Constants { - public class AttributeConstants + public static class AttributeConstants { - public string alias; - public string attribute; - public string attributes; - public string behavior; - public string body; - public string constraint; - public string defaultValue; - public string displayAs; - public string documentation; - public string extensionPoint; - public string id; - public string initialValue; - public string interactionOperatorKind; - public string isComposite; - public string messageSort; - public string multiplicity; - public string name; - public string profileId; - public string profileName; - public string receiveEvent; - public string relationships; - public string sendEvent; - public string stereotype; - public string stereotypeName; - public string submachine; - public string taggedValue; - public string text; - public string type; - public string value; - public string visibility; - - public AttributeConstants() - { - this.alias = "alias"; - this.attribute = "attribute"; - this.attributes = "attributes"; - this.behavior = "behavior"; - this.body = "body"; - this.constraint = "constraint"; - this.defaultValue = "defaultValue"; - this.displayAs = "displayAs"; - this.documentation = "documentation"; - this.extensionPoint = "extensionPoint"; - this.id = "id"; - this.initialValue = "initialValue"; - this.interactionOperatorKind = "interactionOperatorKind"; - this.isComposite = "isComposite"; - this.messageSort = "messageSort"; - this.multiplicity = "multiplicity"; - this.name = "name"; - this.profileId = "profileId"; - this.profileName = "profileName"; - this.receiveEvent = "receiveEvent"; - this.relationships = "relationships"; - this.sendEvent = "sendEvent"; - this.stereotype = "stereotype"; - this.stereotypeName = "stereotypeName"; - this.submachine = "submachine"; - this.taggedValue = "taggedValue"; - this.text = "text"; - this.type = "type"; - this.value = "value"; - this.visibility = "visibility"; - } - + public const string ALIAS = "alias"; + public const string ATTRIBUTE = "attribute"; + public const string ATTRIBUTES = "attributes"; + public const string BEHAVIOR = "behavior"; + public const string BODY = "body"; + public const string CONSTRAINT = "constraint"; + public const string DEFAULTVALUE = "defaultValue"; + public const string DISPLAYAS = "displayAs"; + public const string DOCUMENTATION = "documentation"; + public const string EXTENSIONPOINT = "extensionPoint"; + public const string ID = "id"; + public const string INITIALVALUE = "initialValue"; + public const string INTERACTIONOPERATORKIND = "interactionOperatorKind"; + public const string ISCOMPOSITE = "isComposite"; + public const string MESSAGESORT = "messageSort"; + public const string MULTIPLICITY = "multiplicity"; + public const string NAME = "name"; + public const string PROFILEID = "profileId"; + public const string PROFILENAME = "profileName"; + public const string RECEIVEEVENT = "receiveEvent"; + public const string RELATIONSHIPS = "relationships"; + public const string SENDEVENT = "sendEvent"; + public const string STEREOTYPE = "stereotype"; + public const string STEREOTYPENAME = "stereotypeName"; + public const string SUBMACHINE = "submachine"; + public const string TAGGEDVALUE = "taggedValue"; + public const string TEXT = "text"; + public const string TYPE = "type"; + public const string VALUE = "value"; + public const string VISIBILITY = "visibility"; } } diff --git a/MTIP/Constants/HUDSConstants.cs b/MTIP/Constants/HUDSConstants.cs index 96c56b3..06c937d 100644 --- a/MTIP/Constants/HUDSConstants.cs +++ b/MTIP/Constants/HUDSConstants.cs @@ -22,6 +22,7 @@ public class HUDSConstants public string dict; public string dtype; public string ea; + public string unified; public string element; public string id; public string intType; @@ -43,6 +44,7 @@ public HUDSConstants() dict = "dict"; dtype = "_dtype"; ea = "ea"; + unified = "unified"; element = "element"; id = "id"; intType = "int"; diff --git a/MTIP/MTIP.csproj b/MTIP/MTIP.csproj index c845e94..58dd954 100644 --- a/MTIP/MTIP.csproj +++ b/MTIP/MTIP.csproj @@ -87,6 +87,7 @@ + diff --git a/MTIP/Translations/MTIPCommon.cs b/MTIP/Translations/MTIPCommon.cs new file mode 100644 index 0000000..2cc2390 --- /dev/null +++ b/MTIP/Translations/MTIPCommon.cs @@ -0,0 +1,36 @@ +using MTIP.Constants; +using System.Xml; + +namespace MTIP.Translations +{ + internal static class MTIPCommon + { + //DS: Not the way I would do this. + + public static RelationshipConstants relationshipConstants = new RelationshipConstants(); + public static HUDSConstants hudsConstants =new HUDSConstants(); + + internal static XmlElement CreateIdElement(XmlDocument xmlDocument, string eaElementGuid) + { + + XmlElement idElement = xmlDocument.CreateElement(AttributeConstants.ID); + idElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + + //unified ID shall be the new Vendor independed ID field for cross tool roundtrips. + XmlElement unifiedIdElement = xmlDocument.CreateElement(hudsConstants.unified); + unifiedIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + unifiedIdElement.InnerText = eaElementGuid.ToString(); + + idElement.AppendChild(unifiedIdElement); + + //unified ID shall be the new Vendor specific ID field for cross tool roundtrips, best case this is not required going forward + XmlElement eaIdElement = xmlDocument.CreateElement(hudsConstants.ea); + eaIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + eaIdElement.InnerText = eaElementGuid.ToString(); + + idElement.AppendChild(eaIdElement); + + return idElement; + } + } +} diff --git a/MTIP/Translations/MTIPExportFunctions.cs b/MTIP/Translations/MTIPExportFunctions.cs index ed4942f..dd8cb5b 100644 --- a/MTIP/Translations/MTIPExportFunctions.cs +++ b/MTIP/Translations/MTIPExportFunctions.cs @@ -28,7 +28,7 @@ public class MTIPExportFunctions private string outputDirectory; public Dictionary profilePackages; public List exportLog; - public AttributeConstants attributeConstants; + public RelationshipConstants relationshipConstants; public HUDSConstants hudsConstants; public DiagramConstants diagramConstants; @@ -43,7 +43,7 @@ public MTIPExportFunctions(MTIP plugin) repository = plugin.GetRepository(); profilePackages = new Dictionary(); exportLog = new List(); - attributeConstants = new AttributeConstants(); + relationshipConstants = new RelationshipConstants(); hudsConstants = new HUDSConstants(); diagramConstants = new DiagramConstants(); @@ -137,30 +137,26 @@ public void UnpackagePackage(EA.Package package, XmlDocument xmlDocument, string // Get EA id for the package - XmlElement idElement = xmlDocument.CreateElement(hudsConstants.id); - idElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); string packageGuid = package.PackageGUID.Substring(1, package.PackageGUID.Length - 2); - XmlElement eaIdElement = xmlDocument.CreateElement(hudsConstants.ea); - eaIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); - eaIdElement.InnerText = packageGuid; - idElement.AppendChild(eaIdElement); + + XmlElement idElement = MTIPCommon.CreateIdElement(xmlDocument, packageGuid); // Create attributes element to add to data node - XmlElement attributesElement = xmlDocument.CreateElement(attributeConstants.attributes); + XmlElement attributesElement = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTES); attributesElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - CreateHUDSAttribute(xmlDocument, attributeConstants.name, hudsConstants.str, package.Name, attributesElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, hudsConstants.str, package.Name, attributesElement); if (package.IsModel != true) { if (package.Element.Stereotype != "") { - XmlElement stereotypeAttribute = xmlDocument.CreateElement(attributeConstants.attribute); + XmlElement stereotypeAttribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); stereotypeAttribute.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - stereotypeAttribute.SetAttribute(hudsConstants.key, attributeConstants.stereotype); + stereotypeAttribute.SetAttribute(hudsConstants.key, AttributeConstants.STEREOTYPE); - XmlElement stereotypeNameAttribute = xmlDocument.CreateElement(attributeConstants.attribute); + XmlElement stereotypeNameAttribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); stereotypeNameAttribute.SetAttribute(hudsConstants.dtype, hudsConstants.str); - stereotypeNameAttribute.SetAttribute(hudsConstants.key, attributeConstants.stereotypeName); + stereotypeNameAttribute.SetAttribute(hudsConstants.key, AttributeConstants.STEREOTYPENAME); stereotypeNameAttribute.InnerText = package.Element.Stereotype; @@ -172,9 +168,9 @@ public void UnpackagePackage(EA.Package package, XmlDocument xmlDocument, string string note = Regex.Replace(package.Notes, "<[^>]+>", string.Empty); note = Regex.Replace(note, ">", "greater than"); note = Regex.Replace(note, "<", "less than"); - CreateHUDSAttribute(xmlDocument, attributeConstants.documentation, hudsConstants.str, note, attributesElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.DOCUMENTATION, hudsConstants.str, note, attributesElement); } - if (package.Element.Alias != "") CreateHUDSAttribute(xmlDocument, attributeConstants.alias, hudsConstants.str, package.Element.Alias, attributesElement); + if (package.Element.Alias != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.ALIAS, hudsConstants.str, package.Element.Alias, attributesElement); } // Add type, id, and attributes node to data node @@ -252,15 +248,12 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin if (elementType == SysmlConstants.SYSMLOBJECT && element.ClassfierID != 0) elementType = SysmlConstants.SYSMLINSTANCESPECIFICATION; // Check if Initial Node is from Activity or State Machine if (elementType == SysmlConstants.SYSMLINITIALPSEUDOSTATE && parentType == SysmlConstants.SYSMLACTIVITY) elementType = SysmlConstants.SYSMLINITIALNODE; - - + + // Create id element to be added to data element - XmlElement idElement = xmlDocument.CreateElement(hudsConstants.id); - idElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - XmlElement eaIdElement = xmlDocument.CreateElement(hudsConstants.ea); - eaIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); string elementGuid = element.ElementGUID.Substring(1, element.ElementGUID.Length - 2); - eaIdElement.InnerText = elementGuid; + XmlElement idElement = MTIPCommon.CreateIdElement(xmlDocument, elementGuid); + // Get element profiles and attributes if (element.PropertyType != 0) { @@ -291,13 +284,13 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin else if (elementType == SysmlConstants.SYSMLFLOWPORT || elementType == SysmlConstants.SYSMLFULLPORT || elementType == SysmlConstants.SYSMLPROXYPORT || elementType == SysmlConstants.SYSMLPORT || elementType == SysmlConstants.SYSMLCONSTRAINTBLOCK || elementType == SysmlConstants.CONSTRAINTPROPERTY || elementType == SysmlConstants.SYSMLPARTPROPERTY) { - if (elementType != SysmlConstants.SYSMLPARTPROPERTY) CreateHUDSAttribute(xmlDocument, attributeConstants.isComposite, hudsConstants.str, element.IsComposite.ToString(), attributesElement); + if (elementType != SysmlConstants.SYSMLPARTPROPERTY) CreateHUDSAttribute(xmlDocument, AttributeConstants.ISCOMPOSITE, hudsConstants.str, element.IsComposite.ToString(), attributesElement); if (elementType != SysmlConstants.SYSMLPORT && elementType != SysmlConstants.SYSMLPARTPROPERTY) { profile = "SysML"; } } else if (elementType == SysmlConstants.SYSMLSTATE && element.ClassfierID != 0) { EA.Element classifierElement = repository.GetElementByID(element.ClassifierID); - CreateHUDSAttribute(xmlDocument, attributeConstants.submachine, hudsConstants.str, classifierElement.ElementGUID.Substring(1, element.ElementGUID.Length - 2), attributesElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.SUBMACHINE, hudsConstants.str, classifierElement.ElementGUID.Substring(1, element.ElementGUID.Length - 2), attributesElement); } else if (elementType == SysmlConstants.SYSMLTEXT && element.Name.Contains("://{")) @@ -357,16 +350,16 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin exportLog.Add("Unable to add classifier to xml: Name=" + element.Name + " - GUID=" + element.ElementGUID + " - Type=" + element.Type + " - Stereotype=" + element.Stereotype); } } - if (element.Name != "") CreateHUDSAttribute(xmlDocument, attributeConstants.name, hudsConstants.str, element.Name, attributesElement); + if (element.Name != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, hudsConstants.str, element.Name, attributesElement); if (element.Notes != "") { string note = Regex.Replace(element.Notes, "<[^>]+>", string.Empty); note = Regex.Replace(note, ">", "greater than"); note = Regex.Replace(note, "<", "less than"); - CreateHUDSAttribute(xmlDocument, attributeConstants.documentation, hudsConstants.str, note, attributesElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.DOCUMENTATION, hudsConstants.str, note, attributesElement); } - if (element.Alias != "") CreateHUDSAttribute(xmlDocument, attributeConstants.alias, hudsConstants.str, element.Alias, attributesElement); - if (element.Multiplicity != "") CreateHUDSAttribute(xmlDocument, attributeConstants.multiplicity, hudsConstants.str, element.Multiplicity, attributesElement); + if (element.Alias != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.ALIAS, hudsConstants.str, element.Alias, attributesElement); + if (element.Multiplicity != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.MULTIPLICITY, hudsConstants.str, element.Multiplicity, attributesElement); if (element.IsComposite && element.CompositeDiagram != null) { try @@ -397,21 +390,21 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin // Get stereotype if no element has SysML profile type if (element.Stereotype != "") { - XmlElement stereotypeAttribute = xmlDocument.CreateElement(attributeConstants.attribute); + XmlElement stereotypeAttribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); stereotypeAttribute.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - stereotypeAttribute.SetAttribute(hudsConstants.key, attributeConstants.stereotype); + stereotypeAttribute.SetAttribute(hudsConstants.key, AttributeConstants.STEREOTYPE); - XmlElement stereotypeNameAttribute = xmlDocument.CreateElement(attributeConstants.attribute); + XmlElement stereotypeNameAttribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); stereotypeNameAttribute.SetAttribute(hudsConstants.dtype, hudsConstants.str); - stereotypeNameAttribute.SetAttribute(hudsConstants.key, attributeConstants.stereotypeName); + stereotypeNameAttribute.SetAttribute(hudsConstants.key, AttributeConstants.STEREOTYPENAME); stereotypeNameAttribute.InnerText = element.StereotypeEx; stereotypeAttribute.AppendChild(stereotypeNameAttribute); if (profile != "") { - XmlElement stereotypeProfileAttribute = xmlDocument.CreateElement(attributeConstants.attribute); + XmlElement stereotypeProfileAttribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); stereotypeProfileAttribute.SetAttribute(hudsConstants.dtype, hudsConstants.str); - stereotypeProfileAttribute.SetAttribute(hudsConstants.key, attributeConstants.profileName); + stereotypeProfileAttribute.SetAttribute(hudsConstants.key, AttributeConstants.PROFILENAME); stereotypeProfileAttribute.InnerText = profile; stereotypeAttribute.AppendChild(stereotypeProfileAttribute); } @@ -423,22 +416,22 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin try { int key = 0; - XmlElement attributesbehaviorElement = xmlDocument.CreateElement(attributeConstants.attribute); - attributesbehaviorElement.SetAttribute(hudsConstants.key, attributeConstants.behavior); + XmlElement attributesbehaviorElement = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); + attributesbehaviorElement.SetAttribute(hudsConstants.key, AttributeConstants.BEHAVIOR); attributesbehaviorElement.SetAttribute(hudsConstants.dtype, hudsConstants.list); foreach (EA.Method method in element.Methods) { bool hasBehavior = false; if (method.Behavior != "") { - XmlElement attribute = xmlDocument.CreateElement(attributeConstants.attribute); + XmlElement attribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); attribute.SetAttribute(hudsConstants.key, key.ToString()); attribute.SetAttribute(hudsConstants.dtype, hudsConstants.dict); if (method.Name != "") { - XmlElement attributeName = xmlDocument.CreateElement(attributeConstants.attribute); - attributeName.SetAttribute(hudsConstants.key, attributeConstants.name); + XmlElement attributeName = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); + attributeName.SetAttribute(hudsConstants.key, AttributeConstants.NAME); attributeName.SetAttribute(hudsConstants.dtype, hudsConstants.str); attributeName.InnerText = method.Name; attribute.AppendChild(attributeName); @@ -446,8 +439,8 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin } if (method.Behavior != "") { - XmlElement attributeBehavior = xmlDocument.CreateElement(attributeConstants.attribute); - attributeBehavior.SetAttribute(hudsConstants.key, attributeConstants.value); + XmlElement attributeBehavior = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); + attributeBehavior.SetAttribute(hudsConstants.key, AttributeConstants.VALUE); attributeBehavior.SetAttribute(hudsConstants.dtype, hudsConstants.str); attributeBehavior.InnerText = method.Behavior; attribute.AppendChild(attributeBehavior); @@ -455,8 +448,8 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin } if (method.ReturnType != "") { - XmlElement attributeReturnType = xmlDocument.CreateElement(attributeConstants.attribute); - attributeReturnType.SetAttribute(hudsConstants.key, attributeConstants.type); + XmlElement attributeReturnType = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); + attributeReturnType.SetAttribute(hudsConstants.key, AttributeConstants.TYPE); attributeReturnType.SetAttribute(hudsConstants.dtype, hudsConstants.str); attributeReturnType.InnerText = method.ReturnType; attribute.AppendChild(attributeReturnType); @@ -488,20 +481,20 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin if (element.Attributes.Count > 0) { int key = 0; - XmlElement attributesAttributeElement = xmlDocument.CreateElement(attributeConstants.attribute); - attributesAttributeElement.SetAttribute(hudsConstants.key, attributeConstants.attribute); + XmlElement attributesAttributeElement = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); + attributesAttributeElement.SetAttribute(hudsConstants.key, AttributeConstants.ATTRIBUTE); attributesAttributeElement.SetAttribute(hudsConstants.dtype, hudsConstants.list); foreach (EA.Attribute attribute in element.Attributes) { - XmlElement attElement = xmlDocument.CreateElement(attributeConstants.attribute); + XmlElement attElement = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); attElement.SetAttribute(hudsConstants.key, key.ToString()); - CreateHUDSAttribute(xmlDocument, attributeConstants.type, hudsConstants.str, attribute.Type, attElement); - CreateHUDSAttribute(xmlDocument, attributeConstants.name, hudsConstants.str, attribute.Name, attElement); - if (attribute.Default != "") CreateHUDSAttribute(xmlDocument, attributeConstants.initialValue, hudsConstants.str, attribute.Default, attElement); - if (attribute.Visibility != "") CreateHUDSAttribute(xmlDocument, attributeConstants.visibility, hudsConstants.str, attribute.Visibility, attElement); - if (attribute.Stereotype != "") CreateHUDSAttribute(xmlDocument, attributeConstants.stereotype, hudsConstants.str, attribute.Stereotype, attElement); - if (attribute.Alias != "") CreateHUDSAttribute(xmlDocument, attributeConstants.alias, hudsConstants.str, attribute.Alias, attElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.TYPE, hudsConstants.str, attribute.Type, attElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, hudsConstants.str, attribute.Name, attElement); + if (attribute.Default != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.INITIALVALUE, hudsConstants.str, attribute.Default, attElement); + if (attribute.Visibility != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.VISIBILITY, hudsConstants.str, attribute.Visibility, attElement); + if (attribute.Stereotype != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.STEREOTYPE, hudsConstants.str, attribute.Stereotype, attElement); + if (attribute.Alias != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.ALIAS, hudsConstants.str, attribute.Alias, attElement); attributesAttributeElement.AppendChild(attElement); @@ -510,7 +503,7 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin attributesElement.AppendChild(attributesAttributeElement); } - if (element.ExtensionPoints != "") CreateHUDSAttribute(xmlDocument, attributeConstants.extensionPoint, hudsConstants.str, element.ExtensionPoints, attributesElement); + if (element.ExtensionPoints != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.EXTENSIONPOINT, hudsConstants.str, element.ExtensionPoints, attributesElement); Dictionary taggedValues = new Dictionary(); // Get element tagged values @@ -534,8 +527,8 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin if (taggedValues.Count > 0) { - XmlElement attributesTagsElement = xmlDocument.CreateElement(attributeConstants.attribute); - attributesTagsElement.SetAttribute(hudsConstants.key, attributeConstants.taggedValue); + XmlElement attributesTagsElement = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); + attributesTagsElement.SetAttribute(hudsConstants.key, AttributeConstants.TAGGEDVALUE); attributesTagsElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); foreach (KeyValuePair taggedValue in taggedValues) @@ -616,7 +609,7 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin CheckElementSysMLCompliance(element, elementType, parentType); // Add type, id, attributes, and relationships node to data node - idElement.AppendChild(eaIdElement); + dataElement.AppendChild(typeElement); dataElement.AppendChild(idElement); dataElement.AppendChild(attributesElement); @@ -633,7 +626,7 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin public void UnpackageDiagram(EA.Diagram diagram, XmlDocument xmlDocument, string parentGuid, string parentType) { XmlElement dataElement = xmlDocument.CreateElement(hudsConstants.data); - XmlElement attributesElement = xmlDocument.CreateElement(attributeConstants.attributes); + XmlElement attributesElement = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTES); attributesElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); XmlElement typeElement = xmlDocument.CreateElement(hudsConstants.type); typeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); @@ -642,7 +635,7 @@ public void UnpackageDiagram(EA.Diagram diagram, XmlDocument xmlDocument, string string diagramGuid = diagram.DiagramGUID.Substring(1, diagram.DiagramGUID.Length - 2); string diagramType = GetDiagramSysMLType(diagram); - if (diagramType == SysmlConstants.SYSMLPACKAGE) CreateHUDSAttribute(xmlDocument, attributeConstants.displayAs, hudsConstants.str, "Diagram", attributesElement); + if (diagramType == SysmlConstants.SYSMLPACKAGE) CreateHUDSAttribute(xmlDocument, AttributeConstants.DISPLAYAS, hudsConstants.str, "Diagram", attributesElement); typeElement.InnerText = diagramType; @@ -650,15 +643,11 @@ public void UnpackageDiagram(EA.Diagram diagram, XmlDocument xmlDocument, string CheckDiagramSysMLCompliance(diagram, diagramType, parentType); // Create id element to be added to data element - XmlElement idElement = xmlDocument.CreateElement(hudsConstants.id); - idElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - XmlElement eaIdElement = xmlDocument.CreateElement(hudsConstants.ea); - eaIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); - eaIdElement.InnerText = diagramGuid; - - CreateHUDSAttribute(xmlDocument, attributeConstants.name, hudsConstants.str, diagram.Name, attributesElement); + + XmlElement idElement = MTIPCommon.CreateIdElement(xmlDocument, diagramGuid); + CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, hudsConstants.str, diagram.Name, attributesElement); - if (diagramType == SysmlConstants.SYSMLCLASS) CreateHUDSAttribute(xmlDocument, attributeConstants.displayAs, hudsConstants.str, "Diagram", attributesElement); + if (diagramType == SysmlConstants.SYSMLCLASS) CreateHUDSAttribute(xmlDocument, AttributeConstants.DISPLAYAS, hudsConstants.str, "Diagram", attributesElement); if (diagram.DiagramObjects.Count > 0) { @@ -724,7 +713,7 @@ public void UnpackageDiagram(EA.Diagram diagram, XmlDocument xmlDocument, string elementRelElement.AppendChild(diagramObjectElement); key += 1; } - + } catch { @@ -809,7 +798,6 @@ public void UnpackageDiagram(EA.Diagram diagram, XmlDocument xmlDocument, string hasParentElement.AppendChild(hasParentIdElement); relationshipsElement.AppendChild(hasParentElement); - idElement.AppendChild(eaIdElement); dataElement.AppendChild(typeElement); dataElement.AppendChild(idElement); dataElement.AppendChild(attributesElement); @@ -858,22 +846,18 @@ public void UnpackageConnector(Connector connector, XmlDocument xmlDocument, typeElement.InnerText = connectorType; // Create id element to be added to data element - XmlElement idElement = xmlDocument.CreateElement(attributeConstants.id); - idElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - XmlElement eaIdElement = xmlDocument.CreateElement(hudsConstants.ea); - eaIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); - eaIdElement.InnerText = connectorGuid; - if (connector.Name != "") CreateHUDSAttribute(xmlDocument, attributeConstants.name, hudsConstants.str, connector.Name, attributesElement); + XmlElement idElement = MTIPCommon.CreateIdElement(xmlDocument, connectorGuid); + if (connector.Name != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, hudsConstants.str, connector.Name, attributesElement); if (connector.Stereotype != "") { - XmlElement stereotypeAttribute = xmlDocument.CreateElement(attributeConstants.attribute); + XmlElement stereotypeAttribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); stereotypeAttribute.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - stereotypeAttribute.SetAttribute(hudsConstants.key, attributeConstants.stereotype); + stereotypeAttribute.SetAttribute(hudsConstants.key, AttributeConstants.STEREOTYPE); - XmlElement stereotypeNameAttribute = xmlDocument.CreateElement(attributeConstants.attribute); + XmlElement stereotypeNameAttribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); stereotypeNameAttribute.SetAttribute(hudsConstants.dtype, hudsConstants.str); - stereotypeNameAttribute.SetAttribute(hudsConstants.key, attributeConstants.stereotypeName); + stereotypeNameAttribute.SetAttribute(hudsConstants.key, AttributeConstants.STEREOTYPENAME); stereotypeNameAttribute.InnerText = connector.Stereotype; stereotypeAttribute.AppendChild(stereotypeNameAttribute); @@ -883,7 +867,7 @@ public void UnpackageConnector(Connector connector, XmlDocument xmlDocument, if (connector.TransitionGuard != "") CreateHUDSAttribute(xmlDocument, relationshipConstants.guard, hudsConstants.str, connector.TransitionGuard, attributesElement); if (connector.TransitionAction == blockConstants.signal && connector.TransitionEvent == "Asynchronous") { - CreateHUDSAttribute(xmlDocument, attributeConstants.messageSort, hudsConstants.str, relationshipConstants.asynchSignal, attributesElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.MESSAGESORT, hudsConstants.str, relationshipConstants.asynchSignal, attributesElement); foreach (EA.ConnectorTag tag in connector.TaggedValues) { if (tag.Name == relationshipConstants.signalGuid && tag.Value != "") @@ -905,8 +889,8 @@ public void UnpackageConnector(Connector connector, XmlDocument xmlDocument, } } } - if (connector.TransitionAction == "Call" && connector.TransitionEvent == "Asynchronous") CreateHUDSAttribute(xmlDocument, attributeConstants.messageSort, hudsConstants.str, relationshipConstants.asynchCall, attributesElement); - if (connector.TransitionAction == "Call" && connector.TransitionEvent == "Synchronous") CreateHUDSAttribute(xmlDocument, attributeConstants.messageSort, hudsConstants.str, relationshipConstants.synchCall, attributesElement); + if (connector.TransitionAction == "Call" && connector.TransitionEvent == "Asynchronous") CreateHUDSAttribute(xmlDocument, AttributeConstants.MESSAGESORT, hudsConstants.str, relationshipConstants.asynchCall, attributesElement); + if (connector.TransitionAction == "Call" && connector.TransitionEvent == "Synchronous") CreateHUDSAttribute(xmlDocument, AttributeConstants.MESSAGESORT, hudsConstants.str, relationshipConstants.synchCall, attributesElement); CreateHUDSAttribute(xmlDocument, "isInclusiveOfBaseClass", hudsConstants.str, "false", attributesElement); @@ -960,7 +944,7 @@ public void UnpackageConnector(Connector connector, XmlDocument xmlDocument, hasParentElement.AppendChild(hasParentIdElement); relationshipsElement.AppendChild(hasParentElement); - idElement.AppendChild(eaIdElement); + dataElement.AppendChild(typeElement); dataElement.AppendChild(idElement); dataElement.AppendChild(attributesElement); @@ -983,6 +967,8 @@ public void UnpackageConnector(Connector connector, XmlDocument xmlDocument, exportLog.Add("Could not add connector to XML: " + connector.Name + " - Connector GUID: " + connector.ConnectorGUID); } + + } // Retuen package SysML type @@ -1007,10 +993,10 @@ public string GetPackageType(EA.Package package) } public void CreateHUDSAttribute(XmlDocument xmlDocument, string key, string type, string value, XmlElement parentElement) { - XmlElement attribute = xmlDocument.CreateElement(attributeConstants.attribute); + XmlElement attribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); attribute.SetAttribute(hudsConstants.key, key); attribute.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - XmlElement attributeAttrib = xmlDocument.CreateElement(attributeConstants.attribute); + XmlElement attributeAttrib = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); attributeAttrib.SetAttribute(hudsConstants.key, hudsConstants.value); attributeAttrib.SetAttribute(hudsConstants.dtype, type); attributeAttrib.InnerText = value; @@ -1028,12 +1014,7 @@ public void CreateConstraintNode(XmlDocument xmlDocument, string constraintGuid, relationshipsElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); // Create id element to be added to constraint data element - XmlElement idElement = xmlDocument.CreateElement(hudsConstants.id); - idElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - XmlElement eaIdElement = xmlDocument.CreateElement(hudsConstants.ea); - idElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); - eaIdElement.InnerText = constraintGuid; - + XmlElement idElement = MTIPCommon.CreateIdElement(xmlDocument, constraintGuid); // Create constraint relationship XmlElement valueSpecificationElement = xmlDocument.CreateElement(relationshipConstants.valueSpecification); @@ -1067,7 +1048,6 @@ public void CreateConstraintNode(XmlDocument xmlDocument, string constraintGuid, relationshipsElement.AppendChild(hasParentElement); // Add type, id, attributes, and relationships node to data node - idElement.AppendChild(eaIdElement); dataElement.AppendChild(typeElement); dataElement.AppendChild(idElement); dataElement.AppendChild(relationshipsElement); @@ -1088,11 +1068,7 @@ public void CreateOpaqueNode(XmlDocument xmlDocument, string opaqueGuid, string // Create id element to be added to opaque expression data element - XmlElement idElement = xmlDocument.CreateElement(hudsConstants.id); - relationshipsElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - XmlElement eaIdElement = xmlDocument.CreateElement(hudsConstants.ea); - eaIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); - eaIdElement.InnerText = opaqueGuid; + XmlElement idElement = MTIPCommon.CreateIdElement(xmlDocument, opaqueGuid); // Create opaque expression relationship XmlElement hasParentElement = xmlDocument.CreateElement(relationshipConstants.hasParent); @@ -1111,10 +1087,9 @@ public void CreateOpaqueNode(XmlDocument xmlDocument, string opaqueGuid, string relationshipsElement.AppendChild(hasParentElement); // Create opaque expression relationship - CreateHUDSAttribute(xmlDocument, attributeConstants.body, hudsConstants.str, name, attributesElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.BODY, hudsConstants.str, name, attributesElement); // Add type, id, attributes, and relationships node to data node - idElement.AppendChild(eaIdElement); dataElement.AppendChild(typeElement); dataElement.AppendChild(idElement); dataElement.AppendChild(attributesElement); diff --git a/MTIP/Translations/MTIPImportFunctions.cs b/MTIP/Translations/MTIPImportFunctions.cs index 7e3a6d8..8fea40e 100644 --- a/MTIP/Translations/MTIPImportFunctions.cs +++ b/MTIP/Translations/MTIPImportFunctions.cs @@ -156,9 +156,7 @@ internal void GetSysmlMTIPModel(EA.Package rootPkg, XmlNode packet) internal Dictionary BuildModelDictionary(XmlNode packet) { Dictionary modelElements = new Dictionary(); - AttributeConstants attributeConstants = new AttributeConstants(); - - + foreach (XmlNode dataNode in packet) { XmlItem modelElement = new XmlItem(); @@ -166,7 +164,7 @@ internal void GetSysmlMTIPModel(EA.Package rootPkg, XmlNode packet) foreach (XmlNode fieldNode in dataNode) { // get model element type (ex. Sysml.Package) - if (fieldNode.Name == attributeConstants.type) + if (fieldNode.Name == AttributeConstants.TYPE) { string type = fieldNode.InnerText; string element = type.Split('.')[1]; @@ -174,7 +172,7 @@ internal void GetSysmlMTIPModel(EA.Package rootPkg, XmlNode packet) } //get ID associated with each model element (for now, EA GUID) - if (fieldNode.Name == attributeConstants.id) + if (fieldNode.Name == AttributeConstants.ID) { if (fieldNode.SelectSingleNode("ea") != null) modelElement.SetMappingID(dataNode.SelectSingleNode("id").SelectSingleNode("ea").InnerText); else if (fieldNode.SelectSingleNode("cameo") != null) modelElement.SetMappingID(dataNode.SelectSingleNode("id").SelectSingleNode("cameo").InnerText); @@ -183,11 +181,11 @@ internal void GetSysmlMTIPModel(EA.Package rootPkg, XmlNode packet) } // Loop through attributes - if (fieldNode.Name == attributeConstants.attributes) + if (fieldNode.Name == AttributeConstants.ATTRIBUTES) { modelElement = GetAttributes(fieldNode, modelElement); } - if (fieldNode.Name == attributeConstants.relationships) + if (fieldNode.Name == AttributeConstants.RELATIONSHIPS) { modelElement = GetRelationships(fieldNode, modelElement); } @@ -376,13 +374,11 @@ internal void GetChildren(string parentId) internal XmlItem GetAttributes(XmlNode fieldNode, XmlItem modelElement) { - AttributeConstants attributeConstants = new AttributeConstants(); - foreach (XmlNode attribute in fieldNode) { try { - if (attribute.Attributes["key"].Value == attributeConstants.attribute) + if (attribute.Attributes["key"].Value == AttributeConstants.ATTRIBUTE) { foreach (XmlNode attributeAttrib in attribute) { @@ -390,72 +386,72 @@ internal XmlItem GetAttributes(XmlNode fieldNode, XmlItem modelElement) string name = ""; foreach (XmlNode attribAttrib in attributeAttrib) { - if (attribAttrib.Attributes["key"].Value == attributeConstants.type) attributeAttributes.Add(attributeConstants.type, GetInnerAttribute(attribAttrib)); - if (attribAttrib.Attributes["key"].Value == attributeConstants.initialValue) attributeAttributes.Add(attributeConstants.initialValue, GetInnerAttribute(attribAttrib)); - if (attribAttrib.Attributes["key"].Value == attributeConstants.visibility) attributeAttributes.Add(attributeConstants.visibility, GetInnerAttribute(attribAttrib)); - if (attribAttrib.Attributes["key"].Value == attributeConstants.stereotype) attributeAttributes.Add(attributeConstants.stereotype, GetInnerAttribute(attribAttrib)); - if (attribAttrib.Attributes["key"].Value == attributeConstants.alias) attributeAttributes.Add(attributeConstants.alias, GetInnerAttribute(attribAttrib)); - if (attribAttrib.Attributes["key"].Value == attributeConstants.name) name = GetInnerAttribute(attribAttrib); ; + if (attribAttrib.Attributes["key"].Value == AttributeConstants.TYPE) attributeAttributes.Add(AttributeConstants.TYPE, GetInnerAttribute(attribAttrib)); + if (attribAttrib.Attributes["key"].Value == AttributeConstants.INITIALVALUE) attributeAttributes.Add(AttributeConstants.INITIALVALUE, GetInnerAttribute(attribAttrib)); + if (attribAttrib.Attributes["key"].Value == AttributeConstants.VISIBILITY) attributeAttributes.Add(AttributeConstants.VISIBILITY, GetInnerAttribute(attribAttrib)); + if (attribAttrib.Attributes["key"].Value == AttributeConstants.STEREOTYPE) attributeAttributes.Add(AttributeConstants.STEREOTYPE, GetInnerAttribute(attribAttrib)); + if (attribAttrib.Attributes["key"].Value == AttributeConstants.ALIAS) attributeAttributes.Add(AttributeConstants.ALIAS, GetInnerAttribute(attribAttrib)); + if (attribAttrib.Attributes["key"].Value == AttributeConstants.NAME) name = GetInnerAttribute(attribAttrib); ; } modelElement.AddElementAttribute(name, attributeAttributes); } } - else if (attribute.Attributes["key"].Value == attributeConstants.stereotype) + else if (attribute.Attributes["key"].Value == AttributeConstants.STEREOTYPE) { foreach (XmlNode attribStereotype in attribute) { - if (attribStereotype.Attributes["key"].Value == attributeConstants.stereotypeName) + if (attribStereotype.Attributes["key"].Value == AttributeConstants.STEREOTYPENAME) { if (attribStereotype.InnerText == "Term") GetTerm(fieldNode); - if (!modelElement.GetAttributes().ContainsKey(attributeConstants.stereotype)) modelElement.AddAttribute(attributeConstants.stereotype, attribStereotype.InnerText); + if (!modelElement.GetAttributes().ContainsKey(AttributeConstants.STEREOTYPE)) modelElement.AddAttribute(AttributeConstants.STEREOTYPE, attribStereotype.InnerText); } - if (attribStereotype.Attributes["key"].Value == attributeConstants.profileId) modelElement.SetProfileId(attribStereotype.InnerText); - if (attribStereotype.Attributes["key"].Value == attributeConstants.profileName) modelElement.SetProfileName(attribStereotype.InnerText); + if (attribStereotype.Attributes["key"].Value == AttributeConstants.PROFILEID) modelElement.SetProfileId(attribStereotype.InnerText); + if (attribStereotype.Attributes["key"].Value == AttributeConstants.PROFILENAME) modelElement.SetProfileName(attribStereotype.InnerText); } } - else if (attribute.Attributes["key"].Value == attributeConstants.name) + else if (attribute.Attributes["key"].Value == AttributeConstants.NAME) { - modelElement.AddAttribute(attributeConstants.name, GetInnerAttribute(attribute)); + modelElement.AddAttribute(AttributeConstants.NAME, GetInnerAttribute(attribute)); } - else if (attribute.Attributes["key"].Value == attributeConstants.documentation) + else if (attribute.Attributes["key"].Value == AttributeConstants.DOCUMENTATION) { - modelElement.AddAttribute(attributeConstants.documentation, GetInnerAttribute(attribute)); + modelElement.AddAttribute(AttributeConstants.DOCUMENTATION, GetInnerAttribute(attribute)); } - else if (attribute.Attributes["key"].Value == attributeConstants.displayAs) + else if (attribute.Attributes["key"].Value == AttributeConstants.DISPLAYAS) { - modelElement.AddAttribute(attributeConstants.displayAs, GetInnerAttribute(attribute)); + modelElement.AddAttribute(AttributeConstants.DISPLAYAS, GetInnerAttribute(attribute)); } - else if (attribute.Attributes["key"].Value == attributeConstants.constraint) + else if (attribute.Attributes["key"].Value == AttributeConstants.CONSTRAINT) { modelElement.AddConstraint(attribute.InnerText, GetInnerAttribute(attribute)); } - else if (attribute.Attributes["key"].Value == attributeConstants.taggedValue) + else if (attribute.Attributes["key"].Value == AttributeConstants.TAGGEDVALUE) { foreach (XmlNode taggedValue in attribute) { modelElement.AddTaggedValue(taggedValue.Attributes["key"].Value, GetInnerAttribute(taggedValue)); } } - else if (attribute.Attributes["key"].Value == attributeConstants.behavior) + else if (attribute.Attributes["key"].Value == AttributeConstants.BEHAVIOR) { foreach (XmlNode attr in attribute) { Behavior behavior = new Behavior(); foreach (XmlNode method in attr) { - if (method.Attributes["key"].Value == attributeConstants.name) behavior.SetName(method.InnerText); - if (method.Attributes["key"].Value == attributeConstants.type) behavior.SetType(method.InnerText); - if (method.Attributes["key"].Value == attributeConstants.value) behavior.SetValue(method.InnerText); + if (method.Attributes["key"].Value == AttributeConstants.NAME) behavior.SetName(method.InnerText); + if (method.Attributes["key"].Value == AttributeConstants.TYPE) behavior.SetType(method.InnerText); + if (method.Attributes["key"].Value == AttributeConstants.VALUE) behavior.SetValue(method.InnerText); modelElement.AddBehavior(behavior); } } } - else if (attribute.Attributes["key"].Value == attributeConstants.receiveEvent) + else if (attribute.Attributes["key"].Value == AttributeConstants.RECEIVEEVENT) { modelElement.SetClient(GetInnerAttribute(attribute)); } - else if (attribute.Attributes["key"].Value == attributeConstants.sendEvent) + else if (attribute.Attributes["key"].Value == AttributeConstants.SENDEVENT) { modelElement.SetSupplier(GetInnerAttribute(attribute)); } @@ -481,11 +477,10 @@ internal XmlItem GetAttributes(XmlNode fieldNode, XmlItem modelElement) internal string GetInnerAttribute(XmlNode attribute) { string value = ""; - AttributeConstants attributeConstants = new AttributeConstants(); - + foreach (XmlNode attrib in attribute) { - if (attrib.Attributes["key"].Value == attributeConstants.value) + if (attrib.Attributes["key"].Value == AttributeConstants.VALUE) { value = attrib.InnerText; } @@ -611,19 +606,18 @@ internal XmlItem GetRelationships(XmlNode fieldNode, XmlItem modelElement) } internal void AddPkgPkg(string parentId, string childId) { - AttributeConstants attributeConstants = new AttributeConstants(); try { EA.Package parentPkg = repository.GetPackageByGuid(parsedXml[parentId].GetEAID()); XmlItem childItem = parsedXml[childId]; - if (childItem.GetAttributes().ContainsKey(attributeConstants.displayAs)) + if (childItem.GetAttributes().ContainsKey(AttributeConstants.DISPLAYAS)) { - if (childItem.GetAttribute(attributeConstants.displayAs) == "Diagram") diagramElements.Add(childItem.GetMappingID(), childItem); + if (childItem.GetAttribute(AttributeConstants.DISPLAYAS) == "Diagram") diagramElements.Add(childItem.GetMappingID(), childItem); } else if (childItem.GetElementType() == SysmlConstants.PROFILE) { - EA.Package childPkg = parentPkg.Packages.AddNew(childItem.GetAttribute(attributeConstants.name), ""); + EA.Package childPkg = parentPkg.Packages.AddNew(childItem.GetAttribute(AttributeConstants.NAME), ""); childPkg.Update(); childPkg.Element.Stereotype = "Profile"; childPkg.Update(); @@ -631,15 +625,15 @@ internal void AddPkgPkg(string parentId, string childId) } else { - EA.Package childPkg = parentPkg.Packages.AddNew(childItem.GetAttribute(attributeConstants.name), ""); + EA.Package childPkg = parentPkg.Packages.AddNew(childItem.GetAttribute(AttributeConstants.NAME), ""); string notes = ""; - if (childItem.GetAttributes().ContainsKey(attributeConstants.documentation)) + if (childItem.GetAttributes().ContainsKey(AttributeConstants.DOCUMENTATION)) { - notes += childItem.GetAttribute(attributeConstants.documentation); + notes += childItem.GetAttribute(AttributeConstants.DOCUMENTATION); } - if (childItem.GetAttributes().ContainsKey(attributeConstants.text)) + if (childItem.GetAttributes().ContainsKey(AttributeConstants.TEXT)) { - notes = " - " + childItem.GetAttribute(attributeConstants.text); + notes = " - " + childItem.GetAttribute(AttributeConstants.TEXT); } childPkg.Notes = notes; childPkg.Update(); @@ -653,17 +647,17 @@ internal void AddPkgPkg(string parentId, string childId) } internal void AddPkgElement(string parentId, string childId) { - AttributeConstants attributeConstants = new AttributeConstants(); + XmlItem childItem = parsedXml[childId]; string stereotype = ""; - if (childItem.GetAttributes().ContainsKey(attributeConstants.stereotype)) stereotype = childItem.GetAttribute(attributeConstants.stereotype); + if (childItem.GetAttributes().ContainsKey(AttributeConstants.STEREOTYPE)) stereotype = childItem.GetAttribute(AttributeConstants.STEREOTYPE); if (GetEAType(childItem.GetElementType(), stereotype) != "") { try { - if (childItem.GetAttributes().ContainsKey(attributeConstants.displayAs)) + if (childItem.GetAttributes().ContainsKey(AttributeConstants.DISPLAYAS)) { - if (childItem.GetAttribute(attributeConstants.displayAs) == "Diagram") diagramElements.Add(childItem.GetMappingID(), childItem); + if (childItem.GetAttribute(AttributeConstants.DISPLAYAS) == "Diagram") diagramElements.Add(childItem.GetMappingID(), childItem); } else { @@ -671,9 +665,9 @@ internal void AddPkgElement(string parentId, string childId) EA.Package parentPkg = repository.GetPackageByGuid(parsedXml[parentId].GetEAID()); EA.Element childElement = parentPkg.Elements.AddNew(childItem.GetName(), GetEAType(childItem.GetElementType(), stereotype)); - if (childItem.GetAttributes().ContainsKey(attributeConstants.documentation)) + if (childItem.GetAttributes().ContainsKey(AttributeConstants.DOCUMENTATION)) { - childElement.Notes = childItem.GetAttribute(attributeConstants.documentation); + childElement.Notes = childItem.GetAttribute(AttributeConstants.DOCUMENTATION); } GetElement(childElement, childItem, childId, SysmlConstants.SYSMLPACKAGE); } @@ -693,18 +687,18 @@ internal void AddPkgElement(string parentId, string childId) } internal void AddElementElement(string parentId, string childId) { - AttributeConstants attributeConstants = new AttributeConstants(); + XmlItem childItem = parsedXml[childId]; string stereotype = ""; - if (childItem.GetAttributes().ContainsKey(attributeConstants.stereotype)) stereotype = childItem.GetAttribute(attributeConstants.stereotype); + if (childItem.GetAttributes().ContainsKey(AttributeConstants.STEREOTYPE)) stereotype = childItem.GetAttribute(AttributeConstants.STEREOTYPE); if (GetEAType(childItem.GetElementType(), stereotype) != "") { try { - if (childItem.GetAttributes().ContainsKey(attributeConstants.displayAs)) + if (childItem.GetAttributes().ContainsKey(AttributeConstants.DISPLAYAS)) { - if (childItem.GetAttribute(attributeConstants.displayAs) == "Diagram") diagramElements.Add(childItem.GetMappingID(), childItem); + if (childItem.GetAttribute(AttributeConstants.DISPLAYAS) == "Diagram") diagramElements.Add(childItem.GetMappingID(), childItem); } else { @@ -759,7 +753,7 @@ internal void GetElement(EA.Element childElement, XmlItem childItem, string chil StereotypeConstants stereotypeConstants = new StereotypeConstants(); MetatypeConstants metatypeConstants = new MetatypeConstants(); ProfileConstants profileConstants = new ProfileConstants(); - AttributeConstants attributeConstants = new AttributeConstants(); + if (childElement.Type == SysmlConstants.STATENODE) { @@ -812,9 +806,9 @@ internal void GetElement(EA.Element childElement, XmlItem childItem, string chil if (childItem.GetElementType() == SysmlConstants.DATASTORENODE) childElement.Stereotype = stereotypeConstants.datastore; } - if (childElement.Type == SysmlConstants.STATE && childItem.GetAttributes().ContainsKey(attributeConstants.submachine)) + if (childElement.Type == SysmlConstants.STATE && childItem.GetAttributes().ContainsKey(AttributeConstants.SUBMACHINE)) { - childItem.SetClassifiedBy(childItem.GetAttribute(attributeConstants.submachine)); + childItem.SetClassifiedBy(childItem.GetAttribute(AttributeConstants.SUBMACHINE)); classifiersToAdd.Add(childItem.GetMappingID(), childItem); } if (childElement.Type == SysmlConstants.CONSTRAINT) @@ -834,9 +828,9 @@ internal void GetElement(EA.Element childElement, XmlItem childItem, string chil } if (childElement.Type == SysmlConstants.COMBINEDFRAGMENT) { - if (childItem.GetAttributes().ContainsKey(attributeConstants.interactionOperatorKind)) + if (childItem.GetAttributes().ContainsKey(AttributeConstants.INTERACTIONOPERATORKIND)) { - string interactionKind = childItem.GetAttributes()[attributeConstants.interactionOperatorKind]; + string interactionKind = childItem.GetAttributes()[AttributeConstants.INTERACTIONOPERATORKIND]; if (interactionKind == "alt") childElement.Subtype = 0; else if (interactionKind == "assert") childElement.Subtype = 7; else if (interactionKind == "break") childElement.Subtype = 2; @@ -854,46 +848,46 @@ internal void GetElement(EA.Element childElement, XmlItem childItem, string chil childElement.Update(); childElement.Refresh(); if (childItem.GetElementType() == SysmlConstants.JOIN || childItem.GetElementType() == SysmlConstants.FORK) childElement.Stereotype = childItem.GetElementType(); - if (childItem.GetAttributes().ContainsKey(attributeConstants.displayAs)) + if (childItem.GetAttributes().ContainsKey(AttributeConstants.DISPLAYAS)) { - if (childItem.GetAttribute(attributeConstants.displayAs) == "Diagram") diagramElements.Add(childItem.GetMappingID(), childItem); + if (childItem.GetAttribute(AttributeConstants.DISPLAYAS) == "Diagram") diagramElements.Add(childItem.GetMappingID(), childItem); } - if (childItem.GetAttributes().ContainsKey(attributeConstants.stereotype)) + if (childItem.GetAttributes().ContainsKey(AttributeConstants.STEREOTYPE)) { if (childItem.GetElementType() == SysmlConstants.STEREOTYPE) childElement.Stereotype = stereotypeConstants.stereotype; else { - childElement.Stereotype = childItem.GetAttribute(attributeConstants.stereotype); + childElement.Stereotype = childItem.GetAttribute(AttributeConstants.STEREOTYPE); } if (childItem.GetProfile() != "" && childItem.GetProfileID() != "") { - childElement.StereotypeEx = childItem.GetProfile() + "::" + childItem.GetAttribute(attributeConstants.stereotype); + childElement.StereotypeEx = childItem.GetProfile() + "::" + childItem.GetAttribute(AttributeConstants.STEREOTYPE); } } - if (childItem.GetAttributes().ContainsKey(attributeConstants.extensionPoint)) + if (childItem.GetAttributes().ContainsKey(AttributeConstants.EXTENSIONPOINT)) { - childElement.ExtensionPoints = childItem.GetAttribute(attributeConstants.extensionPoint); + childElement.ExtensionPoints = childItem.GetAttribute(AttributeConstants.EXTENSIONPOINT); } - if (childItem.GetClassifiedBy() != "" && !childItem.GetAttributes().ContainsKey(attributeConstants.submachine)) + if (childItem.GetClassifiedBy() != "" && !childItem.GetAttributes().ContainsKey(AttributeConstants.SUBMACHINE)) { classifiersToAdd.Add(childItem.GetMappingID(), childItem); } string notes = ""; - if (childItem.GetAttributes().ContainsKey(attributeConstants.documentation)) + if (childItem.GetAttributes().ContainsKey(AttributeConstants.DOCUMENTATION)) { - notes += childItem.GetAttribute(attributeConstants.documentation); + notes += childItem.GetAttribute(AttributeConstants.DOCUMENTATION); } - if (childItem.GetAttributes().ContainsKey(attributeConstants.text)) + if (childItem.GetAttributes().ContainsKey(AttributeConstants.TEXT)) { - notes = " - " + childItem.GetAttribute(attributeConstants.text); + notes = " - " + childItem.GetAttribute(AttributeConstants.TEXT); } childElement.Notes = notes; - if (childItem.GetAttributes().ContainsKey(attributeConstants.multiplicity)) + if (childItem.GetAttributes().ContainsKey(AttributeConstants.MULTIPLICITY)) { - childElement.Multiplicity = childItem.GetAttribute(attributeConstants.multiplicity); + childElement.Multiplicity = childItem.GetAttribute(AttributeConstants.MULTIPLICITY); } - if (childItem.GetAttributes().ContainsKey(attributeConstants.defaultValue)) + if (childItem.GetAttributes().ContainsKey(AttributeConstants.DEFAULTVALUE)) { //childElement. = childItem.GetAttribute("extensionPoint"); } @@ -905,12 +899,12 @@ internal void GetElement(EA.Element childElement, XmlItem childItem, string chil { foreach (KeyValuePair attribute in childItem.GetElementAttributes()) { - EA.Attribute childAttribute = childElement.Attributes.AddNew(attribute.Key, attribute.Value.GetAttribute(attributeConstants.type)); - if (attribute.Value.GetAttributes().ContainsKey(attributeConstants.defaultValue)) childAttribute.Default = attribute.Value.GetAttribute(attributeConstants.defaultValue); - if (attribute.Value.GetAttributes().ContainsKey(attributeConstants.initialValue)) childAttribute.Default = attribute.Value.GetAttribute(attributeConstants.initialValue); - if (attribute.Value.GetAttributes().ContainsKey(attributeConstants.stereotype)) childAttribute.Stereotype = attribute.Value.GetAttribute(attributeConstants.stereotype); - if (attribute.Value.GetAttributes().ContainsKey(attributeConstants.visibility)) childAttribute.Visibility = attribute.Value.GetAttribute(attributeConstants.visibility); - if (attribute.Value.GetAttributes().ContainsKey(attributeConstants.alias)) childAttribute.Alias = attribute.Value.GetAttribute(attributeConstants.alias); + EA.Attribute childAttribute = childElement.Attributes.AddNew(attribute.Key, attribute.Value.GetAttribute(AttributeConstants.TYPE)); + if (attribute.Value.GetAttributes().ContainsKey(AttributeConstants.DEFAULTVALUE)) childAttribute.Default = attribute.Value.GetAttribute(AttributeConstants.DEFAULTVALUE); + if (attribute.Value.GetAttributes().ContainsKey(AttributeConstants.INITIALVALUE)) childAttribute.Default = attribute.Value.GetAttribute(AttributeConstants.INITIALVALUE); + if (attribute.Value.GetAttributes().ContainsKey(AttributeConstants.STEREOTYPE)) childAttribute.Stereotype = attribute.Value.GetAttribute(AttributeConstants.STEREOTYPE); + if (attribute.Value.GetAttributes().ContainsKey(AttributeConstants.VISIBILITY)) childAttribute.Visibility = attribute.Value.GetAttribute(AttributeConstants.VISIBILITY); + if (attribute.Value.GetAttributes().ContainsKey(AttributeConstants.ALIAS)) childAttribute.Alias = attribute.Value.GetAttribute(AttributeConstants.ALIAS); childAttribute.Update(); } } @@ -939,15 +933,15 @@ internal void GetElement(EA.Element childElement, XmlItem childItem, string chil } List attributesAllowed = new List() { - attributeConstants.stereotype, - attributeConstants.documentation, - attributeConstants.text, - attributeConstants.alias, - attributeConstants.displayAs, - attributeConstants.name, - attributeConstants.submachine, - attributeConstants.multiplicity, - attributeConstants.interactionOperatorKind + AttributeConstants.STEREOTYPE, + AttributeConstants.DOCUMENTATION, + AttributeConstants.TEXT, + AttributeConstants.ALIAS, + AttributeConstants.DISPLAYAS, + AttributeConstants.NAME, + AttributeConstants.SUBMACHINE, + AttributeConstants.MULTIPLICITY, + AttributeConstants.INTERACTIONOPERATORKIND }; foreach (KeyValuePair attribute in childItem.GetAttributes()) { @@ -965,14 +959,14 @@ internal void GetElement(EA.Element childElement, XmlItem childItem, string chil } internal void GetTerm(XmlNode fieldNode) { - AttributeConstants attributeConstants = new AttributeConstants(); + GlossaryTerm term = new GlossaryTerm(); foreach (XmlNode attribute in fieldNode) { if (attribute.Attributes["key"] != null) { - if (attribute.Attributes["key"].Value == attributeConstants.name) term.SetName(attribute.InnerText); - else if (attribute.Attributes["key"].Value == attributeConstants.documentation) term.SetMeaning(attribute.InnerText); + if (attribute.Attributes["key"].Value == AttributeConstants.NAME) term.SetName(attribute.InnerText); + else if (attribute.Attributes["key"].Value == AttributeConstants.DOCUMENTATION) term.SetMeaning(attribute.InnerText); term.SetTermType("string"); } } @@ -1005,7 +999,7 @@ internal void AddConnectors() { foreach (KeyValuePair relationshipItem in relationshipElements) { - AttributeConstants attributeConstants = new AttributeConstants(); + RelationshipConstants relationshipConstants = new RelationshipConstants(); try { @@ -1036,9 +1030,9 @@ internal void AddConnectors() EA.Connector associationConnector = clientElement.Connectors.AddNew("", "Message"); associationConnector.Name = relationshipItem.Value.GetName(); - if (relationshipItem.Value.GetAttributes().ContainsKey(attributeConstants.messageSort)) + if (relationshipItem.Value.GetAttributes().ContainsKey(AttributeConstants.MESSAGESORT)) { - if (relationshipItem.Value.GetAttribute(attributeConstants.messageSort) == relationshipConstants.asynchSignal) + if (relationshipItem.Value.GetAttribute(AttributeConstants.MESSAGESORT) == relationshipConstants.asynchSignal) { associationConnector.TransitionEvent = "Asynchronous"; associationConnector.TransitionAction = "Signal"; @@ -1057,14 +1051,14 @@ internal void AddConnectors() associationConnector.Update(); } } - if (relationshipItem.Value.GetAttribute(attributeConstants.messageSort) == relationshipConstants.asynchCall) + if (relationshipItem.Value.GetAttribute(AttributeConstants.MESSAGESORT) == relationshipConstants.asynchCall) { associationConnector.TransitionEvent = "Asynchronous"; associationConnector.TransitionAction = "Call"; associationConnector.SupplierID = supplierElement.ElementID; associationConnector.ClientID = clientElement.ElementID; } - if (relationshipItem.Value.GetAttribute(attributeConstants.messageSort) == relationshipConstants.synchCall) + if (relationshipItem.Value.GetAttribute(AttributeConstants.MESSAGESORT) == relationshipConstants.synchCall) { associationConnector.TransitionEvent = "Synchronous"; associationConnector.TransitionAction = "Call"; @@ -1072,7 +1066,7 @@ internal void AddConnectors() associationConnector.ClientID = clientElement.ElementID; } - if (relationshipItem.Value.GetAttribute(attributeConstants.messageSort) == relationshipConstants.reply) + if (relationshipItem.Value.GetAttribute(AttributeConstants.MESSAGESORT) == relationshipConstants.reply) { associationConnector.TransitionEvent = "Synchronous"; associationConnector.TransitionAction = "Call"; @@ -1080,9 +1074,9 @@ internal void AddConnectors() associationConnector.ClientID = clientElement.ElementID; } } - if (relationshipItem.Value.GetAttributes().ContainsKey(attributeConstants.documentation)) + if (relationshipItem.Value.GetAttributes().ContainsKey(AttributeConstants.DOCUMENTATION)) { - associationConnector.Notes = relationshipItem.Value.GetAttribute(attributeConstants.documentation); + associationConnector.Notes = relationshipItem.Value.GetAttribute(AttributeConstants.DOCUMENTATION); } clientElement.Connectors.Refresh(); supplierElement.Connectors.Refresh(); @@ -1105,9 +1099,9 @@ internal void AddConnectors() associationConnector.Subtype = "Extends"; associationConnector.MetaType = "Extend"; } - if (relationshipItem.Value.GetAttributes().ContainsKey(attributeConstants.stereotype)) + if (relationshipItem.Value.GetAttributes().ContainsKey(AttributeConstants.STEREOTYPE)) { - string stereotype = relationshipItem.Value.GetAttribute(attributeConstants.stereotype); + string stereotype = relationshipItem.Value.GetAttribute(AttributeConstants.STEREOTYPE); associationConnector.Stereotype = stereotype; associationConnector.Update(); // Add the type of the metarelationship or stereotyped relationship as a tagged value @@ -1140,9 +1134,9 @@ internal void AddConnectors() associationConnector.SupplierEnd.Aggregation = 2; associationConnector.Subtype = "Strong"; } - if (relationshipItem.Value.GetAttributes().ContainsKey(attributeConstants.documentation)) + if (relationshipItem.Value.GetAttributes().ContainsKey(AttributeConstants.DOCUMENTATION)) { - associationConnector.Notes = relationshipItem.Value.GetAttribute(attributeConstants.documentation); + associationConnector.Notes = relationshipItem.Value.GetAttribute(AttributeConstants.DOCUMENTATION); } associationConnector.Update(); @@ -1226,7 +1220,7 @@ internal void AddConstraints() } internal void BuildDiagrams() { - AttributeConstants attributeConstants = new AttributeConstants(); + foreach (KeyValuePair diagramItem in diagramElements) { try @@ -1234,7 +1228,7 @@ internal void BuildDiagrams() XmlItem parentItem = parsedXml[diagramItem.Value.GetParent()]; string stereotype = ""; - if (diagramItem.Value.GetAttributes().ContainsKey(attributeConstants.stereotype)) stereotype = diagramItem.Value.GetAttribute(attributeConstants.stereotype); + if (diagramItem.Value.GetAttributes().ContainsKey(AttributeConstants.STEREOTYPE)) stereotype = diagramItem.Value.GetAttribute(AttributeConstants.STEREOTYPE); List childItemIds = new List(); @@ -1428,7 +1422,7 @@ internal void AddHyperlinks() { foreach (KeyValuePair hyperlinkToAdd in hyperLinksToAdd) { - AttributeConstants attributeConstants = new AttributeConstants(); + try { XmlItem parentItem = parsedXml[hyperlinkToAdd.Value.GetParent()]; @@ -1436,7 +1430,7 @@ internal void AddHyperlinks() EA.Package parentElement = repository.GetPackageByGuid(parentItem.GetEAID()); EA.Diagram targetDiagram = repository.GetDiagramByGuid(parsedXml[hyperlinkToAdd.Value.GetHyperlink()].GetEAID()); EA.Element hyperlinkElement = parentElement.Elements.AddNew("$" + hyperlinkToAdd.Value.GetHyperlinkType() + "://{" + targetDiagram.DiagramGUID + "}", "Text"); - hyperlinkElement.Notes = hyperlinkItem.GetAttribute(attributeConstants.documentation); + hyperlinkElement.Notes = hyperlinkItem.GetAttribute(AttributeConstants.DOCUMENTATION); hyperlinkItem.SetEAID(hyperlinkElement.ElementGUID); hyperlinkElement.Update(); parentElement.Elements.Refresh(); @@ -1526,16 +1520,16 @@ internal void AddCompositeDiagrams() } internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair diagramItem) { - AttributeConstants attributeConstants = new AttributeConstants(); + DiagramConstants diagramConstants = new DiagramConstants(); EA.Package pkg = repository.GetPackageByID(1); - EA.Diagram relationshipDiagram = repository.GetPackageByID(1).Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.component); ; + EA.Diagram relationshipDiagram = repository.GetPackageByID(1).Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.component); ; if (parentItem.GetElementType() == SysmlConstants.PACKAGE || parentItem.GetElementType() == SysmlConstants.PROFILE || parentItem.GetElementType() == SysmlConstants.MODEL) { EA.Package parentPkg = repository.GetPackageByGuid(parentItem.GetEAID()); if (diagramItem.Value.GetElementType() == SysmlConstants.ACT) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.activity); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.activity); relationshipDiagram.MetaType = "SysML1.4::Activity"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1543,7 +1537,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.BDD) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.logical); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.logical); relationshipDiagram.MetaType = "SysML1.4::BlockDefinition"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1551,14 +1545,14 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.CLASS) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.classType); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.classType); relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); return relationshipDiagram; } if (diagramItem.Value.GetElementType() == SysmlConstants.IBD) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.compositeStructure); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.compositeStructure); relationshipDiagram.MetaType = "SysML1.4::InternalBlock"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1566,14 +1560,14 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.PACKAGE) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.package); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.package); relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); return relationshipDiagram; } if (diagramItem.Value.GetElementType() == SysmlConstants.PAR) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.compositeStructure); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.compositeStructure); relationshipDiagram.MetaType = "SysML1.4::Parametric"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1581,7 +1575,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.REQ) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.custom); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.custom); relationshipDiagram.MetaType = "SysML1.4::Requirement"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1589,7 +1583,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.SEQ) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.sequence); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.sequence); relationshipDiagram.MetaType = "SysML1.4::Sequence"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1597,7 +1591,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.STM) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.statechart); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.statechart); relationshipDiagram.MetaType = "SysML1.4::StateMachine"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1605,7 +1599,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.UC) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.useCase); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.useCase); relationshipDiagram.MetaType = "SysML1.4::UseCase"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1617,7 +1611,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair EA.Element parentElement = repository.GetElementByGuid(parentItem.GetEAID()); if (diagramItem.Value.GetElementType() == SysmlConstants.ACT && parentItem.GetEAID() != diagramConstants.activity) { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.activity); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.activity); relationshipDiagram.MetaType = "SysML1.4::Activity"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1626,7 +1620,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair if (diagramItem.Value.GetElementType() == SysmlConstants.BDD && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.logical); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.logical); relationshipDiagram.MetaType = "SysML1.4::BlockDefinition"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1634,14 +1628,14 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.CLASS && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.classType); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.classType); relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); return relationshipDiagram; } if (diagramItem.Value.GetElementType() == SysmlConstants.IBD && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.compositeStructure); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.compositeStructure); relationshipDiagram.MetaType = "SysML1.4::InternalBlock"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1649,14 +1643,14 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.PACKAGE && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.package); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.package); relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); return relationshipDiagram; } if (diagramItem.Value.GetElementType() == SysmlConstants.PAR && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.compositeStructure); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.compositeStructure); relationshipDiagram.MetaType = "SysML1.4::Parametric"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1664,7 +1658,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.REQ) { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.custom); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.custom); relationshipDiagram.MetaType = "SysML1.4::Requirement"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1672,7 +1666,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.SEQ && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.sequence); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.sequence); relationshipDiagram.MetaType = "SysML1.4::Sequence"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1680,7 +1674,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.STM && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.statechart); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.statechart); relationshipDiagram.MetaType = "SysML1.4::StateMachine"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1688,7 +1682,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.UC && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.useCase); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.useCase); relationshipDiagram.MetaType = "SysML1.4::UseCase"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1698,7 +1692,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } else { - relationshipDiagram = orphanedPackage.Diagrams.AddNew(diagramItem.Value.GetAttribute(attributeConstants.name), diagramConstants.component); + relationshipDiagram = orphanedPackage.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.component); relationshipDiagram.Update(); orphanedPackage.Diagrams.Refresh(); return relationshipDiagram; From c679550376ce3715bb0a33fbb7ee0926017b7587 Mon Sep 17 00:00:00 2001 From: Daniel Siegl Date: Mon, 6 Feb 2023 11:35:27 +0100 Subject: [PATCH 2/3] Refactoring Constants --- MTIP/Constants/ActivityConstants.cs | 85 ++-- MTIP/Constants/BlockConstants.cs | 66 +--- MTIP/Constants/DiagramConstants.cs | 36 +- MTIP/Constants/HUDSConstants.cs | 72 ++-- MTIP/Constants/InternalBlockConstants.cs | 34 +- MTIP/Constants/MetatypeConstants.cs | 43 +- MTIP/Constants/ModelConstants.cs | 28 +- MTIP/Constants/ProfileConstants.cs | 39 +- MTIP/Constants/RelationshipConstants.cs | 109 ++---- MTIP/Constants/RequirementConstants.cs | 33 +- MTIP/Constants/SequenceConstants.cs | 27 +- MTIP/Translations/MTIPCommon.cs | 15 +- MTIP/Translations/MTIPExportFunctions.cs | 479 +++++++++++------------ MTIP/Translations/MTIPImportFunctions.cs | 371 +++++++++--------- 14 files changed, 589 insertions(+), 848 deletions(-) diff --git a/MTIP/Constants/ActivityConstants.cs b/MTIP/Constants/ActivityConstants.cs index 8095388..a9e5fcb 100644 --- a/MTIP/Constants/ActivityConstants.cs +++ b/MTIP/Constants/ActivityConstants.cs @@ -7,67 +7,34 @@ * */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace MTIP.Constants { - public class ActivityConstants + public static class ActivityConstants { - public string acceptEventAction; - public string action; - public string actionPin; - public string activity; - public string activityParameter; - public string activityPartion; - public string callBehaviorAction; - public string callOperationAction; - public string centralBufferNode; - public string change; - public string conditionalNode; - public string createObjectAction; - public string decision; - public string destroyObjectAction; - public string eventType; - public string forkNode; - public string informationItem; - public string interruptibleActivityRegion; - public string mergeNode; - public string objectNode; - public string property; - public string sendSignalAction; - public string stateNode; - public string synchronization; - - - public ActivityConstants(){ - acceptEventAction = "AcceptEventAction"; - action = "Action"; - actionPin = "ActionPin"; - activity = "Activity"; - activityParameter = "ActivityParameter"; - activityPartion = "ActivityPartition"; - callBehaviorAction = "CallBehaviorAction"; - callOperationAction = "CallOperationAction"; - centralBufferNode = "CentralBufferNode"; - change = "Change"; - conditionalNode = "ConditionalNode"; - createObjectAction = "CreateObjectAction"; - decision = "Decision"; - destroyObjectAction = "DestroyObjectAction"; - eventType = "Event"; - forkNode = "ForkNode"; - informationItem = "InformationItem"; - interruptibleActivityRegion = "InterruptibleActivityRegion"; - mergeNode = "MergeNode"; - objectNode = "ObjectNode"; - property = "Property"; - sendSignalAction = "SendSignalAction"; - stateNode = "StateNode"; - synchronization = "Synchronization"; - } + public const string ACCEPTEVENTACTION = "AcceptEventAction"; + public const string ACTION = "Action"; + public const string ACTIONPIN = "ActionPin"; + public const string ACTIVITY = "Activity"; + public const string ACTIVITYPARAMETER = "ActivityParameter"; + public const string ACTIVITYPARTION = "ActivityPartition"; + public const string CALLBEHAVIORACTION = "CallBehaviorAction"; + public const string CALLOPERATIONACTION = "CallOperationAction"; + public const string CENTRALBUFFERNODE = "CentralBufferNode"; + public const string CHANGE = "Change"; + public const string CONDITIONALNODE = "ConditionalNode"; + public const string CREATEOBJECTACTION = "CreateObjectAction"; + public const string DECISION = "Decision"; + public const string DESTROYOBJECTACTION = "DestroyObjectAction"; + public const string EVENTTYPE = "Event"; + public const string FORKNODE = "ForkNode"; + public const string INFORMATIONITEM = "InformationItem"; + public const string INTERRUPTIBLEACTIVITYREGION = "InterruptibleActivityRegion"; + public const string MERGENODE = "MergeNode"; + public const string OBJECTNODE = "ObjectNode"; + public const string PROPERTY = "Property"; + public const string SENDSIGNALACTION = "SendSignalAction"; + public const string STATENODE = "StateNode"; + public const string SYNCHRONIZATION = "Synchronization"; } } + diff --git a/MTIP/Constants/BlockConstants.cs b/MTIP/Constants/BlockConstants.cs index 3b3324c..f1cc9eb 100644 --- a/MTIP/Constants/BlockConstants.cs +++ b/MTIP/Constants/BlockConstants.cs @@ -7,54 +7,28 @@ * */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace MTIP.Constants { - public class BlockConstants + public static class BlockConstants { - public string association; - public string block; - public string constraintBlock; - public string dataType; - public string enumeration; - public string external; - public string flowPort; - public string fullPort; - public string interfaceBlock; - public string interfaceType; - public string operation; - public string port; - public string property; - public string proxyPort; - public string quantityKind; - public string signal; - public string unit; - public string valueType; - public BlockConstants() - { - association = "Association"; - block = "Block"; - constraintBlock = "ConstraintBlock"; - dataType = "DataType"; - enumeration = "Enumeration"; - external = "External"; - flowPort = "FlowPort"; - fullPort = "FullPort"; - interfaceBlock = "InterfaceBlock"; - interfaceType = "Interface"; - operation = "Operation"; - port = "Port"; - property = "Property"; - proxyPort = "ProxyPort"; - quantityKind = "QuantityKind"; - signal = "Signal"; - unit = "Unit"; - valueType = "ValueType"; - } + public const string ASSOCIATION = "Association"; + public const string BLOCK = "Block"; + public const string CONSTRAINTBLOCK = "ConstraintBlock"; + public const string DATATYPE = "DataType"; + public const string ENUMERATION = "Enumeration"; + public const string EXTERNAL = "External"; + public const string FLOWPORT = "FlowPort"; + public const string FULLPORT = "FullPort"; + public const string INTERFACEBLOCK = "InterfaceBlock"; + public const string INTERFACETYPE = "Interface"; + public const string OPERATION = "Operation"; + public const string PORT = "Port"; + public const string PROPERTY = "Property"; + public const string PROXYPORT = "ProxyPort"; + public const string QUANTITYKIND = "QuantityKind"; + public const string SIGNAL = "Signal"; + public const string UNIT = "Unit"; + public const string VALUETYPE = "ValueType"; } } + diff --git a/MTIP/Constants/DiagramConstants.cs b/MTIP/Constants/DiagramConstants.cs index 9680588..c5ffa76 100644 --- a/MTIP/Constants/DiagramConstants.cs +++ b/MTIP/Constants/DiagramConstants.cs @@ -15,30 +15,18 @@ namespace MTIP.Constants { - public class DiagramConstants + public static class DiagramConstants { - public string activity; - public string classType; - public string component; - public string compositeStructure; - public string custom; - public string logical; - public string package; - public string sequence; - public string statechart; - public string useCase; - public DiagramConstants() - { - activity = "Activity"; - classType = "Class"; - component = "Component"; - compositeStructure = "CompositeStructure"; - custom = "Custom"; - logical = "Logical"; - package = "Package"; - sequence = "Sequence"; - statechart = "Statechart"; - useCase = "Use Case"; - } + public const string activity = "Activity"; + public const string classType = "Class"; + public const string component = "Component"; + public const string compositeStructure = "CompositeStructure"; + public const string custom = "Custom"; + public const string logical = "Logical"; + public const string package = "Package"; + public const string sequence = "Sequence"; + public const string statechart = "Statechart"; + public const string useCase = "Use Case"; } + } diff --git a/MTIP/Constants/HUDSConstants.cs b/MTIP/Constants/HUDSConstants.cs index 06c937d..a364b43 100644 --- a/MTIP/Constants/HUDSConstants.cs +++ b/MTIP/Constants/HUDSConstants.cs @@ -7,58 +7,30 @@ * */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace MTIP.Constants { - public class HUDSConstants + public static class HUDSConstants { - public string attributes; - public string data; - public string dict; - public string dtype; - public string ea; - public string unified; - public string element; - public string id; - public string intType; - public string isComposite; - public string key; - public string list; - public string name; - public string relationshipMetadata; - public string relationships; - public string status; - public string str; - public string type; - public string typedBy; - public string value; - public HUDSConstants() - { - attributes = "attributes"; - data = "data"; - dict = "dict"; - dtype = "_dtype"; - ea = "ea"; - unified = "unified"; - element = "element"; - id = "id"; - intType = "int"; - isComposite = "isComposite"; - key = "key"; - list = "list"; - name = "name"; - relationshipMetadata = "relationship_metadata"; - relationships = "relationships"; - status = "status"; - str = "str"; - type = "type"; - typedBy = "typedBy"; - value = "value"; - } + public const string ATTRIBUTES = "attributes"; + public const string DATA = "data"; + public const string DICT = "dict"; + public const string DTYPE = "_dtype"; + public const string EA = "ea"; + public const string UNIFIED = "unified"; + public const string ELEMENT = "element"; + public const string ID = "id"; + public const string INTTYPE = "int"; + public const string ISCOMPOSITE = "isComposite"; + public const string KEY = "key"; + public const string LIST = "list"; + public const string NAME = "name"; + public const string RELATIONSHIPMETADATA = "relationship_metadata"; + public const string RELATIONSHIPS = "relationships"; + public const string STATUS = "status"; + public const string STR = "str"; + public const string TYPE = "type"; + public const string TYPEDBY = "typedBy"; + public const string VALUE = "value"; } } + diff --git a/MTIP/Constants/InternalBlockConstants.cs b/MTIP/Constants/InternalBlockConstants.cs index 35bf419..ef3b8a5 100644 --- a/MTIP/Constants/InternalBlockConstants.cs +++ b/MTIP/Constants/InternalBlockConstants.cs @@ -7,33 +7,17 @@ * */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace MTIP.Constants { - public class InternalBlockConstants + public static class InternalBlockConstants { - public string boundary; - public string boundReference; - public string constraintProperty; - public string flowProperty; - public string participantProperty; - public string property; - public string referenceProperty; - - public InternalBlockConstants() - { - boundary = "Boundary"; - boundReference = "BoundReference"; - constraintProperty = "ConstraintProperty"; - flowProperty = "FlowProperty"; - participantProperty = "ParticipantProperty"; - property = "Property"; - referenceProperty = "ReferenceProperty"; - } + public const string BOUNDARY = "Boundary"; + public const string BOUNDREFERENCE = "BoundReference"; + public const string CONSTRAINTPROPERTY = "ConstraintProperty"; + public const string FLOWPROPERTY = "FlowProperty"; + public const string PARTICIPANTPROPERTY = "ParticipantProperty"; + public const string PROPERTY = "Property"; + public const string REFERENCEPROPERTY = "ReferenceProperty"; } } + diff --git a/MTIP/Constants/MetatypeConstants.cs b/MTIP/Constants/MetatypeConstants.cs index aee351e..5a62aff 100644 --- a/MTIP/Constants/MetatypeConstants.cs +++ b/MTIP/Constants/MetatypeConstants.cs @@ -9,38 +9,23 @@ * */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + namespace MTIP.Constants { - public class MetatypeConstants + + public static class MetatypeConstants { - public string acceptEventAction; - public string callBehaviorAction; - public string callOperationAction; - public string createObjectAction; - public string destroyObjectAction; - public string inputPin; - public string opaqueAction; - public string outputPin; - public string pseudostate; - public string sendSignalAction; - public MetatypeConstants() - { - acceptEventAction = "AcceptEventAction"; - callBehaviorAction = "CallBehaviorAction"; - callOperationAction = "CallOperationAction"; - createObjectAction = "CreateObjectAction"; - destroyObjectAction = "DestroyObjectAction"; - inputPin = "InputPin"; - opaqueAction = "OpaqueAction"; - outputPin = "OutputPin"; - pseudostate = "Pseudostate"; - sendSignalAction = "SendSignalAction"; - } + public const string acceptEventAction = "AcceptEventAction"; + public const string callBehaviorAction = "CallBehaviorAction"; + public const string callOperationAction = "CallOperationAction"; + public const string createObjectAction = "CreateObjectAction"; + public const string destroyObjectAction = "DestroyObjectAction"; + public const string inputPin = "InputPin"; + public const string opaqueAction = "OpaqueAction"; + public const string outputPin = "OutputPin"; + public const string pseudostate = "Pseudostate"; + public const string sendSignalAction = "SendSignalAction"; } + } diff --git a/MTIP/Constants/ModelConstants.cs b/MTIP/Constants/ModelConstants.cs index 5ae61de..76c6788 100644 --- a/MTIP/Constants/ModelConstants.cs +++ b/MTIP/Constants/ModelConstants.cs @@ -6,29 +6,15 @@ * Description: Constants for types used to assign Model element types * */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace MTIP.Constants { - public class ModelConstants + public static class ModelConstants { - public string documentation; - public string model; - public string profile; - public string stereotype; - public string text; - public ModelConstants() - { - this.documentation = "documentation"; - this.model = "Model"; - this.profile = "profile"; - this.stereotype = "stereotype"; - this.text = "text"; - } + public const string DOCUMENTATION = "documentation"; + public const string MODEL = "Model"; + public const string PROFILE = "profile"; + public const string STEREOTYPE = "stereotype"; + public const string TEXT = "text"; } } + diff --git a/MTIP/Constants/ProfileConstants.cs b/MTIP/Constants/ProfileConstants.cs index fe37781..1fb8915 100644 --- a/MTIP/Constants/ProfileConstants.cs +++ b/MTIP/Constants/ProfileConstants.cs @@ -7,37 +7,20 @@ * */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace MTIP.Constants { - public class ProfileConstants + public static class ProfileConstants { - public string classType; - public string constraint; - public string exceptionHandler; - public string note; - public string objectiveFunction; - public string objectType; - public string package; - public string part; - public string text; - - public ProfileConstants(){ - classType = "Class"; - constraint = "Constraint"; - exceptionHandler = "ExceptionHandler"; - note = "Note"; - objectiveFunction = "ObjectiveFunction"; - objectType = "Object"; - package = "Package"; - part = "Part"; - text = "Text"; + public const string CLASSTYPE = "Class"; + public const string CONSTRAINT = "Constraint"; + public const string EXCEPTIONHANDLER = "ExceptionHandler"; + public const string NOTE = "Note"; + public const string OBJECTIVEFUNCTION = "ObjectiveFunction"; + public const string OBJECTTYPE = "Object"; + public const string PACKAGE = "Package"; + public const string PART = "Part"; + public const string TEXT = "Text"; } } -} + diff --git a/MTIP/Constants/RelationshipConstants.cs b/MTIP/Constants/RelationshipConstants.cs index 9d5d451..3d94d3f 100644 --- a/MTIP/Constants/RelationshipConstants.cs +++ b/MTIP/Constants/RelationshipConstants.cs @@ -7,83 +7,42 @@ * */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace MTIP.Constants { - public class RelationshipConstants + public static class RelationshipConstants { - public string asynchCall; - public string asynchSignal; - public string classifiedBy; - public string client; - public string compositeDiagram; - public string diagramConnector; - public string effect; - public string element; - public string guard; - public string hasParent; - public string hyperlink; - public string id; - public string messageNumber; - public string metaclass; - public string metarelationship; - public string profile; - public string relationships; - public string relMetadata; - public string relMetadataBottom; - public string relMetadataLeft; - public string relMetadataRight; - public string relMetadataSeq; - public string relMetadataTop; - public string reply; - public string signalGuid; - public string signature; - public string supplier; - public string synchCall; - public string trigger; - public string type; - public string typedBy; - public string valueSpecification; - - public RelationshipConstants() - { - this.asynchCall = "asynchCall"; - this.asynchSignal = "asynchSignal"; - this.classifiedBy = "classifiedBy"; - this.client = "client"; - this.compositeDiagram = "compositeDiagram"; - this.diagramConnector = "diagramConnector"; - this.effect = "effect"; - this.element = "element"; - this.guard = "guard"; - this.hasParent = "hasParent"; - this.hyperlink = "hyperlink"; - this.id = "id"; - this.messageNumber = "messageNumber"; - this.metaclass = "metaclass"; - this.metarelationship = "metarelationship"; - this.profile = "profile"; - this.relationships = "relationships"; - this.relMetadata = "relationship_metadata"; - this.relMetadataBottom = "bottom"; - this.relMetadataLeft = "left"; - this.relMetadataRight = "right"; - this.relMetadataSeq = "sequence"; - this.relMetadataTop = "top"; - this.reply = "reply"; - this.signalGuid = "signal_guid"; - this.signature = "signature"; - this.supplier = "supplier"; - this.synchCall = "synchCall"; - this.trigger = "trigger"; - this.type = "type"; - this.typedBy = "typedBy"; - this.valueSpecification = "valueSpecification"; - } + public const string ASYNCHCALL = "asynchCall"; + public const string ASYNCHSIGNAL = "asynchSignal"; + public const string CLASSIFIEDBY = "classifiedBy"; + public const string CLIENT = "client"; + public const string COMPOSITEDIAGRAM = "compositeDiagram"; + public const string DIAGRAMCONNECTOR = "diagramConnector"; + public const string EFFECT = "effect"; + public const string ELEMENT = "element"; + public const string GUARD = "guard"; + public const string HASPARENT = "hasParent"; + public const string HYPERLINK = "hyperlink"; + public const string ID = "id"; + public const string MESSAGENUMBER = "messageNumber"; + public const string METACLASS = "metaclass"; + public const string METARELATIONSHIP = "metarelationship"; + public const string PROFILE = "profile"; + public const string RELATIONSHIPS = "relationships"; + public const string RELMETADATA = "relationship_metadata"; + public const string RELMETADATABOTTOM = "bottom"; + public const string RELMETADATALEFT = "left"; + public const string RELMETADATARIGHT = "right"; + public const string RELMETADATASEQ = "sequence"; + public const string RELMETADATATOP = "top"; + public const string REPLY = "reply"; + public const string SIGNALGUID = "signal_guid"; + public const string SIGNATURE = "signature"; + public const string SUPPLIER = "supplier"; + public const string SYNCHCALL = "synchCall"; + public const string TRIGGER = "trigger"; + public const string TYPE = "type"; + public const string TYPEDBY = "typedBy"; + public const string VALUESPECIFICATION = "valueSpecification"; } } + diff --git a/MTIP/Constants/RequirementConstants.cs b/MTIP/Constants/RequirementConstants.cs index b60a885..a913942 100644 --- a/MTIP/Constants/RequirementConstants.cs +++ b/MTIP/Constants/RequirementConstants.cs @@ -7,32 +7,17 @@ * */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace MTIP.Constants { - public class RequirementConstants + public static class RequirementConstants { - public string designConstraint; - public string extendedRequirement; - public string functionalRequirement; - public string interfaceRequirement; - public string performanceRequirement; - public string physicalRequirement; - public string requirement; - public RequirementConstants() - { - designConstraint = "DesignConstraint"; - extendedRequirement = "ExtendedRequirement"; - functionalRequirement = "FunctionalRequirement"; - interfaceRequirement = "InterfaceRequirement"; - performanceRequirement = "PerformanceRequirement"; - physicalRequirement = "PhysicalRequirement"; - requirement = "Requirement"; - } + public const string DESIGNCONSTRAINT = "DesignConstraint"; + public const string EXTENDEDREQUIREMENT = "ExtendedRequirement"; + public const string FUNCTIONALREQUIREMENT = "FunctionalRequirement"; + public const string INTERFACEREQUIREMENT = "InterfaceRequirement"; + public const string PERFORMANCEREQUIREMENT = "PerformanceRequirement"; + public const string PHYSICALREQUIREMENT = "PhysicalRequirement"; + public const string REQUIREMENT = "Requirement"; } } + diff --git a/MTIP/Constants/SequenceConstants.cs b/MTIP/Constants/SequenceConstants.cs index e8108d3..e0d4868 100644 --- a/MTIP/Constants/SequenceConstants.cs +++ b/MTIP/Constants/SequenceConstants.cs @@ -7,28 +7,15 @@ * */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace MTIP.Constants { - public class SequenceConstants - { - public string collaboration; - public string interaction; - public string interactionFragment; - public string interactionState; - public string sequence; - public SequenceConstants() + public static class SequenceConstants { - collaboration = "Collaboration"; - interaction = "Interaction"; - interactionFragment = "InteractionFragment"; - interactionState = "InteractionState"; - sequence = "Sequence"; + public const string COLLABORATION = "Collaboration"; + public const string INTERACTION = "Interaction"; + public const string INTERACTIONFRAGMENT = "InteractionFragment"; + public const string INTERACTIONSTATE = "InteractionState"; + public const string SEQUENCE = "Sequence"; } } -} + diff --git a/MTIP/Translations/MTIPCommon.cs b/MTIP/Translations/MTIPCommon.cs index 2cc2390..f0fac2b 100644 --- a/MTIP/Translations/MTIPCommon.cs +++ b/MTIP/Translations/MTIPCommon.cs @@ -5,27 +5,22 @@ namespace MTIP.Translations { internal static class MTIPCommon { - //DS: Not the way I would do this. - - public static RelationshipConstants relationshipConstants = new RelationshipConstants(); - public static HUDSConstants hudsConstants =new HUDSConstants(); - internal static XmlElement CreateIdElement(XmlDocument xmlDocument, string eaElementGuid) { XmlElement idElement = xmlDocument.CreateElement(AttributeConstants.ID); - idElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + idElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); //unified ID shall be the new Vendor independed ID field for cross tool roundtrips. - XmlElement unifiedIdElement = xmlDocument.CreateElement(hudsConstants.unified); - unifiedIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement unifiedIdElement = xmlDocument.CreateElement(HUDSConstants.UNIFIED); + unifiedIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); unifiedIdElement.InnerText = eaElementGuid.ToString(); idElement.AppendChild(unifiedIdElement); //unified ID shall be the new Vendor specific ID field for cross tool roundtrips, best case this is not required going forward - XmlElement eaIdElement = xmlDocument.CreateElement(hudsConstants.ea); - eaIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement eaIdElement = xmlDocument.CreateElement(HUDSConstants.EA); + eaIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); eaIdElement.InnerText = eaElementGuid.ToString(); idElement.AppendChild(eaIdElement); diff --git a/MTIP/Translations/MTIPExportFunctions.cs b/MTIP/Translations/MTIPExportFunctions.cs index dd8cb5b..f2dc5bf 100644 --- a/MTIP/Translations/MTIPExportFunctions.cs +++ b/MTIP/Translations/MTIPExportFunctions.cs @@ -29,13 +29,8 @@ public class MTIPExportFunctions public Dictionary profilePackages; public List exportLog; - public RelationshipConstants relationshipConstants; - public HUDSConstants hudsConstants; - public DiagramConstants diagramConstants; - public ActivityConstants activityConstants; - public BlockConstants blockConstants; public StereotypeConstants stereotypeConstants; - public ModelConstants modelConstants; + public Dictionary customProfiles; public MTIPExportFunctions(MTIP plugin) @@ -43,14 +38,9 @@ public MTIPExportFunctions(MTIP plugin) repository = plugin.GetRepository(); profilePackages = new Dictionary(); exportLog = new List(); - - relationshipConstants = new RelationshipConstants(); - hudsConstants = new HUDSConstants(); - diagramConstants = new DiagramConstants(); - activityConstants = new ActivityConstants(); - blockConstants = new BlockConstants(); + stereotypeConstants = new StereotypeConstants(); - modelConstants = new ModelConstants(); + customProfiles = new Dictionary(); } public void ExportToMTIPXML() @@ -128,8 +118,8 @@ private void selectOutputDir() public void UnpackagePackage(EA.Package package, XmlDocument xmlDocument, string parentGuid, string parentType, bool isRootNode) { // Get package SysML type - XmlElement typeElement = xmlDocument.CreateElement(hudsConstants.type); - typeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement typeElement = xmlDocument.CreateElement(HUDSConstants.TYPE); + typeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); string packageType = ""; if (package.IsModel) packageType = SysmlConstants.SYSMLMODEL; else packageType = GetPackageType(package); @@ -143,20 +133,20 @@ public void UnpackagePackage(EA.Package package, XmlDocument xmlDocument, string // Create attributes element to add to data node XmlElement attributesElement = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTES); - attributesElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, hudsConstants.str, package.Name, attributesElement); + attributesElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); + CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, HUDSConstants.STR, package.Name, attributesElement); if (package.IsModel != true) { if (package.Element.Stereotype != "") { XmlElement stereotypeAttribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - stereotypeAttribute.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - stereotypeAttribute.SetAttribute(hudsConstants.key, AttributeConstants.STEREOTYPE); + stereotypeAttribute.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); + stereotypeAttribute.SetAttribute(HUDSConstants.KEY, AttributeConstants.STEREOTYPE); XmlElement stereotypeNameAttribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - stereotypeNameAttribute.SetAttribute(hudsConstants.dtype, hudsConstants.str); - stereotypeNameAttribute.SetAttribute(hudsConstants.key, AttributeConstants.STEREOTYPENAME); + stereotypeNameAttribute.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); + stereotypeNameAttribute.SetAttribute(HUDSConstants.KEY, AttributeConstants.STEREOTYPENAME); stereotypeNameAttribute.InnerText = package.Element.Stereotype; @@ -168,13 +158,13 @@ public void UnpackagePackage(EA.Package package, XmlDocument xmlDocument, string string note = Regex.Replace(package.Notes, "<[^>]+>", string.Empty); note = Regex.Replace(note, ">", "greater than"); note = Regex.Replace(note, "<", "less than"); - CreateHUDSAttribute(xmlDocument, AttributeConstants.DOCUMENTATION, hudsConstants.str, note, attributesElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.DOCUMENTATION, HUDSConstants.STR, note, attributesElement); } - if (package.Element.Alias != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.ALIAS, hudsConstants.str, package.Element.Alias, attributesElement); + if (package.Element.Alias != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.ALIAS, HUDSConstants.STR, package.Element.Alias, attributesElement); } // Add type, id, and attributes node to data node - XmlElement dataElement = xmlDocument.CreateElement(hudsConstants.data); + XmlElement dataElement = xmlDocument.CreateElement(HUDSConstants.DATA); dataElement.AppendChild(typeElement); dataElement.AppendChild(idElement); dataElement.AppendChild(attributesElement); @@ -182,21 +172,21 @@ public void UnpackagePackage(EA.Package package, XmlDocument xmlDocument, string // Add relationships to the data node if (parentGuid != null || isRootNode == false) { - XmlElement relationshipsElement = xmlDocument.CreateElement(relationshipConstants.relationships); - relationshipsElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement relationshipsElement = xmlDocument.CreateElement(RelationshipConstants.RELATIONSHIPS); + relationshipsElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement hasParentElement = xmlDocument.CreateElement(relationshipConstants.hasParent); - hasParentElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement hasParentElement = xmlDocument.CreateElement(RelationshipConstants.HASPARENT); + hasParentElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement hasParentTypeElement = xmlDocument.CreateElement(relationshipConstants.type); - hasParentTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hasParentTypeElement = xmlDocument.CreateElement(RelationshipConstants.TYPE); + hasParentTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hasParentTypeElement.InnerText = parentType; - XmlElement hasParentIdElement = xmlDocument.CreateElement(relationshipConstants.id); - hasParentIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hasParentIdElement = xmlDocument.CreateElement(RelationshipConstants.ID); + hasParentIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hasParentIdElement.InnerText = parentGuid; - XmlElement relMetadataElement = xmlDocument.CreateElement(hudsConstants.relationshipMetadata); + XmlElement relMetadataElement = xmlDocument.CreateElement(HUDSConstants.RELATIONSHIPMETADATA); hasParentElement.AppendChild(hasParentTypeElement); hasParentElement.AppendChild(hasParentIdElement); @@ -235,13 +225,13 @@ public void UnpackagePackage(EA.Package package, XmlDocument xmlDocument, string private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, string parentGuid, string parentType) { string profile = ""; - XmlElement dataElement = xmlDocument.CreateElement(hudsConstants.data); - XmlElement attributesElement = xmlDocument.CreateElement(hudsConstants.attributes); - attributesElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - XmlElement typeElement = xmlDocument.CreateElement(hudsConstants.type); - typeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); - XmlElement relationshipsElement = xmlDocument.CreateElement(hudsConstants.relationships); - relationshipsElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement dataElement = xmlDocument.CreateElement(HUDSConstants.DATA); + XmlElement attributesElement = xmlDocument.CreateElement(HUDSConstants.ATTRIBUTES); + attributesElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); + XmlElement typeElement = xmlDocument.CreateElement(HUDSConstants.TYPE); + typeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); + XmlElement relationshipsElement = xmlDocument.CreateElement(HUDSConstants.RELATIONSHIPS); + relationshipsElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); string elementType = GetSysMLType(element.Type, element.Stereotype, element.Subtype, element.MetaType); @@ -257,18 +247,18 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin // Get element profiles and attributes if (element.PropertyType != 0) { - XmlElement typedByRelationship = xmlDocument.CreateElement(hudsConstants.typedBy); - typedByRelationship.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement typedByRelationship = xmlDocument.CreateElement(HUDSConstants.TYPEDBY); + typedByRelationship.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); EA.Element typedByElement = repository.GetElementByID(element.PropertyType); string typedByType = GetSysMLType(typedByElement.Type, typedByElement.Stereotype, typedByElement.Subtype, typedByElement.MetaType); - XmlElement typedbByTypeElement = xmlDocument.CreateElement(hudsConstants.type); - typedbByTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement typedbByTypeElement = xmlDocument.CreateElement(HUDSConstants.TYPE); + typedbByTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); typedbByTypeElement.InnerText = typedByType; typedByRelationship.AppendChild(typedbByTypeElement); - XmlElement typedByIdElement = xmlDocument.CreateElement(hudsConstants.id); - typedByIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement typedByIdElement = xmlDocument.CreateElement(HUDSConstants.ID); + typedByIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); typedByIdElement.InnerText = typedByElement.ElementGUID.Substring(1, element.ElementGUID.Length - 2); typedByRelationship.AppendChild(typedByIdElement); @@ -284,13 +274,13 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin else if (elementType == SysmlConstants.SYSMLFLOWPORT || elementType == SysmlConstants.SYSMLFULLPORT || elementType == SysmlConstants.SYSMLPROXYPORT || elementType == SysmlConstants.SYSMLPORT || elementType == SysmlConstants.SYSMLCONSTRAINTBLOCK || elementType == SysmlConstants.CONSTRAINTPROPERTY || elementType == SysmlConstants.SYSMLPARTPROPERTY) { - if (elementType != SysmlConstants.SYSMLPARTPROPERTY) CreateHUDSAttribute(xmlDocument, AttributeConstants.ISCOMPOSITE, hudsConstants.str, element.IsComposite.ToString(), attributesElement); + if (elementType != SysmlConstants.SYSMLPARTPROPERTY) CreateHUDSAttribute(xmlDocument, AttributeConstants.ISCOMPOSITE, HUDSConstants.STR, element.IsComposite.ToString(), attributesElement); if (elementType != SysmlConstants.SYSMLPORT && elementType != SysmlConstants.SYSMLPARTPROPERTY) { profile = "SysML"; } } else if (elementType == SysmlConstants.SYSMLSTATE && element.ClassfierID != 0) { EA.Element classifierElement = repository.GetElementByID(element.ClassifierID); - CreateHUDSAttribute(xmlDocument, AttributeConstants.SUBMACHINE, hudsConstants.str, classifierElement.ElementGUID.Substring(1, element.ElementGUID.Length - 2), attributesElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.SUBMACHINE, HUDSConstants.STR, classifierElement.ElementGUID.Substring(1, element.ElementGUID.Length - 2), attributesElement); } else if (elementType == SysmlConstants.SYSMLTEXT && element.Name.Contains("://{")) @@ -300,16 +290,16 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin string[] hyperlinkId = hyperlinkType[1].Split('}'); string[] hyperlinkPointType = element.Name.Remove(0, 1).Split(':'); - XmlElement hyperlinkRelationship = xmlDocument.CreateElement(relationshipConstants.hyperlink); - hyperlinkRelationship.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement hyperlinkRelationship = xmlDocument.CreateElement(RelationshipConstants.HYPERLINK); + hyperlinkRelationship.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement hyperlinkTypeElement = xmlDocument.CreateElement(relationshipConstants.type); - hyperlinkTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hyperlinkTypeElement = xmlDocument.CreateElement(RelationshipConstants.TYPE); + hyperlinkTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hyperlinkTypeElement.InnerText = hyperlinkPointType[0]; hyperlinkRelationship.AppendChild(hyperlinkTypeElement); - XmlElement hyperlinkIdIdElement = xmlDocument.CreateElement(hudsConstants.id); - hyperlinkIdIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hyperlinkIdIdElement = xmlDocument.CreateElement(HUDSConstants.ID); + hyperlinkIdIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hyperlinkIdIdElement.InnerText = hyperlinkId[0]; hyperlinkRelationship.AppendChild(hyperlinkIdIdElement); @@ -329,17 +319,17 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin EA.Element classifierElement = repository.GetElementByID(element.ClassifierID); string classifierType = GetSysMLType(classifierElement.Type, classifierElement.Stereotype, classifierElement.Subtype, classifierElement.MetaType); XmlElement classifiedByRelationship; - if (elementType == SysmlConstants.SYSMLACCEPTEVENTACTION || classifierType == SysmlConstants.SYSMLSENDSIGNALACTION) classifiedByRelationship = xmlDocument.CreateElement(relationshipConstants.trigger); - else classifiedByRelationship = xmlDocument.CreateElement(relationshipConstants.classifiedBy); - classifiedByRelationship.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + if (elementType == SysmlConstants.SYSMLACCEPTEVENTACTION || classifierType == SysmlConstants.SYSMLSENDSIGNALACTION) classifiedByRelationship = xmlDocument.CreateElement(RelationshipConstants.TRIGGER); + else classifiedByRelationship = xmlDocument.CreateElement(RelationshipConstants.CLASSIFIEDBY); + classifiedByRelationship.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement hyperlinkTypeElement = xmlDocument.CreateElement(hudsConstants.type); - hyperlinkTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hyperlinkTypeElement = xmlDocument.CreateElement(HUDSConstants.TYPE); + hyperlinkTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hyperlinkTypeElement.InnerText = classifierType; classifiedByRelationship.AppendChild(hyperlinkTypeElement); - XmlElement hyperlinkIdIdElement = xmlDocument.CreateElement(hudsConstants.id); - hyperlinkIdIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hyperlinkIdIdElement = xmlDocument.CreateElement(HUDSConstants.ID); + hyperlinkIdIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hyperlinkIdIdElement.InnerText = classifierElement.ElementGUID.Substring(1, element.ElementGUID.Length - 2); classifiedByRelationship.AppendChild(hyperlinkIdIdElement); @@ -350,32 +340,32 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin exportLog.Add("Unable to add classifier to xml: Name=" + element.Name + " - GUID=" + element.ElementGUID + " - Type=" + element.Type + " - Stereotype=" + element.Stereotype); } } - if (element.Name != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, hudsConstants.str, element.Name, attributesElement); + if (element.Name != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, HUDSConstants.STR, element.Name, attributesElement); if (element.Notes != "") { string note = Regex.Replace(element.Notes, "<[^>]+>", string.Empty); note = Regex.Replace(note, ">", "greater than"); note = Regex.Replace(note, "<", "less than"); - CreateHUDSAttribute(xmlDocument, AttributeConstants.DOCUMENTATION, hudsConstants.str, note, attributesElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.DOCUMENTATION, HUDSConstants.STR, note, attributesElement); } - if (element.Alias != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.ALIAS, hudsConstants.str, element.Alias, attributesElement); - if (element.Multiplicity != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.MULTIPLICITY, hudsConstants.str, element.Multiplicity, attributesElement); + if (element.Alias != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.ALIAS, HUDSConstants.STR, element.Alias, attributesElement); + if (element.Multiplicity != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.MULTIPLICITY, HUDSConstants.STR, element.Multiplicity, attributesElement); if (element.IsComposite && element.CompositeDiagram != null) { try { EA.Diagram diagramElement = repository.GetDiagramByGuid(element.CompositeDiagram.DiagramGUID); string diagramType = GetDiagramSysMLType(diagramElement); - XmlElement compositeDiagramRelationship = xmlDocument.CreateElement(relationshipConstants.compositeDiagram); - compositeDiagramRelationship.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement compositeDiagramRelationship = xmlDocument.CreateElement(RelationshipConstants.COMPOSITEDIAGRAM); + compositeDiagramRelationship.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement diagramTypeElement = xmlDocument.CreateElement(hudsConstants.type); - diagramTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement diagramTypeElement = xmlDocument.CreateElement(HUDSConstants.TYPE); + diagramTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); diagramTypeElement.InnerText = diagramType; compositeDiagramRelationship.AppendChild(diagramTypeElement); - XmlElement diagramIdElement = xmlDocument.CreateElement(hudsConstants.id); - diagramIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement diagramIdElement = xmlDocument.CreateElement(HUDSConstants.ID); + diagramIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); diagramIdElement.InnerText = element.CompositeDiagram.DiagramGUID.Substring(1, element.CompositeDiagram.DiagramGUID.Length - 2); compositeDiagramRelationship.AppendChild(diagramIdElement); @@ -391,20 +381,20 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin if (element.Stereotype != "") { XmlElement stereotypeAttribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - stereotypeAttribute.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - stereotypeAttribute.SetAttribute(hudsConstants.key, AttributeConstants.STEREOTYPE); + stereotypeAttribute.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); + stereotypeAttribute.SetAttribute(HUDSConstants.KEY, AttributeConstants.STEREOTYPE); XmlElement stereotypeNameAttribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - stereotypeNameAttribute.SetAttribute(hudsConstants.dtype, hudsConstants.str); - stereotypeNameAttribute.SetAttribute(hudsConstants.key, AttributeConstants.STEREOTYPENAME); + stereotypeNameAttribute.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); + stereotypeNameAttribute.SetAttribute(HUDSConstants.KEY, AttributeConstants.STEREOTYPENAME); stereotypeNameAttribute.InnerText = element.StereotypeEx; stereotypeAttribute.AppendChild(stereotypeNameAttribute); if (profile != "") { XmlElement stereotypeProfileAttribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - stereotypeProfileAttribute.SetAttribute(hudsConstants.dtype, hudsConstants.str); - stereotypeProfileAttribute.SetAttribute(hudsConstants.key, AttributeConstants.PROFILENAME); + stereotypeProfileAttribute.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); + stereotypeProfileAttribute.SetAttribute(HUDSConstants.KEY, AttributeConstants.PROFILENAME); stereotypeProfileAttribute.InnerText = profile; stereotypeAttribute.AppendChild(stereotypeProfileAttribute); } @@ -417,22 +407,22 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin { int key = 0; XmlElement attributesbehaviorElement = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - attributesbehaviorElement.SetAttribute(hudsConstants.key, AttributeConstants.BEHAVIOR); - attributesbehaviorElement.SetAttribute(hudsConstants.dtype, hudsConstants.list); + attributesbehaviorElement.SetAttribute(HUDSConstants.KEY, AttributeConstants.BEHAVIOR); + attributesbehaviorElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.LIST); foreach (EA.Method method in element.Methods) { bool hasBehavior = false; if (method.Behavior != "") { XmlElement attribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - attribute.SetAttribute(hudsConstants.key, key.ToString()); - attribute.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + attribute.SetAttribute(HUDSConstants.KEY, key.ToString()); + attribute.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); if (method.Name != "") { XmlElement attributeName = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - attributeName.SetAttribute(hudsConstants.key, AttributeConstants.NAME); - attributeName.SetAttribute(hudsConstants.dtype, hudsConstants.str); + attributeName.SetAttribute(HUDSConstants.KEY, AttributeConstants.NAME); + attributeName.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); attributeName.InnerText = method.Name; attribute.AppendChild(attributeName); hasBehavior = true; @@ -440,8 +430,8 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin if (method.Behavior != "") { XmlElement attributeBehavior = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - attributeBehavior.SetAttribute(hudsConstants.key, AttributeConstants.VALUE); - attributeBehavior.SetAttribute(hudsConstants.dtype, hudsConstants.str); + attributeBehavior.SetAttribute(HUDSConstants.KEY, AttributeConstants.VALUE); + attributeBehavior.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); attributeBehavior.InnerText = method.Behavior; attribute.AppendChild(attributeBehavior); hasBehavior = true; @@ -449,8 +439,8 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin if (method.ReturnType != "") { XmlElement attributeReturnType = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - attributeReturnType.SetAttribute(hudsConstants.key, AttributeConstants.TYPE); - attributeReturnType.SetAttribute(hudsConstants.dtype, hudsConstants.str); + attributeReturnType.SetAttribute(HUDSConstants.KEY, AttributeConstants.TYPE); + attributeReturnType.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); attributeReturnType.InnerText = method.ReturnType; attribute.AppendChild(attributeReturnType); hasBehavior = true; @@ -482,19 +472,19 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin { int key = 0; XmlElement attributesAttributeElement = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - attributesAttributeElement.SetAttribute(hudsConstants.key, AttributeConstants.ATTRIBUTE); - attributesAttributeElement.SetAttribute(hudsConstants.dtype, hudsConstants.list); + attributesAttributeElement.SetAttribute(HUDSConstants.KEY, AttributeConstants.ATTRIBUTE); + attributesAttributeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.LIST); foreach (EA.Attribute attribute in element.Attributes) { XmlElement attElement = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - attElement.SetAttribute(hudsConstants.key, key.ToString()); + attElement.SetAttribute(HUDSConstants.KEY, key.ToString()); - CreateHUDSAttribute(xmlDocument, AttributeConstants.TYPE, hudsConstants.str, attribute.Type, attElement); - CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, hudsConstants.str, attribute.Name, attElement); - if (attribute.Default != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.INITIALVALUE, hudsConstants.str, attribute.Default, attElement); - if (attribute.Visibility != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.VISIBILITY, hudsConstants.str, attribute.Visibility, attElement); - if (attribute.Stereotype != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.STEREOTYPE, hudsConstants.str, attribute.Stereotype, attElement); - if (attribute.Alias != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.ALIAS, hudsConstants.str, attribute.Alias, attElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.TYPE, HUDSConstants.STR, attribute.Type, attElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, HUDSConstants.STR, attribute.Name, attElement); + if (attribute.Default != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.INITIALVALUE, HUDSConstants.STR, attribute.Default, attElement); + if (attribute.Visibility != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.VISIBILITY, HUDSConstants.STR, attribute.Visibility, attElement); + if (attribute.Stereotype != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.STEREOTYPE, HUDSConstants.STR, attribute.Stereotype, attElement); + if (attribute.Alias != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.ALIAS, HUDSConstants.STR, attribute.Alias, attElement); attributesAttributeElement.AppendChild(attElement); @@ -503,7 +493,7 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin attributesElement.AppendChild(attributesAttributeElement); } - if (element.ExtensionPoints != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.EXTENSIONPOINT, hudsConstants.str, element.ExtensionPoints, attributesElement); + if (element.ExtensionPoints != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.EXTENSIONPOINT, HUDSConstants.STR, element.ExtensionPoints, attributesElement); Dictionary taggedValues = new Dictionary(); // Get element tagged values @@ -528,26 +518,26 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin if (taggedValues.Count > 0) { XmlElement attributesTagsElement = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - attributesTagsElement.SetAttribute(hudsConstants.key, AttributeConstants.TAGGEDVALUE); + attributesTagsElement.SetAttribute(HUDSConstants.KEY, AttributeConstants.TAGGEDVALUE); - attributesTagsElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + attributesTagsElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); foreach (KeyValuePair taggedValue in taggedValues) { - CreateHUDSAttribute(xmlDocument, taggedValue.Key, hudsConstants.str, taggedValue.Value, attributesTagsElement); + CreateHUDSAttribute(xmlDocument, taggedValue.Key, HUDSConstants.STR, taggedValue.Value, attributesTagsElement); } attributesElement.AppendChild(attributesTagsElement); } // Add relationships to the data element - XmlElement hasParentElement = xmlDocument.CreateElement(relationshipConstants.hasParent); - hasParentElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement hasParentElement = xmlDocument.CreateElement(RelationshipConstants.HASPARENT); + hasParentElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement hasParentTypeElement = xmlDocument.CreateElement(hudsConstants.type); - hasParentTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hasParentTypeElement = xmlDocument.CreateElement(HUDSConstants.TYPE); + hasParentTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hasParentTypeElement.InnerText = parentType; - XmlElement hasParentIdElement = xmlDocument.CreateElement(hudsConstants.id); - hasParentIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hasParentIdElement = xmlDocument.CreateElement(HUDSConstants.ID); + hasParentIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hasParentIdElement.InnerText = parentGuid; hasParentElement.AppendChild(hasParentTypeElement); @@ -625,17 +615,17 @@ private void UnpackageElement(EA.Element element, XmlDocument xmlDocument, strin } public void UnpackageDiagram(EA.Diagram diagram, XmlDocument xmlDocument, string parentGuid, string parentType) { - XmlElement dataElement = xmlDocument.CreateElement(hudsConstants.data); + XmlElement dataElement = xmlDocument.CreateElement(HUDSConstants.DATA); XmlElement attributesElement = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTES); - attributesElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - XmlElement typeElement = xmlDocument.CreateElement(hudsConstants.type); - typeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); - XmlElement relationshipsElement = xmlDocument.CreateElement(hudsConstants.relationships); - relationshipsElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + attributesElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); + XmlElement typeElement = xmlDocument.CreateElement(HUDSConstants.TYPE); + typeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); + XmlElement relationshipsElement = xmlDocument.CreateElement(HUDSConstants.RELATIONSHIPS); + relationshipsElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); string diagramGuid = diagram.DiagramGUID.Substring(1, diagram.DiagramGUID.Length - 2); string diagramType = GetDiagramSysMLType(diagram); - if (diagramType == SysmlConstants.SYSMLPACKAGE) CreateHUDSAttribute(xmlDocument, AttributeConstants.DISPLAYAS, hudsConstants.str, "Diagram", attributesElement); + if (diagramType == SysmlConstants.SYSMLPACKAGE) CreateHUDSAttribute(xmlDocument, AttributeConstants.DISPLAYAS, HUDSConstants.STR, "Diagram", attributesElement); typeElement.InnerText = diagramType; @@ -645,15 +635,15 @@ public void UnpackageDiagram(EA.Diagram diagram, XmlDocument xmlDocument, string // Create id element to be added to data element XmlElement idElement = MTIPCommon.CreateIdElement(xmlDocument, diagramGuid); - CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, hudsConstants.str, diagram.Name, attributesElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, HUDSConstants.STR, diagram.Name, attributesElement); - if (diagramType == SysmlConstants.SYSMLCLASS) CreateHUDSAttribute(xmlDocument, AttributeConstants.DISPLAYAS, hudsConstants.str, "Diagram", attributesElement); + if (diagramType == SysmlConstants.SYSMLCLASS) CreateHUDSAttribute(xmlDocument, AttributeConstants.DISPLAYAS, HUDSConstants.STR, "Diagram", attributesElement); if (diagram.DiagramObjects.Count > 0) { int key = 0; - XmlElement elementRelElement = xmlDocument.CreateElement(hudsConstants.element); - elementRelElement.SetAttribute(hudsConstants.dtype, hudsConstants.list); + XmlElement elementRelElement = xmlDocument.CreateElement(HUDSConstants.ELEMENT); + elementRelElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.LIST); foreach (EA.DiagramObject diagramObject in diagram.DiagramObjects) { @@ -665,46 +655,46 @@ public void UnpackageDiagram(EA.Diagram diagram, XmlDocument xmlDocument, string { string elementGuid = element.ElementGUID.Substring(1, element.ElementGUID.Length - 2); // Add relationships to the data element - XmlElement diagramObjectElement = xmlDocument.CreateElement(hudsConstants.element); - diagramObjectElement.SetAttribute(hudsConstants.key, key.ToString()); - diagramObjectElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement diagramObjectElement = xmlDocument.CreateElement(HUDSConstants.ELEMENT); + diagramObjectElement.SetAttribute(HUDSConstants.KEY, key.ToString()); + diagramObjectElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement objectTypeElement = xmlDocument.CreateElement(relationshipConstants.type); - objectTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement objectTypeElement = xmlDocument.CreateElement(RelationshipConstants.TYPE); + objectTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); objectTypeElement.InnerText = elementType; diagramObjectElement.AppendChild(objectTypeElement); - XmlElement objectIdElement = xmlDocument.CreateElement(hudsConstants.id); - objectIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement objectIdElement = xmlDocument.CreateElement(HUDSConstants.ID); + objectIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); objectIdElement.InnerText = elementGuid; diagramObjectElement.AppendChild(objectIdElement); - XmlElement relMetadataElement = xmlDocument.CreateElement(hudsConstants.relationshipMetadata); - relMetadataElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement relMetadataElement = xmlDocument.CreateElement(HUDSConstants.RELATIONSHIPMETADATA); + relMetadataElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement objectTopElement = xmlDocument.CreateElement(relationshipConstants.relMetadataTop); - objectTopElement.SetAttribute(hudsConstants.dtype, hudsConstants.intType); + XmlElement objectTopElement = xmlDocument.CreateElement(RelationshipConstants.RELMETADATATOP); + objectTopElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.INTTYPE); objectTopElement.InnerText = diagramObject.top.ToString(); relMetadataElement.AppendChild(objectTopElement); - XmlElement objectLeftElement = xmlDocument.CreateElement(relationshipConstants.relMetadataLeft); - objectLeftElement.SetAttribute(hudsConstants.dtype, hudsConstants.intType); + XmlElement objectLeftElement = xmlDocument.CreateElement(RelationshipConstants.RELMETADATALEFT); + objectLeftElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.INTTYPE); objectLeftElement.InnerText = diagramObject.left.ToString(); relMetadataElement.AppendChild(objectLeftElement); - XmlElement objectBottomElement = xmlDocument.CreateElement(relationshipConstants.relMetadataBottom); - objectBottomElement.SetAttribute(hudsConstants.dtype, hudsConstants.intType); + XmlElement objectBottomElement = xmlDocument.CreateElement(RelationshipConstants.RELMETADATABOTTOM); + objectBottomElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.INTTYPE); objectBottomElement.InnerText = diagramObject.bottom.ToString(); relMetadataElement.AppendChild(objectBottomElement); - XmlElement objectRightElement = xmlDocument.CreateElement(relationshipConstants.relMetadataRight); - objectRightElement.SetAttribute(hudsConstants.dtype, hudsConstants.intType); + XmlElement objectRightElement = xmlDocument.CreateElement(RelationshipConstants.RELMETADATARIGHT); + objectRightElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.INTTYPE); objectRightElement.InnerText = diagramObject.right.ToString(); relMetadataElement.AppendChild(objectRightElement); - XmlElement objectSeqElement = xmlDocument.CreateElement(relationshipConstants.relMetadataSeq); - objectSeqElement.SetAttribute(hudsConstants.dtype, hudsConstants.intType); + XmlElement objectSeqElement = xmlDocument.CreateElement(RelationshipConstants.RELMETADATASEQ); + objectSeqElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.INTTYPE); objectSeqElement.InnerText = diagramObject.Sequence.ToString(); relMetadataElement.AppendChild(objectSeqElement); @@ -726,8 +716,8 @@ public void UnpackageDiagram(EA.Diagram diagram, XmlDocument xmlDocument, string if (diagram.DiagramLinks.Count > 0) { int key = 0; - XmlElement diagramLinkRelElement = xmlDocument.CreateElement(relationshipConstants.diagramConnector); - diagramLinkRelElement.SetAttribute(hudsConstants.dtype, hudsConstants.list); + XmlElement diagramLinkRelElement = xmlDocument.CreateElement(RelationshipConstants.DIAGRAMCONNECTOR); + diagramLinkRelElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.LIST); try { @@ -739,26 +729,26 @@ public void UnpackageDiagram(EA.Diagram diagram, XmlDocument xmlDocument, string string diagramLinkType = GetConnectorSysMLType(connectorElement); - XmlElement diagramLinkElement = xmlDocument.CreateElement(relationshipConstants.diagramConnector); - diagramLinkElement.SetAttribute(hudsConstants.key, key.ToString()); - diagramLinkElement.SetAttribute(hudsConstants.dtype, hudsConstants.list); + XmlElement diagramLinkElement = xmlDocument.CreateElement(RelationshipConstants.DIAGRAMCONNECTOR); + diagramLinkElement.SetAttribute(HUDSConstants.KEY, key.ToString()); + diagramLinkElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.LIST); // Create diagram connector relationship - XmlElement diagramLinkTypeElement = xmlDocument.CreateElement(hudsConstants.type); - diagramLinkTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement diagramLinkTypeElement = xmlDocument.CreateElement(HUDSConstants.TYPE); + diagramLinkTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); diagramLinkTypeElement.InnerText = diagramLinkType; - XmlElement diagramLinkIdElement = xmlDocument.CreateElement(hudsConstants.id); - diagramLinkIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement diagramLinkIdElement = xmlDocument.CreateElement(HUDSConstants.ID); + diagramLinkIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); diagramLinkIdElement.InnerText = diagramLinkGuid2; if (diagramLinkType == SysmlConstants.SYSMLMESSAGE) { - XmlElement relMetadataElement = xmlDocument.CreateElement(relationshipConstants.relMetadata); - relMetadataElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - XmlElement sequenceNumElement = xmlDocument.CreateElement(relationshipConstants.messageNumber); - sequenceNumElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement relMetadataElement = xmlDocument.CreateElement(RelationshipConstants.RELMETADATA); + relMetadataElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); + XmlElement sequenceNumElement = xmlDocument.CreateElement(RelationshipConstants.MESSAGENUMBER); + sequenceNumElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); sequenceNumElement.InnerText = connectorElement.SequenceNo.ToString(); relMetadataElement.AppendChild(sequenceNumElement); diagramLinkElement.AppendChild(relMetadataElement); @@ -783,15 +773,15 @@ public void UnpackageDiagram(EA.Diagram diagram, XmlDocument xmlDocument, string } // Create has parent relationship - XmlElement hasParentElement = xmlDocument.CreateElement(relationshipConstants.hasParent); - hasParentElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement hasParentElement = xmlDocument.CreateElement(RelationshipConstants.HASPARENT); + hasParentElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement hasParentTypeElement = xmlDocument.CreateElement(relationshipConstants.type); - hasParentTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hasParentTypeElement = xmlDocument.CreateElement(RelationshipConstants.TYPE); + hasParentTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hasParentTypeElement.InnerText = parentType; - XmlElement hasParentIdElement = xmlDocument.CreateElement(relationshipConstants.id); - hasParentIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hasParentIdElement = xmlDocument.CreateElement(RelationshipConstants.ID); + hasParentIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hasParentIdElement.InnerText = parentGuid; hasParentElement.AppendChild(hasParentTypeElement); @@ -820,13 +810,13 @@ public void UnpackageConnector(Connector connector, XmlDocument xmlDocument, { try { - XmlElement dataElement = xmlDocument.CreateElement(hudsConstants.data); - XmlElement attributesElement = xmlDocument.CreateElement(hudsConstants.attributes); - attributesElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - XmlElement typeElement = xmlDocument.CreateElement(hudsConstants.type); - typeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); - XmlElement relationshipsElement = xmlDocument.CreateElement(hudsConstants.relationships); - relationshipsElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement dataElement = xmlDocument.CreateElement(HUDSConstants.DATA); + XmlElement attributesElement = xmlDocument.CreateElement(HUDSConstants.ATTRIBUTES); + attributesElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); + XmlElement typeElement = xmlDocument.CreateElement(HUDSConstants.TYPE); + typeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); + XmlElement relationshipsElement = xmlDocument.CreateElement(HUDSConstants.RELATIONSHIPS); + relationshipsElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); string connectorGuid = connector.ConnectorGUID.Substring(1, connector.ConnectorGUID.Length - 2); string supplierGuid = repository.GetElementByID(connector.SupplierID).ElementGUID; @@ -847,40 +837,40 @@ public void UnpackageConnector(Connector connector, XmlDocument xmlDocument, // Create id element to be added to data element XmlElement idElement = MTIPCommon.CreateIdElement(xmlDocument, connectorGuid); - if (connector.Name != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, hudsConstants.str, connector.Name, attributesElement); + if (connector.Name != "") CreateHUDSAttribute(xmlDocument, AttributeConstants.NAME, HUDSConstants.STR, connector.Name, attributesElement); if (connector.Stereotype != "") { XmlElement stereotypeAttribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - stereotypeAttribute.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - stereotypeAttribute.SetAttribute(hudsConstants.key, AttributeConstants.STEREOTYPE); + stereotypeAttribute.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); + stereotypeAttribute.SetAttribute(HUDSConstants.KEY, AttributeConstants.STEREOTYPE); XmlElement stereotypeNameAttribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - stereotypeNameAttribute.SetAttribute(hudsConstants.dtype, hudsConstants.str); - stereotypeNameAttribute.SetAttribute(hudsConstants.key, AttributeConstants.STEREOTYPENAME); + stereotypeNameAttribute.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); + stereotypeNameAttribute.SetAttribute(HUDSConstants.KEY, AttributeConstants.STEREOTYPENAME); stereotypeNameAttribute.InnerText = connector.Stereotype; stereotypeAttribute.AppendChild(stereotypeNameAttribute); attributesElement.AppendChild(stereotypeAttribute); } - if (connector.TransitionAction != "" && (connector.TransitionAction != blockConstants.signal || connector.TransitionAction != "Call")) CreateHUDSAttribute(xmlDocument, relationshipConstants.effect, hudsConstants.str, connector.TransitionAction, attributesElement); - if (connector.TransitionGuard != "") CreateHUDSAttribute(xmlDocument, relationshipConstants.guard, hudsConstants.str, connector.TransitionGuard, attributesElement); - if (connector.TransitionAction == blockConstants.signal && connector.TransitionEvent == "Asynchronous") + if (connector.TransitionAction != "" && (connector.TransitionAction != BlockConstants.SIGNAL || connector.TransitionAction != "Call")) CreateHUDSAttribute(xmlDocument, RelationshipConstants.EFFECT, HUDSConstants.STR, connector.TransitionAction, attributesElement); + if (connector.TransitionGuard != "") CreateHUDSAttribute(xmlDocument, RelationshipConstants.GUARD, HUDSConstants.STR, connector.TransitionGuard, attributesElement); + if (connector.TransitionAction == BlockConstants.SIGNAL && connector.TransitionEvent == "Asynchronous") { - CreateHUDSAttribute(xmlDocument, AttributeConstants.MESSAGESORT, hudsConstants.str, relationshipConstants.asynchSignal, attributesElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.MESSAGESORT, HUDSConstants.STR, RelationshipConstants.ASYNCHSIGNAL, attributesElement); foreach (EA.ConnectorTag tag in connector.TaggedValues) { - if (tag.Name == relationshipConstants.signalGuid && tag.Value != "") + if (tag.Name == RelationshipConstants.SIGNALGUID && tag.Value != "") { - XmlElement signalRelElement = xmlDocument.CreateElement(relationshipConstants.signature); - signalRelElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement signalRelElement = xmlDocument.CreateElement(RelationshipConstants.SIGNATURE); + signalRelElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement signalTypeElement = xmlDocument.CreateElement(relationshipConstants.type); - signalTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement signalTypeElement = xmlDocument.CreateElement(RelationshipConstants.TYPE); + signalTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); signalTypeElement.InnerText = SysmlConstants.SYSMLSIGNAL; - XmlElement signalIdElement = xmlDocument.CreateElement(relationshipConstants.id); - signalIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement signalIdElement = xmlDocument.CreateElement(RelationshipConstants.ID); + signalIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); signalIdElement.InnerText = tag.Value.Substring(1, tag.Value.Length - 2); signalRelElement.AppendChild(signalTypeElement); @@ -889,23 +879,23 @@ public void UnpackageConnector(Connector connector, XmlDocument xmlDocument, } } } - if (connector.TransitionAction == "Call" && connector.TransitionEvent == "Asynchronous") CreateHUDSAttribute(xmlDocument, AttributeConstants.MESSAGESORT, hudsConstants.str, relationshipConstants.asynchCall, attributesElement); - if (connector.TransitionAction == "Call" && connector.TransitionEvent == "Synchronous") CreateHUDSAttribute(xmlDocument, AttributeConstants.MESSAGESORT, hudsConstants.str, relationshipConstants.synchCall, attributesElement); + if (connector.TransitionAction == "Call" && connector.TransitionEvent == "Asynchronous") CreateHUDSAttribute(xmlDocument, AttributeConstants.MESSAGESORT, HUDSConstants.STR, RelationshipConstants.ASYNCHCALL, attributesElement); + if (connector.TransitionAction == "Call" && connector.TransitionEvent == "Synchronous") CreateHUDSAttribute(xmlDocument, AttributeConstants.MESSAGESORT, HUDSConstants.STR, RelationshipConstants.SYNCHCALL, attributesElement); - CreateHUDSAttribute(xmlDocument, "isInclusiveOfBaseClass", hudsConstants.str, "false", attributesElement); + CreateHUDSAttribute(xmlDocument, "isInclusiveOfBaseClass", HUDSConstants.STR, "false", attributesElement); // Create client relationship string clientType = GetSysMLType(clientElement.Type, clientElement.Stereotype, clientElement.Subtype, clientElement.MetaType); string supplierType = GetSysMLType(supplierElement.Type, supplierElement.Stereotype, clientElement.Subtype, supplierElement.MetaType); - XmlElement clientRelElement = xmlDocument.CreateElement(relationshipConstants.client); - clientRelElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement clientRelElement = xmlDocument.CreateElement(RelationshipConstants.CLIENT); + clientRelElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement clientTypeElement = xmlDocument.CreateElement(relationshipConstants.type); - clientTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement clientTypeElement = xmlDocument.CreateElement(RelationshipConstants.TYPE); + clientTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); clientTypeElement.InnerText = supplierType; - XmlElement clientIdElement = xmlDocument.CreateElement(relationshipConstants.id); - clientIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement clientIdElement = xmlDocument.CreateElement(RelationshipConstants.ID); + clientIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); clientIdElement.InnerText = supplierGuid; clientRelElement.AppendChild(clientTypeElement); @@ -913,15 +903,15 @@ public void UnpackageConnector(Connector connector, XmlDocument xmlDocument, relationshipsElement.AppendChild(clientRelElement); // Create supplier relationship - XmlElement supplierRelElement = xmlDocument.CreateElement(relationshipConstants.supplier); - supplierRelElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement supplierRelElement = xmlDocument.CreateElement(RelationshipConstants.SUPPLIER); + supplierRelElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement supplierTypeElement = xmlDocument.CreateElement(relationshipConstants.type); - supplierTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement supplierTypeElement = xmlDocument.CreateElement(RelationshipConstants.TYPE); + supplierTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); supplierTypeElement.InnerText = clientType; - XmlElement supplierIdElement = xmlDocument.CreateElement(relationshipConstants.id); - supplierIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement supplierIdElement = xmlDocument.CreateElement(RelationshipConstants.ID); + supplierIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); supplierIdElement.InnerText = clientGuid; supplierRelElement.AppendChild(supplierTypeElement); @@ -929,15 +919,15 @@ public void UnpackageConnector(Connector connector, XmlDocument xmlDocument, relationshipsElement.AppendChild(supplierRelElement); // Create has parent relationship - XmlElement hasParentElement = xmlDocument.CreateElement(relationshipConstants.hasParent); - hasParentElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement hasParentElement = xmlDocument.CreateElement(RelationshipConstants.HASPARENT); + hasParentElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement hasParentTypeElement = xmlDocument.CreateElement(relationshipConstants.type); - hasParentTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hasParentTypeElement = xmlDocument.CreateElement(RelationshipConstants.TYPE); + hasParentTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hasParentTypeElement.InnerText = parentType; - XmlElement hasParentIdElement = xmlDocument.CreateElement(relationshipConstants.id); - hasParentIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hasParentIdElement = xmlDocument.CreateElement(RelationshipConstants.ID); + hasParentIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hasParentIdElement.InnerText = parentGuid; hasParentElement.AppendChild(hasParentTypeElement); @@ -994,11 +984,11 @@ public string GetPackageType(EA.Package package) public void CreateHUDSAttribute(XmlDocument xmlDocument, string key, string type, string value, XmlElement parentElement) { XmlElement attribute = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - attribute.SetAttribute(hudsConstants.key, key); - attribute.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + attribute.SetAttribute(HUDSConstants.KEY, key); + attribute.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); XmlElement attributeAttrib = xmlDocument.CreateElement(AttributeConstants.ATTRIBUTE); - attributeAttrib.SetAttribute(hudsConstants.key, hudsConstants.value); - attributeAttrib.SetAttribute(hudsConstants.dtype, type); + attributeAttrib.SetAttribute(HUDSConstants.KEY, HUDSConstants.VALUE); + attributeAttrib.SetAttribute(HUDSConstants.DTYPE, type); attributeAttrib.InnerText = value; attribute.AppendChild(attributeAttrib); parentElement.AppendChild(attribute); @@ -1006,41 +996,41 @@ public void CreateHUDSAttribute(XmlDocument xmlDocument, string key, string type public void CreateConstraintNode(XmlDocument xmlDocument, string constraintGuid, string opaqueExpressionGuid, string parentGuid, string parentType) { // Create constraint data block - XmlElement dataElement = xmlDocument.CreateElement(hudsConstants.data); - XmlElement typeElement = xmlDocument.CreateElement(hudsConstants.type); - typeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement dataElement = xmlDocument.CreateElement(HUDSConstants.DATA); + XmlElement typeElement = xmlDocument.CreateElement(HUDSConstants.TYPE); + typeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); typeElement.InnerText = SysmlConstants.SYSMLCONSTRAINT; - XmlElement relationshipsElement = xmlDocument.CreateElement(hudsConstants.relationships); - relationshipsElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement relationshipsElement = xmlDocument.CreateElement(HUDSConstants.RELATIONSHIPS); + relationshipsElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); // Create id element to be added to constraint data element XmlElement idElement = MTIPCommon.CreateIdElement(xmlDocument, constraintGuid); // Create constraint relationship - XmlElement valueSpecificationElement = xmlDocument.CreateElement(relationshipConstants.valueSpecification); - valueSpecificationElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement valueSpecificationElement = xmlDocument.CreateElement(RelationshipConstants.VALUESPECIFICATION); + valueSpecificationElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement valueSpecTypeElement = xmlDocument.CreateElement(relationshipConstants.type); - valueSpecTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement valueSpecTypeElement = xmlDocument.CreateElement(RelationshipConstants.TYPE); + valueSpecTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); valueSpecTypeElement.InnerText = SysmlConstants.OPAQUEEXPRESSION; - XmlElement valueSpecIdElement = xmlDocument.CreateElement(relationshipConstants.id); - valueSpecIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement valueSpecIdElement = xmlDocument.CreateElement(RelationshipConstants.ID); + valueSpecIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); valueSpecIdElement.InnerText = opaqueExpressionGuid; valueSpecificationElement.AppendChild(valueSpecTypeElement); valueSpecificationElement.AppendChild(valueSpecIdElement); relationshipsElement.AppendChild(valueSpecificationElement); - XmlElement hasParentElement = xmlDocument.CreateElement(relationshipConstants.hasParent); - hasParentElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement hasParentElement = xmlDocument.CreateElement(RelationshipConstants.HASPARENT); + hasParentElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement hasParentTypeElement = xmlDocument.CreateElement(relationshipConstants.type); - hasParentTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hasParentTypeElement = xmlDocument.CreateElement(RelationshipConstants.TYPE); + hasParentTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hasParentTypeElement.InnerText = parentType; - XmlElement hasParentIdElement = xmlDocument.CreateElement(relationshipConstants.id); - hasParentIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hasParentIdElement = xmlDocument.CreateElement(RelationshipConstants.ID); + hasParentIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hasParentIdElement.InnerText = parentGuid; hasParentElement.AppendChild(hasParentTypeElement); @@ -1057,29 +1047,29 @@ public void CreateConstraintNode(XmlDocument xmlDocument, string constraintGuid, public void CreateOpaqueNode(XmlDocument xmlDocument, string opaqueGuid, string name, string parentGuid) { // Create constraint data block - XmlElement dataElement = xmlDocument.CreateElement(hudsConstants.data); - XmlElement typeElement = xmlDocument.CreateElement(hudsConstants.type); - typeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement dataElement = xmlDocument.CreateElement(HUDSConstants.DATA); + XmlElement typeElement = xmlDocument.CreateElement(HUDSConstants.TYPE); + typeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); typeElement.InnerText = SysmlConstants.SYSMLOPAQUEEXPRESSION; - XmlElement attributesElement = xmlDocument.CreateElement(hudsConstants.attributes); - attributesElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); - XmlElement relationshipsElement = xmlDocument.CreateElement(hudsConstants.relationships); - relationshipsElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement attributesElement = xmlDocument.CreateElement(HUDSConstants.ATTRIBUTES); + attributesElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); + XmlElement relationshipsElement = xmlDocument.CreateElement(HUDSConstants.RELATIONSHIPS); + relationshipsElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); // Create id element to be added to opaque expression data element XmlElement idElement = MTIPCommon.CreateIdElement(xmlDocument, opaqueGuid); // Create opaque expression relationship - XmlElement hasParentElement = xmlDocument.CreateElement(relationshipConstants.hasParent); - hasParentElement.SetAttribute(hudsConstants.dtype, hudsConstants.dict); + XmlElement hasParentElement = xmlDocument.CreateElement(RelationshipConstants.HASPARENT); + hasParentElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.DICT); - XmlElement hasParentTypeElement = xmlDocument.CreateElement(hudsConstants.type); - hasParentTypeElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hasParentTypeElement = xmlDocument.CreateElement(HUDSConstants.TYPE); + hasParentTypeElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hasParentTypeElement.InnerText = SysmlConstants.SYSMLCONSTRAINT; - XmlElement hasParentIdElement = xmlDocument.CreateElement(hudsConstants.id); - hasParentIdElement.SetAttribute(hudsConstants.dtype, hudsConstants.str); + XmlElement hasParentIdElement = xmlDocument.CreateElement(HUDSConstants.ID); + hasParentIdElement.SetAttribute(HUDSConstants.DTYPE, HUDSConstants.STR); hasParentIdElement.InnerText = parentGuid; hasParentElement.AppendChild(hasParentTypeElement); @@ -1087,7 +1077,7 @@ public void CreateOpaqueNode(XmlDocument xmlDocument, string opaqueGuid, string relationshipsElement.AppendChild(hasParentElement); // Create opaque expression relationship - CreateHUDSAttribute(xmlDocument, AttributeConstants.BODY, hudsConstants.str, name, attributesElement); + CreateHUDSAttribute(xmlDocument, AttributeConstants.BODY, HUDSConstants.STR, name, attributesElement); // Add type, id, attributes, and relationships node to data node dataElement.AppendChild(typeElement); @@ -1100,8 +1090,7 @@ public void CreateOpaqueNode(XmlDocument xmlDocument, string opaqueGuid, string private string GetSysMLType(string type, string stereotype, int subtype, string metatype) { StereotypeConstants stereotypeConstants = new StereotypeConstants(); - MetatypeConstants metatypeConstants = new MetatypeConstants(); - + string elementType = ""; if (stereotype == stereotypeConstants.block) elementType = SysmlConstants.SYSMLBLOCK; else if (stereotype == stereotypeConstants.hardware) elementType = SysmlConstants.SYSMLBLOCK; @@ -1213,17 +1202,17 @@ private string GetSysMLType(string type, string stereotype, int subtype, string type == SysmlConstants.ACTIONPIN || type == SysmlConstants.EVENT) { if (stereotype == stereotypeConstants.allocated) elementType = SysmlConstants.SYSMLALLOCATED; - else if (type == SysmlConstants.ACTION && metatype == metatypeConstants.acceptEventAction) elementType = SysmlConstants.SYSMLACCEPTEVENTACTION; - else if (type == SysmlConstants.ACTION && metatype == metatypeConstants.callBehaviorAction) elementType = SysmlConstants.SYSMLCALLBEHAVIORACTION; - else if (type == SysmlConstants.ACTION && metatype == metatypeConstants.createObjectAction) elementType = SysmlConstants.SYSMLCREATEOBJECTACTION; - else if (type == SysmlConstants.ACTION && metatype == metatypeConstants.destroyObjectAction) elementType = SysmlConstants.SYSMLDESTROYOBJECTACTION; - else if (type == SysmlConstants.ACTION && metatype == metatypeConstants.callOperationAction) elementType = SysmlConstants.SYSMLCALLOPERATIONACTION; - else if (type == SysmlConstants.ACTION && metatype == metatypeConstants.opaqueAction) elementType = SysmlConstants.SYSMLOPAQUEACTION; - else if (type == SysmlConstants.ACTION && metatype == metatypeConstants.sendSignalAction) elementType = SysmlConstants.SYSMLSENDSIGNALACTION; + else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.acceptEventAction) elementType = SysmlConstants.SYSMLACCEPTEVENTACTION; + else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.callBehaviorAction) elementType = SysmlConstants.SYSMLCALLBEHAVIORACTION; + else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.createObjectAction) elementType = SysmlConstants.SYSMLCREATEOBJECTACTION; + else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.destroyObjectAction) elementType = SysmlConstants.SYSMLDESTROYOBJECTACTION; + else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.callOperationAction) elementType = SysmlConstants.SYSMLCALLOPERATIONACTION; + else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.opaqueAction) elementType = SysmlConstants.SYSMLOPAQUEACTION; + else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.sendSignalAction) elementType = SysmlConstants.SYSMLSENDSIGNALACTION; else if (type == SysmlConstants.ACTION) elementType = SysmlConstants.SYSMLACTION; else if (type == SysmlConstants.ACTIVITYPARAMETER) elementType = SysmlConstants.SYSMLACTIVITYPARAMETER; - else if (type == SysmlConstants.ACTIONPIN && (stereotype == stereotypeConstants.output || metatype == metatypeConstants.outputPin)) elementType = SysmlConstants.SYSMLOUTPUTPIN; - else if (type == SysmlConstants.ACTIONPIN && (stereotype == stereotypeConstants.input || metatype == metatypeConstants.inputPin)) elementType = SysmlConstants.SYSMLINPUTPIN; + else if (type == SysmlConstants.ACTIONPIN && (stereotype == stereotypeConstants.output || metatype == MetatypeConstants.outputPin)) elementType = SysmlConstants.SYSMLOUTPUTPIN; + else if (type == SysmlConstants.ACTIONPIN && (stereotype == stereotypeConstants.input || metatype == MetatypeConstants.inputPin)) elementType = SysmlConstants.SYSMLINPUTPIN; else if (type == SysmlConstants.ACTIONPIN) elementType = SysmlConstants.SYSMLACTIONPIN; else if (type == SysmlConstants.EVENT) { diff --git a/MTIP/Translations/MTIPImportFunctions.cs b/MTIP/Translations/MTIPImportFunctions.cs index 8fea40e..7c95789 100644 --- a/MTIP/Translations/MTIPImportFunctions.cs +++ b/MTIP/Translations/MTIPImportFunctions.cs @@ -215,7 +215,7 @@ internal void GetSysmlMTIPModel(EA.Package rootPkg, XmlNode packet) // Begin building model internal void BuildModel(EA.Package rootPkg) { - ModelConstants modelConstants = new ModelConstants(); + try { if (terms.Count > 0) @@ -234,28 +234,28 @@ internal void BuildModel(EA.Package rootPkg) if (headModelItem.GetName() == "") { name = "Model"; - headModelItem.AddAttribute(modelConstants.stereotype, modelConstants.model); + headModelItem.AddAttribute(ModelConstants.STEREOTYPE, ModelConstants.MODEL); } else name = headModelItem.GetName(); EA.Package modelPkg = rootPkg.Packages.AddNew(name, ""); modelPkg.Update(); - if (headModelItem.GetAttributes().ContainsKey(modelConstants.stereotype) && headModelItem.GetAttribute(modelConstants.stereotype) == modelConstants.model) + if (headModelItem.GetAttributes().ContainsKey(ModelConstants.STEREOTYPE) && headModelItem.GetAttribute(ModelConstants.STEREOTYPE) == ModelConstants.MODEL) { - modelPkg.Element.Stereotype = modelConstants.model; + modelPkg.Element.Stereotype = ModelConstants.MODEL; } - if (headModelItem.GetAttributes().ContainsKey(modelConstants.stereotype) && headModelItem.GetAttribute(modelConstants.stereotype) == modelConstants.profile) + if (headModelItem.GetAttributes().ContainsKey(ModelConstants.STEREOTYPE) && headModelItem.GetAttribute(ModelConstants.STEREOTYPE) == ModelConstants.PROFILE) { - modelPkg.Element.Stereotype = modelConstants.profile; + modelPkg.Element.Stereotype = ModelConstants.PROFILE; } string notes = ""; - if (headModelItem.GetAttributes().ContainsKey(modelConstants.documentation)) + if (headModelItem.GetAttributes().ContainsKey(ModelConstants.DOCUMENTATION)) { - notes += headModelItem.GetAttribute(modelConstants.documentation); + notes += headModelItem.GetAttribute(ModelConstants.DOCUMENTATION); } - if (headModelItem.GetAttributes().ContainsKey(modelConstants.text)) + if (headModelItem.GetAttributes().ContainsKey(ModelConstants.TEXT)) { - notes = " - " + headModelItem.GetAttribute(modelConstants.text); + notes = " - " + headModelItem.GetAttribute(ModelConstants.TEXT); } modelPkg.Notes = notes; modelPkg.Update(); @@ -489,19 +489,18 @@ internal string GetInnerAttribute(XmlNode attribute) } internal XmlItem GetRelationships(XmlNode fieldNode, XmlItem modelElement) { - RelationshipConstants relConstants = new RelationshipConstants(); foreach (XmlNode relationship in fieldNode) { try { - if (relationship.Name == relConstants.hasParent) + if (relationship.Name == RelationshipConstants.HASPARENT) { foreach (XmlNode hasParent in relationship) { - if (hasParent.Name == relConstants.id) modelElement.SetParent(hasParent.InnerText); + if (hasParent.Name == RelationshipConstants.ID) modelElement.SetParent(hasParent.InnerText); } } - if (relationship.Name == relConstants.element) + if (relationship.Name == RelationshipConstants.ELEMENT) { foreach (XmlNode element in relationship) { @@ -509,19 +508,19 @@ internal XmlItem GetRelationships(XmlNode fieldNode, XmlItem modelElement) DiagramObjectItem diagramObject = new DiagramObjectItem(); foreach (XmlNode elementItem in element) { - if (elementItem.Name == relConstants.id) + if (elementItem.Name == RelationshipConstants.ID) { diagramObject.SetMappingId(elementItem.InnerText); } - if (elementItem.Name == relConstants.relMetadata) + if (elementItem.Name == RelationshipConstants.RELMETADATA) { foreach (XmlNode metadata in elementItem) { - if (metadata.Name == relConstants.relMetadataTop) diagramObject.SetTopCoor(metadata.InnerText); - if (metadata.Name == relConstants.relMetadataLeft) diagramObject.SetLeftCoor(metadata.InnerText); - if (metadata.Name == relConstants.relMetadataBottom) diagramObject.SetBottomCoor(metadata.InnerText); - if (metadata.Name == relConstants.relMetadataRight) diagramObject.SetRightCoor(metadata.InnerText); - if (metadata.Name == relConstants.relMetadataSeq) diagramObject.SetSequenceCoor(metadata.InnerText); + if (metadata.Name == RelationshipConstants.RELMETADATATOP) diagramObject.SetTopCoor(metadata.InnerText); + if (metadata.Name == RelationshipConstants.RELMETADATALEFT) diagramObject.SetLeftCoor(metadata.InnerText); + if (metadata.Name == RelationshipConstants.RELMETADATABOTTOM) diagramObject.SetBottomCoor(metadata.InnerText); + if (metadata.Name == RelationshipConstants.RELMETADATARIGHT) diagramObject.SetRightCoor(metadata.InnerText); + if (metadata.Name == RelationshipConstants.RELMETADATASEQ) diagramObject.SetSequenceCoor(metadata.InnerText); } } @@ -529,19 +528,19 @@ internal XmlItem GetRelationships(XmlNode fieldNode, XmlItem modelElement) modelElement.AddDiagramObjects(diagramObject); } } - if (relationship.Name == relConstants.diagramConnector) + if (relationship.Name == RelationshipConstants.DIAGRAMCONNECTOR) { foreach (XmlNode diagramLinkElem in relationship) { DiagramLinkItem diagramLink = new DiagramLinkItem(); foreach (XmlNode diagramConnElem in diagramLinkElem) { - if (diagramConnElem.Name == relConstants.id) diagramLink.SetMappingId(diagramConnElem.InnerText); - if (diagramConnElem.Name == relConstants.relMetadata) + if (diagramConnElem.Name == RelationshipConstants.ID) diagramLink.SetMappingId(diagramConnElem.InnerText); + if (diagramConnElem.Name == RelationshipConstants.RELMETADATA) { foreach (XmlNode relMetadata in diagramConnElem) { - if (relMetadata.Name == relConstants.messageNumber) diagramLink.SetSequence(relMetadata.InnerText); + if (relMetadata.Name == RelationshipConstants.MESSAGENUMBER) diagramLink.SetSequence(relMetadata.InnerText); } } @@ -550,50 +549,50 @@ internal XmlItem GetRelationships(XmlNode fieldNode, XmlItem modelElement) } } - if (relationship.Name == relConstants.typedBy) + if (relationship.Name == RelationshipConstants.TYPEDBY) { - foreach (XmlNode typedBy in relationship) if (typedBy.Name == relConstants.id) modelElement.SetTypedBy(typedBy.InnerText); + foreach (XmlNode typedBy in relationship) if (typedBy.Name == RelationshipConstants.ID) modelElement.SetTypedBy(typedBy.InnerText); } - if (relationship.Name == relConstants.classifiedBy) + if (relationship.Name == RelationshipConstants.CLASSIFIEDBY) { - foreach (XmlNode classifiedBy in relationship) if (classifiedBy.Name == relConstants.id) modelElement.SetClassifiedBy(classifiedBy.InnerText); + foreach (XmlNode classifiedBy in relationship) if (classifiedBy.Name == RelationshipConstants.ID) modelElement.SetClassifiedBy(classifiedBy.InnerText); } - if (relationship.Name == relConstants.valueSpecification) + if (relationship.Name == RelationshipConstants.VALUESPECIFICATION) { - foreach (XmlNode valueSpecification in relationship) if (valueSpecification.Name == relConstants.id) modelElement.SetValueSpecification(valueSpecification.InnerText); + foreach (XmlNode valueSpecification in relationship) if (valueSpecification.Name == RelationshipConstants.ID) modelElement.SetValueSpecification(valueSpecification.InnerText); } - if (relationship.Name == relConstants.client) + if (relationship.Name == RelationshipConstants.CLIENT) { - foreach (XmlNode client in relationship) if (client.Name == relConstants.id) modelElement.SetClient(client.InnerText); + foreach (XmlNode client in relationship) if (client.Name == RelationshipConstants.ID) modelElement.SetClient(client.InnerText); } - if (relationship.Name == relConstants.supplier) + if (relationship.Name == RelationshipConstants.SUPPLIER) { - foreach (XmlNode supplier in relationship) if (supplier.Name == relConstants.id) modelElement.SetSupplier(supplier.InnerText); + foreach (XmlNode supplier in relationship) if (supplier.Name == RelationshipConstants.ID) modelElement.SetSupplier(supplier.InnerText); } - if (relationship.Name == relConstants.compositeDiagram) + if (relationship.Name == RelationshipConstants.COMPOSITEDIAGRAM) { - foreach (XmlNode compositeDiagram in relationship) if (compositeDiagram.Name == relConstants.id) modelElement.SetCompositeDiagram(compositeDiagram.InnerText); + foreach (XmlNode compositeDiagram in relationship) if (compositeDiagram.Name == RelationshipConstants.ID) modelElement.SetCompositeDiagram(compositeDiagram.InnerText); compositeDiagramsToAdd.Add(modelElement.GetMappingID(), modelElement); } - if (relationship.Name == relConstants.signature) + if (relationship.Name == RelationshipConstants.SIGNATURE) { - foreach (XmlNode signal in relationship) if (signal.Name == relConstants.id) modelElement.SetSignal(signal.InnerText); + foreach (XmlNode signal in relationship) if (signal.Name == RelationshipConstants.ID) modelElement.SetSignal(signal.InnerText); } - if (relationship.Name == relConstants.profile) + if (relationship.Name == RelationshipConstants.PROFILE) { foreach (XmlNode profile in relationship) { - if (profile.Name == relConstants.id) modelElement.SetProfileId(profile.InnerText); - if (profile.Name == relConstants.profile) modelElement.SetProfile(profile.InnerText); + if (profile.Name == RelationshipConstants.ID) modelElement.SetProfileId(profile.InnerText); + if (profile.Name == RelationshipConstants.PROFILE) modelElement.SetProfile(profile.InnerText); } } - if (relationship.Name == relConstants.hyperlink) + if (relationship.Name == RelationshipConstants.HYPERLINK) { foreach (XmlNode hyperlink in relationship) { - if (hyperlink.Name == relConstants.id) modelElement.SetHyperlink(hyperlink.InnerText); - if (hyperlink.Name == relConstants.type) modelElement.SetHyperlinkType(hyperlink.InnerText); + if (hyperlink.Name == RelationshipConstants.ID) modelElement.SetHyperlink(hyperlink.InnerText); + if (hyperlink.Name == RelationshipConstants.TYPE) modelElement.SetHyperlinkType(hyperlink.InnerText); } } } @@ -751,10 +750,6 @@ internal void AddElementElement(string parentId, string childId) internal void GetElement(EA.Element childElement, XmlItem childItem, string childId, string parentType) { StereotypeConstants stereotypeConstants = new StereotypeConstants(); - MetatypeConstants metatypeConstants = new MetatypeConstants(); - ProfileConstants profileConstants = new ProfileConstants(); - - if (childElement.Type == SysmlConstants.STATENODE) { if (childItem.GetElementType() == SysmlConstants.INITIALPSEUDOSTATE) childElement.Subtype = 3; @@ -768,7 +763,7 @@ internal void GetElement(EA.Element childElement, XmlItem childItem, string chil if (childItem.GetElementType() == SysmlConstants.ACTIVITYINITIALNODE) childElement.Subtype = 100; if (childItem.GetElementType() == SysmlConstants.ACTIVITYFINALNODE) childElement.Subtype = 101; if (childItem.GetElementType() == SysmlConstants.FLOWFINALNODE) childElement.Subtype = 102; - childElement.MetaType = metatypeConstants.pseudostate; + childElement.MetaType = MetatypeConstants.pseudostate; } if (childElement.Type == SysmlConstants.ACTION) { @@ -999,8 +994,6 @@ internal void AddConnectors() { foreach (KeyValuePair relationshipItem in relationshipElements) { - - RelationshipConstants relationshipConstants = new RelationshipConstants(); try { if (parsedXml.ContainsKey(relationshipItem.Value.GetSupplier()) && parsedXml.ContainsKey(relationshipItem.Value.GetClient())) @@ -1032,7 +1025,7 @@ internal void AddConnectors() if (relationshipItem.Value.GetAttributes().ContainsKey(AttributeConstants.MESSAGESORT)) { - if (relationshipItem.Value.GetAttribute(AttributeConstants.MESSAGESORT) == relationshipConstants.asynchSignal) + if (relationshipItem.Value.GetAttribute(AttributeConstants.MESSAGESORT) == RelationshipConstants.ASYNCHSIGNAL) { associationConnector.TransitionEvent = "Asynchronous"; associationConnector.TransitionAction = "Signal"; @@ -1043,7 +1036,7 @@ internal void AddConnectors() if (relationshipItem.Value.GetSignal() != "") { string signal = parsedXml[relationshipItem.Value.GetSignal()].GetEAID(); - EA.ConnectorTag tag = associationConnector.TaggedValues.AddNew(relationshipConstants.signalGuid, signal); + EA.ConnectorTag tag = associationConnector.TaggedValues.AddNew(RelationshipConstants.SIGNALGUID, signal); //tag.Name = "signal_guid"; //tag.Value = signal; tag.Update(); @@ -1051,14 +1044,14 @@ internal void AddConnectors() associationConnector.Update(); } } - if (relationshipItem.Value.GetAttribute(AttributeConstants.MESSAGESORT) == relationshipConstants.asynchCall) + if (relationshipItem.Value.GetAttribute(AttributeConstants.MESSAGESORT) == RelationshipConstants.ASYNCHCALL) { associationConnector.TransitionEvent = "Asynchronous"; associationConnector.TransitionAction = "Call"; associationConnector.SupplierID = supplierElement.ElementID; associationConnector.ClientID = clientElement.ElementID; } - if (relationshipItem.Value.GetAttribute(AttributeConstants.MESSAGESORT) == relationshipConstants.synchCall) + if (relationshipItem.Value.GetAttribute(AttributeConstants.MESSAGESORT) == RelationshipConstants.SYNCHCALL) { associationConnector.TransitionEvent = "Synchronous"; associationConnector.TransitionAction = "Call"; @@ -1066,7 +1059,7 @@ internal void AddConnectors() associationConnector.ClientID = clientElement.ElementID; } - if (relationshipItem.Value.GetAttribute(AttributeConstants.MESSAGESORT) == relationshipConstants.reply) + if (relationshipItem.Value.GetAttribute(AttributeConstants.MESSAGESORT) == RelationshipConstants.REPLY) { associationConnector.TransitionEvent = "Synchronous"; associationConnector.TransitionAction = "Call"; @@ -1113,21 +1106,21 @@ internal void AddConnectors() meta_con.Value = meta_ster; meta_con.Update(); } - else if (stereotype == relationshipConstants.metarelationship) + else if (stereotype == RelationshipConstants.METARELATIONSHIP) { - string meta_ster = relationshipItem.Value.GetAttribute(relationshipConstants.metarelationship); - ConnectorTag meta_con = associationConnector.TaggedValues.GetByName(relationshipConstants.metaclass); + string meta_ster = relationshipItem.Value.GetAttribute(RelationshipConstants.METARELATIONSHIP); + ConnectorTag meta_con = associationConnector.TaggedValues.GetByName(RelationshipConstants.METACLASS); meta_con.Value = meta_ster; meta_con.Update(); } } - if (relationshipItem.Value.GetAttributes().ContainsKey(relationshipConstants.guard)) + if (relationshipItem.Value.GetAttributes().ContainsKey(RelationshipConstants.GUARD)) { - associationConnector.TransitionGuard = relationshipItem.Value.GetAttribute(relationshipConstants.guard); + associationConnector.TransitionGuard = relationshipItem.Value.GetAttribute(RelationshipConstants.GUARD); } - if (relationshipItem.Value.GetAttributes().ContainsKey(relationshipConstants.effect)) + if (relationshipItem.Value.GetAttributes().ContainsKey(RelationshipConstants.EFFECT)) { - associationConnector.TransitionAction = relationshipItem.Value.GetAttribute(relationshipConstants.effect); + associationConnector.TransitionAction = relationshipItem.Value.GetAttribute(RelationshipConstants.EFFECT); } if (relationshipItem.Value.GetElementType() == SysmlConstants.COMPOSITION) { @@ -1521,15 +1514,15 @@ internal void AddCompositeDiagrams() internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair diagramItem) { - DiagramConstants diagramConstants = new DiagramConstants(); + EA.Package pkg = repository.GetPackageByID(1); - EA.Diagram relationshipDiagram = repository.GetPackageByID(1).Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.component); ; + EA.Diagram relationshipDiagram = repository.GetPackageByID(1).Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.component); ; if (parentItem.GetElementType() == SysmlConstants.PACKAGE || parentItem.GetElementType() == SysmlConstants.PROFILE || parentItem.GetElementType() == SysmlConstants.MODEL) { EA.Package parentPkg = repository.GetPackageByGuid(parentItem.GetEAID()); if (diagramItem.Value.GetElementType() == SysmlConstants.ACT) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.activity); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.activity); relationshipDiagram.MetaType = "SysML1.4::Activity"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1537,7 +1530,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.BDD) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.logical); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.logical); relationshipDiagram.MetaType = "SysML1.4::BlockDefinition"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1545,14 +1538,14 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.CLASS) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.classType); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.classType); relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); return relationshipDiagram; } if (diagramItem.Value.GetElementType() == SysmlConstants.IBD) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.compositeStructure); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.compositeStructure); relationshipDiagram.MetaType = "SysML1.4::InternalBlock"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1560,14 +1553,14 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.PACKAGE) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.package); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.package); relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); return relationshipDiagram; } if (diagramItem.Value.GetElementType() == SysmlConstants.PAR) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.compositeStructure); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.compositeStructure); relationshipDiagram.MetaType = "SysML1.4::Parametric"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1575,7 +1568,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.REQ) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.custom); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.custom); relationshipDiagram.MetaType = "SysML1.4::Requirement"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1583,7 +1576,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.SEQ) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.sequence); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.sequence); relationshipDiagram.MetaType = "SysML1.4::Sequence"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1591,7 +1584,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.STM) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.statechart); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.statechart); relationshipDiagram.MetaType = "SysML1.4::StateMachine"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1599,7 +1592,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.UC) { - relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.useCase); + relationshipDiagram = parentPkg.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.useCase); relationshipDiagram.MetaType = "SysML1.4::UseCase"; relationshipDiagram.Update(); parentPkg.Diagrams.Refresh(); @@ -1609,9 +1602,9 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair else if (parentItem.GetCategory() == SysmlConstants.ELEMENT) { EA.Element parentElement = repository.GetElementByGuid(parentItem.GetEAID()); - if (diagramItem.Value.GetElementType() == SysmlConstants.ACT && parentItem.GetEAID() != diagramConstants.activity) + if (diagramItem.Value.GetElementType() == SysmlConstants.ACT && parentItem.GetEAID() != DiagramConstants.activity) { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.activity); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.activity); relationshipDiagram.MetaType = "SysML1.4::Activity"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1620,7 +1613,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair if (diagramItem.Value.GetElementType() == SysmlConstants.BDD && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.logical); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.logical); relationshipDiagram.MetaType = "SysML1.4::BlockDefinition"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1628,14 +1621,14 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.CLASS && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.classType); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.classType); relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); return relationshipDiagram; } if (diagramItem.Value.GetElementType() == SysmlConstants.IBD && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.compositeStructure); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.compositeStructure); relationshipDiagram.MetaType = "SysML1.4::InternalBlock"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1643,14 +1636,14 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.PACKAGE && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.package); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.package); relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); return relationshipDiagram; } if (diagramItem.Value.GetElementType() == SysmlConstants.PAR && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.compositeStructure); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.compositeStructure); relationshipDiagram.MetaType = "SysML1.4::Parametric"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1658,7 +1651,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.REQ) { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.custom); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.custom); relationshipDiagram.MetaType = "SysML1.4::Requirement"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1666,7 +1659,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.SEQ && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.sequence); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.sequence); relationshipDiagram.MetaType = "SysML1.4::Sequence"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1674,7 +1667,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.STM && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.statechart); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.statechart); relationshipDiagram.MetaType = "SysML1.4::StateMachine"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1682,7 +1675,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } if (diagramItem.Value.GetElementType() == SysmlConstants.UC && parentItem.GetEAID() != "") { - relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.useCase); + relationshipDiagram = parentElement.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.useCase); relationshipDiagram.MetaType = "SysML1.4::UseCase"; relationshipDiagram.Update(); parentElement.Diagrams.Refresh(); @@ -1692,7 +1685,7 @@ internal EA.Diagram GetDiagram(XmlItem parentItem, KeyValuePair } else { - relationshipDiagram = orphanedPackage.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), diagramConstants.component); + relationshipDiagram = orphanedPackage.Diagrams.AddNew(diagramItem.Value.GetAttribute(AttributeConstants.NAME), DiagramConstants.component); relationshipDiagram.Update(); orphanedPackage.Diagrams.Refresh(); return relationshipDiagram; @@ -1812,132 +1805,126 @@ public bool IsPortType(string type) internal string GetEAType(string sysmlType, string stereotype) { StereotypeConstants stereotypeConstants = new StereotypeConstants(); - ActivityConstants activityConstants = new ActivityConstants(); - BlockConstants blockConstants = new BlockConstants(); UseCaseConstants useCaseConstants = new UseCaseConstants(); - InternalBlockConstants internalBlockConstants = new InternalBlockConstants(); - RequirementConstants requirementConstants = new RequirementConstants(); - ProfileConstants profileConstants = new ProfileConstants(); - SequenceConstants sequenceConstants = new SequenceConstants(); StateMachineConstants stateMachineConstants = new StateMachineConstants(); string type = ""; - if (sysmlType == SysmlConstants.ACTIVITY) type = activityConstants.activity; - else if (sysmlType == SysmlConstants.ACTIVITYFINALNODE) type = activityConstants.stateNode; - else if (sysmlType == SysmlConstants.ACTIVITYPARAMETERNODE) type = activityConstants.activityParameter; - else if (sysmlType == SysmlConstants.ACTIVITYPARTITION) type = activityConstants.activityPartion; + if (sysmlType == SysmlConstants.ACTIVITY) type = ActivityConstants.ACTIVITY; + else if (sysmlType == SysmlConstants.ACTIVITYFINALNODE) type = ActivityConstants.STATENODE; + else if (sysmlType == SysmlConstants.ACTIVITYPARAMETERNODE) type = ActivityConstants.ACTIVITYPARAMETER; + else if (sysmlType == SysmlConstants.ACTIVITYPARTITION) type = ActivityConstants.ACTIVITYPARTION; else if (sysmlType == SysmlConstants.BLOCK) { - if (stereotype == stereotypeConstants.constraintBlockCap || stereotype == stereotypeConstants.constraintBlock) type = blockConstants.constraintBlock; - else type = blockConstants.block; + if (stereotype == stereotypeConstants.constraintBlockCap || stereotype == stereotypeConstants.constraintBlock) type = BlockConstants.CONSTRAINTBLOCK; + else type = BlockConstants.BLOCK; } - else if (sysmlType == SysmlConstants.ACCEPTEVENTACTION) type = activityConstants.acceptEventAction; - else if (sysmlType == SysmlConstants.ACTION) type = activityConstants.action; - else if (sysmlType == SysmlConstants.ACTIONPIN) type = activityConstants.actionPin; - else if (sysmlType == SysmlConstants.ACTIVITYINITIALNODE) type = activityConstants.stateNode; + else if (sysmlType == SysmlConstants.ACCEPTEVENTACTION) type = ActivityConstants.ACCEPTEVENTACTION; + else if (sysmlType == SysmlConstants.ACTION) type = ActivityConstants.ACTION; + else if (sysmlType == SysmlConstants.ACTIONPIN) type = ActivityConstants.ACTIONPIN; + else if (sysmlType == SysmlConstants.ACTIVITYINITIALNODE) type = ActivityConstants.STATENODE; else if (sysmlType == SysmlConstants.ACTOR) type = useCaseConstants.actor; - else if (sysmlType == SysmlConstants.ASSOCIATIONBLOCK) type = blockConstants.association; - else if (sysmlType == SysmlConstants.BOUNDREFERENCE) type = internalBlockConstants.boundReference; - else if (sysmlType == SysmlConstants.BOUNDARY) type = internalBlockConstants.boundary; - else if (sysmlType == SysmlConstants.BUSINESSREQUIREMENT) type = requirementConstants.requirement; - else if (sysmlType == SysmlConstants.CLASSIFIERBEHAVIORPROPERTY) type = internalBlockConstants.property; - else if (sysmlType == SysmlConstants.CALLBEHAVIORACTION) type = activityConstants.callBehaviorAction; - else if (sysmlType == SysmlConstants.CALLOPERATIONACTION) type = activityConstants.callOperationAction; - else if (sysmlType == SysmlConstants.CENTRALBUFFERNODE) type = activityConstants.centralBufferNode; - else if (sysmlType == SysmlConstants.CHANGE) type = activityConstants.change; - else if (sysmlType == SysmlConstants.CHOICEPSUEDOSTATE) type = activityConstants.stateNode; - else if (sysmlType == SysmlConstants.CLASS) type = profileConstants.classType; - else if (sysmlType == SysmlConstants.CLASSIFICATION) type = profileConstants.part; - else if (sysmlType == SysmlConstants.COLLABORATION) type = sequenceConstants.collaboration; - else if (sysmlType == SysmlConstants.CONSTRAINTBLOCK) type = blockConstants.constraintBlock; - else if (sysmlType == SysmlConstants.CONSTRAINT) type = profileConstants.constraint; - else if (sysmlType == SysmlConstants.CONSTRAINTBLOCK) type = blockConstants.block; - else if (sysmlType == SysmlConstants.CONSTRAINTPARAMETER) type = activityConstants.property; - else if (sysmlType == SysmlConstants.CONDITIONALNODE) type = activityConstants.conditionalNode; - else if (sysmlType == SysmlConstants.COMBINEDFRAGMENT) type = sequenceConstants.interactionFragment; - else if (sysmlType == SysmlConstants.CREATEOBJECTACTION) type = activityConstants.createObjectAction; - else if (sysmlType == SysmlConstants.DATASTORENODE) type = profileConstants.objectType; - else if (sysmlType == SysmlConstants.DECISIONNODE) type = activityConstants.decision; + else if (sysmlType == SysmlConstants.ASSOCIATIONBLOCK) type = BlockConstants.ASSOCIATION; + else if (sysmlType == SysmlConstants.BOUNDREFERENCE) type = InternalBlockConstants.BOUNDREFERENCE; + else if (sysmlType == SysmlConstants.BOUNDARY) type = InternalBlockConstants.BOUNDARY; + else if (sysmlType == SysmlConstants.BUSINESSREQUIREMENT) type = RequirementConstants.REQUIREMENT; + else if (sysmlType == SysmlConstants.CLASSIFIERBEHAVIORPROPERTY) type = InternalBlockConstants.PROPERTY; + else if (sysmlType == SysmlConstants.CALLBEHAVIORACTION) type = ActivityConstants.CALLBEHAVIORACTION; + else if (sysmlType == SysmlConstants.CALLOPERATIONACTION) type = ActivityConstants.CALLOPERATIONACTION; + else if (sysmlType == SysmlConstants.CENTRALBUFFERNODE) type = ActivityConstants.CENTRALBUFFERNODE; + else if (sysmlType == SysmlConstants.CHANGE) type = ActivityConstants.CHANGE; + else if (sysmlType == SysmlConstants.CHOICEPSUEDOSTATE) type = ActivityConstants.STATENODE; + else if (sysmlType == SysmlConstants.CLASS) type = ProfileConstants.CLASSTYPE; + else if (sysmlType == SysmlConstants.CLASSIFICATION) type = ProfileConstants.PART; + else if (sysmlType == SysmlConstants.COLLABORATION) type = SequenceConstants.COLLABORATION; + else if (sysmlType == SysmlConstants.CONSTRAINTBLOCK) type = BlockConstants.CONSTRAINTBLOCK; + else if (sysmlType == SysmlConstants.CONSTRAINT) type = ProfileConstants.CONSTRAINT; + else if (sysmlType == SysmlConstants.CONSTRAINTBLOCK) type = BlockConstants.BLOCK; + else if (sysmlType == SysmlConstants.CONSTRAINTPARAMETER) type = ActivityConstants.PROPERTY; + else if (sysmlType == SysmlConstants.CONDITIONALNODE) type = ActivityConstants.CONDITIONALNODE; + else if (sysmlType == SysmlConstants.COMBINEDFRAGMENT) type = SequenceConstants.INTERACTIONFRAGMENT; + else if (sysmlType == SysmlConstants.CREATEOBJECTACTION) type = ActivityConstants.CREATEOBJECTACTION; + else if (sysmlType == SysmlConstants.DATASTORENODE) type = ProfileConstants.OBJECTTYPE; + else if (sysmlType == SysmlConstants.DECISIONNODE) type = ActivityConstants.DECISION; else if (sysmlType == SysmlConstants.DEEPHISTORY) type = stateMachineConstants.stateNode; - else if (sysmlType == SysmlConstants.DESIGNCONSTRAINT) type = requirementConstants.designConstraint; - else if (sysmlType == SysmlConstants.DESTROYOBJECTACTION) type = activityConstants.destroyObjectAction; - else if (sysmlType == SysmlConstants.DOMAIN) type = blockConstants.block; + else if (sysmlType == SysmlConstants.DESIGNCONSTRAINT) type = RequirementConstants.DESIGNCONSTRAINT; + else if (sysmlType == SysmlConstants.DESTROYOBJECTACTION) type = ActivityConstants.DESTROYOBJECTACTION; + else if (sysmlType == SysmlConstants.DOMAIN) type = BlockConstants.BLOCK; else if (sysmlType == SysmlConstants.ENTRYPOINT) type = stateMachineConstants.entryPoint; - else if (sysmlType == SysmlConstants.ENUMERATION) type = blockConstants.enumeration; - else if (sysmlType == SysmlConstants.EVENT) type = activityConstants.eventType; - else if (sysmlType == SysmlConstants.EXCEPTIONHANDLER) type = profileConstants.exceptionHandler; - else if (sysmlType == SysmlConstants.EXTENDEDREQUIREMENT) type = requirementConstants.extendedRequirement; + else if (sysmlType == SysmlConstants.ENUMERATION) type = BlockConstants.ENUMERATION; + else if (sysmlType == SysmlConstants.EVENT) type = ActivityConstants.EVENTTYPE; + else if (sysmlType == SysmlConstants.EXCEPTIONHANDLER) type = ProfileConstants.EXCEPTIONHANDLER; + else if (sysmlType == SysmlConstants.EXTENDEDREQUIREMENT) type = RequirementConstants.EXTENDEDREQUIREMENT; else if (sysmlType == SysmlConstants.EXITPOINT) type = stateMachineConstants.exitPoint; - else if (sysmlType == SysmlConstants.EXTERNAL) type = blockConstants.external; - else if (sysmlType == SysmlConstants.LIFELINE) type = sequenceConstants.sequence; - else if (sysmlType == SysmlConstants.PACKAGE) type = profileConstants.package; - else if (sysmlType == SysmlConstants.PROPERTY) type = internalBlockConstants.property; - else if (sysmlType == SysmlConstants.PORT) type = blockConstants.port; - else if (sysmlType == SysmlConstants.PROXYPORT) type = blockConstants.proxyPort; - else if (sysmlType == SysmlConstants.FINALSTATE) type = activityConstants.stateNode; - else if (sysmlType == SysmlConstants.FULLPORT) type = blockConstants.fullPort; - else if (sysmlType == SysmlConstants.FLOWFINALNODE) type = activityConstants.stateNode; - else if (sysmlType == SysmlConstants.FLOWPORT) type = blockConstants.flowPort; - else if (sysmlType == SysmlConstants.FUNCTIONALREQUIREMENT) type = requirementConstants.functionalRequirement; - else if (sysmlType == SysmlConstants.HYPERLINK) type = profileConstants.text; - else if (sysmlType == SysmlConstants.INFORMATIONITEM) type = activityConstants.informationItem; - else if (sysmlType == SysmlConstants.INITIALPSEUDOSTATE) type = activityConstants.stateNode; - else if (sysmlType == SysmlConstants.INPUTPIN) type = activityConstants.actionPin; - else if (sysmlType == SysmlConstants.INTERACTION) type = sequenceConstants.interaction; - else if (sysmlType == SysmlConstants.INTERFACE) type = blockConstants.interfaceType; - else if (sysmlType == SysmlConstants.INTERFACEREQUIREMENT) type = requirementConstants.interfaceRequirement; - else if (sysmlType == SysmlConstants.INTERFACEBLOCK) type = blockConstants.interfaceBlock; - else if (sysmlType == SysmlConstants.INSTANCESPECIFICATION) type = profileConstants.objectType; - else if (sysmlType == SysmlConstants.INTERRUPTIBLEACTIVITYREGION) type = activityConstants.interruptibleActivityRegion; - else if (sysmlType == SysmlConstants.MERGENODE) type = activityConstants.mergeNode; + else if (sysmlType == SysmlConstants.EXTERNAL) type = BlockConstants.EXTERNAL; + else if (sysmlType == SysmlConstants.LIFELINE) type = SequenceConstants.SEQUENCE; + else if (sysmlType == SysmlConstants.PACKAGE) type = ProfileConstants.PACKAGE; + else if (sysmlType == SysmlConstants.PROPERTY) type = InternalBlockConstants.PROPERTY; + else if (sysmlType == SysmlConstants.PORT) type = BlockConstants.PORT; + else if (sysmlType == SysmlConstants.PROXYPORT) type = BlockConstants.PROXYPORT; + else if (sysmlType == SysmlConstants.FINALSTATE) type = ActivityConstants.STATENODE; + else if (sysmlType == SysmlConstants.FULLPORT) type = BlockConstants.FULLPORT; + else if (sysmlType == SysmlConstants.FLOWFINALNODE) type = ActivityConstants.STATENODE; + else if (sysmlType == SysmlConstants.FLOWPORT) type = BlockConstants.FLOWPORT; + else if (sysmlType == SysmlConstants.FUNCTIONALREQUIREMENT) type = RequirementConstants.FUNCTIONALREQUIREMENT; + else if (sysmlType == SysmlConstants.HYPERLINK) type = ProfileConstants.TEXT; + else if (sysmlType == SysmlConstants.INFORMATIONITEM) type = ActivityConstants.INFORMATIONITEM; + else if (sysmlType == SysmlConstants.INITIALPSEUDOSTATE) type = ActivityConstants.STATENODE; + else if (sysmlType == SysmlConstants.INPUTPIN) type = ActivityConstants.ACTIONPIN; + else if (sysmlType == SysmlConstants.INTERACTION) type = SequenceConstants.INTERACTION; + else if (sysmlType == SysmlConstants.INTERFACE) type = BlockConstants.INTERFACETYPE; + else if (sysmlType == SysmlConstants.INTERFACEREQUIREMENT) type = RequirementConstants.INTERFACEREQUIREMENT; + else if (sysmlType == SysmlConstants.INTERFACEBLOCK) type = BlockConstants.INTERFACEBLOCK; + else if (sysmlType == SysmlConstants.INSTANCESPECIFICATION) type = ProfileConstants.OBJECTTYPE; + else if (sysmlType == SysmlConstants.INTERRUPTIBLEACTIVITYREGION) type = ActivityConstants.INTERRUPTIBLEACTIVITYREGION; + else if (sysmlType == SysmlConstants.MERGENODE) type = ActivityConstants.MERGENODE; else if (sysmlType == SysmlConstants.METACLASS) type = stereotypeConstants.metaclass; - else if (sysmlType == SysmlConstants.NAVIGATIONCELL) type = profileConstants.text; - else if (sysmlType == SysmlConstants.NOTE) type = profileConstants.note; - else if (sysmlType == SysmlConstants.OBJECT) type = profileConstants.objectType; - else if (sysmlType == SysmlConstants.OBJECTNODE) type = activityConstants.objectNode; - else if (sysmlType == SysmlConstants.OBJECTIVEFUNCTION) type = profileConstants.objectiveFunction; - else if (sysmlType == SysmlConstants.OPERATION) type = blockConstants.operation; - else if (sysmlType == SysmlConstants.OPAQUEACTION) type = activityConstants.action; - else if (sysmlType == SysmlConstants.OUTPUTPIN) type = activityConstants.actionPin; + else if (sysmlType == SysmlConstants.NAVIGATIONCELL) type = ProfileConstants.TEXT; + else if (sysmlType == SysmlConstants.NOTE) type = ProfileConstants.NOTE; + else if (sysmlType == SysmlConstants.OBJECT) type = ProfileConstants.OBJECTTYPE; + else if (sysmlType == SysmlConstants.OBJECTNODE) type = ActivityConstants.OBJECTNODE; + else if (sysmlType == SysmlConstants.OBJECTIVEFUNCTION) type = ProfileConstants.OBJECTIVEFUNCTION; + else if (sysmlType == SysmlConstants.OPERATION) type = BlockConstants.OPERATION; + else if (sysmlType == SysmlConstants.OPAQUEACTION) type = ActivityConstants.ACTION; + else if (sysmlType == SysmlConstants.OUTPUTPIN) type = ActivityConstants.ACTIONPIN; else if (sysmlType == SysmlConstants.JOIN) type = stateMachineConstants.synchronization; - else if (sysmlType == SysmlConstants.JOINNODE) type = activityConstants.synchronization; + else if (sysmlType == SysmlConstants.JOINNODE) type = ActivityConstants.SYNCHRONIZATION; else if (sysmlType == SysmlConstants.FORK) type = stateMachineConstants.synchronization; - else if (sysmlType == SysmlConstants.FLOWPROPERTY) type = internalBlockConstants.flowProperty; - else if (sysmlType == SysmlConstants.FORKNODE) type = activityConstants.synchronization; - else if (sysmlType == SysmlConstants.VALUEPROPERTY) type = blockConstants.dataType; - else if (sysmlType == SysmlConstants.PARTPROPERTY) type = blockConstants.property; - else if (sysmlType == SysmlConstants.REFERENCEPROPERTY) type = internalBlockConstants.referenceProperty; - else if (sysmlType == SysmlConstants.REQUIREMENT) type = requirementConstants.requirement; + else if (sysmlType == SysmlConstants.FLOWPROPERTY) type = InternalBlockConstants.FLOWPROPERTY; + else if (sysmlType == SysmlConstants.FORKNODE) type = ActivityConstants.SYNCHRONIZATION; + else if (sysmlType == SysmlConstants.VALUEPROPERTY) type = BlockConstants.DATATYPE; + else if (sysmlType == SysmlConstants.PARTPROPERTY) type = BlockConstants.PROPERTY; + else if (sysmlType == SysmlConstants.REFERENCEPROPERTY) type = InternalBlockConstants.REFERENCEPROPERTY; + else if (sysmlType == SysmlConstants.REQUIREMENT) type = RequirementConstants.REQUIREMENT; else if (sysmlType == SysmlConstants.REGION) type = stateMachineConstants.region; - else if (sysmlType == SysmlConstants.CONSTRAINTPROPERTY) type = internalBlockConstants.constraintProperty; - else if (sysmlType == SysmlConstants.PARTICIPANTPROPERTY) type = internalBlockConstants.participantProperty; - else if (sysmlType == SysmlConstants.PERFORMANCEREQUIREMENT) type = requirementConstants.performanceRequirement; - else if (sysmlType == SysmlConstants.PHYSICALREQUIREMENT) type = requirementConstants.physicalRequirement; - else if (sysmlType == SysmlConstants.PORT) type = blockConstants.port; - else if (sysmlType == SysmlConstants.SENDSIGNALACTION) type = activityConstants.sendSignalAction; + else if (sysmlType == SysmlConstants.CONSTRAINTPROPERTY) type = InternalBlockConstants.CONSTRAINTPROPERTY; + else if (sysmlType == SysmlConstants.PARTICIPANTPROPERTY) type = InternalBlockConstants.PARTICIPANTPROPERTY; + else if (sysmlType == SysmlConstants.PERFORMANCEREQUIREMENT) type = RequirementConstants.PERFORMANCEREQUIREMENT; + else if (sysmlType == SysmlConstants.PHYSICALREQUIREMENT) type = RequirementConstants.PHYSICALREQUIREMENT; + else if (sysmlType == SysmlConstants.PORT) type = BlockConstants.PORT; + else if (sysmlType == SysmlConstants.SENDSIGNALACTION) type = ActivityConstants.SENDSIGNALACTION; else if (sysmlType == SysmlConstants.SHALLOWHISTORY) type = stateMachineConstants.stateNode; - else if (sysmlType == SysmlConstants.SIGNAL) type = blockConstants.signal; - else if (sysmlType == SysmlConstants.STEREOTYPE) type = profileConstants.classType; + else if (sysmlType == SysmlConstants.SIGNAL) type = BlockConstants.SIGNAL; + else if (sysmlType == SysmlConstants.STEREOTYPE) type = ProfileConstants.CLASSTYPE; else if (sysmlType == SysmlConstants.STATE) type = stateMachineConstants.state; - else if (sysmlType == SysmlConstants.STATEINVARIANT) type = sequenceConstants.interactionState; + else if (sysmlType == SysmlConstants.STATEINVARIANT) type = SequenceConstants.INTERACTIONSTATE; else if (sysmlType == SysmlConstants.STATEMACHINE) type = stateMachineConstants.stateMachine; - else if (sysmlType == SysmlConstants.SUBSYSTEM) type = blockConstants.block; + else if (sysmlType == SysmlConstants.SUBSYSTEM) type = BlockConstants.BLOCK; else if (sysmlType == SysmlConstants.SYNCHRONIZATION) type = stateMachineConstants.synchronization; - else if (sysmlType == SysmlConstants.SYSTEM) type = blockConstants.block; - else if (sysmlType == SysmlConstants.SYSTEMCONTEXT) type = blockConstants.block; + else if (sysmlType == SysmlConstants.SYSTEM) type = BlockConstants.BLOCK; + else if (sysmlType == SysmlConstants.SYSTEMCONTEXT) type = BlockConstants.BLOCK; else if (sysmlType == SysmlConstants.TERMINATE) type = stateMachineConstants.stateNode; - else if (sysmlType == SysmlConstants.TEXT) type = profileConstants.text; + else if (sysmlType == SysmlConstants.TEXT) type = ProfileConstants.TEXT; else if (sysmlType == SysmlConstants.TRIGGER) type = stateMachineConstants.trigger; - else if (sysmlType == SysmlConstants.UNIT) type = blockConstants.unit; + else if (sysmlType == SysmlConstants.UNIT) type = BlockConstants.UNIT; else if (sysmlType == SysmlConstants.USECASE) type = useCaseConstants.useCase; - else if (sysmlType == SysmlConstants.QUANTITYKIND) type = blockConstants.quantityKind; - else if (sysmlType == SysmlConstants.VALUETYPE) type = blockConstants.valueType; - else if (sysmlType == SysmlConstants.FLOWSPECIFICATION) type = blockConstants.interfaceType; + else if (sysmlType == SysmlConstants.QUANTITYKIND) type = BlockConstants.QUANTITYKIND; + else if (sysmlType == SysmlConstants.VALUETYPE) type = BlockConstants.VALUETYPE; + else if (sysmlType == SysmlConstants.FLOWSPECIFICATION) type = BlockConstants.INTERFACETYPE; return type; } private string GetSysMLType(string type, string stereotype, int subtype, string metatype) { StereotypeConstants stereotypeConstants = new StereotypeConstants(); - MetatypeConstants metatypeConstants = new MetatypeConstants(); + string elementType = ""; if (stereotype == stereotypeConstants.block) elementType = SysmlConstants.SYSMLBLOCK; @@ -2046,10 +2033,10 @@ private string GetSysMLType(string type, string stereotype, int subtype, string type == SysmlConstants.ACTIONPIN || type == SysmlConstants.EVENT) { if (stereotype == stereotypeConstants.allocated) elementType = SysmlConstants.SYSMLALLOCATED; - else if (type == SysmlConstants.ACTION && metatype == metatypeConstants.acceptEventAction) elementType = SysmlConstants.SYSMLACCEPTEVENTACTION; - else if (type == SysmlConstants.ACTION && metatype == metatypeConstants.callBehaviorAction) elementType = SysmlConstants.SYSMLCALLBEHAVIORACTION; - else if (type == SysmlConstants.ACTION && metatype == metatypeConstants.opaqueAction) elementType = SysmlConstants.SYSMLOPAQUEACTION; - else if (type == SysmlConstants.ACTION && metatype == metatypeConstants.sendSignalAction) elementType = SysmlConstants.SYSMLSENDSIGNALACTION; + else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.acceptEventAction) elementType = SysmlConstants.SYSMLACCEPTEVENTACTION; + else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.callBehaviorAction) elementType = SysmlConstants.SYSMLCALLBEHAVIORACTION; + else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.opaqueAction) elementType = SysmlConstants.SYSMLOPAQUEACTION; + else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.sendSignalAction) elementType = SysmlConstants.SYSMLSENDSIGNALACTION; else if (type == SysmlConstants.ACTION) elementType = SysmlConstants.SYSMLACTION; else if (type == SysmlConstants.ACTIVITYPARAMETER) elementType = SysmlConstants.SYSMLACTIVITYPARAMETER; else if (type == SysmlConstants.ACTIONPIN && stereotype == stereotypeConstants.output) elementType = SysmlConstants.SYSMLOUTPUTPIN; From 8bc96d347207a4754b8eab8c721c2413d9a65b94 Mon Sep 17 00:00:00 2001 From: Daniel Siegl Date: Mon, 6 Feb 2023 12:35:27 +0100 Subject: [PATCH 3/3] Refactoring Constants --- MTIP/Constants/StateMachineConstants.cs | 38 ++---- MTIP/Constants/StereotypeConstants.cs | 138 +++++++--------------- MTIP/Constants/SysmlConstants.cs | 8 +- MTIP/Constants/UseCaseConstants.cs | 19 +-- MTIP/Translations/MTIPExportFunctions.cs | 98 +++++++--------- MTIP/Translations/MTIPImportFunctions.cs | 143 +++++++++++------------ 6 files changed, 172 insertions(+), 272 deletions(-) diff --git a/MTIP/Constants/StateMachineConstants.cs b/MTIP/Constants/StateMachineConstants.cs index b1e96d0..d3d41bd 100644 --- a/MTIP/Constants/StateMachineConstants.cs +++ b/MTIP/Constants/StateMachineConstants.cs @@ -7,36 +7,18 @@ * */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace MTIP.Constants { - public class StateMachineConstants + public static class StateMachineConstants { - public string deepHistory; - public string entryPoint; - public string exitPoint; - public string region; - public string shallowHistory; - public string state; - public string stateMachine; - public string stateNode; - public string synchronization; - public string trigger; - public StateMachineConstants() - { - entryPoint = "EntryPoint"; - exitPoint = "ExitPoint"; - region = "Region"; - state = "State"; - stateMachine = "StateMachine"; - stateNode = "StateNode"; - synchronization = "Synchronization"; - trigger = "Trigger"; - } + public const string ENTRYPOINT = "EntryPoint"; + public const string EXITPOINT = "ExitPoint"; + public const string REGION = "Region"; + public const string STATE = "State"; + public const string STATEMACHINE = "StateMachine"; + public const string STATENODE = "StateNode"; + public const string SYNCHRONIZATION = "Synchronization"; + public const string TRIGGER = "Trigger"; } + } diff --git a/MTIP/Constants/StereotypeConstants.cs b/MTIP/Constants/StereotypeConstants.cs index d35c7c8..dd77a27 100644 --- a/MTIP/Constants/StereotypeConstants.cs +++ b/MTIP/Constants/StereotypeConstants.cs @@ -8,103 +8,51 @@ * */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace MTIP.Constants { - public class StereotypeConstants + public static class StereotypeConstants { - // Block Stereotypes - public string adjunctProperty; - public string allocated; - public string block; - public string boundReference; - public string businessRequirement; - public string classification; - public string classifierBehaviorProperty; - public string constraintBlock; - public string constraintBlockCap; - public string constraintParameter; - public string constraintProperty; - public string datastore; - public string decision; - public string domain; - public string external; - public string flowPort; - public string flowProperty; - public string flowSpecification; - public string fork; - public string fullPort; - public string hardware; - public string input; - public string interfaceBlock; - public string join; - public string metaclass; - public string model; - public string navigationCell; - public string objectiveFunction; - public string objectStereotype; - public string output; - public string participantProperty; - public string partProperty; - public string profile; - public string property; - public string proxyPort; - public string stereotype; - public string subsystem; - public string system; - public string systemContext; - public string valueProperty; - public string valueType; - public StereotypeConstants() - { - //Block Stereotypes - constraintBlock = "constraintBlock"; - constraintBlockCap = "ConstraintBlock"; - input = "input"; - output = "output"; - navigationCell = "NavigationCell"; - stereotype = "stereotype"; - metaclass = "metaclass"; - valueType = "ValueType"; - property = "property"; - datastore = "datastore"; - block = "block"; - hardware = "hardware"; - boundReference = "BoundReference"; - valueProperty = "ValueProperty"; - participantProperty = "participantProperty"; - decision = "Decision"; - domain = "Domain"; - objectStereotype = "Object"; - constraintProperty = "constraintProperty"; - flowProperty = "FlowProperty"; - constraintParameter = "ConstraintParameter"; - classifierBehaviorProperty = "ClassifierBehaviorProperty"; - objectiveFunction = "objectiveFunction"; - interfaceBlock = "InterfaceBlock"; - system = "System"; - subsystem = "Subsystem"; - systemContext = "System context"; - businessRequirement = "BusinessRequirement"; - fork = "Fork"; - flowPort = "FlowPort"; - fullPort = "FullPort"; - proxyPort = "ProxyPort"; - flowSpecification = "flowSpecification"; - partProperty = "PartProperty"; - property = "property"; - classification = "Classification"; - allocated = "allocated"; - join = "Join"; - external = "External"; - model = "model"; - profile = "profile"; - adjunctProperty = "AdjunctProperty"; - } + //Block Stereotypes + public const string CONSTRAINTBLOCK = "constraintBlock"; + public const string CONSTRAINTBLOCKCAP = "ConstraintBlock"; + public const string INPUT = "input"; + public const string OUTPUT = "output"; + public const string NAVIGATIONCELL = "NavigationCell"; + public const string STEREOTYPE = "stereotype"; + public const string METACLASS = "metaclass"; + public const string VALUETYPE = "ValueType"; + public const string PROPERTY = "property"; + public const string DATASTORE = "datastore"; + public const string BLOCK = "block"; + public const string HARDWARE = "hardware"; + public const string BOUNDREFERENCE = "BoundReference"; + public const string VALUEPROPERTY = "ValueProperty"; + public const string PARTICIPANTPROPERTY = "participantProperty"; + public const string DECISION = "Decision"; + public const string DOMAIN = "Domain"; + public const string OBJECTSTEREOTYPE = "Object"; + public const string CONSTRAINTPROPERTY = "constraintProperty"; + public const string FLOWPROPERTY = "FlowProperty"; + public const string CONSTRAINTPARAMETER = "ConstraintParameter"; + public const string CLASSIFIERBEHAVIORPROPERTY = "ClassifierBehaviorProperty"; + public const string OBJECTIVEFUNCTION = "objectiveFunction"; + public const string INTERFACEBLOCK = "InterfaceBlock"; + public const string SYSTEM = "System"; + public const string SUBSYSTEM = "Subsystem"; + public const string SYSTEMCONTEXT = "System context"; + public const string BUSINESSREQUIREMENT = "BusinessRequirement"; + public const string FORK = "Fork"; + public const string FLOWPORT = "FlowPort"; + public const string FULLPORT = "FullPort"; + public const string PROXYPORT = "ProxyPort"; + public const string FLOWSPECIFICATION = "flowSpecification"; + public const string PARTPROPERTY = "PartProperty"; + public const string CLASSIFICATION = "Classification"; + public const string ALLOCATED = "allocated"; + public const string JOIN = "Join"; + public const string EXTERNAL = "External"; + public const string MODEL = "model"; + public const string PROFILE = "profile"; + public const string ADJUNCTPROPERTY = "AdjunctProperty"; } } diff --git a/MTIP/Constants/SysmlConstants.cs b/MTIP/Constants/SysmlConstants.cs index 60c7f1e..4fa8d9f 100644 --- a/MTIP/Constants/SysmlConstants.cs +++ b/MTIP/Constants/SysmlConstants.cs @@ -8,15 +8,9 @@ * */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace MTIP.Constants { - public class SysmlConstants + public static class SysmlConstants { //Categorization constants public static string DIAGRAM = "Diagram"; diff --git a/MTIP/Constants/UseCaseConstants.cs b/MTIP/Constants/UseCaseConstants.cs index e553668..8030ff4 100644 --- a/MTIP/Constants/UseCaseConstants.cs +++ b/MTIP/Constants/UseCaseConstants.cs @@ -7,22 +7,13 @@ * */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace MTIP.Constants { - public class UseCaseConstants + + public static class UseCaseConstants { - public string actor; - public string useCase; - public UseCaseConstants() - { - actor = "Actor"; - useCase = "UseCase"; - } + public const string ACTOR = "Actor"; + public const string USECASE = "UseCase"; } } + diff --git a/MTIP/Translations/MTIPExportFunctions.cs b/MTIP/Translations/MTIPExportFunctions.cs index f2dc5bf..ad85f80 100644 --- a/MTIP/Translations/MTIPExportFunctions.cs +++ b/MTIP/Translations/MTIPExportFunctions.cs @@ -28,9 +28,6 @@ public class MTIPExportFunctions private string outputDirectory; public Dictionary profilePackages; public List exportLog; - - public StereotypeConstants stereotypeConstants; - public Dictionary customProfiles; public MTIPExportFunctions(MTIP plugin) @@ -38,9 +35,6 @@ public MTIPExportFunctions(MTIP plugin) repository = plugin.GetRepository(); profilePackages = new Dictionary(); exportLog = new List(); - - stereotypeConstants = new StereotypeConstants(); - customProfiles = new Dictionary(); } public void ExportToMTIPXML() @@ -969,11 +963,11 @@ public string GetPackageType(EA.Package package) { packageType = SysmlConstants.SYSMLMODEL; } - else if (package.Element.Stereotype == stereotypeConstants.model) + else if (package.Element.Stereotype == StereotypeConstants.MODEL) { packageType = SysmlConstants.SYSMLMODEL; } - else if (package.Element.Stereotype == stereotypeConstants.profile) + else if (package.Element.Stereotype == StereotypeConstants.PROFILE) { packageType = SysmlConstants.SYSMLPROFILE; if (!profilePackages.ContainsKey(package.Name)) profilePackages.Add(package.Name, package); @@ -1089,32 +1083,30 @@ public void CreateOpaqueNode(XmlDocument xmlDocument, string opaqueGuid, string } private string GetSysMLType(string type, string stereotype, int subtype, string metatype) { - StereotypeConstants stereotypeConstants = new StereotypeConstants(); - string elementType = ""; - if (stereotype == stereotypeConstants.block) elementType = SysmlConstants.SYSMLBLOCK; - else if (stereotype == stereotypeConstants.hardware) elementType = SysmlConstants.SYSMLBLOCK; - else if (stereotype == stereotypeConstants.boundReference) elementType = SysmlConstants.SYSMLBOUNDREFERENCE; - else if (stereotype == stereotypeConstants.valueProperty) elementType = SysmlConstants.SYSMLVALUEPROPERTY; - else if (stereotype == stereotypeConstants.participantProperty) elementType = SysmlConstants.SYSMLPARTICIPANTPROPERTY; - else if (stereotype == stereotypeConstants.decision) elementType = SysmlConstants.SYSMLDECISIONNODE; - else if (stereotype == stereotypeConstants.domain) elementType = SysmlConstants.SYSMLBLOCK; - else if (stereotype == stereotypeConstants.objectStereotype) elementType = SysmlConstants.SYSMLOBJECT; - else if (stereotype == stereotypeConstants.constraintProperty) elementType = SysmlConstants.SYSMLCONSTRAINTPROPERTY; - else if (stereotype == stereotypeConstants.valueType) elementType = SysmlConstants.SYSMLVALUEPROPERTY; - else if (stereotype == stereotypeConstants.flowProperty) elementType = SysmlConstants.SYSMLFLOWPROPERTY; - else if (stereotype == stereotypeConstants.constraintParameter) elementType = SysmlConstants.SYSMLCONSTRAINTPARAMETER; - else if (stereotype == stereotypeConstants.constraintBlock || stereotype == stereotypeConstants.constraintBlockCap) elementType = SysmlConstants.SYSMLCONSTRAINTBLOCK; - else if (stereotype == stereotypeConstants.classifierBehaviorProperty) elementType = SysmlConstants.SYSMLCLASSIFIERBEHAVIORPROPERTY; - else if (stereotype == stereotypeConstants.stereotype) elementType = SysmlConstants.SYSMLSTEREOTYPE; - else if (stereotype == stereotypeConstants.objectiveFunction) elementType = SysmlConstants.SYSMLOBJECTIVEFUNCTION; - else if (stereotype == stereotypeConstants.metaclass && type == SysmlConstants.CLASS) elementType = SysmlConstants.SYSMLMETACLASS; + if (stereotype == StereotypeConstants.BLOCK) elementType = SysmlConstants.SYSMLBLOCK; + else if (stereotype == StereotypeConstants.HARDWARE) elementType = SysmlConstants.SYSMLBLOCK; + else if (stereotype == StereotypeConstants.BOUNDREFERENCE) elementType = SysmlConstants.SYSMLBOUNDREFERENCE; + else if (stereotype == StereotypeConstants.VALUEPROPERTY) elementType = SysmlConstants.SYSMLVALUEPROPERTY; + else if (stereotype == StereotypeConstants.PARTICIPANTPROPERTY) elementType = SysmlConstants.SYSMLPARTICIPANTPROPERTY; + else if (stereotype == StereotypeConstants.DECISION) elementType = SysmlConstants.SYSMLDECISIONNODE; + else if (stereotype == StereotypeConstants.DOMAIN) elementType = SysmlConstants.SYSMLBLOCK; + else if (stereotype == StereotypeConstants.OBJECTSTEREOTYPE) elementType = SysmlConstants.SYSMLOBJECT; + else if (stereotype == StereotypeConstants.CONSTRAINTPROPERTY) elementType = SysmlConstants.SYSMLCONSTRAINTPROPERTY; + else if (stereotype == StereotypeConstants.VALUETYPE) elementType = SysmlConstants.SYSMLVALUEPROPERTY; + else if (stereotype == StereotypeConstants.FLOWPROPERTY) elementType = SysmlConstants.SYSMLFLOWPROPERTY; + else if (stereotype == StereotypeConstants.CONSTRAINTPARAMETER) elementType = SysmlConstants.SYSMLCONSTRAINTPARAMETER; + else if (stereotype == StereotypeConstants.CONSTRAINTBLOCK || stereotype == StereotypeConstants.CONSTRAINTBLOCKCAP) elementType = SysmlConstants.SYSMLCONSTRAINTBLOCK; + else if (stereotype == StereotypeConstants.CLASSIFIERBEHAVIORPROPERTY) elementType = SysmlConstants.SYSMLCLASSIFIERBEHAVIORPROPERTY; + else if (stereotype == StereotypeConstants.STEREOTYPE) elementType = SysmlConstants.SYSMLSTEREOTYPE; + else if (stereotype == StereotypeConstants.OBJECTIVEFUNCTION) elementType = SysmlConstants.SYSMLOBJECTIVEFUNCTION; + else if (stereotype == StereotypeConstants.METACLASS && type == SysmlConstants.CLASS) elementType = SysmlConstants.SYSMLMETACLASS; else if (stereotype == "" && type == SysmlConstants.CLASS) elementType = SysmlConstants.SYSMLCLASS; - else if (stereotype != "" && stereotype != stereotypeConstants.metaclass && stereotype != stereotypeConstants.stereotype && stereotype != stereotypeConstants.interfaceBlock - && stereotype != stereotypeConstants.domain && stereotype != stereotypeConstants.external && stereotype != stereotypeConstants.system && stereotype != stereotypeConstants.subsystem - && stereotype != stereotypeConstants.systemContext && type == SysmlConstants.CLASS) elementType = SysmlConstants.SYSMLCLASS; - else if (stereotype == stereotypeConstants.valueType && type != SysmlConstants.ENUMERATION) elementType = SysmlConstants.SYSMLVALUEPROPERTY; - else if (stereotype == stereotypeConstants.valueType && type == SysmlConstants.ENUMERATION) elementType = SysmlConstants.SYSMLENUMERATION; + else if (stereotype != "" && stereotype != StereotypeConstants.METACLASS && stereotype != StereotypeConstants.STEREOTYPE && stereotype != StereotypeConstants.INTERFACEBLOCK + && stereotype != StereotypeConstants.DOMAIN && stereotype != StereotypeConstants.EXTERNAL && stereotype != StereotypeConstants.SYSTEM && stereotype != StereotypeConstants.SUBSYSTEM + && stereotype != StereotypeConstants.SYSTEMCONTEXT && type == SysmlConstants.CLASS) elementType = SysmlConstants.SYSMLCLASS; + else if (stereotype == StereotypeConstants.VALUETYPE && type != SysmlConstants.ENUMERATION) elementType = SysmlConstants.SYSMLVALUEPROPERTY; + else if (stereotype == StereotypeConstants.VALUETYPE && type == SysmlConstants.ENUMERATION) elementType = SysmlConstants.SYSMLENUMERATION; else if (type == SysmlConstants.ACTIVITY) elementType = SysmlConstants.SYSMLACTIVITY; else if (type == SysmlConstants.ACTIVITYPARAMETER) elementType = SysmlConstants.SYSMLACTIVITYPARAMETERNODE; else if (type == SysmlConstants.ACTIVITYPARTITION) elementType = SysmlConstants.SYSMLACTIVITYPARTITION; @@ -1132,7 +1124,7 @@ private string GetSysMLType(string type, string stereotype, int subtype, string else if (type == SysmlConstants.EXITPOINT) elementType = SysmlConstants.SYSMLEXITPOINT; else if (type == SysmlConstants.SEQUENCE) elementType = SysmlConstants.SYSMLLIFELINE; else if (type == SysmlConstants.REGION) elementType = SysmlConstants.SYSMLREGION; - else if (type == SysmlConstants.REQUIREMENT && stereotype == stereotypeConstants.businessRequirement) elementType = SysmlConstants.SYSMLREQUIREMENT; + else if (type == SysmlConstants.REQUIREMENT && stereotype == StereotypeConstants.BUSINESSREQUIREMENT) elementType = SysmlConstants.SYSMLREQUIREMENT; else if (type == SysmlConstants.REQUIREMENT) elementType = SysmlConstants.SYSMLREQUIREMENT; else if (type == SysmlConstants.EXTENDEDREQUIREMENT) elementType = SysmlConstants.SYSMLEXTENDEDREQUIREMENT; else if (type == SysmlConstants.FUNCTIONALREQUIREMENT) elementType = SysmlConstants.SYSMLFUNCTIONALREQUIREMENT; @@ -1148,24 +1140,24 @@ private string GetSysMLType(string type, string stereotype, int subtype, string else if (type == SysmlConstants.OBJECT) elementType = SysmlConstants.SYSMLOBJECT; else if (type == SysmlConstants.OBJECTNODE) elementType = SysmlConstants.SYSMLOBJECTNODE; else if (type == SysmlConstants.USECASE) elementType = SysmlConstants.SYSMLUSECASE; - else if (type == SysmlConstants.OBJECT && stereotype == stereotypeConstants.datastore) elementType = SysmlConstants.SYSMLDATASTORENODE; - else if (type == SysmlConstants.SYNCHRONIZATION && stereotype == stereotypeConstants.fork) elementType = SysmlConstants.SYSMLFORKNODE; + else if (type == SysmlConstants.OBJECT && stereotype == StereotypeConstants.DATASTORE) elementType = SysmlConstants.SYSMLDATASTORENODE; + else if (type == SysmlConstants.SYNCHRONIZATION && stereotype == StereotypeConstants.FORK) elementType = SysmlConstants.SYSMLFORKNODE; else if (type == SysmlConstants.PORT) { - if (stereotype == stereotypeConstants.flowPort) elementType = SysmlConstants.SYSMLFLOWPORT; - else if (stereotype == stereotypeConstants.fullPort) elementType = SysmlConstants.SYSMLFULLPORT; - else if (stereotype == stereotypeConstants.proxyPort) elementType = SysmlConstants.SYSMLPROXYPORT; + if (stereotype == StereotypeConstants.FLOWPORT) elementType = SysmlConstants.SYSMLFLOWPORT; + else if (stereotype == StereotypeConstants.FULLPORT) elementType = SysmlConstants.SYSMLFULLPORT; + else if (stereotype == StereotypeConstants.PROXYPORT) elementType = SysmlConstants.SYSMLPROXYPORT; else { elementType = SysmlConstants.SYSMLPORT; } } - else if (stereotype == stereotypeConstants.interfaceBlock) elementType = SysmlConstants.SYSMLINTERFACEBLOCK; - else if (type == SysmlConstants.INTERFACE && stereotype != stereotypeConstants.flowSpecification) elementType = SysmlConstants.SYSMLINTERFACE; + else if (stereotype == StereotypeConstants.INTERFACEBLOCK) elementType = SysmlConstants.SYSMLINTERFACEBLOCK; + else if (type == SysmlConstants.INTERFACE && stereotype != StereotypeConstants.FLOWSPECIFICATION) elementType = SysmlConstants.SYSMLINTERFACE; else if (type == SysmlConstants.ACTIVITYPARAMETER) elementType = SysmlConstants.SYSMLACTIVITYPARAMETER; else if (type == SysmlConstants.ARTIFACT) elementType = SysmlConstants.SYSMLARTIFACT; else if (type == SysmlConstants.TRIGGER) elementType = SysmlConstants.SYSMLTRIGGER; - else if (type == SysmlConstants.TEXT && stereotype == stereotypeConstants.navigationCell) elementType = SysmlConstants.EANAVIGATIONCELL; + else if (type == SysmlConstants.TEXT && stereotype == StereotypeConstants.NAVIGATIONCELL) elementType = SysmlConstants.EANAVIGATIONCELL; else if (type == SysmlConstants.TEXT) elementType = SysmlConstants.SYSMLTEXT; else if (type == SysmlConstants.NOTE) elementType = SysmlConstants.SYSMLNOTE; else if (type == SysmlConstants.STATENODE) @@ -1189,19 +1181,19 @@ private string GetSysMLType(string type, string stereotype, int subtype, string else if (type == SysmlConstants.PART) { if (stereotype == "") elementType = SysmlConstants.SYSMLPARTPROPERTY; - else if (stereotype == stereotypeConstants.partProperty) elementType = SysmlConstants.SYSMLPARTPROPERTY; - else if (stereotype == stereotypeConstants.property) elementType = SysmlConstants.SYSMLPARTPROPERTY; - else if (stereotype == stereotypeConstants.constraintProperty) elementType = SysmlConstants.SYSMLCONSTRAINTPROPERTY; - else if (stereotype == stereotypeConstants.classification) elementType = SysmlConstants.SYSMLCLASSIFICATION; + else if (stereotype == StereotypeConstants.PARTPROPERTY) elementType = SysmlConstants.SYSMLPARTPROPERTY; + else if (stereotype == StereotypeConstants.PROPERTY) elementType = SysmlConstants.SYSMLPARTPROPERTY; + else if (stereotype == StereotypeConstants.CONSTRAINTPROPERTY) elementType = SysmlConstants.SYSMLCONSTRAINTPROPERTY; + else if (stereotype == StereotypeConstants.CLASSIFICATION) elementType = SysmlConstants.SYSMLCLASSIFICATION; } else if (type == SysmlConstants.REQUIREDINTERFACE) elementType = SysmlConstants.SYSMLREQUIREDINTERFACE; else if (type == SysmlConstants.NOTE) elementType = SysmlConstants.SYSMLNOTE; else if (type == SysmlConstants.PACKAGE) elementType = SysmlConstants.SYSMLPACKAGE; - else if (stereotype == stereotypeConstants.allocated || type == SysmlConstants.ACTION || type == SysmlConstants.ACTIVITYPARAMETER || + else if (stereotype == StereotypeConstants.ALLOCATED || type == SysmlConstants.ACTION || type == SysmlConstants.ACTIVITYPARAMETER || type == SysmlConstants.ACTIONPIN || type == SysmlConstants.EVENT) { - if (stereotype == stereotypeConstants.allocated) elementType = SysmlConstants.SYSMLALLOCATED; + if (stereotype == StereotypeConstants.ALLOCATED) elementType = SysmlConstants.SYSMLALLOCATED; else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.acceptEventAction) elementType = SysmlConstants.SYSMLACCEPTEVENTACTION; else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.callBehaviorAction) elementType = SysmlConstants.SYSMLCALLBEHAVIORACTION; else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.createObjectAction) elementType = SysmlConstants.SYSMLCREATEOBJECTACTION; @@ -1211,8 +1203,8 @@ private string GetSysMLType(string type, string stereotype, int subtype, string else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.sendSignalAction) elementType = SysmlConstants.SYSMLSENDSIGNALACTION; else if (type == SysmlConstants.ACTION) elementType = SysmlConstants.SYSMLACTION; else if (type == SysmlConstants.ACTIVITYPARAMETER) elementType = SysmlConstants.SYSMLACTIVITYPARAMETER; - else if (type == SysmlConstants.ACTIONPIN && (stereotype == stereotypeConstants.output || metatype == MetatypeConstants.outputPin)) elementType = SysmlConstants.SYSMLOUTPUTPIN; - else if (type == SysmlConstants.ACTIONPIN && (stereotype == stereotypeConstants.input || metatype == MetatypeConstants.inputPin)) elementType = SysmlConstants.SYSMLINPUTPIN; + else if (type == SysmlConstants.ACTIONPIN && (stereotype == StereotypeConstants.OUTPUT || metatype == MetatypeConstants.outputPin)) elementType = SysmlConstants.SYSMLOUTPUTPIN; + else if (type == SysmlConstants.ACTIONPIN && (stereotype == StereotypeConstants.INPUT || metatype == MetatypeConstants.inputPin)) elementType = SysmlConstants.SYSMLINPUTPIN; else if (type == SysmlConstants.ACTIONPIN) elementType = SysmlConstants.SYSMLACTIONPIN; else if (type == SysmlConstants.EVENT) { @@ -1224,13 +1216,13 @@ private string GetSysMLType(string type, string stereotype, int subtype, string else if (type == SysmlConstants.MERGENODE) elementType = SysmlConstants.SYSMLMERGENODE; else if (type == SysmlConstants.SYNCHRONIZATION) { - if (stereotype == stereotypeConstants.join) elementType = SysmlConstants.SYSMLJOIN; - else if (stereotype == stereotypeConstants.fork) elementType = SysmlConstants.SYSMLFORK; + if (stereotype == StereotypeConstants.JOIN) elementType = SysmlConstants.SYSMLJOIN; + else if (stereotype == StereotypeConstants.FORK) elementType = SysmlConstants.SYSMLFORK; else elementType = SysmlConstants.SYSMLSYNCHRONIZATION; } else if (type == SysmlConstants.INTERRUPTIBLEACTIVITYREGION) elementType = SysmlConstants.SYSMLINTERRUPTIBLEACTIVITYREGION; - else if (stereotype == stereotypeConstants.flowSpecification) elementType = SysmlConstants.SYSMLFLOWSPECIFICATION; - else if (stereotype == stereotypeConstants.external || stereotype == stereotypeConstants.subsystem || stereotype == stereotypeConstants.system || stereotype == stereotypeConstants.systemContext) elementType = SysmlConstants.SYSMLBLOCK; + else if (stereotype == StereotypeConstants.FLOWSPECIFICATION) elementType = SysmlConstants.SYSMLFLOWSPECIFICATION; + else if (stereotype == StereotypeConstants.EXTERNAL || stereotype == StereotypeConstants.SUBSYSTEM || stereotype == StereotypeConstants.SYSTEM || stereotype == StereotypeConstants.SYSTEMCONTEXT) elementType = SysmlConstants.SYSMLBLOCK; return elementType; } public string GetDiagramSysMLType(EA.Diagram diagram) diff --git a/MTIP/Translations/MTIPImportFunctions.cs b/MTIP/Translations/MTIPImportFunctions.cs index 7c95789..ab57cca 100644 --- a/MTIP/Translations/MTIPImportFunctions.cs +++ b/MTIP/Translations/MTIPImportFunctions.cs @@ -749,7 +749,6 @@ internal void AddElementElement(string parentId, string childId) } internal void GetElement(EA.Element childElement, XmlItem childItem, string childId, string parentType) { - StereotypeConstants stereotypeConstants = new StereotypeConstants(); if (childElement.Type == SysmlConstants.STATENODE) { if (childItem.GetElementType() == SysmlConstants.INITIALPSEUDOSTATE) childElement.Subtype = 3; @@ -783,22 +782,22 @@ internal void GetElement(EA.Element childElement, XmlItem childItem, string chil } if (childElement.Type == SysmlConstants.ACTIONPIN) { - if (childItem.GetElementType() == SysmlConstants.INPUTPIN) childElement.Stereotype = stereotypeConstants.input; - if (childItem.GetElementType() == SysmlConstants.OUTPUTPIN) childElement.Stereotype = stereotypeConstants.output; + if (childItem.GetElementType() == SysmlConstants.INPUTPIN) childElement.Stereotype = StereotypeConstants.INPUT; + if (childItem.GetElementType() == SysmlConstants.OUTPUTPIN) childElement.Stereotype = StereotypeConstants.OUTPUT; } - if (childItem.GetElementType() == SysmlConstants.NAVIGATIONCELL) childElement.Stereotype = stereotypeConstants.navigationCell; - if (childItem.GetElementType() == SysmlConstants.STEREOTYPE) childElement.Stereotype = stereotypeConstants.stereotype; - if (childItem.GetElementType() == SysmlConstants.METACLASS) childElement.Stereotype = stereotypeConstants.metaclass; - if (childItem.GetElementType() == SysmlConstants.VALUEPROPERTY) childElement.Stereotype = stereotypeConstants.valueType; + if (childItem.GetElementType() == SysmlConstants.NAVIGATIONCELL) childElement.Stereotype = StereotypeConstants.NAVIGATIONCELL; + if (childItem.GetElementType() == SysmlConstants.STEREOTYPE) childElement.Stereotype = StereotypeConstants.STEREOTYPE; + if (childItem.GetElementType() == SysmlConstants.METACLASS) childElement.Stereotype = StereotypeConstants.METACLASS; + if (childItem.GetElementType() == SysmlConstants.VALUEPROPERTY) childElement.Stereotype = StereotypeConstants.VALUETYPE; if (childItem.GetElementType() == SysmlConstants.PARTPROPERTY) { - childElement.Stereotype = stereotypeConstants.property; + childElement.Stereotype = StereotypeConstants.PROPERTY; } if (childElement.Type == SysmlConstants.OBJECT) { - if (childItem.GetElementType() == SysmlConstants.DATASTORENODE) childElement.Stereotype = stereotypeConstants.datastore; + if (childItem.GetElementType() == SysmlConstants.DATASTORENODE) childElement.Stereotype = StereotypeConstants.DATASTORE; } if (childElement.Type == SysmlConstants.STATE && childItem.GetAttributes().ContainsKey(AttributeConstants.SUBMACHINE)) @@ -849,7 +848,7 @@ internal void GetElement(EA.Element childElement, XmlItem childItem, string chil } if (childItem.GetAttributes().ContainsKey(AttributeConstants.STEREOTYPE)) { - if (childItem.GetElementType() == SysmlConstants.STEREOTYPE) childElement.Stereotype = stereotypeConstants.stereotype; + if (childItem.GetElementType() == SysmlConstants.STEREOTYPE) childElement.Stereotype = StereotypeConstants.STEREOTYPE; else { childElement.Stereotype = childItem.GetAttribute(AttributeConstants.STEREOTYPE); @@ -1804,9 +1803,6 @@ public bool IsPortType(string type) } internal string GetEAType(string sysmlType, string stereotype) { - StereotypeConstants stereotypeConstants = new StereotypeConstants(); - UseCaseConstants useCaseConstants = new UseCaseConstants(); - StateMachineConstants stateMachineConstants = new StateMachineConstants(); string type = ""; if (sysmlType == SysmlConstants.ACTIVITY) type = ActivityConstants.ACTIVITY; else if (sysmlType == SysmlConstants.ACTIVITYFINALNODE) type = ActivityConstants.STATENODE; @@ -1814,14 +1810,14 @@ internal string GetEAType(string sysmlType, string stereotype) else if (sysmlType == SysmlConstants.ACTIVITYPARTITION) type = ActivityConstants.ACTIVITYPARTION; else if (sysmlType == SysmlConstants.BLOCK) { - if (stereotype == stereotypeConstants.constraintBlockCap || stereotype == stereotypeConstants.constraintBlock) type = BlockConstants.CONSTRAINTBLOCK; + if (stereotype == StereotypeConstants.CONSTRAINTBLOCKCAP || stereotype == StereotypeConstants.CONSTRAINTBLOCK) type = BlockConstants.CONSTRAINTBLOCK; else type = BlockConstants.BLOCK; } else if (sysmlType == SysmlConstants.ACCEPTEVENTACTION) type = ActivityConstants.ACCEPTEVENTACTION; else if (sysmlType == SysmlConstants.ACTION) type = ActivityConstants.ACTION; else if (sysmlType == SysmlConstants.ACTIONPIN) type = ActivityConstants.ACTIONPIN; else if (sysmlType == SysmlConstants.ACTIVITYINITIALNODE) type = ActivityConstants.STATENODE; - else if (sysmlType == SysmlConstants.ACTOR) type = useCaseConstants.actor; + else if (sysmlType == SysmlConstants.ACTOR) type = UseCaseConstants.ACTOR; else if (sysmlType == SysmlConstants.ASSOCIATIONBLOCK) type = BlockConstants.ASSOCIATION; else if (sysmlType == SysmlConstants.BOUNDREFERENCE) type = InternalBlockConstants.BOUNDREFERENCE; else if (sysmlType == SysmlConstants.BOUNDARY) type = InternalBlockConstants.BOUNDARY; @@ -1844,16 +1840,16 @@ internal string GetEAType(string sysmlType, string stereotype) else if (sysmlType == SysmlConstants.CREATEOBJECTACTION) type = ActivityConstants.CREATEOBJECTACTION; else if (sysmlType == SysmlConstants.DATASTORENODE) type = ProfileConstants.OBJECTTYPE; else if (sysmlType == SysmlConstants.DECISIONNODE) type = ActivityConstants.DECISION; - else if (sysmlType == SysmlConstants.DEEPHISTORY) type = stateMachineConstants.stateNode; + else if (sysmlType == SysmlConstants.DEEPHISTORY) type = StateMachineConstants.STATENODE; else if (sysmlType == SysmlConstants.DESIGNCONSTRAINT) type = RequirementConstants.DESIGNCONSTRAINT; else if (sysmlType == SysmlConstants.DESTROYOBJECTACTION) type = ActivityConstants.DESTROYOBJECTACTION; else if (sysmlType == SysmlConstants.DOMAIN) type = BlockConstants.BLOCK; - else if (sysmlType == SysmlConstants.ENTRYPOINT) type = stateMachineConstants.entryPoint; + else if (sysmlType == SysmlConstants.ENTRYPOINT) type = StateMachineConstants.ENTRYPOINT; else if (sysmlType == SysmlConstants.ENUMERATION) type = BlockConstants.ENUMERATION; else if (sysmlType == SysmlConstants.EVENT) type = ActivityConstants.EVENTTYPE; else if (sysmlType == SysmlConstants.EXCEPTIONHANDLER) type = ProfileConstants.EXCEPTIONHANDLER; else if (sysmlType == SysmlConstants.EXTENDEDREQUIREMENT) type = RequirementConstants.EXTENDEDREQUIREMENT; - else if (sysmlType == SysmlConstants.EXITPOINT) type = stateMachineConstants.exitPoint; + else if (sysmlType == SysmlConstants.EXITPOINT) type = StateMachineConstants.EXITPOINT; else if (sysmlType == SysmlConstants.EXTERNAL) type = BlockConstants.EXTERNAL; else if (sysmlType == SysmlConstants.LIFELINE) type = SequenceConstants.SEQUENCE; else if (sysmlType == SysmlConstants.PACKAGE) type = ProfileConstants.PACKAGE; @@ -1876,7 +1872,7 @@ internal string GetEAType(string sysmlType, string stereotype) else if (sysmlType == SysmlConstants.INSTANCESPECIFICATION) type = ProfileConstants.OBJECTTYPE; else if (sysmlType == SysmlConstants.INTERRUPTIBLEACTIVITYREGION) type = ActivityConstants.INTERRUPTIBLEACTIVITYREGION; else if (sysmlType == SysmlConstants.MERGENODE) type = ActivityConstants.MERGENODE; - else if (sysmlType == SysmlConstants.METACLASS) type = stereotypeConstants.metaclass; + else if (sysmlType == SysmlConstants.METACLASS) type = StereotypeConstants.METACLASS; else if (sysmlType == SysmlConstants.NAVIGATIONCELL) type = ProfileConstants.TEXT; else if (sysmlType == SysmlConstants.NOTE) type = ProfileConstants.NOTE; else if (sysmlType == SysmlConstants.OBJECT) type = ProfileConstants.OBJECTTYPE; @@ -1885,37 +1881,37 @@ internal string GetEAType(string sysmlType, string stereotype) else if (sysmlType == SysmlConstants.OPERATION) type = BlockConstants.OPERATION; else if (sysmlType == SysmlConstants.OPAQUEACTION) type = ActivityConstants.ACTION; else if (sysmlType == SysmlConstants.OUTPUTPIN) type = ActivityConstants.ACTIONPIN; - else if (sysmlType == SysmlConstants.JOIN) type = stateMachineConstants.synchronization; + else if (sysmlType == SysmlConstants.JOIN) type = StateMachineConstants.SYNCHRONIZATION; else if (sysmlType == SysmlConstants.JOINNODE) type = ActivityConstants.SYNCHRONIZATION; - else if (sysmlType == SysmlConstants.FORK) type = stateMachineConstants.synchronization; + else if (sysmlType == SysmlConstants.FORK) type = StateMachineConstants.SYNCHRONIZATION; else if (sysmlType == SysmlConstants.FLOWPROPERTY) type = InternalBlockConstants.FLOWPROPERTY; else if (sysmlType == SysmlConstants.FORKNODE) type = ActivityConstants.SYNCHRONIZATION; else if (sysmlType == SysmlConstants.VALUEPROPERTY) type = BlockConstants.DATATYPE; else if (sysmlType == SysmlConstants.PARTPROPERTY) type = BlockConstants.PROPERTY; else if (sysmlType == SysmlConstants.REFERENCEPROPERTY) type = InternalBlockConstants.REFERENCEPROPERTY; else if (sysmlType == SysmlConstants.REQUIREMENT) type = RequirementConstants.REQUIREMENT; - else if (sysmlType == SysmlConstants.REGION) type = stateMachineConstants.region; + else if (sysmlType == SysmlConstants.REGION) type = StateMachineConstants.REGION; else if (sysmlType == SysmlConstants.CONSTRAINTPROPERTY) type = InternalBlockConstants.CONSTRAINTPROPERTY; else if (sysmlType == SysmlConstants.PARTICIPANTPROPERTY) type = InternalBlockConstants.PARTICIPANTPROPERTY; else if (sysmlType == SysmlConstants.PERFORMANCEREQUIREMENT) type = RequirementConstants.PERFORMANCEREQUIREMENT; else if (sysmlType == SysmlConstants.PHYSICALREQUIREMENT) type = RequirementConstants.PHYSICALREQUIREMENT; else if (sysmlType == SysmlConstants.PORT) type = BlockConstants.PORT; else if (sysmlType == SysmlConstants.SENDSIGNALACTION) type = ActivityConstants.SENDSIGNALACTION; - else if (sysmlType == SysmlConstants.SHALLOWHISTORY) type = stateMachineConstants.stateNode; + else if (sysmlType == SysmlConstants.SHALLOWHISTORY) type = StateMachineConstants.STATENODE; else if (sysmlType == SysmlConstants.SIGNAL) type = BlockConstants.SIGNAL; else if (sysmlType == SysmlConstants.STEREOTYPE) type = ProfileConstants.CLASSTYPE; - else if (sysmlType == SysmlConstants.STATE) type = stateMachineConstants.state; + else if (sysmlType == SysmlConstants.STATE) type = StateMachineConstants.STATE; else if (sysmlType == SysmlConstants.STATEINVARIANT) type = SequenceConstants.INTERACTIONSTATE; - else if (sysmlType == SysmlConstants.STATEMACHINE) type = stateMachineConstants.stateMachine; + else if (sysmlType == SysmlConstants.STATEMACHINE) type = StateMachineConstants.STATEMACHINE; else if (sysmlType == SysmlConstants.SUBSYSTEM) type = BlockConstants.BLOCK; - else if (sysmlType == SysmlConstants.SYNCHRONIZATION) type = stateMachineConstants.synchronization; + else if (sysmlType == SysmlConstants.SYNCHRONIZATION) type = StateMachineConstants.SYNCHRONIZATION; else if (sysmlType == SysmlConstants.SYSTEM) type = BlockConstants.BLOCK; else if (sysmlType == SysmlConstants.SYSTEMCONTEXT) type = BlockConstants.BLOCK; - else if (sysmlType == SysmlConstants.TERMINATE) type = stateMachineConstants.stateNode; + else if (sysmlType == SysmlConstants.TERMINATE) type = StateMachineConstants.STATENODE; else if (sysmlType == SysmlConstants.TEXT) type = ProfileConstants.TEXT; - else if (sysmlType == SysmlConstants.TRIGGER) type = stateMachineConstants.trigger; + else if (sysmlType == SysmlConstants.TRIGGER) type = StateMachineConstants.TRIGGER; else if (sysmlType == SysmlConstants.UNIT) type = BlockConstants.UNIT; - else if (sysmlType == SysmlConstants.USECASE) type = useCaseConstants.useCase; + else if (sysmlType == SysmlConstants.USECASE) type = UseCaseConstants.USECASE; else if (sysmlType == SysmlConstants.QUANTITYKIND) type = BlockConstants.QUANTITYKIND; else if (sysmlType == SysmlConstants.VALUETYPE) type = BlockConstants.VALUETYPE; else if (sysmlType == SysmlConstants.FLOWSPECIFICATION) type = BlockConstants.INTERFACETYPE; @@ -1923,33 +1919,30 @@ internal string GetEAType(string sysmlType, string stereotype) } private string GetSysMLType(string type, string stereotype, int subtype, string metatype) { - StereotypeConstants stereotypeConstants = new StereotypeConstants(); - - string elementType = ""; - if (stereotype == stereotypeConstants.block) elementType = SysmlConstants.SYSMLBLOCK; - else if (stereotype == stereotypeConstants.hardware) elementType = SysmlConstants.SYSMLBLOCK; - else if (stereotype == stereotypeConstants.boundReference) elementType = SysmlConstants.SYSMLBOUNDREFERENCE; - else if (stereotype == stereotypeConstants.valueProperty) elementType = SysmlConstants.SYSMLVALUEPROPERTY; - else if (stereotype == stereotypeConstants.participantProperty) elementType = SysmlConstants.SYSMLPARTICIPANTPROPERTY; - else if (stereotype == stereotypeConstants.decision) elementType = SysmlConstants.SYSMLDECISIONNODE; - else if (stereotype == stereotypeConstants.domain) elementType = SysmlConstants.SYSMLBLOCK; - else if (stereotype == stereotypeConstants.objectStereotype) elementType = SysmlConstants.SYSMLOBJECT; - else if (stereotype == stereotypeConstants.constraintProperty) elementType = SysmlConstants.SYSMLCONSTRAINTPROPERTY; - else if (stereotype == stereotypeConstants.valueType) elementType = SysmlConstants.SYSMLVALUEPROPERTY; - else if (stereotype == stereotypeConstants.flowProperty) elementType = SysmlConstants.SYSMLFLOWPROPERTY; - else if (stereotype == stereotypeConstants.constraintParameter) elementType = SysmlConstants.SYSMLCONSTRAINTPARAMETER; - else if (stereotype == stereotypeConstants.constraintBlock || stereotype == stereotypeConstants.constraintBlockCap) elementType = SysmlConstants.SYSMLCONSTRAINTBLOCK; - else if (stereotype == stereotypeConstants.classifierBehaviorProperty) elementType = SysmlConstants.SYSMLCLASSIFIERBEHAVIORPROPERTY; - else if (stereotype == stereotypeConstants.stereotype) elementType = SysmlConstants.SYSMLSTEREOTYPE; - else if (stereotype == stereotypeConstants.objectiveFunction) elementType = SysmlConstants.SYSMLOBJECTIVEFUNCTION; - else if (stereotype == stereotypeConstants.metaclass && type == SysmlConstants.CLASS) elementType = SysmlConstants.SYSMLMETACLASS; + if (stereotype == StereotypeConstants.BLOCK) elementType = SysmlConstants.SYSMLBLOCK; + else if (stereotype == StereotypeConstants.HARDWARE) elementType = SysmlConstants.SYSMLBLOCK; + else if (stereotype == StereotypeConstants.BOUNDREFERENCE) elementType = SysmlConstants.SYSMLBOUNDREFERENCE; + else if (stereotype == StereotypeConstants.VALUEPROPERTY) elementType = SysmlConstants.SYSMLVALUEPROPERTY; + else if (stereotype == StereotypeConstants.PARTICIPANTPROPERTY) elementType = SysmlConstants.SYSMLPARTICIPANTPROPERTY; + else if (stereotype == StereotypeConstants.DECISION) elementType = SysmlConstants.SYSMLDECISIONNODE; + else if (stereotype == StereotypeConstants.DOMAIN) elementType = SysmlConstants.SYSMLBLOCK; + else if (stereotype == StereotypeConstants.OBJECTSTEREOTYPE) elementType = SysmlConstants.SYSMLOBJECT; + else if (stereotype == StereotypeConstants.CONSTRAINTPROPERTY) elementType = SysmlConstants.SYSMLCONSTRAINTPROPERTY; + else if (stereotype == StereotypeConstants.VALUETYPE) elementType = SysmlConstants.SYSMLVALUEPROPERTY; + else if (stereotype == StereotypeConstants.FLOWPROPERTY) elementType = SysmlConstants.SYSMLFLOWPROPERTY; + else if (stereotype == StereotypeConstants.CONSTRAINTPARAMETER) elementType = SysmlConstants.SYSMLCONSTRAINTPARAMETER; + else if (stereotype == StereotypeConstants.CONSTRAINTBLOCK || stereotype == StereotypeConstants.CONSTRAINTBLOCKCAP) elementType = SysmlConstants.SYSMLCONSTRAINTBLOCK; + else if (stereotype == StereotypeConstants.CLASSIFIERBEHAVIORPROPERTY) elementType = SysmlConstants.SYSMLCLASSIFIERBEHAVIORPROPERTY; + else if (stereotype == StereotypeConstants.STEREOTYPE) elementType = SysmlConstants.SYSMLSTEREOTYPE; + else if (stereotype == StereotypeConstants.OBJECTIVEFUNCTION) elementType = SysmlConstants.SYSMLOBJECTIVEFUNCTION; + else if (stereotype == StereotypeConstants.METACLASS && type == SysmlConstants.CLASS) elementType = SysmlConstants.SYSMLMETACLASS; else if (stereotype == "" && type == SysmlConstants.CLASS) elementType = SysmlConstants.SYSMLCLASS; - else if (stereotype != "" && stereotype != stereotypeConstants.metaclass && stereotype != stereotypeConstants.stereotype && stereotype != stereotypeConstants.interfaceBlock - && stereotype != stereotypeConstants.domain && stereotype != stereotypeConstants.external && stereotype != stereotypeConstants.system && stereotype != stereotypeConstants.subsystem - && stereotype != stereotypeConstants.systemContext && type == SysmlConstants.CLASS) elementType = SysmlConstants.SYSMLCLASS; - else if (stereotype == stereotypeConstants.valueType && type != SysmlConstants.ENUMERATION) elementType = SysmlConstants.SYSMLVALUEPROPERTY; - else if (stereotype == stereotypeConstants.valueType && type == SysmlConstants.ENUMERATION) elementType = SysmlConstants.SYSMLENUMERATION; + else if (stereotype != "" && stereotype != StereotypeConstants.METACLASS && stereotype != StereotypeConstants.STEREOTYPE && stereotype != StereotypeConstants.INTERFACEBLOCK + && stereotype != StereotypeConstants.DOMAIN && stereotype != StereotypeConstants.EXTERNAL && stereotype != StereotypeConstants.SYSTEM && stereotype != StereotypeConstants.SUBSYSTEM + && stereotype != StereotypeConstants.SYSTEMCONTEXT && type == SysmlConstants.CLASS) elementType = SysmlConstants.SYSMLCLASS; + else if (stereotype == StereotypeConstants.VALUETYPE && type != SysmlConstants.ENUMERATION) elementType = SysmlConstants.SYSMLVALUEPROPERTY; + else if (stereotype == StereotypeConstants.VALUETYPE && type == SysmlConstants.ENUMERATION) elementType = SysmlConstants.SYSMLENUMERATION; else if (type == SysmlConstants.ACTIVITY) elementType = SysmlConstants.SYSMLACTIVITY; else if (type == SysmlConstants.ACTIVITYPARAMETER) elementType = SysmlConstants.SYSMLACTIVITYPARAMETERNODE; else if (type == SysmlConstants.ACTIVITYPARTITION) elementType = SysmlConstants.SYSMLACTIVITYPARTITION; @@ -1967,7 +1960,7 @@ private string GetSysMLType(string type, string stereotype, int subtype, string else if (type == SysmlConstants.EXITPOINT) elementType = SysmlConstants.SYSMLEXITPOINT; else if (type == SysmlConstants.SEQUENCE) elementType = SysmlConstants.SYSMLLIFELINE; else if (type == SysmlConstants.REGION) elementType = SysmlConstants.SYSMLREGION; - else if (type == SysmlConstants.REQUIREMENT && stereotype == stereotypeConstants.businessRequirement) elementType = SysmlConstants.SYSMLREQUIREMENT; + else if (type == SysmlConstants.REQUIREMENT && stereotype == StereotypeConstants.BUSINESSREQUIREMENT) elementType = SysmlConstants.SYSMLREQUIREMENT; else if (type == SysmlConstants.REQUIREMENT) elementType = SysmlConstants.SYSMLREQUIREMENT; else if (type == SysmlConstants.EXTENDEDREQUIREMENT) elementType = SysmlConstants.SYSMLEXTENDEDREQUIREMENT; else if (type == SysmlConstants.FUNCTIONALREQUIREMENT) elementType = SysmlConstants.SYSMLFUNCTIONALREQUIREMENT; @@ -1983,24 +1976,24 @@ private string GetSysMLType(string type, string stereotype, int subtype, string else if (type == SysmlConstants.OBJECT) elementType = SysmlConstants.SYSMLOBJECT; else if (type == SysmlConstants.OBJECTNODE) elementType = SysmlConstants.SYSMLOBJECTNODE; else if (type == SysmlConstants.USECASE) elementType = SysmlConstants.SYSMLUSECASE; - else if (type == SysmlConstants.OBJECT && stereotype == stereotypeConstants.datastore) elementType = SysmlConstants.SYSMLDATASTORENODE; - else if (type == SysmlConstants.SYNCHRONIZATION && stereotype == stereotypeConstants.fork) elementType = SysmlConstants.SYSMLFORKNODE; + else if (type == SysmlConstants.OBJECT && stereotype == StereotypeConstants.DATASTORE) elementType = SysmlConstants.SYSMLDATASTORENODE; + else if (type == SysmlConstants.SYNCHRONIZATION && stereotype == StereotypeConstants.FORK) elementType = SysmlConstants.SYSMLFORKNODE; else if (type == SysmlConstants.PORT) { - if (stereotype == stereotypeConstants.flowPort) elementType = SysmlConstants.SYSMLFLOWPORT; - else if (stereotype == stereotypeConstants.fullPort) elementType = SysmlConstants.SYSMLFULLPORT; - else if (stereotype == stereotypeConstants.proxyPort) elementType = SysmlConstants.SYSMLPROXYPORT; + if (stereotype == StereotypeConstants.FLOWPORT) elementType = SysmlConstants.SYSMLFLOWPORT; + else if (stereotype == StereotypeConstants.FULLPORT) elementType = SysmlConstants.SYSMLFULLPORT; + else if (stereotype == StereotypeConstants.PROXYPORT) elementType = SysmlConstants.SYSMLPROXYPORT; else { elementType = SysmlConstants.SYSMLPORT; } } - else if (stereotype == stereotypeConstants.interfaceBlock) elementType = SysmlConstants.SYSMLINTERFACEBLOCK; - else if (type == SysmlConstants.INTERFACE && stereotype != stereotypeConstants.flowSpecification) elementType = SysmlConstants.SYSMLINTERFACE; + else if (stereotype == StereotypeConstants.INTERFACEBLOCK) elementType = SysmlConstants.SYSMLINTERFACEBLOCK; + else if (type == SysmlConstants.INTERFACE && stereotype != StereotypeConstants.FLOWSPECIFICATION) elementType = SysmlConstants.SYSMLINTERFACE; else if (type == SysmlConstants.ACTIVITYPARAMETER) elementType = SysmlConstants.SYSMLACTIVITYPARAMETER; else if (type == SysmlConstants.ARTIFACT) elementType = SysmlConstants.SYSMLARTIFACT; else if (type == SysmlConstants.TRIGGER) elementType = SysmlConstants.SYSMLTRIGGER; - else if (type == SysmlConstants.TEXT && stereotype == stereotypeConstants.navigationCell) elementType = SysmlConstants.EANAVIGATIONCELL; + else if (type == SysmlConstants.TEXT && stereotype == StereotypeConstants.NAVIGATIONCELL) elementType = SysmlConstants.EANAVIGATIONCELL; else if (type == SysmlConstants.TEXT) elementType = SysmlConstants.SYSMLTEXT; else if (type == SysmlConstants.NOTE) elementType = SysmlConstants.SYSMLNOTE; else if (type == SysmlConstants.STATENODE) @@ -2022,38 +2015,38 @@ private string GetSysMLType(string type, string stereotype, int subtype, string else if (type == SysmlConstants.CLASS) elementType = SysmlConstants.SYSMLCLASS; else if (type == SysmlConstants.STATEMACHINE) elementType = SysmlConstants.SYSMLSTATEMACHINE; else if (type == SysmlConstants.PART && stereotype == "") elementType = SysmlConstants.SYSMLPARTPROPERTY; - else if (type == SysmlConstants.PART && stereotype == stereotypeConstants.partProperty) elementType = SysmlConstants.SYSMLPARTPROPERTY; - else if (type == SysmlConstants.PART && stereotype == stereotypeConstants.property) elementType = SysmlConstants.SYSMLPARTPROPERTY; - else if (type == SysmlConstants.PART && stereotype == stereotypeConstants.constraintProperty) elementType = SysmlConstants.SYSMLCONSTRAINTPROPERTY; - else if (type == SysmlConstants.PART && stereotype == stereotypeConstants.classification) elementType = SysmlConstants.SYSMLCLASSIFICATION; + else if (type == SysmlConstants.PART && stereotype == StereotypeConstants.PARTPROPERTY) elementType = SysmlConstants.SYSMLPARTPROPERTY; + else if (type == SysmlConstants.PART && stereotype == StereotypeConstants.PROPERTY) elementType = SysmlConstants.SYSMLPARTPROPERTY; + else if (type == SysmlConstants.PART && stereotype == StereotypeConstants.CONSTRAINTPROPERTY) elementType = SysmlConstants.SYSMLCONSTRAINTPROPERTY; + else if (type == SysmlConstants.PART && stereotype == StereotypeConstants.CLASSIFICATION) elementType = SysmlConstants.SYSMLCLASSIFICATION; else if (type == SysmlConstants.REQUIREDINTERFACE) elementType = SysmlConstants.SYSMLREQUIREDINTERFACE; else if (type == SysmlConstants.NOTE) elementType = SysmlConstants.SYSMLNOTE; else if (type == SysmlConstants.PACKAGE) elementType = SysmlConstants.SYSMLPACKAGE; - else if (stereotype == stereotypeConstants.allocated || type == SysmlConstants.ACTION || type == SysmlConstants.ACTIVITYPARAMETER || + else if (stereotype == StereotypeConstants.ALLOCATED || type == SysmlConstants.ACTION || type == SysmlConstants.ACTIVITYPARAMETER || type == SysmlConstants.ACTIONPIN || type == SysmlConstants.EVENT) { - if (stereotype == stereotypeConstants.allocated) elementType = SysmlConstants.SYSMLALLOCATED; + if (stereotype == StereotypeConstants.ALLOCATED) elementType = SysmlConstants.SYSMLALLOCATED; else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.acceptEventAction) elementType = SysmlConstants.SYSMLACCEPTEVENTACTION; else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.callBehaviorAction) elementType = SysmlConstants.SYSMLCALLBEHAVIORACTION; else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.opaqueAction) elementType = SysmlConstants.SYSMLOPAQUEACTION; else if (type == SysmlConstants.ACTION && metatype == MetatypeConstants.sendSignalAction) elementType = SysmlConstants.SYSMLSENDSIGNALACTION; else if (type == SysmlConstants.ACTION) elementType = SysmlConstants.SYSMLACTION; else if (type == SysmlConstants.ACTIVITYPARAMETER) elementType = SysmlConstants.SYSMLACTIVITYPARAMETER; - else if (type == SysmlConstants.ACTIONPIN && stereotype == stereotypeConstants.output) elementType = SysmlConstants.SYSMLOUTPUTPIN; - else if (type == SysmlConstants.ACTIONPIN && stereotype == stereotypeConstants.input) elementType = SysmlConstants.SYSMLINPUTPIN; + else if (type == SysmlConstants.ACTIONPIN && stereotype == StereotypeConstants.OUTPUT) elementType = SysmlConstants.SYSMLOUTPUTPIN; + else if (type == SysmlConstants.ACTIONPIN && stereotype == StereotypeConstants.INPUT) elementType = SysmlConstants.SYSMLINPUTPIN; else if (type == SysmlConstants.ACTIONPIN) elementType = SysmlConstants.SYSMLACTIONPIN; else if (type == SysmlConstants.EVENT) elementType = SysmlConstants.SYSMLEVENT; } else if (type == SysmlConstants.MERGENODE) elementType = SysmlConstants.SYSMLMERGENODE; else if (type == SysmlConstants.SYNCHRONIZATION) { - if (stereotype == stereotypeConstants.join) elementType = SysmlConstants.SYSMLJOIN; - else if (stereotype == stereotypeConstants.fork) elementType = SysmlConstants.SYSMLFORK; + if (stereotype == StereotypeConstants.JOIN) elementType = SysmlConstants.SYSMLJOIN; + else if (stereotype == StereotypeConstants.FORK) elementType = SysmlConstants.SYSMLFORK; else elementType = SysmlConstants.SYSMLSYNCHRONIZATION; } else if (type == SysmlConstants.INTERRUPTIBLEACTIVITYREGION ) elementType = SysmlConstants.SYSMLINTERRUPTIBLEACTIVITYREGION; - else if (stereotype == stereotypeConstants.flowSpecification) elementType = SysmlConstants.SYSMLFLOWSPECIFICATION; - else if (stereotype == stereotypeConstants.external || stereotype == stereotypeConstants.subsystem || stereotype == stereotypeConstants.system || stereotype == stereotypeConstants.systemContext) elementType = SysmlConstants.SYSMLBLOCK; + else if (stereotype == StereotypeConstants.FLOWSPECIFICATION) elementType = SysmlConstants.SYSMLFLOWSPECIFICATION; + else if (stereotype == StereotypeConstants.EXTERNAL || stereotype == StereotypeConstants.SUBSYSTEM || stereotype == StereotypeConstants.SYSTEM || stereotype == StereotypeConstants.SYSTEMCONTEXT) elementType = SysmlConstants.SYSMLBLOCK; return elementType; } }