190 lines
		
	
	
		
			9.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			190 lines
		
	
	
		
			9.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Text.Json.Serialization;
 | |
| 
 | |
| namespace Adaptation.FileHandlers.json.WorkItems;
 | |
| 
 | |
| internal class WorkItem
 | |
| {
 | |
| 
 | |
| #nullable enable
 | |
| 
 | |
|     [JsonConstructor]
 | |
|     public WorkItem(DateTime? activatedDate,
 | |
|                     string areaPath,
 | |
|                     string? assignedTo,
 | |
|                     long? businessValue,
 | |
|                     DateTime changedDate,
 | |
|                     DateTime? closedDate,
 | |
|                     int commentCount,
 | |
|                     DateTime createdDate,
 | |
|                     string description,
 | |
|                     long? effort,
 | |
|                     int id,
 | |
|                     string iterationPath,
 | |
|                     int? parent,
 | |
|                     int? priority,
 | |
|                     Relation[]? relations,
 | |
|                     long? remainingWork,
 | |
|                     string? requester,
 | |
|                     DateTime? resolvedDate,
 | |
|                     int revision,
 | |
|                     long? riskReductionMinusOpportunityEnablement,
 | |
|                     DateTime? startDate,
 | |
|                     string state,
 | |
|                     long? storyPoints,
 | |
|                     string tags,
 | |
|                     DateTime? targetDate,
 | |
|                     long? timeCriticality,
 | |
|                     string title,
 | |
|                     string? violation,
 | |
|                     long? weightedShortestJobFirst,
 | |
|                     string workItemType)
 | |
|     {
 | |
|         ActivatedDate = activatedDate;
 | |
|         AreaPath = areaPath;
 | |
|         AssignedTo = assignedTo;
 | |
|         BusinessValue = businessValue;
 | |
|         ChangedDate = changedDate;
 | |
|         ClosedDate = closedDate;
 | |
|         CommentCount = commentCount;
 | |
|         CreatedDate = createdDate;
 | |
|         Description = description;
 | |
|         Effort = effort;
 | |
|         Id = id;
 | |
|         IterationPath = iterationPath;
 | |
|         Parent = parent;
 | |
|         Priority = priority;
 | |
|         Relations = relations;
 | |
|         RemainingWork = remainingWork;
 | |
|         Requester = requester;
 | |
|         ResolvedDate = resolvedDate;
 | |
|         Revision = revision;
 | |
|         RiskReductionMinusOpportunityEnablement = riskReductionMinusOpportunityEnablement;
 | |
|         StartDate = startDate;
 | |
|         State = state;
 | |
|         StoryPoints = storyPoints;
 | |
|         Tags = tags;
 | |
|         TargetDate = targetDate;
 | |
|         TimeCriticality = timeCriticality;
 | |
|         Title = title;
 | |
|         Violation = violation;
 | |
|         WeightedShortestJobFirst = weightedShortestJobFirst;
 | |
|         WorkItemType = workItemType;
 | |
|     }
 | |
| 
 | |
|     public override string ToString() => $"{Id} - {WorkItemType} - {Title}";
 | |
| 
 | |
|     public static WorkItem Get(WorkItem workItem, Relation[] relations)
 | |
|     {
 | |
|         WorkItem result = new(activatedDate: workItem.ActivatedDate,
 | |
|                               areaPath: workItem.AreaPath,
 | |
|                               assignedTo: workItem.AssignedTo,
 | |
|                               businessValue: workItem.BusinessValue,
 | |
|                               changedDate: workItem.ChangedDate,
 | |
|                               closedDate: workItem.ClosedDate,
 | |
|                               commentCount: workItem.CommentCount,
 | |
|                               createdDate: workItem.CreatedDate,
 | |
|                               description: workItem.Description,
 | |
|                               effort: workItem.Effort,
 | |
|                               id: workItem.Id,
 | |
|                               iterationPath: workItem.IterationPath,
 | |
|                               parent: workItem.Parent,
 | |
|                               priority: workItem.Priority,
 | |
|                               relations: relations,
 | |
|                               remainingWork: workItem.RemainingWork,
 | |
|                               requester: workItem.Requester,
 | |
|                               resolvedDate: workItem.ResolvedDate,
 | |
|                               revision: workItem.Revision,
 | |
|                               riskReductionMinusOpportunityEnablement: workItem.RiskReductionMinusOpportunityEnablement,
 | |
|                               startDate: workItem.StartDate,
 | |
|                               state: workItem.State,
 | |
|                               storyPoints: workItem.StoryPoints,
 | |
|                               tags: workItem.Tags,
 | |
|                               targetDate: workItem.TargetDate,
 | |
|                               timeCriticality: workItem.TimeCriticality,
 | |
|                               title: workItem.Title,
 | |
|                               violation: workItem.Violation,
 | |
|                               weightedShortestJobFirst: workItem.WeightedShortestJobFirst,
 | |
|                               workItemType: workItem.WorkItemType);
 | |
|         return result;
 | |
|     }
 | |
| 
 | |
|     public static WorkItem? GetWithOutRelations(WorkItem? workItem)
 | |
|     {
 | |
|         WorkItem? result = workItem is null ? null : new(activatedDate: workItem.ActivatedDate,
 | |
|                                                          areaPath: workItem.AreaPath,
 | |
|                                                          assignedTo: workItem.AssignedTo,
 | |
|                                                          businessValue: workItem.BusinessValue,
 | |
|                                                          changedDate: workItem.ChangedDate,
 | |
|                                                          closedDate: workItem.ClosedDate,
 | |
|                                                          commentCount: workItem.CommentCount,
 | |
|                                                          createdDate: workItem.CreatedDate,
 | |
|                                                          description: workItem.Description,
 | |
|                                                          effort: workItem.Effort,
 | |
|                                                          id: workItem.Id,
 | |
|                                                          iterationPath: workItem.IterationPath,
 | |
|                                                          parent: workItem.Parent,
 | |
|                                                          priority: workItem.Priority,
 | |
|                                                          relations: Array.Empty<Relation>(),
 | |
|                                                          remainingWork: workItem.RemainingWork,
 | |
|                                                          requester: workItem.Requester,
 | |
|                                                          resolvedDate: workItem.ResolvedDate,
 | |
|                                                          revision: workItem.Revision,
 | |
|                                                          riskReductionMinusOpportunityEnablement: workItem.RiskReductionMinusOpportunityEnablement,
 | |
|                                                          startDate: workItem.StartDate,
 | |
|                                                          state: workItem.State,
 | |
|                                                          storyPoints: workItem.StoryPoints,
 | |
|                                                          tags: workItem.Tags,
 | |
|                                                          targetDate: workItem.TargetDate,
 | |
|                                                          timeCriticality: workItem.TimeCriticality,
 | |
|                                                          title: workItem.Title,
 | |
|                                                          violation: workItem.Violation,
 | |
|                                                          weightedShortestJobFirst: workItem.WeightedShortestJobFirst,
 | |
|                                                          workItemType: workItem.WorkItemType);
 | |
|         return result;
 | |
|     }
 | |
| 
 | |
|     [JsonPropertyName("ActivatedDate")] public DateTime? ActivatedDate { get; }
 | |
|     [JsonPropertyName("AreaPath")] public string AreaPath { get; }
 | |
|     [JsonPropertyName("AssignedTo")] public string? AssignedTo { get; }
 | |
|     [JsonPropertyName("BusinessValue")] public long? BusinessValue { get; }
 | |
|     [JsonPropertyName("ChangedDate")] public DateTime ChangedDate { get; }
 | |
|     [JsonPropertyName("ClosedDate")] public DateTime? ClosedDate { get; }
 | |
|     [JsonPropertyName("CommentCount")] public int CommentCount { get; }
 | |
|     [JsonPropertyName("CreatedDate")] public DateTime CreatedDate { get; }
 | |
|     [JsonPropertyName("Description")] public string Description { get; }
 | |
|     [JsonPropertyName("Effort")] public long? Effort { get; }
 | |
|     [JsonPropertyName("Id")] public int Id { get; }
 | |
|     [JsonPropertyName("IterationPath")] public string IterationPath { get; }
 | |
|     [JsonPropertyName("Parent")] public int? Parent { get; }
 | |
|     [JsonPropertyName("Priority")] public int? Priority { get; }
 | |
|     [JsonPropertyName("Relations")] public Relation[]? Relations { get; }
 | |
|     [JsonPropertyName("RemainingWork")] public long? RemainingWork { get; }
 | |
|     [JsonPropertyName("Requester")] public string? Requester { get; }
 | |
|     [JsonPropertyName("ResolvedDate")] public DateTime? ResolvedDate { get; }
 | |
|     [JsonPropertyName("Revision")] public int Revision { get; }
 | |
|     [JsonPropertyName("RiskReductionMinusOpportunityEnablement")] public long? RiskReductionMinusOpportunityEnablement { get; }
 | |
|     [JsonPropertyName("StartDate")] public DateTime? StartDate { get; }
 | |
|     [JsonPropertyName("State")] public string State { get; }
 | |
|     [JsonPropertyName("StoryPoints")] public long? StoryPoints { get; }
 | |
|     [JsonPropertyName("Tags")] public string Tags { get; }
 | |
|     [JsonPropertyName("TargetDate")] public DateTime? TargetDate { get; }
 | |
|     [JsonPropertyName("TimeCriticality")] public long? TimeCriticality { get; }
 | |
|     [JsonPropertyName("Title")] public string Title { get; }
 | |
|     [JsonPropertyName("Violation")] public string? Violation { get; }
 | |
|     [JsonPropertyName("WeightedShortestJobFirst")] public long? WeightedShortestJobFirst { get; }
 | |
|     [JsonPropertyName("WorkItemType")] public string WorkItemType { get; }
 | |
| 
 | |
| }
 | |
| 
 | |
| [JsonSourceGenerationOptions(WriteIndented = true)]
 | |
| [JsonSerializable(typeof(WorkItem))]
 | |
| internal partial class WorkItemSourceGenerationContext : JsonSerializerContext
 | |
| {
 | |
| }
 | |
| 
 | |
| [JsonSourceGenerationOptions(WriteIndented = true)]
 | |
| [JsonSerializable(typeof(WorkItem[]))]
 | |
| internal partial class WorkItemCollectionSourceGenerationContext : JsonSerializerContext
 | |
| {
 | |
| } |