-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathFeatureDeSerializer.cs
More file actions
1709 lines (1545 loc) · 68.4 KB
/
FeatureDeSerializer.cs
File metadata and controls
1709 lines (1545 loc) · 68.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// -------------------------------------------------------------------------------------------------
// <copyright file="FeatureDeSerializer.cs" company="Starion Group S.A.">
//
// Copyright 2022-2026 Starion Group S.A.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// </copyright>
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
// ------------------------------------------------------------------------------------------------
namespace SysML2.NET.Serializer.Json.Core.DTO
{
using System;
using System.Text.Json;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using SysML2.NET.Common;
using SysML2.NET.Core.DTO.Core.Features;
using SysML2.NET.Serializer.Json;
/// <summary>
/// The purpose of the <see cref="FeatureDeSerializer"/> is to provide deserialization capabilities
/// for the <see cref="IFeature"/> interface
/// </summary>
internal static class FeatureDeSerializer
{
/// <summary>
/// Deserializes an instance of <see cref="IFeature"/> from the provided <see cref="JsonElement"/>
/// </summary>
/// <param name="jsonElement">
/// The <see cref="JsonElement"/> that contains the <see cref="IFeature"/> json object
/// </param>
/// <param name="serializationModeKind">
/// enumeration specifying what kind of serialization shall be used
/// </param>
/// <param name="deserializeDerivedProperties">
/// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
/// </param>
/// <param name="loggerFactory">
/// The <see cref="ILoggerFactory"/> used to setup logging
/// </param>
/// <returns>
/// an instance of <see cref="IFeature"/>
/// </returns>
internal static IFeature DeSerialize(JsonElement jsonElement, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
{
var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("FeatureDeSerializer");
if (!jsonElement.TryGetProperty("@type"u8, out var @type))
{
throw new InvalidOperationException("The @type property is not available, the FeatureDeSerializer cannot be used to deserialize this JsonElement");
}
if (@type.GetString() != "Feature")
{
throw new InvalidOperationException($"The FeatureDeSerializer can only be used to deserialize objects of type IFeature, a {@type.GetString()} was provided");
}
var dtoInstance = new SysML2.NET.Core.DTO.Core.Features.Feature();
if (jsonElement.TryGetProperty("@id"u8, out var idProperty))
{
var propertyValue = idProperty.GetString();
if (propertyValue == null)
{
throw new JsonException("The @id property is not present, the Feature cannot be deserialized");
}
else
{
dtoInstance.Id = Guid.Parse(propertyValue);
}
}
if (deserializeDerivedProperties)
{
DeserializeDtoIncludingDerivedProperties(dtoInstance, jsonElement, logger);
}
else
{
DeserializeDtoExcludingDerivedProperties(dtoInstance, jsonElement, logger);
}
return dtoInstance;
}
/// <summary>
/// Deserializes properties of a <see cref="Feature" />
/// from a <see cref="JsonElement" />, including derived properties
/// </summary>
/// <param name="dtoInstance">
/// The <see cref="Feature"/> instance holding deserialized values
/// </param>
/// <param name="jsonElement">
/// The <see cref="JsonElement"/> that contains the <see cref="IFeature"/> json object
/// </param>
/// <param name="logger">
/// The <see cref="ILogger"/> to produce logging statement
/// </param>
private static void DeserializeDtoIncludingDerivedProperties(SysML2.NET.Core.DTO.Core.Features.Feature dtoInstance, JsonElement jsonElement, ILogger logger)
{
if (jsonElement.TryGetProperty("aliasIds"u8, out var aliasIdsProperty))
{
foreach (var arrayItem in aliasIdsProperty.EnumerateArray())
{
var propertyValue = arrayItem.GetString();
if (propertyValue != null)
{
dtoInstance.AliasIds.Add(propertyValue);
}
}
}
else
{
logger.LogDebug("the aliasIds Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("chainingFeature"u8, out var chainingFeatureProperty))
{
foreach (var arrayItem in chainingFeatureProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var chainingFeatureExternalIdProperty))
{
var propertyValue = chainingFeatureExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.chainingFeature.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the chainingFeature Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("crossFeature"u8, out var crossFeatureProperty))
{
if (crossFeatureProperty.ValueKind == JsonValueKind.Null)
{
dtoInstance.crossFeature = null;
}
else
{
if (crossFeatureProperty.TryGetProperty("@id"u8, out var crossFeatureExternalIdProperty))
{
var propertyValue = crossFeatureExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.crossFeature = Guid.Parse(propertyValue);
}
}
}
}
else
{
logger.LogDebug("the crossFeature Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("declaredName"u8, out var declaredNameProperty))
{
dtoInstance.DeclaredName = declaredNameProperty.GetString();
}
else
{
logger.LogDebug("the declaredName Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("declaredShortName"u8, out var declaredShortNameProperty))
{
dtoInstance.DeclaredShortName = declaredShortNameProperty.GetString();
}
else
{
logger.LogDebug("the declaredShortName Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("differencingType"u8, out var differencingTypeProperty))
{
foreach (var arrayItem in differencingTypeProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var differencingTypeExternalIdProperty))
{
var propertyValue = differencingTypeExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.differencingType.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the differencingType Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("directedFeature"u8, out var directedFeatureProperty))
{
foreach (var arrayItem in directedFeatureProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var directedFeatureExternalIdProperty))
{
var propertyValue = directedFeatureExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.directedFeature.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the directedFeature Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("direction"u8, out var directionProperty))
{
dtoInstance.Direction = FeatureDirectionKindDeSerializer.DeserializeNullable(directionProperty.GetString());
}
else
{
logger.LogDebug("the direction Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("documentation"u8, out var documentationProperty))
{
foreach (var arrayItem in documentationProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var documentationExternalIdProperty))
{
var propertyValue = documentationExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.documentation.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the documentation Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("elementId"u8, out var elementIdProperty))
{
var propertyValue = elementIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.ElementId = propertyValue;
}
}
else
{
logger.LogDebug("the elementId Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("endFeature"u8, out var endFeatureProperty))
{
foreach (var arrayItem in endFeatureProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var endFeatureExternalIdProperty))
{
var propertyValue = endFeatureExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.endFeature.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the endFeature Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("endOwningType"u8, out var endOwningTypeProperty))
{
if (endOwningTypeProperty.ValueKind == JsonValueKind.Null)
{
dtoInstance.endOwningType = null;
}
else
{
if (endOwningTypeProperty.TryGetProperty("@id"u8, out var endOwningTypeExternalIdProperty))
{
var propertyValue = endOwningTypeExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.endOwningType = Guid.Parse(propertyValue);
}
}
}
}
else
{
logger.LogDebug("the endOwningType Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("feature"u8, out var featureProperty))
{
foreach (var arrayItem in featureProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var featureExternalIdProperty))
{
var propertyValue = featureExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.feature.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the feature Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("featureMembership"u8, out var featureMembershipProperty))
{
foreach (var arrayItem in featureMembershipProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var featureMembershipExternalIdProperty))
{
var propertyValue = featureMembershipExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.featureMembership.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the featureMembership Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("featureTarget"u8, out var featureTargetProperty))
{
if (featureTargetProperty.ValueKind == JsonValueKind.Null)
{
dtoInstance.featureTarget = Guid.Empty;
logger.LogDebug($"the Feature.featureTarget property was not found in the Json. The value is set to Guid.Empty");
}
else
{
if (featureTargetProperty.TryGetProperty("@id"u8, out var featureTargetExternalIdProperty))
{
var propertyValue = featureTargetExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.featureTarget = Guid.Parse(propertyValue);
}
}
}
}
else
{
logger.LogDebug("the featureTarget Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("featuringType"u8, out var featuringTypeProperty))
{
foreach (var arrayItem in featuringTypeProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var featuringTypeExternalIdProperty))
{
var propertyValue = featuringTypeExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.featuringType.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the featuringType Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("importedMembership"u8, out var importedMembershipProperty))
{
foreach (var arrayItem in importedMembershipProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var importedMembershipExternalIdProperty))
{
var propertyValue = importedMembershipExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.importedMembership.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the importedMembership Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("inheritedFeature"u8, out var inheritedFeatureProperty))
{
foreach (var arrayItem in inheritedFeatureProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var inheritedFeatureExternalIdProperty))
{
var propertyValue = inheritedFeatureExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.inheritedFeature.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the inheritedFeature Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("inheritedMembership"u8, out var inheritedMembershipProperty))
{
foreach (var arrayItem in inheritedMembershipProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var inheritedMembershipExternalIdProperty))
{
var propertyValue = inheritedMembershipExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.inheritedMembership.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the inheritedMembership Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("input"u8, out var inputProperty))
{
foreach (var arrayItem in inputProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var inputExternalIdProperty))
{
var propertyValue = inputExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.input.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the input Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("intersectingType"u8, out var intersectingTypeProperty))
{
foreach (var arrayItem in intersectingTypeProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var intersectingTypeExternalIdProperty))
{
var propertyValue = intersectingTypeExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.intersectingType.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the intersectingType Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("isAbstract"u8, out var isAbstractProperty))
{
if (isAbstractProperty.ValueKind != JsonValueKind.Null)
{
dtoInstance.IsAbstract = isAbstractProperty.GetBoolean();
}
}
else
{
logger.LogDebug("the isAbstract Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("isComposite"u8, out var isCompositeProperty))
{
if (isCompositeProperty.ValueKind != JsonValueKind.Null)
{
dtoInstance.IsComposite = isCompositeProperty.GetBoolean();
}
}
else
{
logger.LogDebug("the isComposite Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("isConjugated"u8, out var isConjugatedProperty))
{
if (isConjugatedProperty.ValueKind != JsonValueKind.Null)
{
dtoInstance.isConjugated = isConjugatedProperty.GetBoolean();
}
}
else
{
logger.LogDebug("the isConjugated Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("isConstant"u8, out var isConstantProperty))
{
if (isConstantProperty.ValueKind != JsonValueKind.Null)
{
dtoInstance.IsConstant = isConstantProperty.GetBoolean();
}
}
else
{
logger.LogDebug("the isConstant Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("isDerived"u8, out var isDerivedProperty))
{
if (isDerivedProperty.ValueKind != JsonValueKind.Null)
{
dtoInstance.IsDerived = isDerivedProperty.GetBoolean();
}
}
else
{
logger.LogDebug("the isDerived Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("isEnd"u8, out var isEndProperty))
{
if (isEndProperty.ValueKind != JsonValueKind.Null)
{
dtoInstance.IsEnd = isEndProperty.GetBoolean();
}
}
else
{
logger.LogDebug("the isEnd Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("isImpliedIncluded"u8, out var isImpliedIncludedProperty))
{
if (isImpliedIncludedProperty.ValueKind != JsonValueKind.Null)
{
dtoInstance.IsImpliedIncluded = isImpliedIncludedProperty.GetBoolean();
}
}
else
{
logger.LogDebug("the isImpliedIncluded Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("isLibraryElement"u8, out var isLibraryElementProperty))
{
if (isLibraryElementProperty.ValueKind != JsonValueKind.Null)
{
dtoInstance.isLibraryElement = isLibraryElementProperty.GetBoolean();
}
}
else
{
logger.LogDebug("the isLibraryElement Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("isOrdered"u8, out var isOrderedProperty))
{
if (isOrderedProperty.ValueKind != JsonValueKind.Null)
{
dtoInstance.IsOrdered = isOrderedProperty.GetBoolean();
}
}
else
{
logger.LogDebug("the isOrdered Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("isPortion"u8, out var isPortionProperty))
{
if (isPortionProperty.ValueKind != JsonValueKind.Null)
{
dtoInstance.IsPortion = isPortionProperty.GetBoolean();
}
}
else
{
logger.LogDebug("the isPortion Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("isSufficient"u8, out var isSufficientProperty))
{
if (isSufficientProperty.ValueKind != JsonValueKind.Null)
{
dtoInstance.IsSufficient = isSufficientProperty.GetBoolean();
}
}
else
{
logger.LogDebug("the isSufficient Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("isUnique"u8, out var isUniqueProperty))
{
if (isUniqueProperty.ValueKind != JsonValueKind.Null)
{
dtoInstance.IsUnique = isUniqueProperty.GetBoolean();
}
}
else
{
logger.LogDebug("the isUnique Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("isVariable"u8, out var isVariableProperty))
{
if (isVariableProperty.ValueKind != JsonValueKind.Null)
{
dtoInstance.IsVariable = isVariableProperty.GetBoolean();
}
}
else
{
logger.LogDebug("the isVariable Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("member"u8, out var memberProperty))
{
foreach (var arrayItem in memberProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var memberExternalIdProperty))
{
var propertyValue = memberExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.member.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the member Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("membership"u8, out var membershipProperty))
{
foreach (var arrayItem in membershipProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var membershipExternalIdProperty))
{
var propertyValue = membershipExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.membership.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the membership Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("multiplicity"u8, out var multiplicityProperty))
{
if (multiplicityProperty.ValueKind == JsonValueKind.Null)
{
dtoInstance.multiplicity = null;
}
else
{
if (multiplicityProperty.TryGetProperty("@id"u8, out var multiplicityExternalIdProperty))
{
var propertyValue = multiplicityExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.multiplicity = Guid.Parse(propertyValue);
}
}
}
}
else
{
logger.LogDebug("the multiplicity Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("name"u8, out var nameProperty))
{
dtoInstance.name = nameProperty.GetString();
}
else
{
logger.LogDebug("the name Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("output"u8, out var outputProperty))
{
foreach (var arrayItem in outputProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var outputExternalIdProperty))
{
var propertyValue = outputExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.output.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the output Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("ownedAnnotation"u8, out var ownedAnnotationProperty))
{
foreach (var arrayItem in ownedAnnotationProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var ownedAnnotationExternalIdProperty))
{
var propertyValue = ownedAnnotationExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.ownedAnnotation.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the ownedAnnotation Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("ownedConjugator"u8, out var ownedConjugatorProperty))
{
if (ownedConjugatorProperty.ValueKind == JsonValueKind.Null)
{
dtoInstance.ownedConjugator = null;
}
else
{
if (ownedConjugatorProperty.TryGetProperty("@id"u8, out var ownedConjugatorExternalIdProperty))
{
var propertyValue = ownedConjugatorExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.ownedConjugator = Guid.Parse(propertyValue);
}
}
}
}
else
{
logger.LogDebug("the ownedConjugator Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("ownedCrossSubsetting"u8, out var ownedCrossSubsettingProperty))
{
if (ownedCrossSubsettingProperty.ValueKind == JsonValueKind.Null)
{
dtoInstance.ownedCrossSubsetting = null;
}
else
{
if (ownedCrossSubsettingProperty.TryGetProperty("@id"u8, out var ownedCrossSubsettingExternalIdProperty))
{
var propertyValue = ownedCrossSubsettingExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.ownedCrossSubsetting = Guid.Parse(propertyValue);
}
}
}
}
else
{
logger.LogDebug("the ownedCrossSubsetting Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("ownedDifferencing"u8, out var ownedDifferencingProperty))
{
foreach (var arrayItem in ownedDifferencingProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var ownedDifferencingExternalIdProperty))
{
var propertyValue = ownedDifferencingExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.ownedDifferencing.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the ownedDifferencing Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("ownedDisjoining"u8, out var ownedDisjoiningProperty))
{
foreach (var arrayItem in ownedDisjoiningProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var ownedDisjoiningExternalIdProperty))
{
var propertyValue = ownedDisjoiningExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.ownedDisjoining.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the ownedDisjoining Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("ownedElement"u8, out var ownedElementProperty))
{
foreach (var arrayItem in ownedElementProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var ownedElementExternalIdProperty))
{
var propertyValue = ownedElementExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.ownedElement.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the ownedElement Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("ownedEndFeature"u8, out var ownedEndFeatureProperty))
{
foreach (var arrayItem in ownedEndFeatureProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var ownedEndFeatureExternalIdProperty))
{
var propertyValue = ownedEndFeatureExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.ownedEndFeature.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the ownedEndFeature Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("ownedFeature"u8, out var ownedFeatureProperty))
{
foreach (var arrayItem in ownedFeatureProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var ownedFeatureExternalIdProperty))
{
var propertyValue = ownedFeatureExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.ownedFeature.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the ownedFeature Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("ownedFeatureChaining"u8, out var ownedFeatureChainingProperty))
{
foreach (var arrayItem in ownedFeatureChainingProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var ownedFeatureChainingExternalIdProperty))
{
var propertyValue = ownedFeatureChainingExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.ownedFeatureChaining.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the ownedFeatureChaining Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("ownedFeatureInverting"u8, out var ownedFeatureInvertingProperty))
{
foreach (var arrayItem in ownedFeatureInvertingProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var ownedFeatureInvertingExternalIdProperty))
{
var propertyValue = ownedFeatureInvertingExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.ownedFeatureInverting.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the ownedFeatureInverting Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("ownedFeatureMembership"u8, out var ownedFeatureMembershipProperty))
{
foreach (var arrayItem in ownedFeatureMembershipProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var ownedFeatureMembershipExternalIdProperty))
{
var propertyValue = ownedFeatureMembershipExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.ownedFeatureMembership.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the ownedFeatureMembership Json property was not found in the Feature: {Id}", dtoInstance.Id);
}
if (jsonElement.TryGetProperty("ownedImport"u8, out var ownedImportProperty))
{
foreach (var arrayItem in ownedImportProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var ownedImportExternalIdProperty))
{
var propertyValue = ownedImportExternalIdProperty.GetString();
if (propertyValue != null)
{
dtoInstance.ownedImport.Add(Guid.Parse(propertyValue));
}
}
}
}