Skip to content

Commit

Permalink
First step implementing PathComponents
Browse files Browse the repository at this point in the history
  • Loading branch information
lxatstariongroup committed Nov 16, 2023
1 parent 20f13b2 commit c3a59a6
Show file tree
Hide file tree
Showing 33 changed files with 1,721 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -351,3 +351,5 @@ MigrationBackup/
/Kalliope.OO.Tests/Generation/OSMOSEModelLoaderTestFixture.cs
/Kalliope.OO/Documentation/Doxyfile
/Kalliope.OO/Documentation/latex
/Kalliope.Xml.Tests/Data/SSO_MBSEHUB_dev.orm
/Kalliope.Xml.Tests/OrmXmlReaders/SSO_MBSEHUB_dev_TestFixture.cs
8 changes: 8 additions & 0 deletions Kalliope.DTO/AutoGenDto/LeadRolePath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public partial class LeadRolePath : RolePath
/// </summary>
public LeadRolePath()
{
this.CalculatedConditions = new List<string>();
this.CalculatedValues = new List<string>();
this.ObjectUnifiers = new List<string>();
this.ProjectedPathComponents = new List<string>();
Expand All @@ -55,6 +56,13 @@ public LeadRolePath()
public string Container {get; set;}


/// <summary>
/// Gets or sets a list unique identifiers of the contained <see cref="CalculatedPathValue"/> instances
/// </summary>
[Description("A list of calculated boolean results that are necessary conditions for this role path.")]
[Property(name: "CalculatedConditions", aggregation: AggregationKind.Composite, multiplicity: "0..*", typeKind: TypeKind.Object, defaultValue: "", typeName: "CalculatedPathValue", allowOverride: false, isOverride: false, isDerived: false)]
public List<string> CalculatedConditions { get; set; }

/// <summary>
/// Gets or sets a list unique identifiers of the contained <see cref="CalculatedPathValue"/> instances
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions Kalliope.DTO/AutoGenDto/PathConditionRoleValueConstraint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace Kalliope.DTO
/// <remarks>
/// Value constraint applied to a pathed role in a role path
/// </remarks>
[Container(typeName: "PathedRole", propertyName: "PathedRoleConditionValueConstraint")]
public partial class PathConditionRoleValueConstraint : ValueConstraint
{
/// <summary>
Expand All @@ -44,6 +45,11 @@ public PathConditionRoleValueConstraint()
{
}

/// <summary>
/// Gets or sets the unique identifier of the container
/// </summary>
public string Container {get; set;}

}
}

Expand Down
66 changes: 66 additions & 0 deletions Kalliope.DTO/AutoGenDto/PathConditionRoleValueRestriction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// -------------------------------------------------------------------------------------------------
// <copyright file="PathConditionRoleValueRestriction.cs" company="RHEA System S.A.">
//
// Copyright 2022-2023 RHEA System S.A.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// </copyright>
// ------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
// ------------------------------------------------------------------------------------------------

namespace Kalliope.DTO
{
using System;
using System.Collections.Generic;

using Kalliope.Common;

/// <summary>
/// A Data Transfer Object that represents a PathConditionRoleValueRestriction
/// </summary>
/// <remarks>
/// Restrict the values required by a pathed role to satisfy the role path.
/// </remarks>
[Container(typeName: "PathedRole", propertyName: "ValueRestriction")]
public partial class PathConditionRoleValueRestriction : ModelThing
{
/// <summary>
/// Initializes a new instance of the <see cref="PathConditionRoleValueRestriction"/> class.
/// </summary>
public PathConditionRoleValueRestriction()
{
}

/// <summary>
/// Gets or sets the unique identifier of the container
/// </summary>
public string Container {get; set;}


/// <summary>
/// Gets or sets the unique identifier of the referenced <see cref="ValueConstraint"/>
/// </summary>
[Description("The ValueConstraint")]
[Property(name: "PathedRoleConditionValueConstraint", aggregation: AggregationKind.None, multiplicity: "1..1", typeKind: TypeKind.Object, defaultValue: "", typeName: "ValueConstraint", allowOverride: false, isOverride: false, isDerived: false)]
public string PathedRoleConditionValueConstraint { get; set; }

}
}

// ------------------------------------------------------------------------------------------------
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
// ------------------------------------------------------------------------------------------------
88 changes: 88 additions & 0 deletions Kalliope.DTO/AutoGenDto/PathedRole.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// -------------------------------------------------------------------------------------------------
// <copyright file="PathedRole.cs" company="RHEA System S.A.">
//
// Copyright 2022-2023 RHEA System S.A.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// </copyright>
// ------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
// ------------------------------------------------------------------------------------------------

namespace Kalliope.DTO
{
using System;
using System.Collections.Generic;

using Kalliope.Common;

/// <summary>
/// A Data Transfer Object that represents a PathedRole
/// </summary>
/// <remarks>
/// A role in connected path.
/// </remarks>
[Container(typeName: "RolePath", propertyName: "PathedRole")]
public partial class PathedRole : ModelThing
{
/// <summary>
/// Initializes a new instance of the <see cref="PathedRole"/> class.
/// </summary>
public PathedRole()
{
this.Purpose = PathedRolePurpose.SameFactType;
}

/// <summary>
/// Gets or sets the unique identifier of the container
/// </summary>
public string Container {get; set;}


/// <summary>
/// Gets or sets a IsNegated
/// </summary>
[Description("Is this PathedRole Negated")]
[Property(name: "IsNegated", aggregation: AggregationKind.None, multiplicity: "1..1", typeKind: TypeKind.Boolean, defaultValue: "false", typeName: "", allowOverride: false, isOverride: false, isDerived: false)]
public bool IsNegated { get; set; }

/// <summary>
/// Gets or sets a Purpose
/// </summary>
[Description("The Purpose specification for a PathedRole.")]
[Property(name: "Purpose", aggregation: AggregationKind.None, multiplicity: "1..1", typeKind: TypeKind.Enumeration, defaultValue: "SameFactType", typeName: "PathedRolePurpose", allowOverride: false, isOverride: false, isDerived: false)]
public PathedRolePurpose Purpose { get; set; }

/// <summary>
/// Gets or sets the unique identifier of the referenced <see cref="RoleBase"/>
/// </summary>
[Description("")]
[Property(name: "Role", aggregation: AggregationKind.None, multiplicity: "1..1", typeKind: TypeKind.Object, defaultValue: "", typeName: "RoleBase", allowOverride: false, isOverride: false, isDerived: false)]
public string Role { get; set; }

/// <summary>
/// Gets or sets the unique identifier of the referenced <see cref="PathConditionRoleValueRestriction"/>
/// </summary>
[Description("The PathConditionRoleValueRestriction")]
[Property(name: "ValueRestriction", aggregation: AggregationKind.None, multiplicity: "1..1", typeKind: TypeKind.Object, defaultValue: "", typeName: "PathConditionRoleValueRestriction", allowOverride: false, isOverride: false, isDerived: false)]
public string ValueRestriction { get; set; }

}
}

// ------------------------------------------------------------------------------------------------
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
// ------------------------------------------------------------------------------------------------
8 changes: 8 additions & 0 deletions Kalliope.DTO/AutoGenDto/RolePath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,20 @@ public abstract partial class RolePath : OrmModelElement
/// </summary>
protected RolePath()
{
this.PathedRoles = new List<string>();
this.Roles = new List<string>();
this.SplitCombinationOperator = LogicalCombinationOperator.And;
this.SubPaths = new List<string>();
}


/// <summary>
/// Gets or sets a list unique identifiers of the referenced <see cref="PathedRole"/> instances
/// </summary>
[Description("The pathed roles included in this path")]
[Property(name: "PathedRoles", aggregation: AggregationKind.None, multiplicity: "0..*", typeKind: TypeKind.Object, defaultValue: "", typeName: "PathedRole", allowOverride: false, isOverride: false, isDerived: false)]
public List<string> PathedRoles { get; set; }

/// <summary>
/// Gets or sets a list unique identifiers of the referenced <see cref="Role"/> instances
/// </summary>
Expand Down
66 changes: 66 additions & 0 deletions Kalliope.DTO/AutoGenDto/RootObjectType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// -------------------------------------------------------------------------------------------------
// <copyright file="RootObjectType.cs" company="RHEA System S.A.">
//
// Copyright 2022-2023 RHEA System S.A.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// </copyright>
// ------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
// ------------------------------------------------------------------------------------------------

namespace Kalliope.DTO
{
using System;
using System.Collections.Generic;

using Kalliope.Common;

/// <summary>
/// A Data Transfer Object that represents a RootObjectType
/// </summary>
/// <remarks>
/// A reference to the object type that establishes the start point object type for a role path.
/// </remarks>
[Container(typeName: "RolePath", propertyName: "RootObjectType")]
public partial class RootObjectType : ModelThing
{
/// <summary>
/// Initializes a new instance of the <see cref="RootObjectType"/> class.
/// </summary>
public RootObjectType()
{
}

/// <summary>
/// Gets or sets the unique identifier of the container
/// </summary>
public string Container {get; set;}


/// <summary>
/// Gets or sets the unique identifier of the referenced <see cref="ObjectType"/>
/// </summary>
[Description("")]
[Property(name: "ObjectType", aggregation: AggregationKind.None, multiplicity: "1..1", typeKind: TypeKind.Object, defaultValue: "", typeName: "ObjectType", allowOverride: false, isOverride: false, isDerived: false)]
public string ObjectType { get; set; }

}
}

// ------------------------------------------------------------------------------------------------
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
// ------------------------------------------------------------------------------------------------
35 changes: 35 additions & 0 deletions Kalliope.Dal/AutoGenExtension/LeadRolePathExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ public static IEnumerable<string> UpdateValueAndRemoveDeletedReferenceProperties
poco.AssociatedModelErrors.Remove(modelError);
}

var calculatedConditionsToDelete = poco.CalculatedConditions.Select(x => x.Id).Except(dto.CalculatedConditions);
identifiersOfObjectsToDelete.AddRange(calculatedConditionsToDelete);
foreach (var identifier in calculatedConditionsToDelete)
{
var calculatedPathValue = poco.CalculatedConditions.Single(x => x.Id == identifier);
poco.CalculatedConditions.Remove(calculatedPathValue);
}

var calculatedValuesToDelete = poco.CalculatedValues.Select(x => x.Id).Except(dto.CalculatedValues);
identifiersOfObjectsToDelete.AddRange(calculatedValuesToDelete);
foreach (var identifier in calculatedValuesToDelete)
Expand Down Expand Up @@ -115,6 +123,13 @@ public static IEnumerable<string> UpdateValueAndRemoveDeletedReferenceProperties
poco.ObjectUnifiers.Remove(pathObjectUnifier);
}

var pathedRolesToDelete = poco.PathedRoles.Select(x => x.Id).Except(dto.PathedRoles);
foreach (var identifier in pathedRolesToDelete)
{
var pathedRole = poco.PathedRoles.Single(x => x.Id == identifier);
poco.PathedRoles.Remove(pathedRole);
}

var projectedPathComponentsToDelete = poco.ProjectedPathComponents.Select(x => x.Id).Except(dto.ProjectedPathComponents);
foreach (var identifier in projectedPathComponentsToDelete)
{
Expand Down Expand Up @@ -199,6 +214,16 @@ public static void UpdateReferenceProperties(this Kalliope.Core.LeadRolePath poc
}
}

var calculatedConditionsToAdd = dto.CalculatedConditions.Except(poco.CalculatedConditions.Select(x => x.Id));
foreach (var identifier in calculatedConditionsToAdd)
{
if (cache.TryGetValue(identifier, out lazyPoco))
{
var calculatedPathValue = (CalculatedPathValue)lazyPoco.Value;
poco.CalculatedConditions.Add(calculatedPathValue);
}
}

var calculatedValuesToAdd = dto.CalculatedValues.Except(poco.CalculatedValues.Select(x => x.Id));
foreach (var identifier in calculatedValuesToAdd)
{
Expand Down Expand Up @@ -244,6 +269,16 @@ public static void UpdateReferenceProperties(this Kalliope.Core.LeadRolePath poc
}
}

var pathedRolesToAdd = dto.PathedRoles.Except(poco.PathedRoles.Select(x => x.Id));
foreach (var identifier in pathedRolesToAdd)
{
if (cache.TryGetValue(identifier, out lazyPoco))
{
var pathedRole = (PathedRole)lazyPoco.Value;
poco.PathedRoles.Add(pathedRole);
}
}

var projectedPathComponentsToAdd = dto.ProjectedPathComponents.Except(poco.ProjectedPathComponents.Select(x => x.Id));
foreach (var identifier in projectedPathComponentsToAdd)
{
Expand Down

0 comments on commit c3a59a6

Please sign in to comment.