Skip to content

Commit fec69b5

Browse files
committed
[1983] Synchronize reqId and declaredShortName
Bug: #1983 Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
1 parent 0d66d42 commit fec69b5

8 files changed

Lines changed: 105 additions & 12 deletions

File tree

CHANGELOG.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ The property `SysONTestsProperties#ELASTICSEARCH` has been removed, tests that r
3838
- https://github.com/eclipse-syson/syson/issues/1860[#1860] [diagrams] Add a precondition for compartment item node descriptions in order to filter out unwanted types.
3939
For example `ViewUsage` elements are no longer rendered in _parts_ compartments.
4040
- https://github.com/eclipse-syson/syson/issues/1981[#1981] [export] Fix an error during textual export where `Expose` elements with apostrophes in their name were not properly escaped.
41+
- https://github.com/eclipse-syson/syson/issues/1983[#1983] [metamodel] `reqId` and `declaredShortName` properties of `RequirementDefinition` and `RequirementUsage` are now synchronized, as required by the SysMLv2 specification.
4142

4243
=== Improvements
4344

@@ -65,6 +66,7 @@ Also add a _New Satisfy Requirement_ graphical edge tool between `Feature` grap
6566
As a result, the application won't start if a service call is constructed with an invalid number of arguments.
6667
- https://github.com/eclipse-syson/syson/issues/1988[#1988] [syson] Extract Elasticsearch container initialization in a dedicated abstract test class.
6768
Integration tests that require Elasticsearch now need to extend `AbstractIntegrationTestsWithElasticsearch`.
69+
- https://github.com/eclipse-syson/syson/issues/1983[#1983] [details] `reqId` property of `RequirementDefinition` is now visible in the _Core_ tab of the _Details_ view.
6870

6971
=== New features
7072

backend/application/syson-application-configuration/src/main/java/org/eclipse/syson/application/services/CoreFeaturesSwitch.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2023, 2025 Obeo.
2+
* Copyright (c) 2023, 2026 Obeo.
33
* This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
@@ -37,6 +37,7 @@
3737
import org.eclipse.syson.sysml.Redefinition;
3838
import org.eclipse.syson.sysml.ReferenceSubsetting;
3939
import org.eclipse.syson.sysml.RequirementConstraintMembership;
40+
import org.eclipse.syson.sysml.RequirementDefinition;
4041
import org.eclipse.syson.sysml.RequirementUsage;
4142
import org.eclipse.syson.sysml.Specialization;
4243
import org.eclipse.syson.sysml.StateDefinition;
@@ -231,6 +232,14 @@ public List<EStructuralFeature> caseRequirementConstraintMembership(RequirementC
231232
return features;
232233
}
233234

235+
@Override
236+
public List<EStructuralFeature> caseRequirementDefinition(RequirementDefinition object) {
237+
var features = new ArrayList<EStructuralFeature>();
238+
features.addAll(this.caseElement(object));
239+
features.add(SysmlPackage.eINSTANCE.getRequirementDefinition_ReqId());
240+
return features;
241+
}
242+
234243
@Override
235244
public List<EStructuralFeature> caseRequirementUsage(RequirementUsage object) {
236245
var features = new ArrayList<EStructuralFeature>();

backend/application/syson-application-configuration/src/test/java/org/eclipse/syson/application/services/DetailsViewServiceTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2024, 2025 Obeo.
2+
* Copyright (c) 2024, 2026 Obeo.
33
* This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
@@ -78,6 +78,15 @@ public void getCoreFeaturesOfMembership() {
7878
SysmlPackage.eINSTANCE.getMembership_MemberElement());
7979
}
8080

81+
@Test
82+
public void getCoreFeaturesOfRequirementDefinition() {
83+
List<EStructuralFeature> coreStructuralFeatures = this.detailsViewService.getCoreFeatures(SysmlFactory.eINSTANCE.createRequirementDefinition());
84+
assertThat(coreStructuralFeatures).containsOnly(SysmlPackage.eINSTANCE.getElement_DeclaredName(),
85+
SysmlPackage.eINSTANCE.getElement_QualifiedName(),
86+
SysmlPackage.eINSTANCE.getElement_DeclaredShortName(),
87+
SysmlPackage.eINSTANCE.getRequirementDefinition_ReqId());
88+
}
89+
8190
@Test
8291
public void getCoreFeaturesOfRequirementUsage() {
8392
List<EStructuralFeature> coreStructuralFeatures = this.detailsViewService.getCoreFeatures(SysmlFactory.eINSTANCE.createRequirementUsage());

backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/RequirementDefinitionImpl.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2023, 2025 Obeo.
2+
* Copyright (c) 2023, 2026 Obeo.
33
* This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
@@ -349,4 +349,23 @@ public String toString() {
349349
return result.toString();
350350
}
351351

352+
/**
353+
* <!-- begin-user-doc --> Redefines getter <!-- end-user-doc -->
354+
*
355+
* @generated NOT
356+
*/
357+
@Override
358+
public String getDeclaredShortName() {
359+
return this.getReqId();
360+
}
361+
362+
/**
363+
* <!-- begin-user-doc --> Redefines setter <!-- end-user-doc -->
364+
*
365+
* @generated NOT
366+
*/
367+
@Override
368+
public void setDeclaredShortName(String newDeclaredShortName) {
369+
this.setReqId(newDeclaredShortName);
370+
}
352371
} // RequirementDefinitionImpl

backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/RequirementUsageImpl.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2023, 2025 Obeo.
2+
* Copyright (c) 2023, 2026 Obeo.
33
* This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
@@ -401,4 +401,23 @@ public Predicate getConstraintDefinition() {
401401
return this.getRequirementDefinition();
402402
}
403403

404+
/**
405+
* <!-- begin-user-doc --> Redefines getter <!-- end-user-doc -->
406+
*
407+
* @generated NOT
408+
*/
409+
@Override
410+
public String getDeclaredShortName() {
411+
return this.getReqId();
412+
}
413+
414+
/**
415+
* <!-- begin-user-doc --> Redefines setter <!-- end-user-doc -->
416+
*
417+
* @generated NOT
418+
*/
419+
@Override
420+
public void setDeclaredShortName(String newDeclaredShortName) {
421+
this.setReqId(newDeclaredShortName);
422+
}
404423
} // RequirementUsageImpl

backend/metamodel/syson-sysml-metamodel/src/test/java/org/eclipse/syson/sysml/impl/RequirementDefinitionImplTest.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2025 Obeo.
2+
* Copyright (c) 2025, 2026 Obeo.
33
* This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
@@ -12,6 +12,8 @@
1212
*******************************************************************************/
1313
package org.eclipse.syson.sysml.impl;
1414

15+
import static org.junit.jupiter.api.Assertions.assertEquals;
16+
1517
import java.util.List;
1618
import java.util.stream.Stream;
1719

@@ -70,4 +72,14 @@ public void testGetStakeholderParameter() {
7072
Assertions.assertNotNull(stakeholderParameterValue);
7173
Assertions.assertIterableEquals(STAKEHOLDER_PART_USAGES, stakeholderParameterValue);
7274
}
75+
76+
@Test
77+
public void testReqId() {
78+
REQUIREMENT_DEFINITION.setReqId("REQID");
79+
assertEquals("REQID", REQUIREMENT_DEFINITION.getReqId());
80+
assertEquals("REQID", REQUIREMENT_DEFINITION.getDeclaredShortName());
81+
REQUIREMENT_DEFINITION.setDeclaredShortName("DECLARED_SHORT_NAME");
82+
assertEquals("DECLARED_SHORT_NAME", REQUIREMENT_DEFINITION.getReqId());
83+
assertEquals("DECLARED_SHORT_NAME", REQUIREMENT_DEFINITION.getDeclaredShortName());
84+
}
7385
}

backend/metamodel/syson-sysml-metamodel/src/test/java/org/eclipse/syson/sysml/impl/RequirementUsageImplTest.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2025 Obeo.
2+
* Copyright (c) 2025, 2026 Obeo.
33
* This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
@@ -12,6 +12,10 @@
1212
*******************************************************************************/
1313
package org.eclipse.syson.sysml.impl;
1414

15+
import static org.junit.jupiter.api.Assertions.assertEquals;
16+
import static org.junit.jupiter.api.Assertions.assertIterableEquals;
17+
import static org.junit.jupiter.api.Assertions.assertNotNull;
18+
1519
import java.util.List;
1620
import java.util.stream.Stream;
1721

@@ -21,7 +25,6 @@
2125
import org.eclipse.syson.sysml.StakeholderMembership;
2226
import org.eclipse.syson.sysml.SysmlFactory;
2327
import org.eclipse.syson.sysml.SysmlPackage;
24-
import org.junit.jupiter.api.Assertions;
2528
import org.junit.jupiter.api.BeforeAll;
2629
import org.junit.jupiter.api.Test;
2730

@@ -60,14 +63,24 @@ public static void setUpRequirementUsage() {
6063
@Test
6164
public void testGetActorParameter() {
6265
final List<PartUsage> actorParameterValue = REQUIREMENT_USAGE.getActorParameter();
63-
Assertions.assertNotNull(actorParameterValue);
64-
Assertions.assertIterableEquals(ACTOR_PART_USAGES, actorParameterValue);
66+
assertNotNull(actorParameterValue);
67+
assertIterableEquals(ACTOR_PART_USAGES, actorParameterValue);
6568
}
6669

6770
@Test
6871
public void testGetStakeholderParameter() {
6972
final List<PartUsage> stakeholderParameterValue = REQUIREMENT_USAGE.getStakeholderParameter();
70-
Assertions.assertNotNull(stakeholderParameterValue);
71-
Assertions.assertIterableEquals(STAKEHOLDER_PART_USAGES, stakeholderParameterValue);
73+
assertNotNull(stakeholderParameterValue);
74+
assertIterableEquals(STAKEHOLDER_PART_USAGES, stakeholderParameterValue);
75+
}
76+
77+
@Test
78+
public void testReqId() {
79+
REQUIREMENT_USAGE.setReqId("REQID");
80+
assertEquals("REQID", REQUIREMENT_USAGE.getReqId());
81+
assertEquals("REQID", REQUIREMENT_USAGE.getDeclaredShortName());
82+
REQUIREMENT_USAGE.setDeclaredShortName("DECLARED_SHORT_NAME");
83+
assertEquals("DECLARED_SHORT_NAME", REQUIREMENT_USAGE.getReqId());
84+
assertEquals("DECLARED_SHORT_NAME", REQUIREMENT_USAGE.getDeclaredShortName());
7285
}
7386
}

doc/content/modules/user-manual/pages/release-notes/2026.3.0.adoc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ part system {
6161
}
6262
```
6363

64+
* In _Details_ view:
65+
66+
** `Req Id` and `Declared Short Name` properties of `RequirementDefinition` and `RequirementUsage` are now synchronized, as required by the SysMLv2 specification.
67+
6468
== Improvements
6569

6670
* In diagrams:
@@ -100,7 +104,13 @@ package root {
100104
```
101105
** Implement the textual export for `AllocationUsage` and `AllocationDefinition`.
102106

103-
* Add support for publishing representations with libraries.
107+
* In _Details_ view:
108+
109+
** `Req Id` property of `RequirementDefinition` is now visible in the _Core_ tab of the _Details_ view.
110+
111+
* Miscellaneous:
112+
113+
** Add support for publishing representations with libraries.
104114
Publishing a project that contains representations now produces libraries that also contain the representations.
105115
Users can navigate to `/libraries/<library identifier>` to open a library and see its representations.
106116

0 commit comments

Comments
 (0)