diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 675069e4c..906266039 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -10,6 +10,8 @@ === Improvements +- https://github.com/eclipse-syson/syson/issues/829[#829] [metamodel] `OccurrenceUsag#portionKind` is now unsettable and its default value is `null`. + === New features diff --git a/backend/application/syson-application/src/test/resources/simple_project.json b/backend/application/syson-application/src/test/resources/simple_project.json index 349356bc4..86286583c 100644 --- a/backend/application/syson-application/src/test/resources/simple_project.json +++ b/backend/application/syson-application/src/test/resources/simple_project.json @@ -224,7 +224,7 @@ "isReference": "false", "isVariation": "false", "isIndividual": "false", - "portionKind": "snapshot", + "portionKind": null, "documentation": [], "ownedAnnotation": [], "ownedElement": [], @@ -4621,4 +4621,4 @@ "variantMembership": [], "lifeClass": null } -] \ No newline at end of file +] diff --git a/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/OccurrenceUsage.java b/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/OccurrenceUsage.java index 56b11374c..3767bb049 100644 --- a/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/OccurrenceUsage.java +++ b/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/OccurrenceUsage.java @@ -84,9 +84,11 @@ public interface OccurrenceUsage extends Usage { * * @return the value of the 'Portion Kind' attribute. * @see org.eclipse.syson.sysml.PortionKind + * @see #isSetPortionKind() + * @see #unsetPortionKind() * @see #setPortionKind(PortionKind) * @see org.eclipse.syson.sysml.SysmlPackage#getOccurrenceUsage_PortionKind() - * @model ordered="false" + * @model unsettable="true" ordered="false" * @generated */ PortionKind getPortionKind(); @@ -98,9 +100,34 @@ public interface OccurrenceUsage extends Usage { * @param value * the new value of the 'Portion Kind' attribute. * @see org.eclipse.syson.sysml.PortionKind + * @see #isSetPortionKind() + * @see #unsetPortionKind() * @see #getPortionKind() * @generated */ void setPortionKind(PortionKind value); + /** + * Unsets the value of the '{@link org.eclipse.syson.sysml.OccurrenceUsage#getPortionKind Portion Kind}' + * attribute. + * + * @see #isSetPortionKind() + * @see #getPortionKind() + * @see #setPortionKind(PortionKind) + * @generated + */ + void unsetPortionKind(); + + /** + * Returns whether the value of the '{@link org.eclipse.syson.sysml.OccurrenceUsage#getPortionKind Portion + * Kind}' attribute is set. + * + * @return whether the value of the 'Portion Kind' attribute is set. + * @see #unsetPortionKind() + * @see #getPortionKind() + * @see #setPortionKind(PortionKind) + * @generated + */ + boolean isSetPortionKind(); + } // OccurrenceUsage diff --git a/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/ConnectionUsageImpl.java b/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/ConnectionUsageImpl.java index 5ee1758b6..3c05cbb89 100644 --- a/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/ConnectionUsageImpl.java +++ b/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/ConnectionUsageImpl.java @@ -81,10 +81,10 @@ public class ConnectionUsageImpl extends ConnectorAsUsageImpl implements Connect * * * @see #getPortionKind() - * @generated + * @generated NOT * @ordered */ - protected static final PortionKind PORTION_KIND_EDEFAULT = PortionKind.SNAPSHOT; + protected static final PortionKind PORTION_KIND_EDEFAULT = null; /** * The cached value of the '{@link #getPortionKind() Portion Kind}' attribute. + * + * @generated + * @ordered + */ + protected boolean portionKindESet; + /** * * @@ -191,8 +199,35 @@ public PortionKind getPortionKind() { public void setPortionKind(PortionKind newPortionKind) { PortionKind oldPortionKind = this.portionKind; this.portionKind = newPortionKind == null ? PORTION_KIND_EDEFAULT : newPortionKind; + boolean oldPortionKindESet = this.portionKindESet; + this.portionKindESet = true; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, SysmlPackage.CONNECTION_USAGE__PORTION_KIND, oldPortionKind, this.portionKind, !oldPortionKindESet)); + } + + /** + * + * + * @generated + */ + @Override + public void unsetPortionKind() { + PortionKind oldPortionKind = this.portionKind; + boolean oldPortionKindESet = this.portionKindESet; + this.portionKind = PORTION_KIND_EDEFAULT; + this.portionKindESet = false; if (this.eNotificationRequired()) - this.eNotify(new ENotificationImpl(this, Notification.SET, SysmlPackage.CONNECTION_USAGE__PORTION_KIND, oldPortionKind, this.portionKind)); + this.eNotify(new ENotificationImpl(this, Notification.UNSET, SysmlPackage.CONNECTION_USAGE__PORTION_KIND, oldPortionKind, PORTION_KIND_EDEFAULT, oldPortionKindESet)); + } + + /** + * + * + * @generated + */ + @Override + public boolean isSetPortionKind() { + return this.portionKindESet; } /** @@ -287,7 +322,7 @@ public void eUnset(int featureID) { this.setIsIndividual(IS_INDIVIDUAL_EDEFAULT); return; case SysmlPackage.CONNECTION_USAGE__PORTION_KIND: - this.setPortionKind(PORTION_KIND_EDEFAULT); + this.unsetPortionKind(); return; } super.eUnset(featureID); @@ -304,7 +339,7 @@ public boolean eIsSet(int featureID) { case SysmlPackage.CONNECTION_USAGE__IS_INDIVIDUAL: return this.isIndividual != IS_INDIVIDUAL_EDEFAULT; case SysmlPackage.CONNECTION_USAGE__PORTION_KIND: - return this.portionKind != PORTION_KIND_EDEFAULT; + return this.isSetPortionKind(); case SysmlPackage.CONNECTION_USAGE__INDIVIDUAL_DEFINITION: return this.basicGetIndividualDefinition() != null; case SysmlPackage.CONNECTION_USAGE__OCCURRENCE_DEFINITION: @@ -413,7 +448,10 @@ public String toString() { result.append(" (isIndividual: "); result.append(this.isIndividual); result.append(", portionKind: "); - result.append(this.portionKind); + if (this.portionKindESet) + result.append(this.portionKind); + else + result.append(""); result.append(')'); return result.toString(); } diff --git a/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/OccurrenceUsageImpl.java b/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/OccurrenceUsageImpl.java index 0d00fc62f..553b847e2 100644 --- a/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/OccurrenceUsageImpl.java +++ b/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/OccurrenceUsageImpl.java @@ -71,10 +71,10 @@ public class OccurrenceUsageImpl extends UsageImpl implements OccurrenceUsage { * * * @see #getPortionKind() - * @generated + * @generated NOT * @ordered */ - protected static final PortionKind PORTION_KIND_EDEFAULT = PortionKind.SNAPSHOT; + protected static final PortionKind PORTION_KIND_EDEFAULT = null; /** * The cached value of the '{@link #getPortionKind() Portion Kind}' attribute. + * + * @generated + * @ordered + */ + protected boolean portionKindESet; + /** * * @@ -181,8 +189,35 @@ public PortionKind getPortionKind() { public void setPortionKind(PortionKind newPortionKind) { PortionKind oldPortionKind = this.portionKind; this.portionKind = newPortionKind == null ? PORTION_KIND_EDEFAULT : newPortionKind; + boolean oldPortionKindESet = this.portionKindESet; + this.portionKindESet = true; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, SysmlPackage.OCCURRENCE_USAGE__PORTION_KIND, oldPortionKind, this.portionKind, !oldPortionKindESet)); + } + + /** + * + * + * @generated + */ + @Override + public void unsetPortionKind() { + PortionKind oldPortionKind = this.portionKind; + boolean oldPortionKindESet = this.portionKindESet; + this.portionKind = PORTION_KIND_EDEFAULT; + this.portionKindESet = false; if (this.eNotificationRequired()) - this.eNotify(new ENotificationImpl(this, Notification.SET, SysmlPackage.OCCURRENCE_USAGE__PORTION_KIND, oldPortionKind, this.portionKind)); + this.eNotify(new ENotificationImpl(this, Notification.UNSET, SysmlPackage.OCCURRENCE_USAGE__PORTION_KIND, oldPortionKind, PORTION_KIND_EDEFAULT, oldPortionKindESet)); + } + + /** + * + * + * @generated + */ + @Override + public boolean isSetPortionKind() { + return this.portionKindESet; } /** @@ -238,7 +273,7 @@ public void eUnset(int featureID) { this.setIsIndividual(IS_INDIVIDUAL_EDEFAULT); return; case SysmlPackage.OCCURRENCE_USAGE__PORTION_KIND: - this.setPortionKind(PORTION_KIND_EDEFAULT); + this.unsetPortionKind(); return; } super.eUnset(featureID); @@ -255,7 +290,7 @@ public boolean eIsSet(int featureID) { case SysmlPackage.OCCURRENCE_USAGE__IS_INDIVIDUAL: return this.isIndividual != IS_INDIVIDUAL_EDEFAULT; case SysmlPackage.OCCURRENCE_USAGE__PORTION_KIND: - return this.portionKind != PORTION_KIND_EDEFAULT; + return this.isSetPortionKind(); case SysmlPackage.OCCURRENCE_USAGE__INDIVIDUAL_DEFINITION: return this.basicGetIndividualDefinition() != null; case SysmlPackage.OCCURRENCE_USAGE__OCCURRENCE_DEFINITION: @@ -278,7 +313,10 @@ public String toString() { result.append(" (isIndividual: "); result.append(this.isIndividual); result.append(", portionKind: "); - result.append(this.portionKind); + if (this.portionKindESet) + result.append(this.portionKind); + else + result.append(""); result.append(')'); return result.toString(); } diff --git a/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/SysmlPackageImpl.java b/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/SysmlPackageImpl.java index e998ff275..c3e9dd499 100644 --- a/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/SysmlPackageImpl.java +++ b/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/SysmlPackageImpl.java @@ -9790,7 +9790,7 @@ public void initializePackageContents() { this.initEAttribute(this.getOccurrenceUsage_IsIndividual(), this.ecorePackage.getEBoolean(), "isIndividual", "false", 1, 1, OccurrenceUsage.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); - this.initEAttribute(this.getOccurrenceUsage_PortionKind(), this.getPortionKind(), "portionKind", null, 0, 1, OccurrenceUsage.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, + this.initEAttribute(this.getOccurrenceUsage_PortionKind(), this.getPortionKind(), "portionKind", null, 0, 1, OccurrenceUsage.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); this.initEReference(this.getOccurrenceUsage_IndividualDefinition(), this.getOccurrenceDefinition(), null, "individualDefinition", null, 0, 1, OccurrenceUsage.class, IS_TRANSIENT, IS_VOLATILE, diff --git a/backend/metamodel/syson-sysml-metamodel/src/main/resources/model/sysml.ecore b/backend/metamodel/syson-sysml-metamodel/src/main/resources/model/sysml.ecore index 735055186..a6098c120 100644 --- a/backend/metamodel/syson-sysml-metamodel/src/main/resources/model/sysml.ecore +++ b/backend/metamodel/syson-sysml-metamodel/src/main/resources/model/sysml.ecore @@ -1226,7 +1226,7 @@ lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" defaultValueLiteral="false"/> + eType="#//PortionKind" unsettable="true"/> diff --git a/doc/content/modules/user-manual/pages/release-notes/2025.1.0.adoc b/doc/content/modules/user-manual/pages/release-notes/2025.1.0.adoc index c518ac798..12716bf1a 100644 --- a/doc/content/modules/user-manual/pages/release-notes/2025.1.0.adoc +++ b/doc/content/modules/user-manual/pages/release-notes/2025.1.0.adoc @@ -10,4 +10,6 @@ == Improvements +- `OccurrenceUsag#portionKind` is now unsettable and its default value is `null` in the SysMLv2 metamodel to conform to the specification. + == New features