Skip to content

Commit

Permalink
Adding EnterpriseBoundary.cs Diagram
Browse files Browse the repository at this point in the history
  • Loading branch information
yanjustino committed Nov 17, 2021
1 parent 43132e7 commit d74edbb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/components/C4Sharp/Models/EnterpriseBoundary.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;

namespace C4Sharp.Models
{
public record EnterpriseBoundary(string Alias, string Label) : Structure(Alias, Label)
{
public IEnumerable<Structure> Structures { get; init; } = Array.Empty<Structure>();
}
}
22 changes: 21 additions & 1 deletion src/components/C4Sharp/Models/Plantuml/PlantumlStructure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static string ToPumlString(this Structure structure)
Component component => component.ToPumlString(),
Container container => container.ToPumlString(),
ContainerBoundary containerBoundary => containerBoundary.ToPumlString(),
EnterpriseBoundary enterpriseBoundary => enterpriseBoundary.ToPumlString(),
_ => string.Empty
};
}
Expand Down Expand Up @@ -56,7 +57,26 @@ private static string ToPumlString(this SoftwareSystemBoundary boundary)
stream.AppendLine("}");

return stream.ToString();
}
}

private static string ToPumlString(this EnterpriseBoundary boundary)
{
var stream = new StringBuilder();
stream.AppendLine();
stream.AppendLine($"Enterprise_Boundary({boundary.Alias}, \"{boundary.Label}\") {{");

foreach (var structure in boundary.Structures)
{
if (structure is (Person or SoftwareSystem))
{
stream.AppendLine($"{SpaceMethods.Indent()}{structure.ToPumlString()}");
}
}

stream.AppendLine("}");

return stream.ToString();
}

private static string ToPumlString(this Component component)
{
Expand Down

0 comments on commit d74edbb

Please sign in to comment.