Skip to content

Commit

Permalink
Tbm0115/attribute fix (#13)
Browse files Browse the repository at this point in the history
* Update UmlProperty.cs

* Update MtconnectTranspiler.csproj

* Compiler improvements

 - Resolved compiler warnings
 - Added missing documentation
 - Added SemanticVersion to keep track of the semantic versioning of the standard

* Bug Fix

 - Fixed deserialization of attributes due to access level of internal properties.
  • Loading branch information
tbm0115 authored Mar 30, 2023
1 parent 8f3a6bc commit dddcd5d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 35 deletions.
2 changes: 1 addition & 1 deletion MtconnectTranspiler.Console/Views/MainView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void TestNavigationalTree()
var deserializer = options.GetDeserializer();
var result = deserializer.Deserialize(default);

var path = MTConnectHelper.PackageNavigationTree.Profile.DataTypes;
var path = MTConnectHelper.PackageNavigationTree.ObservationInformationModel.ObservationTypes;
Consoul.Write("Path: " + path);
var package = MTConnectHelper.JumpToPackage(result!, path);
Consoul.Write("Package ID: " + (package?.Id ?? "Not found"));
Expand Down
2 changes: 1 addition & 1 deletion MtconnectTranspiler/MtconnectTranspiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>MTConnect Transpiler</Title>
<Version>1.0.2</Version>
<Version>1.0.3</Version>
<Authors>mtconnect, tbm0115</Authors>
<Company>MTConnect Institute; TAMS;</Company>
<Description>A library capable of parsing an XMI for the MTConnect Standard and passing it to an implemented transpiler.</Description>
Expand Down
4 changes: 1 addition & 3 deletions MtconnectTranspiler/Xmi/OwnedOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ public class OwnedOperation : XmiElement
/// <c>isQuery</c> attribute
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.isQuery, Namespace = "")]
internal bool _isQuery { get; set; }
/// <inheritdoc cref="_isQuery"/>
public bool isQuery => _isQuery;
public bool isQuery { get; set; }

/// <summary>
/// Collection of <inheritdoc cref="MtconnectTranspiler.Xmi.UML.UmlComment"/>
Expand Down
4 changes: 1 addition & 3 deletions MtconnectTranspiler/Xmi/UML/UmlClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ public class UmlClass : PackagedElement
/// <c>isAbstract</c> attribute
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.isAbstract, Namespace = "")]
private bool _isAbstract { get; set; }
/// <inheritdoc cref="_isAbstract"/>
public bool IsAbstract => _isAbstract;
public bool IsAbstract { get; set; }

/// <summary>
/// Collection of <inheritdoc cref="MtconnectTranspiler.Xmi.UML.UmlConstraint"/>
Expand Down
8 changes: 2 additions & 6 deletions MtconnectTranspiler/Xmi/UML/UmlDataType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,13 @@ public class UmlDataType : PackagedElement
/// <c>isAbstract</c> attribute
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.isAbstract, Namespace = "")]
private bool _isAbstract { get; set; }
/// <inheritdoc cref="_isAbstract"/>
public bool IsAbstract => _isAbstract;
public bool IsAbstract { get; set; }

/// <summary>
/// <c>visibility</c> attribute
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.visibility, Namespace = "")]
private string _visibility { get; set; } = "public";
/// <inheritdoc cref="_visibility"/>
public string Visibility => _visibility;
public string Visibility { get; set; } = "public";

/// <summary>
/// Collection of <inheritdoc cref="UmlComment"/>
Expand Down
4 changes: 1 addition & 3 deletions MtconnectTranspiler/Xmi/UML/UmlInstanceValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public class UmlInstanceValue : DefaultValue
/// <c>instance</c> attribute
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.instance, Namespace = "")]
internal string? _instance { get; set; }
/// <inheritdoc cref="_instance"/>
public string Instance => _instance ?? string.Empty;
public string Instance { get; set; } = string.Empty;
}
}
24 changes: 6 additions & 18 deletions MtconnectTranspiler/Xmi/UML/UmlProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ public class UmlProperty : OwnedAttribute
/// <c>association</c> attribute
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.association, Namespace = "")]
private string? _association { get; set; }
/// <inheritdoc cref="_association"/>
public string Association => _association ?? string.Empty;
public string? Association { get; set; }

// TODO: Lookup the uml:Association[@name] to determine the expected Property Name
// TODO: Figure out how to determine if the associated type is an array. Possibly just a reference to the lowerValue/upperValue elements
Expand All @@ -28,33 +26,25 @@ public class UmlProperty : OwnedAttribute
/// <c>aggregation</c> attribute
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.aggregation, Namespace = "")]
private string? _aggregation { get; set; }
/// <inheritdoc cref="_aggregation"/>
public string Aggregation => _aggregation ?? string.Empty;
public string? Aggregation { get; set; }

/// <summary>
/// <c>type</c> attribute
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.type, Namespace = "")]
private string? _propertyType { get; set; }
/// <inheritdoc cref="_propertyType"/>
public string PropertyType => _propertyType ?? string.Empty;
public string? PropertyType { get; set; }

/// <summary>
/// <c>isStatic</c> attribute
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.isStatic, Namespace = "")]
private bool _isStatic { get; set; }
/// <inheritdoc cref="_isStatic"/>
public bool IsStatic => _isStatic;
public bool IsStatic { get; set; }

/// <summary>
/// <c>isReadOnly</c> attribute
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.isReadOnly, Namespace = "")]
private bool _isReadOnly { get; set; }
/// <inheritdoc cref="_isReadOnly"/>
public bool IsReadOnly => _isReadOnly;
public bool IsReadOnly { get; set; }

/// <summary>
/// Child <inheritdoc cref="MtconnectTranspiler.Xmi.LowerValue"/>
Expand All @@ -78,9 +68,7 @@ public class UmlProperty : OwnedAttribute
/// <c>visibility</c> attribute
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.visibility, Namespace = "")]
private string _visibility { get; set; } = "public";
/// <inheritdoc cref="_visibility"/>
public string Visibility => _visibility;
public string Visibility { get; set; } = "public";

/// <summary>
/// Collection of <inheritdoc cref="MtconnectTranspiler.Xmi.UML.UmlComment"/>
Expand Down

0 comments on commit dddcd5d

Please sign in to comment.