Skip to content

Commit

Permalink
Refactoring of Attribute Constants
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsiegl committed Feb 6, 2023
1 parent c8bcf0d commit 7a7988a
Show file tree
Hide file tree
Showing 8 changed files with 686 additions and 305 deletions.
414 changes: 414 additions & 0 deletions .gitignore

Large diffs are not rendered by default.

Binary file removed .vs/MTIP/v16/.suo
Binary file not shown.
103 changes: 31 additions & 72 deletions MTIP/Constants/AttributeConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
2 changes: 2 additions & 0 deletions MTIP/Constants/HUDSConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -43,6 +44,7 @@ public HUDSConstants()
dict = "dict";
dtype = "_dtype";
ea = "ea";
unified = "unified";
element = "element";
id = "id";
intType = "int";
Expand Down
1 change: 1 addition & 0 deletions MTIP/MTIP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
<Compile Include="Models\XmlItem.cs" />
<Compile Include="MTIP.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Translations\MTIPCommon.cs" />
<Compile Include="Translations\MTIPExportFunctions.cs" />
<Compile Include="Translations\MTIPImportFunctions.cs" />
<Compile Include="Utilities\Tools.cs" />
Expand Down
36 changes: 36 additions & 0 deletions MTIP/Translations/MTIPCommon.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
Loading

0 comments on commit 7a7988a

Please sign in to comment.