Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Both tools optionally allow selecting an existing `StateUsage` to exhibit.

- https://github.com/eclipse-syson/syson/issues/1979[#1979] [diagrams] Add tools to create timeslices and snapshots, available on `OccurrenceUsage`, `ItemUsage`, and `PartUsage` graphical nodes.
These tools leverage a selection dialog to either create a specific timeslice/snapshot graphical node or, if no selection is made, default to a timeslice/snapshot `OccurrenceUsage` graphical node.
- https://github.com/eclipse-syson/syson/issues/2176[#2176] [metamodel] Implements `ownedConcern` and `referencedConcern` of `FramedConcernMembership`.

== v2026.3.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/*******************************************************************************
* Copyright (c) 2023, 2025 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
* Copyright (c) 2023, 2026 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.syson.sysml.impl;

import org.eclipse.emf.ecore.EClass;
Expand Down Expand Up @@ -67,13 +67,14 @@ public ConcernUsage getOwnedConcern() {
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @generated NOT
*/
public ConcernUsage basicGetOwnedConcern() {
// TODO: implement this method to return the 'Owned Concern' reference
// -> do not perform proxy resolution
// Ensure that you remove @generated or mark it @generated NOT
return null;
return this.getOwnedRelatedElement().stream()
.filter(ConcernUsage.class::isInstance)
.map(ConcernUsage.class::cast)
.findFirst()
.orElse(null);
}

/**
Expand All @@ -93,9 +94,10 @@ public ConcernUsage getReferencedConcern() {
* @generated
*/
public ConcernUsage basicGetReferencedConcern() {
// TODO: implement this method to return the 'Referenced Concern' reference
// -> do not perform proxy resolution
// Ensure that you remove @generated or mark it @generated NOT
var referencedConstraint = super.getReferencedConstraint();
if (referencedConstraint instanceof ConcernUsage referencedConcern) {
return referencedConcern;
}
return null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023, 2025 Obeo.
/*******************************************************************************
* Copyright (c) 2023, 2026 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -9,9 +9,11 @@
*
* Contributors:
* Obeo - initial API and implementation
*/
*******************************************************************************/
package org.eclipse.syson.sysml.impl;

import java.util.Optional;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
Expand Down Expand Up @@ -140,13 +142,16 @@ public ConstraintUsage getReferencedConstraint() {
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @generated NOT
*/
public ConstraintUsage basicGetReferencedConstraint() {
// TODO: implement this method to return the 'Referenced Constraint' reference
// -> do not perform proxy resolution
// Ensure that you remove @generated or mark it @generated NOT
return null;
var ownedConstraint = this.getOwnedConstraint();
return Optional.ofNullable(ownedConstraint)
.map(ConstraintUsage::referencedFeatureTarget)
.filter(ConstraintUsage.class::isInstance)
.map(ConstraintUsage.class::cast)
.or(() -> Optional.ofNullable(ownedConstraint))
.orElse(null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2025 Obeo.
* Copyright (c) 2025, 2026 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -12,6 +12,7 @@
*******************************************************************************/
package org.eclipse.syson.sysml.impl;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.eclipse.syson.sysml.ConstraintUsage;
Expand Down Expand Up @@ -47,6 +48,7 @@ public void getNames() {

reqMembership.getOwnedRelatedElement().add(constraint);
this.builder.addReferenceSubsetting(constraint, superConstraint);
assertThat(reqMembership.getReferencedConstraint()).isEqualTo(superConstraint);

assertEquals("SuperConstraint", constraint.getName());
assertEquals("SuperConstraint", constraint.effectiveName());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*******************************************************************************
* Copyright (c) 2026 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.syson.sysml.impl;

import static org.assertj.core.api.Assertions.assertThat;

import org.eclipse.syson.sysml.SysmlFactory;
import org.eclipse.syson.sysml.util.ModelBuilder;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

/**
* Test class for {@link FramedConcernMembershipImpl}.
*
* @author gcoutable
*/
public class FramedConcernMembershipImplTest {

private ModelBuilder builder;

@BeforeEach
public void setUp() {
this.builder = new ModelBuilder();
}

@Test
public void checkBasicGetOwnedConcern() {
var framedConcernMembership = SysmlFactory.eINSTANCE.createFramedConcernMembership();

var requirementUsage = SysmlFactory.eINSTANCE.createRequirementUsage();
requirementUsage.setDeclaredName("requirement1");
framedConcernMembership.getOwnedRelatedElement().add(requirementUsage);
assertThat(framedConcernMembership.getOwnedConcern()).isNull();

var anotherFramedConcernMembership = SysmlFactory.eINSTANCE.createFramedConcernMembership();

var concernUsage = SysmlFactory.eINSTANCE.createConcernUsage();
concernUsage.setDeclaredName("concern1");
anotherFramedConcernMembership.getOwnedRelatedElement().add(concernUsage);
assertThat(anotherFramedConcernMembership.getOwnedConcern()).isEqualTo(concernUsage);

var referencedConcernUsage = SysmlFactory.eINSTANCE.createConcernUsage();
referencedConcernUsage.setDeclaredName("concern2");
this.builder.addReferenceSubsetting(concernUsage, referencedConcernUsage);
assertThat(anotherFramedConcernMembership.getOwnedConcern()).isEqualTo(concernUsage);
}

@Test
public void checkBasicGetReferencedConstraint() {
var framedConcernMembership = SysmlFactory.eINSTANCE.createFramedConcernMembership();

var requirementUsage = SysmlFactory.eINSTANCE.createRequirementUsage();
requirementUsage.setDeclaredName("requirement1");
framedConcernMembership.getOwnedRelatedElement().add(requirementUsage);
assertThat(framedConcernMembership.getReferencedConstraint()).isNull();

var anotherFramedConcernMembership = SysmlFactory.eINSTANCE.createFramedConcernMembership();

var concernUsage = SysmlFactory.eINSTANCE.createConcernUsage();
concernUsage.setDeclaredName("concern1");
anotherFramedConcernMembership.getOwnedRelatedElement().add(concernUsage);
assertThat(anotherFramedConcernMembership.getReferencedConcern()).isEqualTo(concernUsage);

var referencedConcernUsage = SysmlFactory.eINSTANCE.createConcernUsage();
referencedConcernUsage.setDeclaredName("concern2");
this.builder.addReferenceSubsetting(concernUsage, referencedConcernUsage);
assertThat(anotherFramedConcernMembership.getReferencedConcern()).isEqualTo(referencedConcernUsage);
}
}
Loading