[Xtend] constraint on existance [message #525323] |
Tue, 06 April 2010 00:54  |
Eclipse User |
|
|
|
Hi,
I'm using Xtend in a m2m and m2t transformation, and I have errors saying : 'no null' constraint is violated.
I think it comes from an attribute I have in my metamodel, which can be defined (but doesn't have to be defined all the time).
List[Attribute] attributs(Class c) :
c.classdeclaration.typeSelect(Attribute).composition.select(e| (e!=true || e!=false));
List[Attribute] relations(Class c) :
c.classdeclaration.typeSelect(Attribute).composition.select(e| (e==true || e==false));
I want to define 2 sets, based on whether composition is defined or not. I tried that, as the oclIsUndefined doesn't exist (as it's Xtend and not ocl), but I still get errors when running the workflow.
6 avr. 2010 10:36:21 org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflowComponent invokeInternal
GRAVE: Error in Component of type org.eclipse.xtend.XtendComponent:
EvaluationException : The 'no null' constraint is violated
object2relationnal::object2relationnal.ext[604,29] on line 19 'this.setColumn(c.attributs())'
object2relationnal::object2relationnal.ext[484,25] on line 15 'p.classes().createTable()'
nofile[0,16] on line 1 'transform(model)'
6 avr. 2010 10:36:21 org.eclipse.emf.mwe.core.WorkflowRunner executeWorkflow
GRAVE: Workflow interrupted. Reason: The 'no null' constraint is violated
So is there an equivalent to oclIsUndefined in Xtend ? Or does everything need to be defined (and so I have to modify my metamodel) ?
|
|
|
Re: [Xtend] constraint on existance [message #525329 is a reply to message #525323] |
Tue, 06 April 2010 01:08   |
Eclipse User |
|
|
|
I guess you need to check for null before setting the column in
object2relationnal.ext on line 19
(if (c.attributs()!=null) then this.setColumn(c.attributs()))
Sven
Maxime Lecourt schrieb:
> Hi,
>
> I'm using Xtend in a m2m and m2t transformation, and I have errors
> saying : 'no null' constraint is violated.
>
> I think it comes from an attribute I have in my metamodel, which can be
> defined (but doesn't have to be defined all the time).
>
>
>
> List[Attribute] attributs(Class c) :
> c.classdeclaration.typeSelect(Attribute).composition.select( e|
> (e!=true || e!=false));
>
> List[Attribute] relations(Class c) :
> c.classdeclaration.typeSelect(Attribute).composition.select( e|
> (e==true || e==false));
>
>
> I want to define 2 sets, based on whether composition is defined or not.
> I tried that, as the oclIsUndefined doesn't exist (as it's Xtend and not
> ocl), but I still get errors when running the workflow.
>
> 6 avr. 2010 10:36:21
> org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflo wComponent
> invokeInternal
> GRAVE: Error in Component of type org.eclipse.xtend.XtendComponent:
> EvaluationException : The 'no null' constraint is violated
> object2relationnal::object2relationnal.ext[604,29] on line 19
> 'this.setColumn(c.attributs())'
> object2relationnal::object2relationnal.ext[484,25] on line 15
> 'p.classes().createTable()' nofile[0,16] on line 1
> 'transform(model)'
> 6 avr. 2010 10:36:21 org.eclipse.emf.mwe.core.WorkflowRunner
> executeWorkflow
> GRAVE: Workflow interrupted. Reason: The 'no null' constraint is violated
>
> So is there an equivalent to oclIsUndefined in Xtend ? Or does
> everything need to be defined (and so I have to modify my metamodel) ?
--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05083 seconds