|
126 | 126 | jsonObjectDataObjectMapping.Remove("mappingName");
|
127 | 127 | jsonObjectDataObjectMapping.Add("name", mappingNameNode);
|
128 | 128 |
|
129 |
| - var getName = jsonObjectDataObjectMapping.TryGetPropertyValue("name", out var mappingNameJsonNode).ToString(); |
130 |
| - |
131 |
| - // Add the mapping name as a 'name' to the list of mappings, only once. |
132 |
| - if (jsonObject["dataObjectMappings"].AsArray().IndexOf(dataObjectMapping) == 0) |
133 |
| - { |
134 |
| - jsonObject["name"] = mappingNameJsonNode.ToString(); |
135 |
| - } |
136 |
| - |
137 | 129 | // Rename the mapping classifications.
|
138 | 130 | var mappingClassificationsNode = jsonObjectDataObjectMapping["mappingClassifications"];
|
139 | 131 | jsonObjectDataObjectMapping.Remove("mappingClassifications");
|
|
142 | 134 | // Update the classifications
|
143 | 135 | UpdateClassifications(jsonObjectDataObjectMapping, classificationGuids);
|
144 | 136 |
|
| 137 | + var getName = jsonObjectDataObjectMapping.TryGetPropertyValue("name", out var mappingNameJsonNode).ToString(); |
| 138 | + var getClassification = jsonObjectDataObjectMapping.TryGetPropertyValue("classifications", out var mappingClassificationJsonNode).ToString(); |
| 139 | + |
| 140 | + var copyOfMappingClassificationNode = JsonNode.Parse(mappingClassificationJsonNode.ToJsonString()); |
| 141 | + |
| 142 | + // Add the mapping name as a 'name', and the classification, to the list of mappings, only once. |
| 143 | + if (jsonObject["dataObjectMappings"].AsArray().IndexOf(dataObjectMapping) == 0) |
| 144 | + { |
| 145 | + jsonObject["name"] = mappingNameJsonNode.ToString(); |
| 146 | + jsonObject["classifications"] = copyOfMappingClassificationNode; |
| 147 | + } |
| 148 | + |
145 | 149 | // Rename the business key definitions.
|
146 | 150 | var businessKeyDefinitionsNode = jsonObjectDataObjectMapping["businessKeys"];
|
147 | 151 | jsonObjectDataObjectMapping.Remove("businessKeys");
|
|
183 | 187 |
|
184 | 188 | // Data Items.
|
185 | 189 | var dataItems = new List<JsonObject>();
|
186 |
| - foreach (var dataItem in dataObjectJsonObject["dataItems"].AsArray()) |
| 190 | + if (dataObjectJsonObject["dataItems"] != null) |
187 | 191 | {
|
188 |
| - var dataItemJsonObject = JsonNode.Parse(dataItem.ToJsonString()).AsObject(); |
| 192 | + foreach (var dataItem in dataObjectJsonObject["dataItems"].AsArray()) |
| 193 | + { |
| 194 | + var dataItemJsonObject = JsonNode.Parse(dataItem.ToJsonString()).AsObject(); |
189 | 195 |
|
190 |
| - // Type must be first. |
191 |
| - dataItemJsonObject.Add("dataItemType", "dataItem"); |
| 196 | + // Type must be first. |
| 197 | + dataItemJsonObject.Add("dataItemType", "dataItem"); |
192 | 198 |
|
193 |
| - // Ensure each item has a GUID |
194 |
| - AddGuid(dataItemJsonObject, dataItemGuids, "name"); |
| 199 | + // Ensure each item has a GUID |
| 200 | + AddGuid(dataItemJsonObject, dataItemGuids, "name"); |
195 | 201 |
|
196 |
| - // Re-add unchanged properties to manage order. |
197 |
| - AddUnchangedDataItemProperties(dataItemJsonObject); |
| 202 | + // Re-add unchanged properties to manage order. |
| 203 | + AddUnchangedDataItemProperties(dataItemJsonObject); |
198 | 204 |
|
199 |
| - // Replace properties with newer names (upgrade). |
200 |
| - ReplaceDataObjectProperties(dataItemJsonObject); |
| 205 | + // Replace properties with newer names (upgrade). |
| 206 | + ReplaceDataObjectProperties(dataItemJsonObject); |
201 | 207 |
|
202 |
| - dataItems.Add(dataItemJsonObject); |
| 208 | + dataItems.Add(dataItemJsonObject); |
| 209 | + } |
203 | 210 | }
|
204 | 211 |
|
205 | 212 | foreach (var dataItem in dataItems)
|
@@ -773,6 +780,32 @@ void UpdateClassifications(JsonObject jsonObject, Dictionary<string, Guid> objec
|
773 | 780 | var classificationJsonObject = JsonNode.Parse(classification.ToJsonString()).AsObject();
|
774 | 781 | var getClassification = classificationJsonObject.TryGetPropertyValue("classification", out var classificationValue).ToString();
|
775 | 782 |
|
| 783 | + // Rename to phyiscal model object classifications. |
| 784 | + string newClassificationValue = classificationValue.ToString() switch |
| 785 | + { |
| 786 | + "Source" => "Source", |
| 787 | + "Core Business Concept" => "Hub", |
| 788 | + "CoreBusinessConcept" => "Hub", |
| 789 | + "Context" => "Satellite", |
| 790 | + "Natural Business Relationship" => "Link", |
| 791 | + "NaturalBusinessRelationship" => "Link", |
| 792 | + "Natural Business Relationship Context" => "Link-Satellite", |
| 793 | + "NaturalBusinessRelationshipContext" => "Link-Satellite", |
| 794 | + "Natural Business Relationship Context Driving Key" => "Link-Satellite Driving Key", |
| 795 | + "NaturalBusinessRelationshipContextDrivingKey" => "Link-Satellite Driving Key", |
| 796 | + "Person" => "Conceptual", |
| 797 | + "Place" => "Conceptual", |
| 798 | + "Event" => "Physical", |
| 799 | + _ => "Unknown" |
| 800 | + }; |
| 801 | + |
| 802 | + if (newClassificationValue != "Unknown") |
| 803 | + { |
| 804 | + classificationJsonObject["classification"] = newClassificationValue; |
| 805 | + classificationValue = newClassificationValue; |
| 806 | + } |
| 807 | + |
| 808 | + // Add a group. |
776 | 809 | string groupValue = classificationValue.ToString() switch
|
777 | 810 | {
|
778 | 811 | "Source" => "Solution Layer",
|
|
0 commit comments