Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
* adding Qualifiers to the
Browse files Browse the repository at this point in the history
   Samm SM instance creation
  • Loading branch information
festo-i40 committed Nov 8, 2023
1 parent 492c3dc commit f51bf5e
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/AasxPackageLogic/DispEditHelperSammModules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2590,9 +2590,6 @@ public void CreateSubmodelElementsInto(
if (meProp == null)
continue;

if (sitProp?.CD?.IdShort == "catenaXId")
;

// keep track for later use
Aas.ISubmodelElement addedElem = null;
var qualiferToAdd = new List<Aas.IQualifier>();
Expand All @@ -2603,6 +2600,12 @@ public void CreateSubmodelElementsInto(
qualiferToAdd.Add(
AasPresetHelper.CreateQualifierSmtCardinality(AasPresetHelper.SmtCardinality.ZeroToOne));

// example value directly associated with the property
if (meProp.ExampleValue != null)
// ExampleValue
qualiferToAdd.Add(
AasPresetHelper.CreateQualifierSmtExampleValue(meProp.ExampleValue));

// ok, a Submodel element shall be created.
// But more details (SMC? Property?) are only avilable via
// Characteristic -> dataType ..
Expand Down Expand Up @@ -2670,9 +2673,24 @@ public void CreateSubmodelElementsInto(
qualiferToAdd.Add(
AasPresetHelper.CreateQualifierSmtAllowedValue(regexCons.Value));
}

if (sitCons.ME is Samm.LanguageConstraint langCons)
{
// RequiredLanguage
qualiferToAdd.Add(
AasPresetHelper.CreateQualifierSmtRequiredLang(langCons.LanguageCode));
}
}
}

if (sitChar?.ME is Samm.State charState)
{
if (charState.DefaultValue?.HasContent() == true)
// Default value .. only for States
qualiferToAdd.Add(
AasPresetHelper.CreateQualifierSmtDefaultValue(charState.DefaultValue));
}

// elaborate added element further
if (addedElem != null && qualiferToAdd.Count > 0)
addedElem.Qualifiers = qualiferToAdd;
Expand Down

0 comments on commit f51bf5e

Please sign in to comment.