Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ internal static IAnnotatingElement DeSerialize(JsonElement jsonElement, Serializ
throw new InvalidOperationException($"The AnnotatingElementDeSerializer can only be used to deserialize objects of type IAnnotatingElement, a {@type.GetString()} was provided");
}

IAnnotatingElement dtoInstance = new SysML2.NET.Core.DTO.Root.Annotations.AnnotatingElement();
var dtoInstance = new SysML2.NET.Core.DTO.Root.Annotations.AnnotatingElement();

if (jsonElement.TryGetProperty("@id"u8, out var idProperty))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ internal static IAssociation DeSerialize(JsonElement jsonElement, SerializationM
throw new InvalidOperationException($"The AssociationDeSerializer can only be used to deserialize objects of type IAssociation, a {@type.GetString()} was provided");
}

IAssociation dtoInstance = new SysML2.NET.Core.DTO.Kernel.Associations.Association();
var dtoInstance = new SysML2.NET.Core.DTO.Kernel.Associations.Association();

if (jsonElement.TryGetProperty("@id"u8, out var idProperty))
{
Expand Down Expand Up @@ -270,46 +270,6 @@ internal static IAssociation DeSerialize(JsonElement jsonElement, SerializationM
logger.LogDebug("the owningRelationship Json property was not found in the Association: { Id }", dtoInstance.Id);
}

if (jsonElement.TryGetProperty("source"u8, out var sourceProperty))
{
foreach (var arrayItem in sourceProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var sourceIdProperty))
{
var propertyValue = sourceIdProperty.GetString();

if (propertyValue != null)
{
dtoInstance.Source.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the source Json property was not found in the Association: { Id }", dtoInstance.Id);
}

if (jsonElement.TryGetProperty("target"u8, out var targetProperty))
{
foreach (var arrayItem in targetProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var targetIdProperty))
{
var propertyValue = targetIdProperty.GetString();

if (propertyValue != null)
{
dtoInstance.Target.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the target Json property was not found in the Association: { Id }", dtoInstance.Id);
}


return dtoInstance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ internal static IDependency DeSerialize(JsonElement jsonElement, SerializationMo
throw new InvalidOperationException($"The DependencyDeSerializer can only be used to deserialize objects of type IDependency, a {@type.GetString()} was provided");
}

IDependency dtoInstance = new SysML2.NET.Core.DTO.Root.Dependencies.Dependency();
var dtoInstance = new SysML2.NET.Core.DTO.Root.Dependencies.Dependency();

if (jsonElement.TryGetProperty("@id"u8, out var idProperty))
{
Expand Down Expand Up @@ -266,26 +266,6 @@ internal static IDependency DeSerialize(JsonElement jsonElement, SerializationMo
logger.LogDebug("the owningRelationship Json property was not found in the Dependency: { Id }", dtoInstance.Id);
}

if (jsonElement.TryGetProperty("source"u8, out var sourceProperty))
{
foreach (var arrayItem in sourceProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var sourceIdProperty))
{
var propertyValue = sourceIdProperty.GetString();

if (propertyValue != null)
{
dtoInstance.Source.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the source Json property was not found in the Dependency: { Id }", dtoInstance.Id);
}

if (jsonElement.TryGetProperty("supplier"u8, out var supplierProperty))
{
foreach (var arrayItem in supplierProperty.EnumerateArray())
Expand All @@ -306,26 +286,6 @@ internal static IDependency DeSerialize(JsonElement jsonElement, SerializationMo
logger.LogDebug("the supplier Json property was not found in the Dependency: { Id }", dtoInstance.Id);
}

if (jsonElement.TryGetProperty("target"u8, out var targetProperty))
{
foreach (var arrayItem in targetProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var targetIdProperty))
{
var propertyValue = targetIdProperty.GetString();

if (propertyValue != null)
{
dtoInstance.Target.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the target Json property was not found in the Dependency: { Id }", dtoInstance.Id);
}


return dtoInstance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ internal static IEnumerationDefinition DeSerialize(JsonElement jsonElement, Seri
throw new InvalidOperationException($"The EnumerationDefinitionDeSerializer can only be used to deserialize objects of type IEnumerationDefinition, a {@type.GetString()} was provided");
}

IEnumerationDefinition dtoInstance = new SysML2.NET.Core.DTO.Systems.Enumerations.EnumerationDefinition();
var dtoInstance = new SysML2.NET.Core.DTO.Systems.Enumerations.EnumerationDefinition();

if (jsonElement.TryGetProperty("@id"u8, out var idProperty))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ internal static IFeature DeSerialize(JsonElement jsonElement, SerializationModeK
throw new InvalidOperationException($"The FeatureDeSerializer can only be used to deserialize objects of type IFeature, a {@type.GetString()} was provided");
}

IFeature dtoInstance = new SysML2.NET.Core.DTO.Core.Features.Feature();
var dtoInstance = new SysML2.NET.Core.DTO.Core.Features.Feature();

if (jsonElement.TryGetProperty("@id"u8, out var idProperty))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ internal static IFeatureTyping DeSerialize(JsonElement jsonElement, Serializatio
throw new InvalidOperationException($"The FeatureTypingDeSerializer can only be used to deserialize objects of type IFeatureTyping, a {@type.GetString()} was provided");
}

IFeatureTyping dtoInstance = new SysML2.NET.Core.DTO.Core.Features.FeatureTyping();
var dtoInstance = new SysML2.NET.Core.DTO.Core.Features.FeatureTyping();

if (jsonElement.TryGetProperty("@id"u8, out var idProperty))
{
Expand Down Expand Up @@ -134,31 +134,6 @@ internal static IFeatureTyping DeSerialize(JsonElement jsonElement, Serializatio
logger.LogDebug("the elementId Json property was not found in the FeatureTyping: { Id }", dtoInstance.Id);
}

if (jsonElement.TryGetProperty("general"u8, out var generalProperty))
{
if (generalProperty.ValueKind == JsonValueKind.Null)
{
dtoInstance.General = Guid.Empty;
logger.LogDebug($"the FeatureTyping.General property was not found in the Json. The value is set to Guid.Empty");
}
else
{
if (generalProperty.TryGetProperty("@id"u8, out var generalIdProperty))
{
var propertyValue = generalIdProperty.GetString();

if (propertyValue != null)
{
dtoInstance.General = Guid.Parse(propertyValue);
}
}
}
}
else
{
logger.LogDebug("the general Json property was not found in the FeatureTyping: { Id }", dtoInstance.Id);
}

if (jsonElement.TryGetProperty("isImplied"u8, out var isImpliedProperty))
{
if (isImpliedProperty.ValueKind != JsonValueKind.Null)
Expand Down Expand Up @@ -271,71 +246,6 @@ internal static IFeatureTyping DeSerialize(JsonElement jsonElement, Serializatio
logger.LogDebug("the owningRelationship Json property was not found in the FeatureTyping: { Id }", dtoInstance.Id);
}

if (jsonElement.TryGetProperty("source"u8, out var sourceProperty))
{
foreach (var arrayItem in sourceProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var sourceIdProperty))
{
var propertyValue = sourceIdProperty.GetString();

if (propertyValue != null)
{
dtoInstance.Source.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the source Json property was not found in the FeatureTyping: { Id }", dtoInstance.Id);
}

if (jsonElement.TryGetProperty("specific"u8, out var specificProperty))
{
if (specificProperty.ValueKind == JsonValueKind.Null)
{
dtoInstance.Specific = Guid.Empty;
logger.LogDebug($"the FeatureTyping.Specific property was not found in the Json. The value is set to Guid.Empty");
}
else
{
if (specificProperty.TryGetProperty("@id"u8, out var specificIdProperty))
{
var propertyValue = specificIdProperty.GetString();

if (propertyValue != null)
{
dtoInstance.Specific = Guid.Parse(propertyValue);
}
}
}
}
else
{
logger.LogDebug("the specific Json property was not found in the FeatureTyping: { Id }", dtoInstance.Id);
}

if (jsonElement.TryGetProperty("target"u8, out var targetProperty))
{
foreach (var arrayItem in targetProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var targetIdProperty))
{
var propertyValue = targetIdProperty.GetString();

if (propertyValue != null)
{
dtoInstance.Target.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the target Json property was not found in the FeatureTyping: { Id }", dtoInstance.Id);
}

if (jsonElement.TryGetProperty("type"u8, out var typeProperty))
{
if (typeProperty.ValueKind == JsonValueKind.Null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ internal static IFlow DeSerialize(JsonElement jsonElement, SerializationModeKind
throw new InvalidOperationException($"The FlowDeSerializer can only be used to deserialize objects of type IFlow, a {@type.GetString()} was provided");
}

IFlow dtoInstance = new SysML2.NET.Core.DTO.Kernel.Interactions.Flow();
var dtoInstance = new SysML2.NET.Core.DTO.Kernel.Interactions.Flow();

if (jsonElement.TryGetProperty("@id"u8, out var idProperty))
{
Expand Down Expand Up @@ -375,46 +375,6 @@ internal static IFlow DeSerialize(JsonElement jsonElement, SerializationModeKind
logger.LogDebug("the owningRelationship Json property was not found in the Flow: { Id }", dtoInstance.Id);
}

if (jsonElement.TryGetProperty("source"u8, out var sourceProperty))
{
foreach (var arrayItem in sourceProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var sourceIdProperty))
{
var propertyValue = sourceIdProperty.GetString();

if (propertyValue != null)
{
dtoInstance.Source.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the source Json property was not found in the Flow: { Id }", dtoInstance.Id);
}

if (jsonElement.TryGetProperty("target"u8, out var targetProperty))
{
foreach (var arrayItem in targetProperty.EnumerateArray())
{
if (arrayItem.TryGetProperty("@id"u8, out var targetIdProperty))
{
var propertyValue = targetIdProperty.GetString();

if (propertyValue != null)
{
dtoInstance.Target.Add(Guid.Parse(propertyValue));
}
}
}
}
else
{
logger.LogDebug("the target Json property was not found in the Flow: { Id }", dtoInstance.Id);
}


return dtoInstance;
}
Expand Down
Loading
Loading