diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 918c67cc7f..67461e858e 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -51,6 +51,7 @@ This also fixes `relatedFeature`, `sourceFeature` and `targetFeature`, which wer - https://github.com/eclipse-syson/syson/issues/2419[#2419] [export] Fix the export of the prefix metadata carried by the ends of a connector, which were dropped when those ends are declared inline. The ends of a connector created from a diagram are owned through an `EndFeatureMembership` and are exported inline, so their metadata, such as the `#original` and `#derive` of a requirement derivation, were lost. - https://github.com/eclipse-syson/syson/issues/2340[#2340] [diagrams] Replace the name of the _New Perform action_ tool to _New Perform Action_ to be consistent with other tools. +- https://github.com/eclipse-syson/syson/issues/2437[#2437] [metamodel] Fix elementId when creating a FlowDefinition === Improvements diff --git a/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/SysmlFactoryImpl.java b/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/SysmlFactoryImpl.java index 2b4af09fab..00f8895e2c 100644 --- a/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/SysmlFactoryImpl.java +++ b/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/SysmlFactoryImpl.java @@ -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 @@ -1213,11 +1213,12 @@ public Flow createFlow() { /** * * - * @generated + * @generated NOT */ @Override public FlowDefinition createFlowDefinition() { FlowDefinitionImpl flowDefinition = new FlowDefinitionImpl(); + flowDefinition.setElementId(ElementUtil.generateUUID(flowDefinition).toString()); return flowDefinition; } diff --git a/backend/metamodel/syson-sysml-metamodel/src/test/java/org/eclipse/syson/sysml/impl/FlowDefinitionTest.java b/backend/metamodel/syson-sysml-metamodel/src/test/java/org/eclipse/syson/sysml/impl/FlowDefinitionTest.java new file mode 100644 index 0000000000..53be09f602 --- /dev/null +++ b/backend/metamodel/syson-sysml-metamodel/src/test/java/org/eclipse/syson/sysml/impl/FlowDefinitionTest.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * 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.junit.jupiter.api.Assertions.assertFalse; + +import org.eclipse.syson.sysml.FlowDefinition; +import org.eclipse.syson.sysml.SysmlFactory; +import org.junit.jupiter.api.Test; + +/** + * {@link FlowDefinition} related tests. + * + * @author rpage + */ +public class FlowDefinitionTest { + + @Test + public void testElementIdNotEmpty() { + FlowDefinition flowDefinition = SysmlFactory.eINSTANCE.createFlowDefinition(); + assertFalse(flowDefinition.getElementId().isEmpty()); + } +}