From ce82768753c49cab10a2632947ca0a542146c04b Mon Sep 17 00:00:00 2001 From: Alexander van Delft Date: Tue, 13 Feb 2024 14:31:31 +0100 Subject: [PATCH] Refactor DiagramCanvas and ArchitectureDiagram --- CDP4Common/AutoGenDto/ArchitectureDiagram.cs | 42 ++++++++++++++- CDP4Common/AutoGenDto/DiagramCanvas.cs | 54 +++++++++++++++++-- .../ArchitectureDiagramEquatable.cs | 15 +++--- .../DiagramCanvasEquatable.cs | 31 ++++++----- .../ArchitectureDiagramMetaInfo.cs | 12 +++-- .../AutoGenMetaInfo/DiagramCanvasMetaInfo.cs | 12 +++-- CDP4Common/AutoGenPoco/ArchitectureDiagram.cs | 6 ++- CDP4Common/AutoGenPoco/DiagramCanvas.cs | 53 ++++++++++++++++-- .../ArchitectureDiagramPropertyAccessor.cs | 21 ++++++-- .../DiagramCanvasPropertyAccessor.cs | 36 ++++++++++--- .../ArchitectureDiagramResolver.cs | 15 ++++-- .../DiagramCanvasResolver.cs | 15 ++++-- .../ArchitectureDiagramSerializer.cs | 6 ++- .../DiagramCanvasSerializer.cs | 6 ++- ...ArchitectureDiagramMessagePackFormatter.cs | 23 ++++---- .../DiagramCanvasMessagePackFormatter.cs | 53 +++++++++--------- 16 files changed, 304 insertions(+), 96 deletions(-) diff --git a/CDP4Common/AutoGenDto/ArchitectureDiagram.cs b/CDP4Common/AutoGenDto/ArchitectureDiagram.cs index 456739c0..1fea0de3 100644 --- a/CDP4Common/AutoGenDto/ArchitectureDiagram.cs +++ b/CDP4Common/AutoGenDto/ArchitectureDiagram.cs @@ -110,6 +110,11 @@ public override IDictionary> GetReferenceProperties() dictionary.Add("ExcludedPerson", this.ExcludedPerson); + if (this.LockedBy != null) + { + dictionary.Add("LockedBy", new [] { this.LockedBy }); + } + if (this.Owner != null) { dictionary.Add("Owner", new [] { this.Owner }); @@ -162,6 +167,14 @@ public override bool TryRemoveReferences(IEnumerable ids, out List this.ExcludedPerson.Remove(id); break; + case "LockedBy": + if (addModelErrors) + { + errors.Add($"Removed reference '{id}' from LockedBy property results in inconsistent ArchitectureDiagram."); + result = false; + } + break; + case "Owner": if (addModelErrors) { @@ -224,6 +237,14 @@ public override bool TryRemoveReferencesNotIn(IEnumerable ids, out List ids) { switch (kvp.Key) { + case "LockedBy": + if (ids.Intersect(kvp.Value).Any()) + { + result = true; + } + break; + case "Owner": if (ids.Intersect(kvp.Value).Any()) { @@ -287,6 +315,13 @@ public override bool HasMandatoryReferenceNotIn(HashSet ids) { switch (kvp.Key) { + case "LockedBy": + if (kvp.Value.Except(ids).Any()) + { + result = true; + } + break; + case "Owner": if (kvp.Value.Except(ids).Any()) { @@ -361,6 +396,11 @@ public override void ResolveCopy(Thing originalThing, IReadOnlyDictionary kvp.Key.Iid == original.LockedBy); + this.LockedBy = copyLockedBy.Value == null ? original.LockedBy : copyLockedBy.Value.Iid; + this.ModifiedOn = original.ModifiedOn; this.Name = original.Name; @@ -368,8 +408,6 @@ public override void ResolveCopy(Thing originalThing, IReadOnlyDictionary 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); diff --git a/CDP4Common/AutoGenDto/DiagramCanvas.cs b/CDP4Common/AutoGenDto/DiagramCanvas.cs index a88da49c..81e3ef7a 100644 --- a/CDP4Common/AutoGenDto/DiagramCanvas.cs +++ b/CDP4Common/AutoGenDto/DiagramCanvas.cs @@ -82,16 +82,26 @@ public DiagramCanvas(Guid iid, int rev) : base(iid: iid, rev: rev) /// /// Gets or sets the Description. /// + [CDPVersion("1.4.0")] [UmlInformation(aggregation: AggregationKind.None, isDerived: false, isOrdered: false, isNullable: false, isPersistent: true)] [DataMember] public virtual string Description { get; set; } /// - /// Gets or sets the PublicationState. + /// Gets or sets a value indicating whether IsHidden. /// + [CDPVersion("1.4.0")] [UmlInformation(aggregation: AggregationKind.None, isDerived: false, isOrdered: false, isNullable: false, isPersistent: true)] [DataMember] - public virtual PublicationState PublicationState { get; set; } + public virtual bool IsHidden { get; set; } + + /// + /// Gets or sets the unique identifier of the referenced LockedBy. + /// + [CDPVersion("1.4.0")] + [UmlInformation(aggregation: AggregationKind.None, isDerived: false, isOrdered: false, isNullable: false, isPersistent: true)] + [DataMember] + public virtual Guid LockedBy { get; set; } /// /// Gets the route for the current . @@ -117,6 +127,11 @@ public override IDictionary> GetReferenceProperties() dictionary.Add("ExcludedPerson", this.ExcludedPerson); + if (this.LockedBy != null) + { + dictionary.Add("LockedBy", new [] { this.LockedBy }); + } + return dictionary; } @@ -158,6 +173,14 @@ public override bool TryRemoveReferences(IEnumerable ids, out List case "ExcludedPerson": this.ExcludedPerson.Remove(id); break; + + case "LockedBy": + if (addModelErrors) + { + errors.Add($"Removed reference '{id}' from LockedBy property results in inconsistent DiagramCanvas."); + result = false; + } + break; } } } @@ -208,6 +231,14 @@ public override bool TryRemoveReferencesNotIn(IEnumerable ids, out List ids) { switch (kvp.Key) { + case "LockedBy": + if (ids.Intersect(kvp.Value).Any()) + { + result = true; + } + break; } } @@ -251,6 +288,12 @@ public override bool HasMandatoryReferenceNotIn(HashSet ids) { switch (kvp.Key) { + case "LockedBy": + if (kvp.Value.Except(ids).Any()) + { + result = true; + } + break; } } @@ -319,12 +362,15 @@ public override void ResolveCopy(Thing originalThing, IReadOnlyDictionary kvp.Key.Iid == original.LockedBy); + this.LockedBy = copyLockedBy.Value == null ? original.LockedBy : copyLockedBy.Value.Iid; + this.ModifiedOn = original.ModifiedOn; this.Name = original.Name; - this.PublicationState = original.PublicationState; - this.ThingPreference = original.ThingPreference; } diff --git a/CDP4Common/AutoGenEquatable/ArchitectureDiagramEquatable.cs b/CDP4Common/AutoGenEquatable/ArchitectureDiagramEquatable.cs index c15029cc..0922972b 100644 --- a/CDP4Common/AutoGenEquatable/ArchitectureDiagramEquatable.cs +++ b/CDP4Common/AutoGenEquatable/ArchitectureDiagramEquatable.cs @@ -42,10 +42,11 @@ | 8 | createdOn | DateTime | 1..1 | 1.4.0 | | 9 | description | string | 1..1 | 1.4.0 | | 10 | diagramElement | Guid | 0..* | 1.4.0 | - | 11 | name | string | 1..1 | 1.4.0 | - | 12 | owner | Guid | 1..1 | 1.4.0 | - | 13 | publicationState | PublicationState | 1..1 | 1.4.0 | - | 14 | topArchitectureElement | Guid | 0..1 | 1.4.0 | + | 11 | isHidden | bool | 1..1 | 1.4.0 | + | 12 | lockedBy | Guid | 1..1 | 1.4.0 | + | 13 | name | string | 1..1 | 1.4.0 | + | 14 | owner | Guid | 1..1 | 1.4.0 | + | 15 | topArchitectureElement | Guid | 0..1 | 1.4.0 | * -------------------------------------------- | ---------------------------- | ----------- | ------- */ namespace CDP4Common.DTO.Equatable @@ -106,13 +107,15 @@ public static bool ArePropertiesEqual(this ArchitectureDiagram me, ArchitectureD if (!me.DiagramElement.OrderBy(x => x).SequenceEqual(other.DiagramElement.OrderBy(x => x))) return false; + if (!me.IsHidden.Equals(other.IsHidden)) return false; + + if (!me.LockedBy.Equals(other.LockedBy)) return false; + if (me.Name == null && other.Name != null) return false; if (me.Name != null && !me.Name.Equals(other.Name)) return false; if (!me.Owner.Equals(other.Owner)) return false; - if (!me.PublicationState.Equals(other.PublicationState)) return false; - if (me.TopArchitectureElement.HasValue != other.TopArchitectureElement.HasValue) return false; if (!me.TopArchitectureElement.Equals(other.TopArchitectureElement)) return false; diff --git a/CDP4Common/AutoGenEquatable/DiagramCanvasEquatable.cs b/CDP4Common/AutoGenEquatable/DiagramCanvasEquatable.cs index 4102214e..e71d524d 100644 --- a/CDP4Common/AutoGenEquatable/DiagramCanvasEquatable.cs +++ b/CDP4Common/AutoGenEquatable/DiagramCanvasEquatable.cs @@ -35,15 +35,16 @@ | -------------------------------------------- | ---------------------------- | ----------- | ------- | | 2 | bounds | Guid | 0..1 | 1.1.0 | | 3 | createdOn | DateTime | 1..1 | 1.1.0 | - | 4 | description | string | 1..1 | 1.1.0 | - | 5 | diagramElement | Guid | 0..* | 1.1.0 | - | 6 | excludedDomain | Guid | 0..* | 1.1.0 | - | 7 | excludedPerson | Guid | 0..* | 1.1.0 | - | 8 | modifiedOn | DateTime | 1..1 | 1.1.0 | - | 9 | name | string | 1..1 | 1.1.0 | - | 10 | publicationState | PublicationState | 1..1 | 1.1.0 | - | 11 | thingPreference | string | 0..1 | 1.2.0 | - | 12 | actor | Guid | 0..1 | 1.3.0 | + | 4 | diagramElement | Guid | 0..* | 1.1.0 | + | 5 | excludedDomain | Guid | 0..* | 1.1.0 | + | 6 | excludedPerson | Guid | 0..* | 1.1.0 | + | 7 | modifiedOn | DateTime | 1..1 | 1.1.0 | + | 8 | name | string | 1..1 | 1.1.0 | + | 9 | thingPreference | string | 0..1 | 1.2.0 | + | 10 | actor | Guid | 0..1 | 1.3.0 | + | 11 | description | string | 1..1 | 1.4.0 | + | 12 | isHidden | bool | 1..1 | 1.4.0 | + | 13 | lockedBy | Guid | 1..1 | 1.4.0 | * -------------------------------------------- | ---------------------------- | ----------- | ------- */ namespace CDP4Common.DTO.Equatable @@ -87,9 +88,6 @@ public static bool ArePropertiesEqual(this DiagramCanvas me, DiagramCanvas other if (!me.CreatedOn.Equals(other.CreatedOn)) return false; - if (me.Description == null && other.Description != null) return false; - if (me.Description != null && !me.Description.Equals(other.Description)) return false; - if (!me.DiagramElement.OrderBy(x => x).SequenceEqual(other.DiagramElement.OrderBy(x => x))) return false; if (!me.ExcludedDomain.OrderBy(x => x).SequenceEqual(other.ExcludedDomain.OrderBy(x => x))) return false; @@ -101,14 +99,19 @@ public static bool ArePropertiesEqual(this DiagramCanvas me, DiagramCanvas other if (me.Name == null && other.Name != null) return false; if (me.Name != null && !me.Name.Equals(other.Name)) return false; - if (!me.PublicationState.Equals(other.PublicationState)) return false; - if (me.ThingPreference == null && other.ThingPreference != null) return false; if (me.ThingPreference != null && !me.ThingPreference.Equals(other.ThingPreference)) return false; if (me.Actor.HasValue != other.Actor.HasValue) return false; if (!me.Actor.Equals(other.Actor)) return false; + if (me.Description == null && other.Description != null) return false; + if (me.Description != null && !me.Description.Equals(other.Description)) return false; + + if (!me.IsHidden.Equals(other.IsHidden)) return false; + + if (!me.LockedBy.Equals(other.LockedBy)) return false; + return true; } } diff --git a/CDP4Common/AutoGenMetaInfo/ArchitectureDiagramMetaInfo.cs b/CDP4Common/AutoGenMetaInfo/ArchitectureDiagramMetaInfo.cs index b093e77f..d0b6a593 100644 --- a/CDP4Common/AutoGenMetaInfo/ArchitectureDiagramMetaInfo.cs +++ b/CDP4Common/AutoGenMetaInfo/ArchitectureDiagramMetaInfo.cs @@ -197,8 +197,11 @@ public IEnumerable GetOrderedContainmentIds(CDP4Common.DTO.Thing ar private readonly Dictionary cdpVersionedProperties = new Dictionary { { "Actor", "1.3.0" }, + { "Description", "1.4.0" }, { "ExcludedDomain", "1.1.0" }, { "ExcludedPerson", "1.1.0" }, + { "IsHidden", "1.4.0" }, + { "LockedBy", "1.4.0" }, { "ModifiedOn", "1.1.0" }, { "ThingPreference", "1.2.0" }, }; @@ -245,10 +248,11 @@ public IEnumerable Properties { "ExcludedDomain", thing => thing.ExcludedDomain }, { "ExcludedPerson", thing => thing.ExcludedPerson }, { "Iid", thing => thing.Iid }, + { "IsHidden", thing => thing.IsHidden }, + { "LockedBy", thing => thing.LockedBy }, { "ModifiedOn", thing => thing.ModifiedOn }, { "Name", thing => thing.Name }, { "Owner", thing => thing.Owner }, - { "PublicationState", thing => thing.PublicationState }, { "RevisionNumber", thing => thing.RevisionNumber }, { "ThingPreference", thing => thing.ThingPreference }, { "TopArchitectureElement", thing => thing.TopArchitectureElement }, @@ -269,10 +273,11 @@ public IEnumerable Properties { "ExcludedDomain", new PropertyMetaInfo("ExcludedDomain", "DomainOfExpertise", PropertyKind.List, AggregationKind.None, false, false, true, 0, "*", true) }, { "ExcludedPerson", new PropertyMetaInfo("ExcludedPerson", "Person", PropertyKind.List, AggregationKind.None, false, false, true, 0, "*", true) }, { "Iid", new PropertyMetaInfo("Iid", "Guid", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, + { "IsHidden", new PropertyMetaInfo("IsHidden", "bool", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, + { "LockedBy", new PropertyMetaInfo("LockedBy", "Person", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, { "ModifiedOn", new PropertyMetaInfo("ModifiedOn", "DateTime", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, { "Name", new PropertyMetaInfo("Name", "string", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, { "Owner", new PropertyMetaInfo("Owner", "DomainOfExpertise", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, - { "PublicationState", new PropertyMetaInfo("PublicationState", "CDP4Common.DiagramData.PublicationState", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, { "RevisionNumber", new PropertyMetaInfo("RevisionNumber", "int", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, { "ThingPreference", new PropertyMetaInfo("ThingPreference", "string", PropertyKind.Scalar, AggregationKind.None, false, false, true, 0, "1", true) }, { "TopArchitectureElement", new PropertyMetaInfo("TopArchitectureElement", "ArchitectureElement", PropertyKind.Scalar, AggregationKind.None, false, false, true, 0, "1", true) }, @@ -298,10 +303,11 @@ public IEnumerable Properties { "CreatedOn", (architectureDiagram, value) => architectureDiagram.CreatedOn = (DateTime)value }, { "Description", (architectureDiagram, value) => architectureDiagram.Description = value.ToString() }, { "Iid", (architectureDiagram, value) => architectureDiagram.Iid = (Guid)value }, + { "IsHidden", (architectureDiagram, value) => architectureDiagram.IsHidden = (bool)value }, + { "LockedBy", (architectureDiagram, value) => architectureDiagram.LockedBy = (Guid)value }, { "ModifiedOn", (architectureDiagram, value) => architectureDiagram.ModifiedOn = (DateTime)value }, { "Name", (architectureDiagram, value) => architectureDiagram.Name = value.ToString() }, { "Owner", (architectureDiagram, value) => architectureDiagram.Owner = (Guid)value }, - { "PublicationState", (architectureDiagram, value) => architectureDiagram.PublicationState = (PublicationState)value }, { "ThingPreference", (architectureDiagram, value) => architectureDiagram.ThingPreference = value == null ? (string)null : value.ToString() }, { "TopArchitectureElement", (architectureDiagram, value) => architectureDiagram.TopArchitectureElement = value == null ? (Guid?)null : (Guid)value }, }; diff --git a/CDP4Common/AutoGenMetaInfo/DiagramCanvasMetaInfo.cs b/CDP4Common/AutoGenMetaInfo/DiagramCanvasMetaInfo.cs index ad762300..6f6a672f 100644 --- a/CDP4Common/AutoGenMetaInfo/DiagramCanvasMetaInfo.cs +++ b/CDP4Common/AutoGenMetaInfo/DiagramCanvasMetaInfo.cs @@ -197,8 +197,11 @@ public IEnumerable GetOrderedContainmentIds(CDP4Common.DTO.Thing di private readonly Dictionary cdpVersionedProperties = new Dictionary { { "Actor", "1.3.0" }, + { "Description", "1.4.0" }, { "ExcludedDomain", "1.1.0" }, { "ExcludedPerson", "1.1.0" }, + { "IsHidden", "1.4.0" }, + { "LockedBy", "1.4.0" }, { "ModifiedOn", "1.1.0" }, { "ThingPreference", "1.2.0" }, }; @@ -245,9 +248,10 @@ public IEnumerable Properties { "ExcludedDomain", thing => thing.ExcludedDomain }, { "ExcludedPerson", thing => thing.ExcludedPerson }, { "Iid", thing => thing.Iid }, + { "IsHidden", thing => thing.IsHidden }, + { "LockedBy", thing => thing.LockedBy }, { "ModifiedOn", thing => thing.ModifiedOn }, { "Name", thing => thing.Name }, - { "PublicationState", thing => thing.PublicationState }, { "RevisionNumber", thing => thing.RevisionNumber }, { "ThingPreference", thing => thing.ThingPreference }, }; @@ -267,9 +271,10 @@ public IEnumerable Properties { "ExcludedDomain", new PropertyMetaInfo("ExcludedDomain", "DomainOfExpertise", PropertyKind.List, AggregationKind.None, false, false, true, 0, "*", true) }, { "ExcludedPerson", new PropertyMetaInfo("ExcludedPerson", "Person", PropertyKind.List, AggregationKind.None, false, false, true, 0, "*", true) }, { "Iid", new PropertyMetaInfo("Iid", "Guid", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, + { "IsHidden", new PropertyMetaInfo("IsHidden", "bool", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, + { "LockedBy", new PropertyMetaInfo("LockedBy", "Person", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, { "ModifiedOn", new PropertyMetaInfo("ModifiedOn", "DateTime", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, { "Name", new PropertyMetaInfo("Name", "string", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, - { "PublicationState", new PropertyMetaInfo("PublicationState", "CDP4Common.DiagramData.PublicationState", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, { "RevisionNumber", new PropertyMetaInfo("RevisionNumber", "int", PropertyKind.Scalar, AggregationKind.None, false, false, true, 1, "1", true) }, { "ThingPreference", new PropertyMetaInfo("ThingPreference", "string", PropertyKind.Scalar, AggregationKind.None, false, false, true, 0, "1", true) }, }; @@ -294,9 +299,10 @@ public IEnumerable Properties { "CreatedOn", (diagramCanvas, value) => diagramCanvas.CreatedOn = (DateTime)value }, { "Description", (diagramCanvas, value) => diagramCanvas.Description = value.ToString() }, { "Iid", (diagramCanvas, value) => diagramCanvas.Iid = (Guid)value }, + { "IsHidden", (diagramCanvas, value) => diagramCanvas.IsHidden = (bool)value }, + { "LockedBy", (diagramCanvas, value) => diagramCanvas.LockedBy = (Guid)value }, { "ModifiedOn", (diagramCanvas, value) => diagramCanvas.ModifiedOn = (DateTime)value }, { "Name", (diagramCanvas, value) => diagramCanvas.Name = value.ToString() }, - { "PublicationState", (diagramCanvas, value) => diagramCanvas.PublicationState = (PublicationState)value }, { "ThingPreference", (diagramCanvas, value) => diagramCanvas.ThingPreference = value == null ? (string)null : value.ToString() }, }; diff --git a/CDP4Common/AutoGenPoco/ArchitectureDiagram.cs b/CDP4Common/AutoGenPoco/ArchitectureDiagram.cs index 8db5729c..514add9a 100644 --- a/CDP4Common/AutoGenPoco/ArchitectureDiagram.cs +++ b/CDP4Common/AutoGenPoco/ArchitectureDiagram.cs @@ -215,10 +215,11 @@ internal override void ResolveProperties(DTO.Thing dtoThing) this.DiagramElement.ResolveList(dto.DiagramElement, dto.IterationContainerId, this.Cache); this.ExcludedDomain.ResolveList(dto.ExcludedDomain, dto.IterationContainerId, this.Cache); this.ExcludedPerson.ResolveList(dto.ExcludedPerson, dto.IterationContainerId, this.Cache); + this.IsHidden = dto.IsHidden; + this.LockedBy = this.Cache.Get(dto.LockedBy, dto.IterationContainerId) ?? SentinelThingProvider.GetSentinel(); this.ModifiedOn = dto.ModifiedOn; this.Name = dto.Name; this.Owner = this.Cache.Get(dto.Owner, dto.IterationContainerId) ?? SentinelThingProvider.GetSentinel(); - this.PublicationState = dto.PublicationState; this.RevisionNumber = dto.RevisionNumber; this.ThingPreference = dto.ThingPreference; this.TopArchitectureElement = (dto.TopArchitectureElement.HasValue) ? this.Cache.Get(dto.TopArchitectureElement.Value, dto.IterationContainerId) : null; @@ -240,10 +241,11 @@ public override DTO.Thing ToDto() dto.DiagramElement.AddRange(this.DiagramElement.Select(x => x.Iid)); dto.ExcludedDomain.AddRange(this.ExcludedDomain.Select(x => x.Iid)); dto.ExcludedPerson.AddRange(this.ExcludedPerson.Select(x => x.Iid)); + dto.IsHidden = this.IsHidden; + dto.LockedBy = this.LockedBy != null ? this.LockedBy.Iid : Guid.Empty; dto.ModifiedOn = this.ModifiedOn; dto.Name = this.Name; dto.Owner = this.Owner != null ? this.Owner.Iid : Guid.Empty; - dto.PublicationState = this.PublicationState; dto.RevisionNumber = this.RevisionNumber; dto.ThingPreference = this.ThingPreference; dto.TopArchitectureElement = this.TopArchitectureElement != null ? (Guid?)this.TopArchitectureElement.Iid : null; diff --git a/CDP4Common/AutoGenPoco/DiagramCanvas.cs b/CDP4Common/AutoGenPoco/DiagramCanvas.cs index 6fe4ea31..423eeefa 100644 --- a/CDP4Common/AutoGenPoco/DiagramCanvas.cs +++ b/CDP4Common/AutoGenPoco/DiagramCanvas.cs @@ -101,16 +101,52 @@ public DiagramCanvas(Guid iid, ConcurrentDictionary /// Textual description of a DiagramCanvas. /// + [CDPVersion("1.4.0")] [UmlInformation(aggregation: AggregationKind.None, isDerived: false, isOrdered: false, isNullable: false, isPersistent: true)] public virtual string Description { get; set; } /// - /// Gets or sets the PublicationState. + /// Gets or sets a value indicating whether IsHidden. /// /// + /// assertion whether the DiagramCanvas is hidden or not /// + [CDPVersion("1.4.0")] [UmlInformation(aggregation: AggregationKind.None, isDerived: false, isOrdered: false, isNullable: false, isPersistent: true)] - public virtual PublicationState PublicationState { get; set; } + public virtual bool IsHidden { get; set; } + + /// + /// Gets or sets the LockedBy. + /// + /// + /// reference to a Person that has locked this DiagramCanvas for write / modify access + /// + [CDPVersion("1.4.0")] + [UmlInformation(aggregation: AggregationKind.None, isDerived: false, isOrdered: false, isNullable: false, isPersistent: true)] + public virtual Person LockedBy { get; set; } + + /// + /// Queries the referenced s of the current + /// + /// + /// This does not include the contained s, the contained s + /// are exposed via the property + /// + /// + /// An + /// + public override IEnumerable QueryReferencedThings() + { + foreach (var thing in base.QueryReferencedThings()) + { + yield return thing; + } + + if (this.LockedBy != null) + { + yield return this.LockedBy; + } + } /// /// Creates and returns a copy of this for edit purpose. @@ -166,6 +202,13 @@ protected override IEnumerable ValidatePocoCardinality() errorList.Add("The property Description is null or empty."); } + if (this.LockedBy == null || this.LockedBy.Iid == Guid.Empty) + { + errorList.Add("The property LockedBy is null."); + this.LockedBy = SentinelThingProvider.GetSentinel(); + this.sentinelResetMap["LockedBy"] = () => this.LockedBy = null; + } + return errorList; } @@ -193,9 +236,10 @@ internal override void ResolveProperties(DTO.Thing dtoThing) this.DiagramElement.ResolveList(dto.DiagramElement, dto.IterationContainerId, this.Cache); this.ExcludedDomain.ResolveList(dto.ExcludedDomain, dto.IterationContainerId, this.Cache); this.ExcludedPerson.ResolveList(dto.ExcludedPerson, dto.IterationContainerId, this.Cache); + this.IsHidden = dto.IsHidden; + this.LockedBy = this.Cache.Get(dto.LockedBy, dto.IterationContainerId) ?? SentinelThingProvider.GetSentinel(); this.ModifiedOn = dto.ModifiedOn; this.Name = dto.Name; - this.PublicationState = dto.PublicationState; this.RevisionNumber = dto.RevisionNumber; this.ThingPreference = dto.ThingPreference; @@ -216,9 +260,10 @@ public override DTO.Thing ToDto() dto.DiagramElement.AddRange(this.DiagramElement.Select(x => x.Iid)); dto.ExcludedDomain.AddRange(this.ExcludedDomain.Select(x => x.Iid)); dto.ExcludedPerson.AddRange(this.ExcludedPerson.Select(x => x.Iid)); + dto.IsHidden = this.IsHidden; + dto.LockedBy = this.LockedBy != null ? this.LockedBy.Iid : Guid.Empty; dto.ModifiedOn = this.ModifiedOn; dto.Name = this.Name; - dto.PublicationState = this.PublicationState; dto.RevisionNumber = this.RevisionNumber; dto.ThingPreference = this.ThingPreference; diff --git a/CDP4Common/AutoGenThingPropertyAccessor/ArchitectureDiagramPropertyAccessor.cs b/CDP4Common/AutoGenThingPropertyAccessor/ArchitectureDiagramPropertyAccessor.cs index 1fa2fb11..ac1e41c9 100644 --- a/CDP4Common/AutoGenThingPropertyAccessor/ArchitectureDiagramPropertyAccessor.cs +++ b/CDP4Common/AutoGenThingPropertyAccessor/ArchitectureDiagramPropertyAccessor.cs @@ -90,6 +90,10 @@ public override object QueryValue(string path) return base.QueryValue(pd.Input); case "diagramelement": return base.QueryValue(pd.Input); + case "ishidden": + return base.QueryValue(pd.Input); + case "lockedby": + return base.QueryValue(pd.Input); case "name": return base.QueryValue(pd.Input); case "owner": @@ -107,8 +111,6 @@ public override object QueryValue(string path) var sentinelowner = new DomainOfExpertise(Guid.Empty, null, null); return sentinelowner.QuerySentinelValue(pd.Next.Input, false); - case "publicationstate": - return base.QueryValue(pd.Input); case "toparchitectureelement": pd.VerifyPropertyDescriptorForReferenceProperty(); @@ -190,6 +192,18 @@ internal object QuerySentinelValue(string path, bool isCallerEmunerable) return isCallerEmunerable ? (object) new List() : null; case "diagramelement": return pd.Next == null ? (object) new List() : new DiagramEdge(Guid.Empty, null, null).QuerySentinelValue(pd.Next.Input, true); + case "ishidden": + pd.VerifyPropertyDescriptorForValueProperty(); + return isCallerEmunerable ? (object) new List() : null; + case "lockedby": + pd.VerifyPropertyDescriptorForReferenceProperty(); + + if (pd.Next != null) + { + return new Person(Guid.Empty, null, null).QuerySentinelValue(pd.Next.Input, true); + } + + return isCallerEmunerable ? (object) new List() : default(Person); case "name": pd.VerifyPropertyDescriptorForValueProperty(); return isCallerEmunerable ? (object) new List() : null; @@ -202,9 +216,6 @@ internal object QuerySentinelValue(string path, bool isCallerEmunerable) } return isCallerEmunerable ? (object) new List() : default(DomainOfExpertise); - case "publicationstate": - pd.VerifyPropertyDescriptorForValueProperty(); - return isCallerEmunerable ? (object) new List() : null; case "toparchitectureelement": pd.VerifyPropertyDescriptorForReferenceProperty(); diff --git a/CDP4Common/AutoGenThingPropertyAccessor/DiagramCanvasPropertyAccessor.cs b/CDP4Common/AutoGenThingPropertyAccessor/DiagramCanvasPropertyAccessor.cs index 4d5b0d9d..a853502f 100644 --- a/CDP4Common/AutoGenThingPropertyAccessor/DiagramCanvasPropertyAccessor.cs +++ b/CDP4Common/AutoGenThingPropertyAccessor/DiagramCanvasPropertyAccessor.cs @@ -92,11 +92,26 @@ public override object QueryValue(string path) return this.Description; case "diagramelement": return base.QueryValue(pd.Input); + case "ishidden": + pd.VerifyPropertyDescriptorForValueProperty(); + return this.IsHidden; + case "lockedby": + pd.VerifyPropertyDescriptorForReferenceProperty(); + + if (pd.Next == null) + { + return this.LockedBy; + } + + if (this.LockedBy != null) + { + return this.LockedBy.QueryValue(pd.Next.Input); + } + + var sentinellockedby = new Person(Guid.Empty, null, null); + return sentinellockedby.QuerySentinelValue(pd.Next.Input, false); case "name": return base.QueryValue(pd.Input); - case "publicationstate": - pd.VerifyPropertyDescriptorForValueProperty(); - return this.PublicationState; default: throw new ArgumentException($"The path:{path} does not exist on {this.ClassKind}"); } @@ -163,12 +178,21 @@ internal object QuerySentinelValue(string path, bool isCallerEmunerable) return isCallerEmunerable ? (object) new List() : null; case "diagramelement": return pd.Next == null ? (object) new List() : new DiagramEdge(Guid.Empty, null, null).QuerySentinelValue(pd.Next.Input, true); + case "ishidden": + pd.VerifyPropertyDescriptorForValueProperty(); + return isCallerEmunerable ? (object) new List() : null; + case "lockedby": + pd.VerifyPropertyDescriptorForReferenceProperty(); + + if (pd.Next != null) + { + return new Person(Guid.Empty, null, null).QuerySentinelValue(pd.Next.Input, true); + } + + return isCallerEmunerable ? (object) new List() : default(Person); case "name": pd.VerifyPropertyDescriptorForValueProperty(); return isCallerEmunerable ? (object) new List() : null; - case "publicationstate": - pd.VerifyPropertyDescriptorForValueProperty(); - return isCallerEmunerable ? (object) new List() : null; default: throw new ArgumentException($"The path:{path} does not exist on {this.ClassKind}"); } diff --git a/CDP4JsonSerializer/AutoGenDtoDeserializer/ArchitectureDiagramResolver.cs b/CDP4JsonSerializer/AutoGenDtoDeserializer/ArchitectureDiagramResolver.cs index ce202186..625e1571 100644 --- a/CDP4JsonSerializer/AutoGenDtoDeserializer/ArchitectureDiagramResolver.cs +++ b/CDP4JsonSerializer/AutoGenDtoDeserializer/ArchitectureDiagramResolver.cs @@ -91,6 +91,16 @@ public static CDP4Common.DTO.ArchitectureDiagram FromJsonObject(JObject jObject) architectureDiagram.ExcludedPerson.AddRange(jObject["excludedPerson"].ToObject>()); } + if (!jObject["isHidden"].IsNullOrEmpty()) + { + architectureDiagram.IsHidden = jObject["isHidden"].ToObject(); + } + + if (!jObject["lockedBy"].IsNullOrEmpty()) + { + architectureDiagram.LockedBy = jObject["lockedBy"].ToObject(); + } + if (!jObject["modifiedOn"].IsNullOrEmpty()) { architectureDiagram.ModifiedOn = jObject["modifiedOn"].ToObject(); @@ -106,11 +116,6 @@ public static CDP4Common.DTO.ArchitectureDiagram FromJsonObject(JObject jObject) architectureDiagram.Owner = jObject["owner"].ToObject(); } - if (!jObject["publicationState"].IsNullOrEmpty()) - { - architectureDiagram.PublicationState = jObject["publicationState"].ToObject(); - } - if (!jObject["thingPreference"].IsNullOrEmpty()) { architectureDiagram.ThingPreference = jObject["thingPreference"].ToObject(); diff --git a/CDP4JsonSerializer/AutoGenDtoDeserializer/DiagramCanvasResolver.cs b/CDP4JsonSerializer/AutoGenDtoDeserializer/DiagramCanvasResolver.cs index a34c642d..1208304d 100644 --- a/CDP4JsonSerializer/AutoGenDtoDeserializer/DiagramCanvasResolver.cs +++ b/CDP4JsonSerializer/AutoGenDtoDeserializer/DiagramCanvasResolver.cs @@ -91,6 +91,16 @@ public static CDP4Common.DTO.DiagramCanvas FromJsonObject(JObject jObject) diagramCanvas.ExcludedPerson.AddRange(jObject["excludedPerson"].ToObject>()); } + if (!jObject["isHidden"].IsNullOrEmpty()) + { + diagramCanvas.IsHidden = jObject["isHidden"].ToObject(); + } + + if (!jObject["lockedBy"].IsNullOrEmpty()) + { + diagramCanvas.LockedBy = jObject["lockedBy"].ToObject(); + } + if (!jObject["modifiedOn"].IsNullOrEmpty()) { diagramCanvas.ModifiedOn = jObject["modifiedOn"].ToObject(); @@ -101,11 +111,6 @@ public static CDP4Common.DTO.DiagramCanvas FromJsonObject(JObject jObject) diagramCanvas.Name = jObject["name"].ToObject(); } - if (!jObject["publicationState"].IsNullOrEmpty()) - { - diagramCanvas.PublicationState = jObject["publicationState"].ToObject(); - } - if (!jObject["thingPreference"].IsNullOrEmpty()) { diagramCanvas.ThingPreference = jObject["thingPreference"].ToObject(); diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ArchitectureDiagramSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ArchitectureDiagramSerializer.cs index 90bc0f71..3219245e 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ArchitectureDiagramSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ArchitectureDiagramSerializer.cs @@ -58,10 +58,11 @@ public class ArchitectureDiagramSerializer : BaseThingSerializer, IThingSerializ { "excludedDomain", excludedDomain => new JArray(excludedDomain) }, { "excludedPerson", excludedPerson => new JArray(excludedPerson) }, { "iid", iid => new JValue(iid) }, + { "isHidden", isHidden => new JValue(isHidden) }, + { "lockedBy", lockedBy => new JValue(lockedBy) }, { "modifiedOn", modifiedOn => new JValue(((DateTime)modifiedOn).ToString("yyyy-MM-ddTHH:mm:ss.fffZ")) }, { "name", name => new JValue(name) }, { "owner", owner => new JValue(owner) }, - { "publicationState", publicationState => new JValue(publicationState.ToString()) }, { "revisionNumber", revisionNumber => new JValue(revisionNumber) }, { "thingPreference", thingPreference => new JValue(thingPreference) }, { "topArchitectureElement", topArchitectureElement => new JValue(topArchitectureElement) }, @@ -83,10 +84,11 @@ private JObject Serialize(ArchitectureDiagram architectureDiagram) jsonObject.Add("excludedDomain", this.PropertySerializerMap["excludedDomain"](architectureDiagram.ExcludedDomain.OrderBy(x => x, this.guidComparer))); jsonObject.Add("excludedPerson", this.PropertySerializerMap["excludedPerson"](architectureDiagram.ExcludedPerson.OrderBy(x => x, this.guidComparer))); jsonObject.Add("iid", this.PropertySerializerMap["iid"](architectureDiagram.Iid)); + jsonObject.Add("isHidden", this.PropertySerializerMap["isHidden"](architectureDiagram.IsHidden)); + jsonObject.Add("lockedBy", this.PropertySerializerMap["lockedBy"](architectureDiagram.LockedBy)); jsonObject.Add("modifiedOn", this.PropertySerializerMap["modifiedOn"](architectureDiagram.ModifiedOn)); jsonObject.Add("name", this.PropertySerializerMap["name"](architectureDiagram.Name)); jsonObject.Add("owner", this.PropertySerializerMap["owner"](architectureDiagram.Owner)); - jsonObject.Add("publicationState", this.PropertySerializerMap["publicationState"](Enum.GetName(typeof(CDP4Common.DiagramData.PublicationState), architectureDiagram.PublicationState))); jsonObject.Add("revisionNumber", this.PropertySerializerMap["revisionNumber"](architectureDiagram.RevisionNumber)); jsonObject.Add("thingPreference", this.PropertySerializerMap["thingPreference"](architectureDiagram.ThingPreference)); jsonObject.Add("topArchitectureElement", this.PropertySerializerMap["topArchitectureElement"](architectureDiagram.TopArchitectureElement)); diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramCanvasSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramCanvasSerializer.cs index e1d11ff6..a410fdec 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramCanvasSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramCanvasSerializer.cs @@ -58,9 +58,10 @@ public class DiagramCanvasSerializer : BaseThingSerializer, IThingSerializer { "excludedDomain", excludedDomain => new JArray(excludedDomain) }, { "excludedPerson", excludedPerson => new JArray(excludedPerson) }, { "iid", iid => new JValue(iid) }, + { "isHidden", isHidden => new JValue(isHidden) }, + { "lockedBy", lockedBy => new JValue(lockedBy) }, { "modifiedOn", modifiedOn => new JValue(((DateTime)modifiedOn).ToString("yyyy-MM-ddTHH:mm:ss.fffZ")) }, { "name", name => new JValue(name) }, - { "publicationState", publicationState => new JValue(publicationState.ToString()) }, { "revisionNumber", revisionNumber => new JValue(revisionNumber) }, { "thingPreference", thingPreference => new JValue(thingPreference) }, }; @@ -81,9 +82,10 @@ private JObject Serialize(DiagramCanvas diagramCanvas) jsonObject.Add("excludedDomain", this.PropertySerializerMap["excludedDomain"](diagramCanvas.ExcludedDomain.OrderBy(x => x, this.guidComparer))); jsonObject.Add("excludedPerson", this.PropertySerializerMap["excludedPerson"](diagramCanvas.ExcludedPerson.OrderBy(x => x, this.guidComparer))); jsonObject.Add("iid", this.PropertySerializerMap["iid"](diagramCanvas.Iid)); + jsonObject.Add("isHidden", this.PropertySerializerMap["isHidden"](diagramCanvas.IsHidden)); + jsonObject.Add("lockedBy", this.PropertySerializerMap["lockedBy"](diagramCanvas.LockedBy)); jsonObject.Add("modifiedOn", this.PropertySerializerMap["modifiedOn"](diagramCanvas.ModifiedOn)); jsonObject.Add("name", this.PropertySerializerMap["name"](diagramCanvas.Name)); - jsonObject.Add("publicationState", this.PropertySerializerMap["publicationState"](Enum.GetName(typeof(CDP4Common.DiagramData.PublicationState), diagramCanvas.PublicationState))); jsonObject.Add("revisionNumber", this.PropertySerializerMap["revisionNumber"](diagramCanvas.RevisionNumber)); jsonObject.Add("thingPreference", this.PropertySerializerMap["thingPreference"](diagramCanvas.ThingPreference)); return jsonObject; diff --git a/CDP4MessagePackSerializer/AutoGenMessagePackFormatter/ArchitectureDiagramMessagePackFormatter.cs b/CDP4MessagePackSerializer/AutoGenMessagePackFormatter/ArchitectureDiagramMessagePackFormatter.cs index 34582590..45534f0b 100644 --- a/CDP4MessagePackSerializer/AutoGenMessagePackFormatter/ArchitectureDiagramMessagePackFormatter.cs +++ b/CDP4MessagePackSerializer/AutoGenMessagePackFormatter/ArchitectureDiagramMessagePackFormatter.cs @@ -42,10 +42,11 @@ | 8 | createdOn | DateTime | 1..1 | 1.4.0 | | 9 | description | string | 1..1 | 1.4.0 | | 10 | diagramElement | Guid | 0..* | 1.4.0 | - | 11 | name | string | 1..1 | 1.4.0 | - | 12 | owner | Guid | 1..1 | 1.4.0 | - | 13 | publicationState | PublicationState | 1..1 | 1.4.0 | - | 14 | topArchitectureElement | Guid | 0..1 | 1.4.0 | + | 11 | isHidden | bool | 1..1 | 1.4.0 | + | 12 | lockedBy | Guid | 1..1 | 1.4.0 | + | 13 | name | string | 1..1 | 1.4.0 | + | 14 | owner | Guid | 1..1 | 1.4.0 | + | 15 | topArchitectureElement | Guid | 0..1 | 1.4.0 | * -------------------------------------------- | ---------------------------- | ----------- | ------- */ namespace CDP4MessagePackSerializer @@ -98,7 +99,7 @@ public void Serialize(ref MessagePackWriter writer, ArchitectureDiagram architec throw new ArgumentNullException(nameof(architectureDiagram), "The ArchitectureDiagram may not be null"); } - writer.WriteArrayHeader(15); + writer.WriteArrayHeader(16); writer.Write(architectureDiagram.Iid.ToByteArray()); writer.Write(architectureDiagram.RevisionNumber); @@ -135,9 +136,10 @@ public void Serialize(ref MessagePackWriter writer, ArchitectureDiagram architec { writer.Write(identifier.ToByteArray()); } + writer.Write(architectureDiagram.IsHidden); + writer.Write(architectureDiagram.LockedBy.ToByteArray()); writer.Write(architectureDiagram.Name); writer.Write(architectureDiagram.Owner.ToByteArray()); - writer.Write(architectureDiagram.PublicationState.ToString()); if (architectureDiagram.TopArchitectureElement.HasValue) { writer.Write(architectureDiagram.TopArchitectureElement.Value.ToByteArray()); @@ -240,15 +242,18 @@ public ArchitectureDiagram Deserialize(ref MessagePackReader reader, MessagePack } break; case 11: - architectureDiagram.Name = reader.ReadString(); + architectureDiagram.IsHidden = reader.ReadBoolean(); break; case 12: - architectureDiagram.Owner = reader.ReadBytes().ToGuid(); + architectureDiagram.LockedBy = reader.ReadBytes().ToGuid(); break; case 13: - architectureDiagram.PublicationState = (CDP4Common.DiagramData.PublicationState)Enum.Parse(typeof(CDP4Common.DiagramData.PublicationState), reader.ReadString(), true); + architectureDiagram.Name = reader.ReadString(); break; case 14: + architectureDiagram.Owner = reader.ReadBytes().ToGuid(); + break; + case 15: if (reader.TryReadNil()) { architectureDiagram.TopArchitectureElement = null; diff --git a/CDP4MessagePackSerializer/AutoGenMessagePackFormatter/DiagramCanvasMessagePackFormatter.cs b/CDP4MessagePackSerializer/AutoGenMessagePackFormatter/DiagramCanvasMessagePackFormatter.cs index d0bd37d8..83a0e954 100644 --- a/CDP4MessagePackSerializer/AutoGenMessagePackFormatter/DiagramCanvasMessagePackFormatter.cs +++ b/CDP4MessagePackSerializer/AutoGenMessagePackFormatter/DiagramCanvasMessagePackFormatter.cs @@ -35,15 +35,16 @@ | -------------------------------------------- | ---------------------------- | ----------- | ------- | | 2 | bounds | Guid | 0..1 | 1.1.0 | | 3 | createdOn | DateTime | 1..1 | 1.1.0 | - | 4 | description | string | 1..1 | 1.1.0 | - | 5 | diagramElement | Guid | 0..* | 1.1.0 | - | 6 | excludedDomain | Guid | 0..* | 1.1.0 | - | 7 | excludedPerson | Guid | 0..* | 1.1.0 | - | 8 | modifiedOn | DateTime | 1..1 | 1.1.0 | - | 9 | name | string | 1..1 | 1.1.0 | - | 10 | publicationState | PublicationState | 1..1 | 1.1.0 | - | 11 | thingPreference | string | 0..1 | 1.2.0 | - | 12 | actor | Guid | 0..1 | 1.3.0 | + | 4 | diagramElement | Guid | 0..* | 1.1.0 | + | 5 | excludedDomain | Guid | 0..* | 1.1.0 | + | 6 | excludedPerson | Guid | 0..* | 1.1.0 | + | 7 | modifiedOn | DateTime | 1..1 | 1.1.0 | + | 8 | name | string | 1..1 | 1.1.0 | + | 9 | thingPreference | string | 0..1 | 1.2.0 | + | 10 | actor | Guid | 0..1 | 1.3.0 | + | 11 | description | string | 1..1 | 1.4.0 | + | 12 | isHidden | bool | 1..1 | 1.4.0 | + | 13 | lockedBy | Guid | 1..1 | 1.4.0 | * -------------------------------------------- | ---------------------------- | ----------- | ------- */ namespace CDP4MessagePackSerializer @@ -96,7 +97,7 @@ public void Serialize(ref MessagePackWriter writer, DiagramCanvas diagramCanvas, throw new ArgumentNullException(nameof(diagramCanvas), "The DiagramCanvas may not be null"); } - writer.WriteArrayHeader(13); + writer.WriteArrayHeader(14); writer.Write(diagramCanvas.Iid.ToByteArray()); writer.Write(diagramCanvas.RevisionNumber); @@ -107,7 +108,6 @@ public void Serialize(ref MessagePackWriter writer, DiagramCanvas diagramCanvas, writer.Write(identifier.ToByteArray()); } writer.Write(diagramCanvas.CreatedOn); - writer.Write(diagramCanvas.Description); writer.WriteArrayHeader(diagramCanvas.DiagramElement.Count); foreach (var identifier in diagramCanvas.DiagramElement.OrderBy(x => x, guidComparer)) { @@ -125,7 +125,6 @@ public void Serialize(ref MessagePackWriter writer, DiagramCanvas diagramCanvas, } writer.Write(diagramCanvas.ModifiedOn); writer.Write(diagramCanvas.Name); - writer.Write(diagramCanvas.PublicationState.ToString()); writer.Write(diagramCanvas.ThingPreference); if (diagramCanvas.Actor.HasValue) { @@ -135,6 +134,9 @@ public void Serialize(ref MessagePackWriter writer, DiagramCanvas diagramCanvas, { writer.WriteNil(); } + writer.Write(diagramCanvas.Description); + writer.Write(diagramCanvas.IsHidden); + writer.Write(diagramCanvas.LockedBy.ToByteArray()); writer.Flush(); } @@ -189,42 +191,36 @@ public DiagramCanvas Deserialize(ref MessagePackReader reader, MessagePackSerial diagramCanvas.CreatedOn = reader.ReadDateTime(); break; case 4: - diagramCanvas.Description = reader.ReadString(); - break; - case 5: valueLength = reader.ReadArrayHeader(); for (valueCounter = 0; valueCounter < valueLength; valueCounter++) { diagramCanvas.DiagramElement.Add(reader.ReadBytes().ToGuid()); } break; - case 6: + case 5: valueLength = reader.ReadArrayHeader(); for (valueCounter = 0; valueCounter < valueLength; valueCounter++) { diagramCanvas.ExcludedDomain.Add(reader.ReadBytes().ToGuid()); } break; - case 7: + case 6: valueLength = reader.ReadArrayHeader(); for (valueCounter = 0; valueCounter < valueLength; valueCounter++) { diagramCanvas.ExcludedPerson.Add(reader.ReadBytes().ToGuid()); } break; - case 8: + case 7: diagramCanvas.ModifiedOn = reader.ReadDateTime(); break; - case 9: + case 8: diagramCanvas.Name = reader.ReadString(); break; - case 10: - diagramCanvas.PublicationState = (CDP4Common.DiagramData.PublicationState)Enum.Parse(typeof(CDP4Common.DiagramData.PublicationState), reader.ReadString(), true); - break; - case 11: + case 9: diagramCanvas.ThingPreference = reader.ReadString(); break; - case 12: + case 10: if (reader.TryReadNil()) { diagramCanvas.Actor = null; @@ -234,6 +230,15 @@ public DiagramCanvas Deserialize(ref MessagePackReader reader, MessagePackSerial diagramCanvas.Actor = reader.ReadBytes().ToGuid(); } break; + case 11: + diagramCanvas.Description = reader.ReadString(); + break; + case 12: + diagramCanvas.IsHidden = reader.ReadBoolean(); + break; + case 13: + diagramCanvas.LockedBy = reader.ReadBytes().ToGuid(); + break; default: reader.Skip(); break;