[Table] Lines with incompatible feature columns [message #1498299] |
Thu, 04 December 2014 10:01 |
Eclipse User |
|
|
|
Hello
I got a problem to avoid resolving invalid features names when using
features columns with a table having different kinds of lines.
Example :
Class Text {
String value;
}
Class C {
Text name;
}
Class A {
Text name;
Text b;
Class C c; //containment
}
I want to define a table with two features columns containing
name.value and b.value, for Class C and A in the same table.
In the O design I do :
o Table MyTable
o Line A
o Line C
o Feature name
o Feature b
Line A, Line C, Feature name are ok.
More precisely, the name feature colomns has the following properties :
- feature name : value
- feature parent expression : [self.name/]
Everything works perfectly...
Now the 'b' feature column is defined the same way :
- feature name : value
- feature parent expression : [self.b/] <- There is the issue
Obviously the issue is that ther is no property named 'b' for Class C.
The table is rendered correctly, but the validation show an error... I
wanted to create an if statement in the parent expression (something
like : if self.oclIsType of Class A, then xxx else) but could not
figure how to create an if in the parent expression (nor OCL nor
Acceleo), and after, I could not figure what should be the parent
expression results in the else case (if I return oclUndefine or null,
then the feature name 'value' will be evaluated agains an undefined
object, which I gues is not very clean approach)
QUESTIONS : What is the good approach when creating tables with lines
of different classes to avoid the computation of invalid features ?
Best regards
Cedric
--
The closer you are to the wall, the better you see it.
|
|
|
Re: [Table] Lines with incompatible feature columns [message #1504928 is a reply to message #1498299] |
Tue, 09 December 2014 17:40 |
|
Hello,
My replies are below.
Regards,
Steve
Le 04/12/2014 11:01, cgava a écrit :
> Hello
>
> I got a problem to avoid resolving invalid features names when using
> features columns with a table having different kinds of lines.
>
>
> Example :
>
> Class Text {
> String value;
> }
>
> Class C {
> Text name;
> }
>
> Class A {
> Text name;
> Text b;
> Class C c; //containment
> }
>
> I want to define a table with two features columns containing name.value
> and b.value, for Class C and A in the same table.
>
> In the O design I do :
>
> o Table MyTable
> o Line A
> o Line C
> o Feature name
> o Feature b
>
> Line A, Line C, Feature name are ok.
> More precisely, the name feature colomns has the following properties :
> - feature name : value
> - feature parent expression : [self.name/]
>
> Everything works perfectly...
>
> Now the 'b' feature column is defined the same way :
> - feature name : value
> - feature parent expression : [self.b/] <- There is the issue
>
> Obviously the issue is that ther is no property named 'b' for Class C.
> The table is rendered correctly, but the validation show an error... I
> wanted to create an if statement in the parent expression (something
> like : if self.oclIsType of Class A, then xxx else) but could not figure
> how to create an if in the parent expression (nor OCL nor Acceleo), and
> after, I could not figure what should be the parent expression results
> in the else case (if I return oclUndefine or null, then the feature name
> 'value' will be evaluated agains an undefined object, which I gues is
> not very clean approach)
In the 'b' feature column have you tried to set as the feature parent
expression [self.oclAsType(A).b/]? But as there is no precondition
expression for this feature, to really filter "A" element, I am afraid
this will print a generic String for an element typed C.
>
> QUESTIONS : What is the good approach when creating tables with lines of
> different classes to avoid the computation of invalid features ?
Without using the feature parent expression, a label will be displayed
only if the EClass as a feature with the same name. Otherwise, it will
be left blank.
>
> Best regards
> Cedric
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Powered by
FUDForum. Page generated in 0.03090 seconds