Bug 562660 - It is not possible to provide several overrides (with different conditions) for a same mapping
Summary: It is not possible to provide several overrides (with different conditions) f...
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 6.3.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2020-04-30 07:17 EDT by Cedric Notot CLA
Modified: 2020-06-05 11:41 EDT (History)
1 user (show)

See Also:


Attachments
Example on basicfamily (21.98 KB, application/x-zip-compressed)
2020-04-30 07:35 EDT, Cedric Notot CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cedric Notot CLA 2020-04-30 07:17:50 EDT
Let's take a group description A in an odesign.

In an other odesign, let's specify a group override B on A, according to its conditions C1. Let's specify an other group override C on A, according to its conditions C2.

At runtime, the first group override found is considered and its condition is only checked after that.
So, in the overriding odesign, if B is located before C, it is B that will be chosen to override A (even if C1 is false and C2 is true). If C1 is false, the override is equivalent to a "blank" result. If you want to keep the default mapping A with C1, you can not. If you move C before B, C will be chosen whatever the condition.

From my point of view, all the candidates which meet the conditions should be considered and then only the first one should be chosen. If no override meets the conditions, the mapping A should not be overridden.

Here, a workaround could consist in specifying different conditions in a single override but this makes the specification more complex and this may involve redundancy if you want to keep the base behavior in some cases.
Comment 1 Cedric Notot CLA 2020-04-30 07:35:33 EDT
Created attachment 282634 [details]
Example on basicfamily

In this example, in test.odesign, DefaultGroup on Person displays 2 text fields.
In extension.odesign, you have GroupOverrideForMan which overrides this group if the person is a Man (displays a label "I'm a man !" with the text fields) and GroupOverrideForWoman if the person is a Woman (displays a label "I'm a woman !" with the text fields).

With GroupOverrideForMan before GroupOverrideForWoman:
At runtime, if you select a man, you will get "I'm a man !" with the text fields (OK).
If you select a woman, you will get nothing (NOK).

With GroupOverrideForWoman before GroupOverrideForMan:
At runtime, if you select a man, you will get nothing (NOK). 
If you select a woman, you will get "I'm a woman !" with the text fields (OK).

If you specify only GroupOverrideForMan for example:
At runtime, if you select a woman, you will get nothing too (NOK). I will expect to get the base behavior at least (the 2 text fields). If you specify an override with Person as domain class, after GroupOverrideForMan , it will not work either. So, you have to define an override on Person with several conditions and copy the behavior from DefaultGroup for women... In real projects, this could be complex and copying definition is not advised.
Comment 2 Florian Barbin CLA 2020-06-05 11:41:17 EDT
Hi Cédric,

thank you for your detailed bug report. I mark this enhancement as confirmed but for now there is no plan to work on this feature in the next release.

Regards,

Florian