Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 481733

Summary: Make URIs referencing ValidationRules more robust
Product: [Modeling] Sirius Reporter: Maxime Porhel <maxime.porhel>
Component: CoreAssignee: Pierre-Charles David <pierre-charles.david>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: florian.barbin, jessy.mallet, maxime.porhel, nathalie.lepine, pierre-charles.david
Version: 3.0.0Keywords: triaged
Target Milestone: 5.0.0M7   
Hardware: PC   
OS: All   
See Also: https://git.eclipse.org/r/59658
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=9ae6923cdd4d14cb985c1efbd916b45caef5e34e
https://git.eclipse.org/r/92026
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=b374f4350a117ee7bf110daaa11f4be4236e4150
https://git.eclipse.org/r/92224
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=2c752ebbba531f5f8c6737d783699b0de4d12387
https://git.eclipse.org/r/92242
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=c977d6724598b665fd988b24e0097fd6157dea10
Whiteboard: needtest
Bug Depends on: 470596    
Bug Blocks:    

Description Maxime Porhel CLA 2015-11-09 10:49:14 EST
+++ This bug was initially created as a clone of Bug #470596 +++

A feature request to add an id/name for the validation rules.

Rules URI is not stable:
rule=platform:/plugin/project.design/description/my.odesign#//@ownedViewpoints[name='myVP']/@ownedRepresentations[name='MyDiagram']/@validationSet/@ownedRules.0
"@ownedRules.0" not stable


Discussed with Cédric, it must be in eKeys to have a more robust uri.
The problem is if you move your rules between two sirius versions, the user will have a marker with bad uri rule. Workaround, do not move the rules after delivering, easy to do with unit test.
Comment 1 Maxime Porhel CLA 2015-11-09 10:50:33 EST
See https://git.eclipse.org/r/#/c/59658/
Comment 3 Maxime Porhel CLA 2015-11-09 10:56:38 EST
Corrected on master
Comment 4 Florian Barbin CLA 2016-05-19 12:07:29 EDT
I quickly tried to reference a Validation Rule in a ValidationSet ( reusedRules) and the rules seem to be still referenced with this kind of id: @ownedRules.0 and not its name.
Comment 5 Florian Barbin CLA 2016-05-26 11:41:33 EDT
I reopen it following the previous comment
Comment 6 Florian Barbin CLA 2016-05-27 04:50:48 EDT
We also need to set the eKeys on the following features:
org.eclipse.sirius.diagram.DDiagram.getActivatedRules()
org.eclipse.sirius.diagram.description.concern.ConcernDescription.getRules()
org.eclipse.sirius.viewpoint.description.validation.ValidationSet.getReusedRules()
Comment 7 Eclipse Genie CLA 2017-02-28 11:30:49 EST
New Gerrit change created: https://git.eclipse.org/r/92026
Comment 9 Eclipse Genie CLA 2017-03-03 04:24:00 EST
New Gerrit change created: https://git.eclipse.org/r/92224
Comment 11 Eclipse Genie CLA 2017-03-03 07:36:38 EST
New Gerrit change created: https://git.eclipse.org/r/92242
Comment 13 Pierre-Charles David CLA 2017-04-05 09:26:09 EDT
Just to make things clear: the only thing left here is a non-regression test.
Comment 14 Pierre-Charles David CLA 2017-05-02 04:58:55 EDT
Marking as resolved to make it clearer what's left to do for 5.0. This is still marked as "needtest".
Comment 15 Pierre-Charles David CLA 2017-05-18 10:53:47 EDT
Re-opening. I *thought* I had fixed this, but trying to make a proper reproduction case it seems broken.
Comment 16 Pierre-Charles David CLA 2017-05-23 11:16:28 EDT
Can't reproduce the problem I thought I had seen, closing again.
Comment 17 Pierre-Charles David CLA 2017-05-23 11:29:57 EDT
Verified on OD CE 10.0rc2 (Sirius 5.0.0.201705230722).

Steps to reproduce:
1. Create a.odesign, with a validation set containing two rules R1 and r2 (in that order).
2. Create b.odesign. Load a.odesign ("Load resource..." > from workspace).
3. In b.odesign, create a validation set, and in the "Import" section, reference "R1".
4. Save & Close.
5. Open b.odesign in text mode, and check that the URI in href for "reusedRules" (which points to "R1") ends with "@ownedRules[name='R1']" and NOT with "@ownedRules.0".
6. Open a.odesign, and reorder R1 and R2, so that R1 appears first. Save.
7. Re-open b.odesign with the VSM editor, and check that the validation set still imports "R1", even though it has changed position.
Comment 18 Pierre-Charles David CLA 2017-06-29 03:32:10 EDT
Available in Sirius 5.0.0, see https://wiki.eclipse.org/Sirius/5.0.0 for details.