Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] support for removal of unlinked references in Annex.C3 export #288

Merged
Merged
Show file tree
Hide file tree
Changes from 4 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
  •  
  •  
  •  
17 changes: 10 additions & 7 deletions CDP4Common/AutoGenDto/ActionItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ public override IDictionary<string, IEnumerable<Guid>> GetReferenceProperties()
{
var dictionary = new Dictionary<string, IEnumerable<Guid>>();

if (this.Actionee != default)
if (this.Actionee != null)
{
dictionary.Add("Actionee", new [] { this.Actionee });
}

dictionary.Add("ApprovedBy", this.ApprovedBy);

if (this.Author != default)
if (this.Author != null)
{
dictionary.Add("Author", new [] { this.Author });
}
Expand All @@ -136,12 +136,12 @@ public override IDictionary<string, IEnumerable<Guid>> GetReferenceProperties()

dictionary.Add("ExcludedPerson", this.ExcludedPerson);

if (this.Owner != default)
if (this.Owner != null)
{
dictionary.Add("Owner", new [] { this.Owner });
}

if (this.PrimaryAnnotatedThing != default)
if (this.PrimaryAnnotatedThing != null)
{
dictionary.Add("PrimaryAnnotatedThing", new [] { this.PrimaryAnnotatedThing.Value });
}
Expand Down Expand Up @@ -179,7 +179,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "Actionee":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Actionee property is not allowed.");
errors.Add($"Removed reference '{id}' from Actionee property results in inconsistent ActionItem.");
result = false;
}
break;

Expand All @@ -190,7 +191,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "Author":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Author property is not allowed.");
errors.Add($"Removed reference '{id}' from Author property results in inconsistent ActionItem.");
result = false;
}
break;

Expand All @@ -213,7 +215,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "Owner":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Owner property is not allowed.");
errors.Add($"Removed reference '{id}' from Owner property results in inconsistent ActionItem.");
result = false;
}
break;

Expand Down
3 changes: 2 additions & 1 deletion CDP4Common/AutoGenDto/ActualFiniteState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "PossibleState":
if (addModelErrors && this.PossibleState.Count == 1)
{
errors.Add($"Remove reference '{id}' from PossibleState property is not allowed.");
errors.Add($"Removing reference '{id}' from PossibleState property results in inconsistent ActualFiniteState.");
result = false;
}
this.PossibleState.Remove(id);
break;
Expand Down
5 changes: 3 additions & 2 deletions CDP4Common/AutoGenDto/ActualFiniteStateList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public override IDictionary<string, IEnumerable<Guid>> GetReferenceProperties()

dictionary.Add("ExcludeOption", this.ExcludeOption);

if (this.Owner != default)
if (this.Owner != null)
{
dictionary.Add("Owner", new [] { this.Owner });
}
Expand Down Expand Up @@ -220,7 +220,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "Owner":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Owner property is not allowed.");
errors.Add($"Removed reference '{id}' from Owner property results in inconsistent ActualFiniteStateList.");
result = false;
}
break;
}
Expand Down
3 changes: 2 additions & 1 deletion CDP4Common/AutoGenDto/AndExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "Term":
if (addModelErrors && this.Term.Count == 1)
{
errors.Add($"Remove reference '{id}' from Term property is not allowed.");
errors.Add($"Removing reference '{id}' from Term property results in inconsistent AndExpression.");
result = false;
}
this.Term.Remove(id);
break;
Expand Down
10 changes: 6 additions & 4 deletions CDP4Common/AutoGenDto/Approval.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public override IDictionary<string, IEnumerable<Guid>> GetReferenceProperties()
{
var dictionary = new Dictionary<string, IEnumerable<Guid>>();

if (this.Author != default)
if (this.Author != null)
{
dictionary.Add("Author", new [] { this.Author });
}
Expand All @@ -118,7 +118,7 @@ public override IDictionary<string, IEnumerable<Guid>> GetReferenceProperties()

dictionary.Add("ExcludedPerson", this.ExcludedPerson);

if (this.Owner != default)
if (this.Owner != null)
{
dictionary.Add("Owner", new [] { this.Owner });
}
Expand Down Expand Up @@ -152,7 +152,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "Author":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Author property is not allowed.");
errors.Add($"Removed reference '{id}' from Author property results in inconsistent Approval.");
result = false;
}
break;

Expand All @@ -167,7 +168,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "Owner":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Owner property is not allowed.");
errors.Add($"Removed reference '{id}' from Owner property results in inconsistent Approval.");
result = false;
}
break;
}
Expand Down
10 changes: 6 additions & 4 deletions CDP4Common/AutoGenDto/BinaryNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ public override IDictionary<string, IEnumerable<Guid>> GetReferenceProperties()

dictionary.Add("ExcludedPerson", this.ExcludedPerson);

if (this.FileType != default)
if (this.FileType != null)
{
dictionary.Add("FileType", new [] { this.FileType });
}

if (this.Owner != default)
if (this.Owner != null)
{
dictionary.Add("Owner", new [] { this.Owner });
}
Expand Down Expand Up @@ -159,14 +159,16 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "FileType":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from FileType property is not allowed.");
errors.Add($"Removed reference '{id}' from FileType property results in inconsistent BinaryNote.");
result = false;
}
break;

case "Owner":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Owner property is not allowed.");
errors.Add($"Removed reference '{id}' from Owner property results in inconsistent BinaryNote.");
result = false;
}
break;
}
Expand Down
15 changes: 9 additions & 6 deletions CDP4Common/AutoGenDto/BinaryRelationship.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,19 @@ public override IDictionary<string, IEnumerable<Guid>> GetReferenceProperties()

dictionary.Add("ExcludedPerson", this.ExcludedPerson);

if (this.Owner != default)
if (this.Owner != null)
{
dictionary.Add("Owner", new [] { this.Owner });
}

dictionary.Add("ParameterValue", this.ParameterValue);

if (this.Source != default)
if (this.Source != null)
{
dictionary.Add("Source", new [] { this.Source });
}

if (this.Target != default)
if (this.Target != null)
{
dictionary.Add("Target", new [] { this.Target });
}
Expand Down Expand Up @@ -165,7 +165,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "Owner":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Owner property is not allowed.");
errors.Add($"Removed reference '{id}' from Owner property results in inconsistent BinaryRelationship.");
result = false;
}
break;

Expand All @@ -176,14 +177,16 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "Source":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Source property is not allowed.");
errors.Add($"Removed reference '{id}' from Source property results in inconsistent BinaryRelationship.");
result = false;
}
break;

case "Target":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Target property is not allowed.");
errors.Add($"Removed reference '{id}' from Target property results in inconsistent BinaryRelationship.");
result = false;
}
break;
}
Expand Down
15 changes: 9 additions & 6 deletions CDP4Common/AutoGenDto/BinaryRelationshipRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,17 @@ public override IDictionary<string, IEnumerable<Guid>> GetReferenceProperties()

dictionary.Add("HyperLink", this.HyperLink);

if (this.RelationshipCategory != default)
if (this.RelationshipCategory != null)
{
dictionary.Add("RelationshipCategory", new [] { this.RelationshipCategory });
}

if (this.SourceCategory != default)
if (this.SourceCategory != null)
{
dictionary.Add("SourceCategory", new [] { this.SourceCategory });
}

if (this.TargetCategory != default)
if (this.TargetCategory != null)
{
dictionary.Add("TargetCategory", new [] { this.TargetCategory });
}
Expand Down Expand Up @@ -196,21 +196,24 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "RelationshipCategory":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from RelationshipCategory property is not allowed.");
errors.Add($"Removed reference '{id}' from RelationshipCategory property results in inconsistent BinaryRelationshipRule.");
result = false;
}
break;

case "SourceCategory":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from SourceCategory property is not allowed.");
errors.Add($"Removed reference '{id}' from SourceCategory property results in inconsistent BinaryRelationshipRule.");
result = false;
}
break;

case "TargetCategory":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from TargetCategory property is not allowed.");
errors.Add($"Removed reference '{id}' from TargetCategory property results in inconsistent BinaryRelationshipRule.");
result = false;
}
break;
}
Expand Down
5 changes: 3 additions & 2 deletions CDP4Common/AutoGenDto/Book.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public override IDictionary<string, IEnumerable<Guid>> GetReferenceProperties()

dictionary.Add("ExcludedPerson", this.ExcludedPerson);

if (this.Owner != default)
if (this.Owner != null)
{
dictionary.Add("Owner", new [] { this.Owner });
}
Expand Down Expand Up @@ -199,7 +199,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "Owner":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Owner property is not allowed.");
errors.Add($"Removed reference '{id}' from Owner property results in inconsistent Book.");
result = false;
}
break;
}
Expand Down
17 changes: 10 additions & 7 deletions CDP4Common/AutoGenDto/ChangeProposal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ public override IDictionary<string, IEnumerable<Guid>> GetReferenceProperties()

dictionary.Add("ApprovedBy", this.ApprovedBy);

if (this.Author != default)
if (this.Author != null)
{
dictionary.Add("Author", new [] { this.Author });
}

dictionary.Add("Category", this.Category);

if (this.ChangeRequest != default)
if (this.ChangeRequest != null)
{
dictionary.Add("ChangeRequest", new [] { this.ChangeRequest });
}
Expand All @@ -115,12 +115,12 @@ public override IDictionary<string, IEnumerable<Guid>> GetReferenceProperties()

dictionary.Add("ExcludedPerson", this.ExcludedPerson);

if (this.Owner != default)
if (this.Owner != null)
{
dictionary.Add("Owner", new [] { this.Owner });
}

if (this.PrimaryAnnotatedThing != default)
if (this.PrimaryAnnotatedThing != null)
{
dictionary.Add("PrimaryAnnotatedThing", new [] { this.PrimaryAnnotatedThing.Value });
}
Expand Down Expand Up @@ -162,7 +162,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "Author":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Author property is not allowed.");
errors.Add($"Removed reference '{id}' from Author property results in inconsistent ChangeProposal.");
result = false;
}
break;

Expand All @@ -173,7 +174,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "ChangeRequest":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from ChangeRequest property is not allowed.");
errors.Add($"Removed reference '{id}' from ChangeRequest property results in inconsistent ChangeProposal.");
result = false;
}
break;

Expand All @@ -192,7 +194,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "Owner":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Owner property is not allowed.");
errors.Add($"Removed reference '{id}' from Owner property results in inconsistent ChangeProposal.");
result = false;
}
break;

Expand Down
12 changes: 7 additions & 5 deletions CDP4Common/AutoGenDto/ChangeRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public override IDictionary<string, IEnumerable<Guid>> GetReferenceProperties()

dictionary.Add("ApprovedBy", this.ApprovedBy);

if (this.Author != default)
if (this.Author != null)
{
dictionary.Add("Author", new [] { this.Author });
}
Expand All @@ -103,12 +103,12 @@ public override IDictionary<string, IEnumerable<Guid>> GetReferenceProperties()

dictionary.Add("ExcludedPerson", this.ExcludedPerson);

if (this.Owner != default)
if (this.Owner != null)
{
dictionary.Add("Owner", new [] { this.Owner });
}

if (this.PrimaryAnnotatedThing != default)
if (this.PrimaryAnnotatedThing != null)
{
dictionary.Add("PrimaryAnnotatedThing", new [] { this.PrimaryAnnotatedThing.Value });
}
Expand Down Expand Up @@ -150,7 +150,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "Author":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Author property is not allowed.");
errors.Add($"Removed reference '{id}' from Author property results in inconsistent ChangeRequest.");
result = false;
}
break;

Expand All @@ -173,7 +174,8 @@ public override bool TryRemoveReferences(IEnumerable<Guid> ids, out List<string>
case "Owner":
if (addModelErrors)
{
errors.Add($"Remove reference '{id}' from Owner property is not allowed.");
errors.Add($"Removed reference '{id}' from Owner property results in inconsistent ChangeRequest.");
result = false;
}
break;

Expand Down
Loading
Loading