[2428] Create a requirement derivation from the General View - #2435
Open
kkkk1258999 wants to merge 1 commit into
Open
[2428] Create a requirement derivation from the General View#2435kkkk1258999 wants to merge 1 commit into
kkkk1258999 wants to merge 1 commit into
Conversation
Requirement derivations were displayed in the General View since eclipse-syson#2397, but could only be created from SysML v2 text, unlike satisfy which has the New Satisfy Requirement tool. Add the New Derived Requirement edge tool on RequirementUsage graphical nodes. The edge is drawn from the derived requirement to the original one, the direction the derivation is read in and the direction its edge is displayed in. Unlike satisfy, frame, assume and require, which all have a dedicated metaclass and are created with a plain SysmlFactory call, a derivation is identified by metadata coming from the RequirementDerivation standard library. Those three definitions are resolved with findByNameAndTypeInStandardLibraries, the way the standard start and done actions already are, and the import of the library is added to the owning namespace when missing, through the existing ImportService#handleImport. The connection and its ends are created by the existing createConnectionUsage, so what is added here is only what is specific to a derivation: the #derivation metadata on the connection, and the #original and #derive metadata on its ends. Annotating the ends rather than relying on their declaration order keeps the direction explicit, which is what the display side uses to orient the edge. The ends are nevertheless created original first, so that the end order fallback of the display orients the edge the same way. The created derivation has the same shape as one written in text, so both can be mixed in a model and the export gives back a #derivation connection. Bug: eclipse-syson#2428 Signed-off-by: kkkk1258999 <fishing_kaba@yahoo.co.jp>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PLEASE READ ALL ITEMS AND CHECK ONLY RELEVANT CHECKBOXES BELOW
Auto review
Project management
priority:andpr:labels been added to the pull request? (In case of doubt, start with the labelspriority: lowandpr: to review later)area:,type:)Changelog and release notes
CHANGELOG.adoc+doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adocbeen updated to reference the relevant issues?CHANGELOG.adoc?CHANGELOG.adoc?doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc?Key highlightssection indoc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc?Documentation
Tests
The unchecked boxes of the Project management section are the ones I have no
permission for: the milestone, on this pull request and on the issue, and the
labels on the pull request. Could someone from the team set them? The remaining
unchecked boxes do not apply: there is no API break and no dependency change.
Fixes #2428
What it does
Adds the New Derived Requirement edge tool on
RequirementUsagegraphicalnodes, creating a requirement derivation towards another
RequirementUsage.The edge is drawn from the derived requirement to the original one, the
direction the derivation is read in and the direction its edge is displayed in
since #2397.
Implementation
Unlike
satisfy,frame,assumeandrequire, which all have a dedicatedmetaclass and are created with a plain
SysmlFactorycall, a derivation isidentified by metadata coming from the
RequirementDerivationstandardlibrary. Following your answer on the issue:
UtilService#findByNameAndTypeInStandardLibraries, the way the standardstart and done actions already are;
missing, through the existing
ImportService#handleImport.The connection and its ends are created by the existing
createConnectionUsage, owned by the namespace owning the source requirement,so what is added here is only what is specific to a derivation: the
#derivationmetadata on the connection, and the#originaland#derivemetadata on its ends.
The generated name of the connection is dropped, the way the generated name of
a connector end already is, since a derivation is not referenced by its name.
It keeps a derivation created from the diagram anonymous, as it is when written
in text.
Annotating the ends rather than relying on their declaration order keeps the
direction explicit, which is what the display side uses to orient the edge. The
ends are nevertheless created original first, so that the end order fallback of
the display orients the edge the same way even if the metadata were lost.
The created derivation has the same shape as one written in text, so both can
be mixed in a model, and exporting it gives back a
#derivationconnection,which #2419 made possible.
Tests
MetamodelMutationElementServiceTest(unit):derivation metadata and has two resolved ends;
getDerivationOriginalEnd/getDerivationDerivedEndgives the requirementspassed at creation;
GVRequirementDerivationCreationTests(integration): using the tool betweentwo requirements displayed in a General View creates the
«derive»edge fromthe derived requirement to the original one, and the resulting semantic model
has the
#derivationconnection, its two annotated ends referencing the rightrequirements, and the
RequirementDerivationimport. The model used by thattest deliberately does not import the library, so that the import added by the
tool is actually covered.
GVRequirementDerivationEdgeTests, the display tests added by #2397, stillpass, as do the 212 unit tests of the five modules touched here.
The release notes show the new tool in the edge tool list that appears when
drawing an edge from a requirement, since this is where an edge tool shows up
rather than in the click palette.