Skip to content

Commit

Permalink
Add Gueltig and Qualitaet to BusinessObject (#534)
Browse files Browse the repository at this point in the history
* update projects

* Add Gueltig and Qualitaet to businessobject

* Update name to gueltigkeitszeitraum + add some docstrings
  • Loading branch information
JoschaMetze authored Sep 23, 2024
1 parent 7cd7e2a commit 5c69bea
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 159 deletions.
4 changes: 3 additions & 1 deletion BO4E.Extensions/BO4E.Extensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@

<ItemGroup>
<PackageReference Include="TimePeriodLibrary.NET" Version="2.1.5" />
<None Include="..\LICENSE.txt">
<PackageReference Include="System.Net.Http" Version="4.3.*" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.*" />
<None Include="..\LICENSE.txt">
<Pack>True</Pack>
<PackagePath />
</None>
Expand Down
5 changes: 5 additions & 0 deletions BO4E.Reporting/Report.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ Dictionary<List<string>, List<string>> returnData
}
else
{
if (field is null || value is null)
{
continue;
}

var nestedValue = field.GetValue(value);
if (nestedValue != null)
{
Expand Down
39 changes: 39 additions & 0 deletions BO4E/BO/BusinessObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ public abstract class BusinessObject : IUserProperties, IOptionalGuid
[ProtoIgnore]
public const string USER_PROPERTIES_NAME = "userProperties";

/// <summary>
/// define common property name for gueltigkeit
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[ProtoIgnore]
public const string GUELTIGKEIT_PROPERTIES_NAME = "gueltigkeitszeitraum";

/// <summary>
/// generates the BO4E boTyp attribute value (class name as upper case)
/// </summary>
Expand Down Expand Up @@ -218,6 +226,37 @@ protected DateTime _TimeStamp
[System.Text.Json.Serialization.JsonExtensionData]
public IDictionary<string, object>? UserProperties { get; set; }

/// <summary>
/// Defines the validity of a business object in terms of time (maybe multiple versions exist).
/// Background: German market communication requires for master data changes starting 03.04.2025 that business objects are ordered and aggregated by validity (in terms of time).
/// To easily group data based on this data a new zeitraum is introduced as an optional field in all business objects.
/// </summary>
[JsonProperty(
PropertyName = GUELTIGKEIT_PROPERTIES_NAME,
Required = Required.Default,
DefaultValueHandling = DefaultValueHandling.Ignore,
Order = 201
)]
[ProtoMember(201)]
[JsonPropertyName(GUELTIGKEIT_PROPERTIES_NAME)]
[JsonPropertyOrder(201)]
public COM.Zeitraum? Gueltigkeitszeitraum { get; set; }

/// <summary>
/// Defines a level of data quality that is attached to the business object, this can have multiple origins, you could specify a version as draft or uncomplete if this is in the state of creation.
/// Another requirement is coming from german market communictation where business objects of different quality levels need to be grouped.
/// </summary>
[JsonProperty(
PropertyName = "qualitaet",
Required = Required.Default,
DefaultValueHandling = DefaultValueHandling.Ignore,
Order = 202
)]
[JsonPropertyName("qualitaet")]
[ProtoMember(202)]
[JsonPropertyOrder(202)]
public ENUM.Qualitaet? Qualitaet { get; set; }

/// <summary>
/// true iff any of the keys in <see cref="UserProperties"/> is the same as a property name of the class itself.
/// Example:
Expand Down
39 changes: 39 additions & 0 deletions BO4E/ENUM/Qualitaet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Runtime.Serialization;
using ProtoBuf;

namespace BO4E.ENUM;

/// <summary>Qualitätsstufen eines Business-Objektes, v.a. aus Sicht Marktkommunikation </summary>
public enum Qualitaet
{
/// <summary>Vollstaendig</summary>
[EnumMember(Value = "VOLLSTAENDIG")]
[ProtoEnum(Name = nameof(Qualitaet) + "_" + nameof(VOLLSTAENDIG))]
VOLLSTAENDIG,

/// <summary>Informativ
/// </summary>
[EnumMember(Value = "INFORMATIV")]
[ProtoEnum(Name = nameof(Qualitaet) + "_" + nameof(INFORMATIV))]
INFORMATIV,

/// <summary>Im System vorhanden</summary>
[EnumMember(Value = "IM_SYSTEM_VORHANDEN")]
[ProtoEnum(Name = nameof(Qualitaet) + "_" + nameof(IM_SYSTEM_VORHANDEN))]
IM_SYSTEM_VORHANDEN,

/// <summary>Erwartet</summary>
[EnumMember(Value = "ERWARTET")]
[ProtoEnum(Name = nameof(Qualitaet) + "_" + nameof(ERWARTET))]
ERWARTET,

/// <summary>Vorlaeufig</summary>
[EnumMember(Value = "VORLAEUFIG")]
[ProtoEnum(Name = nameof(Qualitaet) + "_" + nameof(VORLAEUFIG))]
VORLAEUFIG,

/// <summary>Unvollstaendig</summary>
[EnumMember(Value = "UNVOLLSTAENDIG")]
[ProtoEnum(Name = nameof(Qualitaet) + "_" + nameof(UNVOLLSTAENDIG))]
UNVOLLSTAENDIG,
}
Loading

0 comments on commit 5c69bea

Please sign in to comment.