Files
biztalk-application-catalog/src/BizTalkApplicationCatalog/Models/InventoryModels.cs
T

127 lines
3.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
namespace BizTalkApplicationCatalog.Models
{
/// <summary>
/// Arbeitsmodell eines lokalen, ausschließlich lesenden Inventarlaufs.
/// </summary>
internal sealed class InventoryDocument
{
public InventoryDocument()
{
Applications = new List<ApplicationRecord>();
Endpoints = new List<EndpointRecord>();
Findings = new List<Finding>();
SectionStatuses = new List<SectionStatus>();
}
public string EnvironmentName { get; set; }
public string ComputerName { get; set; }
public DateTime StartedUtc { get; set; }
public DateTime CompletedUtc { get; set; }
public List<ApplicationRecord> Applications { get; private set; }
public List<EndpointRecord> Endpoints { get; private set; }
public List<Finding> Findings { get; private set; }
public List<SectionStatus> SectionStatuses { get; private set; }
public bool HasRequiredFailure
{
get
{
return SectionStatuses.Any(item => item.Required && item.Status != "Erfolgreich")
|| Findings.Any(item => item.Severity == "Fehler");
}
}
}
internal sealed class ApplicationRecord
{
public string Name { get; set; }
}
internal sealed class EndpointRecord
{
public string ApplicationName { get; set; }
public string AdapterType { get; set; }
}
internal sealed class Finding
{
public string Severity { get; set; }
public string Area { get; set; }
public string Message { get; set; }
public string RecommendedAction { get; set; }
}
internal sealed class SectionStatus
{
public string Name { get; set; }
public string Status { get; set; }
public string Message { get; set; }
public bool Required { get; set; }
public long DurationMilliseconds { get; set; }
}
/// <summary>
/// Kleines, transportierbares JSON-Modell für den ACC/PRD-Abgleich.
/// </summary>
[DataContract]
internal sealed class CatalogSnapshot
{
public CatalogSnapshot()
{
SchemaVersion = 1;
Applications = new List<CatalogApplication>();
}
[DataMember(Order = 1)]
public int SchemaVersion { get; set; }
[DataMember(Order = 2)]
public string EnvironmentName { get; set; }
[DataMember(Order = 3)]
public string ComputerName { get; set; }
[DataMember(Order = 4)]
public string CreatedUtc { get; set; }
[DataMember(Order = 5)]
public bool IsComplete { get; set; }
[DataMember(Order = 6)]
public List<CatalogApplication> Applications { get; set; }
}
[DataContract]
internal sealed class CatalogApplication
{
public CatalogApplication()
{
AdapterCounts = new List<AdapterCount>();
}
[DataMember(Order = 1)]
public string Name { get; set; }
[DataMember(Order = 2)]
public int EndpointCount { get; set; }
[DataMember(Order = 3)]
public List<AdapterCount> AdapterCounts { get; set; }
}
[DataContract]
internal sealed class AdapterCount
{
[DataMember(Order = 1)]
public string AdapterType { get; set; }
[DataMember(Order = 2)]
public int Count { get; set; }
}
}