@@ -69,7 +69,7 @@ internal static IAnnotatingElement DeSerialize(JsonElement jsonElement, Serializ
6969 throw new InvalidOperationException ( $ "The AnnotatingElementDeSerializer can only be used to deserialize objects of type IAnnotatingElement, a { @type . GetString ( ) } was provided") ;
7070 }
7171
72- IAnnotatingElement dtoInstance = new SysML2 . NET . Core . DTO . Root . Annotations . AnnotatingElement ( ) ;
72+ var dtoInstance = new SysML2 . NET . Core . DTO . Root . Annotations . AnnotatingElement ( ) ;
7373
7474 if ( jsonElement . TryGetProperty ( "@id"u8 , out var idProperty ) )
7575 {
@@ -102,6 +102,46 @@ internal static IAnnotatingElement DeSerialize(JsonElement jsonElement, Serializ
102102 logger . LogDebug ( "the aliasIds Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
103103 }
104104
105+ if ( jsonElement . TryGetProperty ( "annotatedElement"u8 , out var annotatedElementProperty ) )
106+ {
107+ foreach ( var arrayItem in annotatedElementProperty . EnumerateArray ( ) )
108+ {
109+ if ( arrayItem . TryGetProperty ( "@id"u8 , out var annotatedElementExternalIdProperty ) )
110+ {
111+ var propertyValue = annotatedElementExternalIdProperty . GetString ( ) ;
112+
113+ if ( propertyValue != null )
114+ {
115+ dtoInstance . annotatedElement . Add ( Guid . Parse ( propertyValue ) ) ;
116+ }
117+ }
118+ }
119+ }
120+ else
121+ {
122+ logger . LogDebug ( "the annotatedElement Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
123+ }
124+
125+ if ( jsonElement . TryGetProperty ( "annotation"u8 , out var annotationProperty ) )
126+ {
127+ foreach ( var arrayItem in annotationProperty . EnumerateArray ( ) )
128+ {
129+ if ( arrayItem . TryGetProperty ( "@id"u8 , out var annotationExternalIdProperty ) )
130+ {
131+ var propertyValue = annotationExternalIdProperty . GetString ( ) ;
132+
133+ if ( propertyValue != null )
134+ {
135+ dtoInstance . annotation . Add ( Guid . Parse ( propertyValue ) ) ;
136+ }
137+ }
138+ }
139+ }
140+ else
141+ {
142+ logger . LogDebug ( "the annotation Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
143+ }
144+
105145 if ( jsonElement . TryGetProperty ( "declaredName"u8 , out var declaredNameProperty ) )
106146 {
107147 dtoInstance . DeclaredName = declaredNameProperty . GetString ( ) ;
@@ -120,6 +160,26 @@ internal static IAnnotatingElement DeSerialize(JsonElement jsonElement, Serializ
120160 logger . LogDebug ( "the declaredShortName Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
121161 }
122162
163+ if ( jsonElement . TryGetProperty ( "documentation"u8 , out var documentationProperty ) )
164+ {
165+ foreach ( var arrayItem in documentationProperty . EnumerateArray ( ) )
166+ {
167+ if ( arrayItem . TryGetProperty ( "@id"u8 , out var documentationExternalIdProperty ) )
168+ {
169+ var propertyValue = documentationExternalIdProperty . GetString ( ) ;
170+
171+ if ( propertyValue != null )
172+ {
173+ dtoInstance . documentation . Add ( Guid . Parse ( propertyValue ) ) ;
174+ }
175+ }
176+ }
177+ }
178+ else
179+ {
180+ logger . LogDebug ( "the documentation Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
181+ }
182+
123183 if ( jsonElement . TryGetProperty ( "elementId"u8 , out var elementIdProperty ) )
124184 {
125185 var propertyValue = elementIdProperty . GetString ( ) ;
@@ -146,13 +206,94 @@ internal static IAnnotatingElement DeSerialize(JsonElement jsonElement, Serializ
146206 logger . LogDebug ( "the isImpliedIncluded Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
147207 }
148208
209+ if ( jsonElement . TryGetProperty ( "isLibraryElement"u8 , out var isLibraryElementProperty ) )
210+ {
211+ if ( isLibraryElementProperty . ValueKind != JsonValueKind . Null )
212+ {
213+ dtoInstance . isLibraryElement = isLibraryElementProperty . GetBoolean ( ) ;
214+ }
215+ }
216+ else
217+ {
218+ logger . LogDebug ( "the isLibraryElement Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
219+ }
220+
221+ if ( jsonElement . TryGetProperty ( "name"u8 , out var nameProperty ) )
222+ {
223+ dtoInstance . name = nameProperty . GetString ( ) ;
224+ }
225+ else
226+ {
227+ logger . LogDebug ( "the name Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
228+ }
229+
230+ if ( jsonElement . TryGetProperty ( "ownedAnnotatingRelationship"u8 , out var ownedAnnotatingRelationshipProperty ) )
231+ {
232+ foreach ( var arrayItem in ownedAnnotatingRelationshipProperty . EnumerateArray ( ) )
233+ {
234+ if ( arrayItem . TryGetProperty ( "@id"u8 , out var ownedAnnotatingRelationshipExternalIdProperty ) )
235+ {
236+ var propertyValue = ownedAnnotatingRelationshipExternalIdProperty . GetString ( ) ;
237+
238+ if ( propertyValue != null )
239+ {
240+ dtoInstance . ownedAnnotatingRelationship . Add ( Guid . Parse ( propertyValue ) ) ;
241+ }
242+ }
243+ }
244+ }
245+ else
246+ {
247+ logger . LogDebug ( "the ownedAnnotatingRelationship Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
248+ }
249+
250+ if ( jsonElement . TryGetProperty ( "ownedAnnotation"u8 , out var ownedAnnotationProperty ) )
251+ {
252+ foreach ( var arrayItem in ownedAnnotationProperty . EnumerateArray ( ) )
253+ {
254+ if ( arrayItem . TryGetProperty ( "@id"u8 , out var ownedAnnotationExternalIdProperty ) )
255+ {
256+ var propertyValue = ownedAnnotationExternalIdProperty . GetString ( ) ;
257+
258+ if ( propertyValue != null )
259+ {
260+ dtoInstance . ownedAnnotation . Add ( Guid . Parse ( propertyValue ) ) ;
261+ }
262+ }
263+ }
264+ }
265+ else
266+ {
267+ logger . LogDebug ( "the ownedAnnotation Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
268+ }
269+
270+ if ( jsonElement . TryGetProperty ( "ownedElement"u8 , out var ownedElementProperty ) )
271+ {
272+ foreach ( var arrayItem in ownedElementProperty . EnumerateArray ( ) )
273+ {
274+ if ( arrayItem . TryGetProperty ( "@id"u8 , out var ownedElementExternalIdProperty ) )
275+ {
276+ var propertyValue = ownedElementExternalIdProperty . GetString ( ) ;
277+
278+ if ( propertyValue != null )
279+ {
280+ dtoInstance . ownedElement . Add ( Guid . Parse ( propertyValue ) ) ;
281+ }
282+ }
283+ }
284+ }
285+ else
286+ {
287+ logger . LogDebug ( "the ownedElement Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
288+ }
289+
149290 if ( jsonElement . TryGetProperty ( "ownedRelationship"u8 , out var ownedRelationshipProperty ) )
150291 {
151292 foreach ( var arrayItem in ownedRelationshipProperty . EnumerateArray ( ) )
152293 {
153- if ( arrayItem . TryGetProperty ( "@id"u8 , out var ownedRelationshipIdProperty ) )
294+ if ( arrayItem . TryGetProperty ( "@id"u8 , out var ownedRelationshipExternalIdProperty ) )
154295 {
155- var propertyValue = ownedRelationshipIdProperty . GetString ( ) ;
296+ var propertyValue = ownedRelationshipExternalIdProperty . GetString ( ) ;
156297
157298 if ( propertyValue != null )
158299 {
@@ -166,6 +307,102 @@ internal static IAnnotatingElement DeSerialize(JsonElement jsonElement, Serializ
166307 logger . LogDebug ( "the ownedRelationship Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
167308 }
168309
310+ if ( jsonElement . TryGetProperty ( "owner"u8 , out var ownerProperty ) )
311+ {
312+ if ( ownerProperty . ValueKind == JsonValueKind . Null )
313+ {
314+ dtoInstance . owner = null ;
315+ }
316+ else
317+ {
318+ if ( ownerProperty . TryGetProperty ( "@id"u8 , out var ownerExternalIdProperty ) )
319+ {
320+ var propertyValue = ownerExternalIdProperty . GetString ( ) ;
321+
322+ if ( propertyValue != null )
323+ {
324+ dtoInstance . owner = Guid . Parse ( propertyValue ) ;
325+ }
326+ }
327+ }
328+ }
329+ else
330+ {
331+ logger . LogDebug ( "the owner Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
332+ }
333+
334+ if ( jsonElement . TryGetProperty ( "owningAnnotatingRelationship"u8 , out var owningAnnotatingRelationshipProperty ) )
335+ {
336+ if ( owningAnnotatingRelationshipProperty . ValueKind == JsonValueKind . Null )
337+ {
338+ dtoInstance . owningAnnotatingRelationship = null ;
339+ }
340+ else
341+ {
342+ if ( owningAnnotatingRelationshipProperty . TryGetProperty ( "@id"u8 , out var owningAnnotatingRelationshipExternalIdProperty ) )
343+ {
344+ var propertyValue = owningAnnotatingRelationshipExternalIdProperty . GetString ( ) ;
345+
346+ if ( propertyValue != null )
347+ {
348+ dtoInstance . owningAnnotatingRelationship = Guid . Parse ( propertyValue ) ;
349+ }
350+ }
351+ }
352+ }
353+ else
354+ {
355+ logger . LogDebug ( "the owningAnnotatingRelationship Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
356+ }
357+
358+ if ( jsonElement . TryGetProperty ( "owningMembership"u8 , out var owningMembershipProperty ) )
359+ {
360+ if ( owningMembershipProperty . ValueKind == JsonValueKind . Null )
361+ {
362+ dtoInstance . owningMembership = null ;
363+ }
364+ else
365+ {
366+ if ( owningMembershipProperty . TryGetProperty ( "@id"u8 , out var owningMembershipExternalIdProperty ) )
367+ {
368+ var propertyValue = owningMembershipExternalIdProperty . GetString ( ) ;
369+
370+ if ( propertyValue != null )
371+ {
372+ dtoInstance . owningMembership = Guid . Parse ( propertyValue ) ;
373+ }
374+ }
375+ }
376+ }
377+ else
378+ {
379+ logger . LogDebug ( "the owningMembership Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
380+ }
381+
382+ if ( jsonElement . TryGetProperty ( "owningNamespace"u8 , out var owningNamespaceProperty ) )
383+ {
384+ if ( owningNamespaceProperty . ValueKind == JsonValueKind . Null )
385+ {
386+ dtoInstance . owningNamespace = null ;
387+ }
388+ else
389+ {
390+ if ( owningNamespaceProperty . TryGetProperty ( "@id"u8 , out var owningNamespaceExternalIdProperty ) )
391+ {
392+ var propertyValue = owningNamespaceExternalIdProperty . GetString ( ) ;
393+
394+ if ( propertyValue != null )
395+ {
396+ dtoInstance . owningNamespace = Guid . Parse ( propertyValue ) ;
397+ }
398+ }
399+ }
400+ }
401+ else
402+ {
403+ logger . LogDebug ( "the owningNamespace Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
404+ }
405+
169406 if ( jsonElement . TryGetProperty ( "owningRelationship"u8 , out var owningRelationshipProperty ) )
170407 {
171408 if ( owningRelationshipProperty . ValueKind == JsonValueKind . Null )
@@ -174,9 +411,9 @@ internal static IAnnotatingElement DeSerialize(JsonElement jsonElement, Serializ
174411 }
175412 else
176413 {
177- if ( owningRelationshipProperty . TryGetProperty ( "@id"u8 , out var owningRelationshipIdProperty ) )
414+ if ( owningRelationshipProperty . TryGetProperty ( "@id"u8 , out var owningRelationshipExternalIdProperty ) )
178415 {
179- var propertyValue = owningRelationshipIdProperty . GetString ( ) ;
416+ var propertyValue = owningRelationshipExternalIdProperty . GetString ( ) ;
180417
181418 if ( propertyValue != null )
182419 {
@@ -190,6 +427,44 @@ internal static IAnnotatingElement DeSerialize(JsonElement jsonElement, Serializ
190427 logger . LogDebug ( "the owningRelationship Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
191428 }
192429
430+ if ( jsonElement . TryGetProperty ( "qualifiedName"u8 , out var qualifiedNameProperty ) )
431+ {
432+ dtoInstance . qualifiedName = qualifiedNameProperty . GetString ( ) ;
433+ }
434+ else
435+ {
436+ logger . LogDebug ( "the qualifiedName Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
437+ }
438+
439+ if ( jsonElement . TryGetProperty ( "shortName"u8 , out var shortNameProperty ) )
440+ {
441+ dtoInstance . shortName = shortNameProperty . GetString ( ) ;
442+ }
443+ else
444+ {
445+ logger . LogDebug ( "the shortName Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
446+ }
447+
448+ if ( jsonElement . TryGetProperty ( "textualRepresentation"u8 , out var textualRepresentationProperty ) )
449+ {
450+ foreach ( var arrayItem in textualRepresentationProperty . EnumerateArray ( ) )
451+ {
452+ if ( arrayItem . TryGetProperty ( "@id"u8 , out var textualRepresentationExternalIdProperty ) )
453+ {
454+ var propertyValue = textualRepresentationExternalIdProperty . GetString ( ) ;
455+
456+ if ( propertyValue != null )
457+ {
458+ dtoInstance . textualRepresentation . Add ( Guid . Parse ( propertyValue ) ) ;
459+ }
460+ }
461+ }
462+ }
463+ else
464+ {
465+ logger . LogDebug ( "the textualRepresentation Json property was not found in the AnnotatingElement: { Id }" , dtoInstance . Id ) ;
466+ }
467+
193468
194469 return dtoInstance ;
195470 }
0 commit comments