Skip to content

Commit 8c692a0

Browse files
authored
Merge pull request #24 from data-solution-automation-engine/dev2
Merging dev branch back into main
2 parents af6b904 + dbf949f commit 8c692a0

30 files changed

+269
-63
lines changed

DataWarehouseAutomation/DataWarehouseAutomation.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RunDwhAutomation", "RunDwhA
5252
EndProject
5353
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SchemaJsonConverter", "SchemaJsonConverter\SchemaJsonConverter.csproj", "{07214B80-37A9-4137-B0F3-109FA0D0926A}"
5454
EndProject
55-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Export", "Export\Export.csproj", "{555AD192-6E8B-49DD-B60C-2E2CC41C0FA2}"
55+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Export", "Export\Export.csproj", "{555AD192-6E8B-49DD-B60C-2E2CC41C0FA2}"
5656
EndProject
5757
Global
5858
GlobalSection(SolutionConfigurationPlatforms) = preSolution

DataWarehouseAutomation/DataWarehouseAutomation/DataWarehouseAutomation.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Version>2.0.2</Version>

DataWarehouseAutomation/DataWarehouseAutomation/BusinessKeyDefinition.cs renamed to DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/BusinessKeyDefinition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace DataWarehouseAutomation;
1+
namespace DataWarehouseAutomation.DwaModel;
22

33
/// <summary>
44
/// A Business Key, which consists of one or more components (column mappings) and has its own surrogate key.

DataWarehouseAutomation/DataWarehouseAutomation/DataClassification.cs renamed to DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/DataClassification.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace DataWarehouseAutomation;
1+
namespace DataWarehouseAutomation.DwaModel;
22

33
/// <summary>
44
/// Used to define a list of classifications (labels) and notes to add to various components of the schema definition.

DataWarehouseAutomation/DataWarehouseAutomation/DataConnection.cs renamed to DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/DataConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace DataWarehouseAutomation;
1+
namespace DataWarehouseAutomation.DwaModel;
22

33
/// <summary>
44
/// Connectivity information, that can be used for either a DataObject or DataObjectQuery.

DataWarehouseAutomation/DataWarehouseAutomation/DataItem.cs renamed to DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/DataItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace DataWarehouseAutomation;
1+
namespace DataWarehouseAutomation.DwaModel;
22

33
public class DataItem : IDataItem
44
{

DataWarehouseAutomation/DataWarehouseAutomation/DataItemMapping.cs renamed to DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/DataItemMapping.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace DataWarehouseAutomation;
1+
namespace DataWarehouseAutomation.DwaModel;
22

33
/// <summary>
44
/// The individual column-to-column mapping.
@@ -16,7 +16,7 @@ public class DataItemMapping
1616
public List<IDataItem> SourceDataItems { get; set; } = new();
1717

1818
[JsonPropertyName("targetDataItem")]
19-
public DataItem TargetDataItem { get; set; } = new() { Name = "NewTargetDataItem" };
19+
public IDataItem TargetDataItem { get; set; } = new DataItem() { Name = "newTargetDataItem" };
2020

2121
/// <summary>
2222
/// The collection of extension Key/Value pairs.

DataWarehouseAutomation/DataWarehouseAutomation/DataItemQuery.cs renamed to DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/DataItemQuery.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace DataWarehouseAutomation;
1+
namespace DataWarehouseAutomation.DwaModel;
22

33
public class DataItemQuery : IDataItem
44
{

DataWarehouseAutomation/DataWarehouseAutomation/DataObject.cs renamed to DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/DataObject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace DataWarehouseAutomation;
1+
namespace DataWarehouseAutomation.DwaModel;
22

33
/// <summary>
44
/// The definition of a data set, file, or table.

DataWarehouseAutomation/DataWarehouseAutomation/DataObjectMapping.cs renamed to DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/DataObjectMapping.cs

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace DataWarehouseAutomation;
1+
using DataWarehouseAutomation.Utils;
2+
3+
namespace DataWarehouseAutomation.DwaModel;
24

35
/// <summary>
46
/// The mapping between a source and target data set / table / file.
@@ -46,15 +48,35 @@ public class DataObjectMapping : IMetadata
4648
/// The target object of the mapping. This is always a Data Object type.
4749
/// </summary>
4850
[JsonPropertyName("targetDataObject")]
49-
public DataObject TargetDataObject { get; set; } = new() { Name = "NewTargetDataObject" };
51+
public IDataObject TargetDataObject { get; set; } = new DataObject() { Name = "newTargetDataObject" };
5052

5153
/// <summary>
5254
/// The collection of associated data object for purposes other than source-target relationship.
5355
/// For example for lookups, merge joins, lineage etc.
5456
/// </summary>
5557
[JsonPropertyName("relatedDataObjects")]
5658
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
57-
public List<DataObject>? RelatedDataObjects { get; set; }
59+
public List<IDataObject>? RelatedDataObjects { get; set; }
60+
61+
private List<IDataItem> _dataItems = [];
62+
/// <summary>
63+
/// The collection of Data Items <see cref="IDataItem"/> specifically associated with this Data Object Mapping,
64+
/// used as source/target Data Items/Queries for the mapping or the Mappings BKCM as needed.
65+
/// </summary>
66+
[JsonPropertyName("dataItems")]
67+
[JsonPropertyOrder(order: 55)]
68+
public List<IDataItem> DataItems
69+
{
70+
get
71+
{
72+
return _dataItems;
73+
}
74+
set
75+
{
76+
_dataItems = value;
77+
isSorted = false;
78+
}
79+
}
5880

5981
/// <summary>
6082
/// The collection of individual attribute (column or query) mappings.
@@ -99,6 +121,33 @@ public class DataObjectMapping : IMetadata
99121
public string? Notes { get; set; }
100122
#endregion
101123

124+
#region Json Representation
125+
private bool isSorted = false;
126+
127+
/// <summary>
128+
/// Sort all the lists in the metadata object
129+
/// </summary>
130+
public void SortLists()
131+
{
132+
if (!isSorted)
133+
{
134+
isSorted = true;
135+
SourceDataObjects.Sort();
136+
RelatedDataObjects.Sort();
137+
DataItemMappings.Sort();
138+
BusinessKeyDefinitions.Sort();
139+
Classifications.Sort();
140+
Extensions.Sort();
141+
}
142+
}
143+
144+
/// <summary>
145+
/// Get the standard Json representation
146+
/// </summary>
147+
[JsonIgnore(Condition = JsonIgnoreCondition.Always)]
148+
public string Json => JsonSerializer.Serialize(this, DefaultJsonOptions.SerializerOptions);
149+
#endregion
150+
102151
#region Methods
103152
/// <summary>
104153
/// Use this method to assert if two Data Object Mappings are the same, based on their Ids.

0 commit comments

Comments
 (0)