-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fixes #1832 individual serialization * PR feedback
- Loading branch information
1 parent
6170cc3
commit 82b06c0
Showing
9 changed files
with
100 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
using OSPSuite.Utility.Collections; | ||
|
||
namespace OSPSuite.Core.Domain.Builder | ||
namespace OSPSuite.Core.Domain.Builder | ||
{ | ||
public class IndividualBuildingBlock : PathAndValueEntityBuildingBlockFromPKSim<IndividualParameter> | ||
{ | ||
public Cache<string, string> OriginData { set; get; } = new Cache<string, string>(); | ||
public ValueOrigin ValueOrigin { set; get; } | ||
public CalculationMethodCache CalculationMethodCache { set; get; } | ||
public OriginDataItems OriginData { get; } = new OriginDataItems(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace OSPSuite.Core.Domain.Builder | ||
{ | ||
public class OriginDataItem | ||
{ | ||
public string Name { get; set; } | ||
public string DisplayName { get; set; } | ||
public string Description { get; set; } | ||
public string Icon { get; set; } | ||
public string Value { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using OSPSuite.Utility.Collections; | ||
|
||
namespace OSPSuite.Core.Domain.Builder | ||
{ | ||
public class OriginDataItems | ||
{ | ||
private readonly Cache<string, OriginDataItem> _cache = new Cache<string, OriginDataItem>(getKey: x => x.Name); | ||
|
||
public IReadOnlyList<OriginDataItem> AllDataItems => _cache.ToList(); | ||
|
||
public ValueOrigin ValueOrigin { set; get; } | ||
|
||
public void AddOriginDataItem(OriginDataItem originDataItem) | ||
{ | ||
_cache[originDataItem.Name]= originDataItem; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/OSPSuite.Core/Serialization/Xml/IndividualParameterXmlSerializer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using OSPSuite.Core.Domain.Builder; | ||
|
||
namespace OSPSuite.Core.Serialization.Xml | ||
{ | ||
public class IndividualParameterXmlSerializer : PathAndValueEntityXmlSerializer<IndividualParameter> | ||
{ | ||
|
||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/OSPSuite.Core/Serialization/Xml/OriginDataItemXmlSerializer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using OSPSuite.Core.Domain.Builder; | ||
|
||
namespace OSPSuite.Core.Serialization.Xml | ||
{ | ||
public class OriginDataItemXmlSerializer : OSPSuiteXmlSerializer<OriginDataItem> | ||
{ | ||
public override void PerformMapping() | ||
{ | ||
Map(x => x.Value); | ||
Map(x => x.Description); | ||
Map(x => x.Name); | ||
Map(x => x.DisplayName); | ||
Map(x => x.Icon); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/OSPSuite.Core/Serialization/Xml/OriginDataItemsXmlSerializer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using OSPSuite.Core.Domain.Builder; | ||
|
||
namespace OSPSuite.Core.Serialization.Xml | ||
{ | ||
public class OriginDataItemsXmlSerializer : OSPSuiteXmlSerializer<OriginDataItems> | ||
{ | ||
protected OriginDataItemsXmlSerializer(string name) | ||
: base(name) | ||
{ | ||
} | ||
|
||
protected OriginDataItemsXmlSerializer() | ||
{ | ||
} | ||
|
||
public override void PerformMapping() | ||
{ | ||
Map(x => x.ValueOrigin); | ||
MapEnumerable(x => x.AllDataItems, x=> x.AddOriginDataItem); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters