Skip to content

Commit 69da427

Browse files
committed
[1532] Add new Requirements table View
Bug: #1532 Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
1 parent 2ec97f0 commit 69da427

71 files changed

Lines changed: 3511 additions & 66 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ Any `Namespace` stored in those libraries are now cached for quick access.
5353
As a consequence, some coding rules violations have been fixed.
5454
The `org.eclipse.syson.services.grammars` package in `syson-direct-edit-grammar` has been renamed into `org.eclipse.syson.direct.edit.grammars`.
5555
`AbtractItemUsageBorderNodeDescriptionProvider` has been renamed to `AbstractItemUsageBorderNodeDescriptionProvider`.
56+
- https://github.com/eclipse-syson/syson/issues/1532[#1532] [tables] Add new Requirements table View.
57+
As a consequence, the `syson-table-requirements-view` and `syson-common-view` modules has been created.
58+
`IViewDescriptionProvider.java` and `SysONViewDescriptionProvider.java` have been moved from `syson-diagram-common-view` to `syson-common-view`.
5659

5760
=== Dependency update
5861

@@ -98,6 +101,7 @@ This contribution allows to switch from one _ViewDefinition_ to another one in a
98101
* `SysMLPackageNodeAppearanceHandler implements INodeAppearanceHandler` handles how the node is updated from the `appearanceChanges`.
99102
* A GraphQL mutation is also added through `editSysMLPackageNodeAppearance`.
100103
* Same mechanism is applied to `ImportedPackage`, `Note` and `ViewFrame` nodes.
104+
- https://github.com/eclipse-syson/syson/issues/1532[#1532] [tables] Add new Requirements table View.
101105

102106
== v2025.8.0
103107

backend/application/syson-application-configuration/src/main/java/org/eclipse/syson/application/migration/DiagramOnViewUsageMigrationHook.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
import org.eclipse.sirius.web.domain.boundedcontexts.representationdata.RepresentationMetadata;
3131
import org.eclipse.sirius.web.domain.boundedcontexts.representationdata.repositories.IRepresentationContentRepository;
3232
import org.eclipse.sirius.web.domain.boundedcontexts.representationdata.services.api.IRepresentationMetadataUpdateService;
33-
import org.eclipse.syson.application.services.GetIntermediateContainerCreationSwitch;
3433
import org.eclipse.syson.sysml.Element;
3534
import org.eclipse.syson.sysml.Relationship;
3635
import org.eclipse.syson.sysml.SysmlFactory;
3736
import org.eclipse.syson.sysml.ViewDefinition;
3837
import org.eclipse.syson.sysml.ViewUsage;
3938
import org.eclipse.syson.sysml.util.ElementUtil;
39+
import org.eclipse.syson.util.GetIntermediateContainerCreationSwitch;
4040
import org.eclipse.syson.util.SysONRepresentationDescriptionIdentifiers;
4141
import org.springframework.stereotype.Service;
4242
import org.springframework.transaction.annotation.Transactional;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import org.eclipse.syson.sysml.SysmlPackage;
5353
import org.eclipse.syson.sysml.ViewUsage;
5454
import org.eclipse.syson.sysml.util.ElementUtil;
55+
import org.eclipse.syson.util.GetIntermediateContainerCreationSwitch;
5556
import org.eclipse.syson.util.SysMLMetamodelHelper;
5657
import org.eclipse.syson.util.SysONRepresentationDescriptionIdentifiers;
5758
import org.springframework.stereotype.Service;

backend/application/syson-application/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@
114114
<artifactId>syson-standard-diagrams-view</artifactId>
115115
<version>2025.8.5</version>
116116
</dependency>
117+
<dependency>
118+
<groupId>org.eclipse.syson</groupId>
119+
<artifactId>syson-table-requirements-view</artifactId>
120+
<version>2025.8.5</version>
121+
</dependency>
117122
<dependency>
118123
<groupId>org.eclipse.syson</groupId>
119124
<artifactId>syson-tree-explorer-view</artifactId>

backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/util/ElementUtil.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.eclipse.syson.sysml.Membership;
3737
import org.eclipse.syson.sysml.Namespace;
3838
import org.eclipse.syson.sysml.Specialization;
39+
import org.eclipse.syson.sysml.SysmlPackage;
3940
import org.eclipse.syson.sysml.TypeFeaturing;
4041
import org.eclipse.syson.sysml.VisibilityKind;
4142

@@ -231,22 +232,16 @@ public <T extends Element> T findByNameAndType(Collection<EObject> roots, String
231232
}
232233

233234
/**
234-
* Count the number of existing elements having the same type than the given Element inside the owning Namespace of
235-
* the given Element.
235+
* Count the number of existing ViewUsages inside the given Namespace.
236236
*
237-
* @param element
238-
* the given {@link Element}.
239-
* @return the number of existing elements having the same type than the given Element inside the owning Namespace
240-
* of the given Element.
237+
* @param namespace
238+
* the given {@link Namespace}.
239+
* @return the number of existing ViewUsages inside the given Namespace.
241240
*/
242-
public long existingElementsCount(Element element) {
243-
Namespace owningNamespace = element.getOwningNamespace();
244-
if (owningNamespace != null) {
245-
return owningNamespace.getOwnedMember().stream()
246-
.filter(member -> element.eClass().equals(member.eClass()))
247-
.count();
248-
}
249-
return 0;
241+
public long existingViewUsagesCountForRepresentationCreation(Namespace namespace) {
242+
return namespace.getOwnedMember().stream()
243+
.filter(member -> SysmlPackage.eINSTANCE.getViewUsage().equals(member.eClass()))
244+
.count();
250245
}
251246

252247
/**

backend/releng/syson-test-coverage/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@
100100
<artifactId>syson-standard-diagrams-view</artifactId>
101101
<version>2025.8.5</version>
102102
</dependency>
103+
<dependency>
104+
<groupId>org.eclipse.syson</groupId>
105+
<artifactId>syson-table-requirements-view</artifactId>
106+
<version>2025.8.5</version>
107+
</dependency>
103108
<dependency>
104109
<groupId>org.eclipse.syson</groupId>
105110
<artifactId>syson-tree-explorer-view</artifactId>

backend/services/syson-services/src/main/java/org/eclipse/syson/services/ElementInitializerSwitch.java

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public Element caseDependency(Dependency object) {
119119

120120
@Override
121121
public Element caseDefinition(Definition object) {
122-
var existingElements = this.elementUtil.existingElementsCount(object);
122+
var existingElements = this.existingElementsCount(object);
123123
object.setDeclaredName(object.eClass().getName() + existingElements);
124124
return object;
125125
}
@@ -138,7 +138,7 @@ public Element caseElement(Element object) {
138138
@Override
139139
public Element caseEnumerationDefinition(EnumerationDefinition object) {
140140
object.setIsVariation(true);
141-
var existingElements = this.elementUtil.existingElementsCount(object);
141+
var existingElements = this.existingElementsCount(object);
142142
object.setDeclaredName(object.eClass().getName() + existingElements);
143143
return object;
144144
}
@@ -155,7 +155,7 @@ public Element caseFlowUsage(FlowUsage object) {
155155

156156
@Override
157157
public Element casePackage(Package object) {
158-
var existingElements = this.elementUtil.existingElementsCount(object);
158+
var existingElements = this.existingElementsCount(object);
159159
object.setDeclaredName(object.eClass().getName() + existingElements);
160160
return object;
161161
}
@@ -193,7 +193,7 @@ public Element casePerformActionUsage(PerformActionUsage object) {
193193

194194
@Override
195195
public Element casePortDefinition(PortDefinition object) {
196-
var existingElements = this.elementUtil.existingElementsCount(object);
196+
var existingElements = this.existingElementsCount(object);
197197
object.setDeclaredName(object.eClass().getName() + existingElements);
198198
OwningMembership owningMembership = SysmlFactory.eINSTANCE.createOwningMembership();
199199
object.getOwnedRelationship().add(owningMembership);
@@ -272,7 +272,7 @@ public Element caseUsage(Usage object) {
272272
defaultName = defaultName.substring(0, defaultName.length() - 5);
273273
}
274274

275-
var existingElements = this.elementUtil.existingElementsCount(object);
275+
var existingElements = this.existingElementsCount(object);
276276

277277
object.setDeclaredName(defaultName + existingElements);
278278
object.setIsComposite(true);
@@ -290,6 +290,25 @@ public Element caseViewUsage(ViewUsage object) {
290290
return object;
291291
}
292292

293+
/**
294+
* Count the number of existing elements having the same type than the given Element inside the owning Namespace of
295+
* the given Element.
296+
*
297+
* @param element
298+
* the given {@link Element}.
299+
* @return the number of existing elements having the same type than the given Element inside the owning Namespace
300+
* of the given Element.
301+
*/
302+
public long existingElementsCount(Element element) {
303+
Namespace owningNamespace = element.getOwningNamespace();
304+
if (owningNamespace != null) {
305+
return owningNamespace.getOwnedMember().stream()
306+
.filter(member -> element.eClass().equals(member.eClass()))
307+
.count();
308+
}
309+
return 0;
310+
}
311+
293312
private ParameterMembership createParameterMembershipWithReferenceUsage(String refName, FeatureDirectionKind direction) {
294313
var reference = SysmlFactory.eINSTANCE.createReferenceUsage();
295314
reference.setDirection(direction);

backend/services/syson-services/src/main/java/org/eclipse/syson/services/UtilService.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,16 +1015,14 @@ public boolean isEmptyObjectiveRequirement(Element self) {
10151015
}
10161016

10171017
/**
1018-
* Count the number of existing elements having the same type than the given Element inside the owning Namespace of
1019-
* the given Element.
1018+
* Count the number of existing ViewUsages inside the given Namespace.
10201019
*
1021-
* @param element
1022-
* the given {@link Element}.
1023-
* @return the number of existing elements having the same type than the given Element inside the owning Namespace
1024-
* of the given Element.
1020+
* @param namespace
1021+
* the given {@link Namespace}.
1022+
* @return the number of existing ViewUsages inside the given Namespace.
10251023
*/
1026-
public long existingElementsCount(Element element) {
1027-
return this.elementUtil.existingElementsCount(element);
1024+
public long existingViewUsagesCountForRepresentationCreation(Namespace namespace) {
1025+
return this.elementUtil.existingViewUsagesCountForRepresentationCreation(namespace);
10281026
}
10291027

10301028
private ReferenceUsage addConnectorEnd(ConnectorAsUsage connectorAsUsage, Feature end, Type connectorContainer) {

backend/services/syson-services/src/main/java/org/eclipse/syson/util/AQLConstants.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2023 Obeo.
2+
* Copyright (c) 2023, 2025 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
@@ -23,6 +23,10 @@ public class AQLConstants {
2323

2424
public static final String AQL_SELF = "aql:self";
2525

26+
public static final String AQL_TRUE = "aql:true";
27+
28+
public static final String AQL_FALSE = "aql:false";
29+
2630
public static final String DEFAULT_LABEL_EXPRESSION = "aql:self.declaredName";
2731

2832
public static final String DIAGRAM = "diagram";

backend/application/syson-application-configuration/src/main/java/org/eclipse/syson/application/services/GetIntermediateContainerCreationSwitch.java renamed to backend/services/syson-services/src/main/java/org/eclipse/syson/util/GetIntermediateContainerCreationSwitch.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2024 , 2025 Obeo.
2+
* Copyright (c) 2024, 2025 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
@@ -10,7 +10,7 @@
1010
* Contributors:
1111
* Obeo - initial API and implementation
1212
*******************************************************************************/
13-
package org.eclipse.syson.application.services;
13+
package org.eclipse.syson.util;
1414

1515
import java.util.Objects;
1616
import java.util.Optional;
@@ -30,10 +30,9 @@
3030
import org.eclipse.syson.sysml.SysmlPackage;
3131
import org.eclipse.syson.sysml.TextualRepresentation;
3232
import org.eclipse.syson.sysml.Usage;
33-
import org.eclipse.syson.util.SysmlEClassSwitch;
3433

3534
/**
36-
* Switch for retrieving the intermediate container of the element to create, if there is one..
35+
* Switch for retrieving the intermediate container of the element to create, if there is one.
3736
*
3837
* @author arichard
3938
*/

0 commit comments

Comments
 (0)