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

GCD PR For Nuget - DO NOT MERGE #210

Draft
wants to merge 6 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,4 @@ __pycache__/
*.btm.cs
*.odx.cs
*.xsd.cs
/*/*.orig
/**/*.orig
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void Verify_that_GetDerivedTypes_returns_expected_results()

var subtypes = TypeResolver.GetDerivedTypes(subjectType, assembly).ToList();

Assert.That(subtypes.Count, Is.EqualTo(67));
Assert.That(subtypes.Count, Is.EqualTo(68));
}

[Test]
Expand Down
55 changes: 55 additions & 0 deletions CDP4Common.NetCore.Tests/Poco/AttachmentTestFixture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AttachmentTestFixture.cs" company="RHEA System S.A.">
// Copyright (c) 2015-2021 RHEA System S.A.
//
// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft
//
// This file is part of CDP4-SDK Community Edition
//
// The CDP4-SDK Community Edition is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// The CDP4-SDK Community Edition is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace CDP4Common.Tests.Poco
{
using System;

using CDP4Common.EngineeringModelData;
using CDP4Common.SiteDirectoryData;

using NUnit.Framework;

[TestFixture]
internal class AttachmentTestFixture
{
private Attachment attachment;

[SetUp]
public void Setup()
{
this.attachment = new Attachment(Guid.NewGuid(), null, null);
this.attachment.FileName = "filerev";

this.attachment.FileType.Add(new FileType(Guid.NewGuid(), null, null) { Extension = "ext1" });
this.attachment.FileType.Add(new FileType(Guid.NewGuid(), null, null) { Extension = "ext2" });
}

[Test]
public void VerifyPathForFileRevisionLocatedInFileStore()
{
Assert.AreEqual("filerev.ext1.ext2", this.attachment.Path);
}
}
}
8 changes: 4 additions & 4 deletions CDP4Common.NetCore.Tests/Poco/ParticipantRoleTestFixture.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ParticipantRoleTestFixture.cs" company="RHEA System S.A.">
// Copyright (c) 2015-2020 RHEA System S.A.
// Copyright (c) 2015-2021 RHEA System S.A.
//
// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou
// Author: Sam Gerené, Alex Vorobiev, Naron Phou, Patxi Ozkoidi, Alexander van Delft, Nathanael Smiechowski, Ahmed Ahmed, Simon Wood
//
// This file is part of CDP4-SDK Community Edition
//
Expand Down Expand Up @@ -38,8 +38,8 @@ internal class ParticipantRoleTestFixture
public void VerifyPopulateParticipantPermissions()
{
var participantRole = new ParticipantRole();
Assert.AreEqual(48, participantRole.ParticipantPermission.Count);
Assert.AreEqual(49, participantRole.ParticipantPermission.Count);
Assert.IsTrue(participantRole.ParticipantPermission.All(x => x.AccessRight == ParticipantAccessRightKind.NONE));
}
}
}
}
2 changes: 1 addition & 1 deletion CDP4Common.Tests/Helpers/TypeResolverTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void Verify_that_GetDerivedTypes_returns_expected_results()

var subtypes = TypeResolver.GetDerivedTypes(subjectType, assembly).ToList();

Assert.That(subtypes.Count, Is.EqualTo(67));
Assert.That(subtypes.Count, Is.EqualTo(68));
}

[Test]
Expand Down
55 changes: 55 additions & 0 deletions CDP4Common.Tests/Poco/AttachmentTestFixture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AttachmentTestFixture.cs" company="RHEA System S.A.">
// Copyright (c) 2015-2021 RHEA System S.A.
//
// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft
//
// This file is part of CDP4-SDK Community Edition
//
// The CDP4-SDK Community Edition is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// The CDP4-SDK Community Edition is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace CDP4Common.Tests.Poco
{
using System;

using CDP4Common.EngineeringModelData;
using CDP4Common.SiteDirectoryData;

using NUnit.Framework;

[TestFixture]
internal class AttachmentTestFixture
{
private Attachment attachment;

[SetUp]
public void Setup()
{
this.attachment = new Attachment(Guid.NewGuid(), null, null);
this.attachment.FileName = "filerev";

this.attachment.FileType.Add(new FileType(Guid.NewGuid(), null, null) { Extension = "ext1" });
this.attachment.FileType.Add(new FileType(Guid.NewGuid(), null, null) { Extension = "ext2" });
}

[Test]
public void VerifyPathForFileRevisionLocatedInFileStore()
{
Assert.AreEqual("filerev.ext1.ext2", this.attachment.Path);
}
}
}
14 changes: 7 additions & 7 deletions CDP4Common.Tests/Poco/ParticipantRoleTestFixture.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#region Copyright
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ParticipantRoleTestFixture.cs" company="RHEA System S.A.">
// Copyright (c) 2015-2019 RHEA System S.A.
// Copyright (c) 2015-2021 RHEA System S.A.
//
// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou
// Author: Sam Gerené, Alex Vorobiev, Naron Phou, Patxi Ozkoidi, Alexander van Delft, Nathanael Smiechowski, Ahmed Ahmed, Simon Wood
//
// This file is part of CDP4-SDK Community Edition
//
Expand All @@ -22,13 +21,14 @@
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
#endregion

namespace CDP4Common.Tests.Poco
{
using System.Linq;

using CDP4Common.CommonData;
using CDP4Common.SiteDirectoryData;

using NUnit.Framework;

[TestFixture]
Expand All @@ -38,8 +38,8 @@ internal class ParticipantRoleTestFixture
public void VerifyPopulateParticipantPermissions()
{
var participantRole = new ParticipantRole();
Assert.AreEqual(48, participantRole.ParticipantPermission.Count);
Assert.AreEqual(49, participantRole.ParticipantPermission.Count);
Assert.IsTrue(participantRole.ParticipantPermission.All(x => x.AccessRight == ParticipantAccessRightKind.NONE));
}
}
}
}
180 changes: 180 additions & 0 deletions CDP4Common/AutoGenDto/ArchitectureDiagram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ArchitectureDiagram.cs" company="RHEA System S.A.">
// Copyright (c) 2015-2021 RHEA System S.A.
//
// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Nathanael Smiechowski
//
// This file is part of COMET-SDK Community Edition
// This is an auto-generated class. Any manual changes to this file will be overwritten!
//
// The COMET-SDK Community Edition is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// The COMET-SDK Community Edition is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// --------------------------------------------------------------------------------------------------------------------

namespace CDP4Common.DTO
{
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using CDP4Common.CommonData;
using CDP4Common.DiagramData;
using CDP4Common.EngineeringModelData;
using CDP4Common.ReportingData;
using CDP4Common.SiteDirectoryData;
using CDP4Common.Types;

/// <summary>
/// A Data Transfer Object representation of the <see cref="ArchitectureDiagram"/> class.
/// </summary>
[DataContract]
[CDPVersion("1.3.0")]
[Container(typeof(Iteration), "DiagramCanvas")]
public sealed partial class ArchitectureDiagram : DiagramCanvas, IOwnedThing
{
/// <summary>
/// Initializes a new instance of the <see cref="ArchitectureDiagram"/> class.
/// </summary>
public ArchitectureDiagram()
{
}

/// <summary>
/// Initializes a new instance of the <see cref="ArchitectureDiagram"/> class.
/// </summary>
/// <param name="iid">
/// The unique identifier.
/// </param>
/// <param name="rev">
/// The revision number.
/// </param>
public ArchitectureDiagram(Guid iid, int rev) : base(iid: iid, rev: rev)
{
}

/// <summary>
/// Gets or sets the unique identifier of the referenced Owner.
/// </summary>
[UmlInformation(aggregation: AggregationKind.None, isDerived: false, isOrdered: false, isNullable: false, isPersistent: true)]
[DataMember]
public Guid Owner { get; set; }

/// <summary>
/// Gets or sets the unique identifier of the referenced TopArchitectureElement.
/// </summary>
[UmlInformation(aggregation: AggregationKind.None, isDerived: false, isOrdered: false, isNullable: true, isPersistent: true)]
[DataMember]
public Guid? TopArchitectureElement { get; set; }

/// <summary>
/// Gets the route for the current <see ref="ArchitectureDiagram"/>.
/// </summary>
public override string Route
{
get { return this.ComputedRoute(); }
}

/// <summary>
/// Instantiate a <see cref="CDP4Common.DiagramData.ArchitectureDiagram"/> from a <see cref="ArchitectureDiagram"/>
/// </summary>
/// <param name="cache">The cache that stores all the <see cref="CommonData.Thing"/>s</param>.
/// <param name="uri">The <see cref="Uri"/> of the <see cref="CDP4Common.DiagramData.ArchitectureDiagram"/></param>.
/// <returns>A new <see cref="CommonData.Thing"/></returns>
public override CommonData.Thing InstantiatePoco(ConcurrentDictionary<CacheKey, Lazy<CommonData.Thing>> cache, Uri uri)
{
return new CDP4Common.DiagramData.ArchitectureDiagram(this.Iid, cache, uri);
}

/// <summary>
/// Resolves the properties of a copied <see cref="Thing"/> based on the original and a collection of copied <see cref="Thing"/>.
/// </summary>
/// <param name="originalThing">The original <see cref="Thing"/></param>.
/// <param name="originalCopyMap">The map containig all instance of copied <see cref="Thing"/>s with their original</param>.
public override void ResolveCopy(Thing originalThing, IReadOnlyDictionary<Thing, Thing> originalCopyMap)
{
var original = originalThing as ArchitectureDiagram;
if (original == null)
{
throw new InvalidOperationException("The originalThing cannot be null or is of the incorrect type");
}

foreach (var guid in original.Bounds)
{
var copy = originalCopyMap.SingleOrDefault(kvp => kvp.Key.Iid == guid);
if (Equals(copy, default(KeyValuePair<Thing, Thing>)))
{
throw new InvalidOperationException(string.Format("The copy could not be found for {0}", guid));
lxatstariongroup marked this conversation as resolved.
Show resolved Hide resolved
}

this.Bounds.Add(copy.Value.Iid);
}

this.CreatedOn = original.CreatedOn;

this.Description = original.Description;

foreach (var guid in original.DiagramElement)
{
var copy = originalCopyMap.SingleOrDefault(kvp => kvp.Key.Iid == guid);
if (Equals(copy, default(KeyValuePair<Thing, Thing>)))
{
throw new InvalidOperationException(string.Format("The copy could not be found for {0}", guid));
}

this.DiagramElement.Add(copy.Value.Iid);
}

foreach (var guid in original.ExcludedDomain)
{
var copy = originalCopyMap.SingleOrDefault(kvp => kvp.Key.Iid == guid);
this.ExcludedDomain.Add(copy.Value == null ? guid : copy.Value.Iid);
}

foreach (var guid in original.ExcludedPerson)
{
var copy = originalCopyMap.SingleOrDefault(kvp => kvp.Key.Iid == guid);
this.ExcludedPerson.Add(copy.Value == null ? guid : copy.Value.Iid);
}

this.ModifiedOn = original.ModifiedOn;

this.Name = original.Name;

var copyOwner = originalCopyMap.SingleOrDefault(kvp => kvp.Key.Iid == original.Owner);
this.Owner = copyOwner.Value == null ? original.Owner : copyOwner.Value.Iid;

this.PublicationState = original.PublicationState;

this.ThingPreference = original.ThingPreference;

var copyTopArchitectureElement = originalCopyMap.SingleOrDefault(kvp => kvp.Key.Iid == original.TopArchitectureElement);
this.TopArchitectureElement = copyTopArchitectureElement.Value == null ? original.TopArchitectureElement : copyTopArchitectureElement.Value.Iid;
}

/// <summary>
/// Resolves the references of a copied <see cref="Thing"/> based on a original to copy map.
/// </summary>
/// <param name="originalCopyMap">The map containig all instance of copied <see cref="Thing"/>s with their original</param>.
/// <returns>True if a modification was done in the process of this method</returns>.
public override bool ResolveCopyReference(IReadOnlyDictionary<Thing, Thing> originalCopyMap)
{
var hasChanges = false;

return hasChanges;
}
}
}
Loading