Skip to content

Commit

Permalink
[Update] PackageImportReader
Browse files Browse the repository at this point in the history
  • Loading branch information
samatstariongroup committed Nov 17, 2024
1 parent d602ef6 commit 56a2261
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
19 changes: 11 additions & 8 deletions uml4net.xmi/Readers/CommonStructure/PackageImportReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@

namespace uml4net.xmi.Readers.CommonStructure
{
using Cache;
using System;
using System.Xml;

using Microsoft.Extensions.Logging;
using POCO;

using uml4net.POCO;
using uml4net.POCO.CommonStructure;
using Readers;
using uml4net.xmi.Cache;
using uml4net.xmi.Readers;

/// <summary>
/// The purpose of the <see cref="PackageImportReader"/> is to read an instance of <see cref="IPackageImport"/>
Expand Down Expand Up @@ -67,14 +68,16 @@ public override IPackageImport Read(XmlReader xmlReader)
packageImport.XmiId = xmlReader.GetAttribute("xmi:id");

var importedPackage = xmlReader.GetAttribute("importedPackage");
if (importedPackage != null)
if (!string.IsNullOrEmpty(importedPackage))
{
packageImport.ReferencePropertyValueIdentifies.Add("ImportedPackage", importedPackage);
packageImport.SingleValueReferencePropertyIdentifiers.Add("ImportedPackage", importedPackage);
}

// TODO: figure out an algorithm to interpret how to set the "importingNamespace" property
this.Logger.LogInformation("TODO: figure out an algorithm to interpret how to set the \"importingNamespace\" property");
packageImport.ImportingNamespace = null;
var importingNamespace = xmlReader.GetAttribute("importingNamespace");
if (!string.IsNullOrEmpty(importingNamespace))
{
packageImport.SingleValueReferencePropertyIdentifiers.Add("ImportingNamespace", importingNamespace);
}

string visibility = xmlReader.GetAttribute("visibility");
if (visibility != null)
Expand Down
5 changes: 0 additions & 5 deletions uml4net/POCO/CommonStructure/IPackageImport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ namespace uml4net.POCO.CommonStructure
/// </summary>
public interface IPackageImport : IDirectedRelationship
{
/// <summary>
/// Gets or sets a dictionary of reference properties and the associated unique identifiers
/// </summary>
public Dictionary<string, string> ReferencePropertyValueIdentifies { get; set; }

/// <summary>
/// Specifies the Package whose members are imported into a Namespace.
/// </summary>
Expand Down
6 changes: 0 additions & 6 deletions uml4net/POCO/CommonStructure/PackageImport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ namespace uml4net.POCO.CommonStructure
/// </summary>
public class PackageImport : XmiElement, IPackageImport
{
/// <summary>
/// Gets or sets a dictionary of reference properties and the associated unique identifiers
/// </summary>
[Implements(implementation: "IPackageImport.ReferencePropertyValueIdentifiers")]
public Dictionary<string, string> ReferencePropertyValueIdentifies { get; set; } = new Dictionary<string, string>();

/// <summary>
/// The Comments owned by this Element.
/// </summary>
Expand Down

0 comments on commit 56a2261

Please sign in to comment.