[EMFTVM] Comparing enum types [message #1403118] |
Mon, 21 July 2014 12:59 |
Fernando Macias Messages: 20 Registered: March 2014 |
Junior Member |
|
|
Hello everybody.
I get a weird behaviour when trying to execute comparisons between enum literal types. I have the MethodType in the output model, whose values can be GET, POST, PUT and DELETE. If I used them like in the following example, the execution froze and I couldn't even stop it without closing Eclipse, although Eclipse kept working fine and I could even relaunch the transformation (with the same result).
getHttpMethod helper:
helper context mmMIGRARIAMVC!Mapping def : getHttpMethod : mmRestconfig!MethodType =
let dop : mmMIGRARIAMVC!DataOperationCall = self.controlFlow.getCalledDataOperations
-> select(d | d.dataObject = self.getResource) in
if not dop -> any(d | d.type = #Create).oclIsUndefined() then
#POST
else if not dop -> any(d | d.type = #Update).oclIsUndefined() then
#PUT
else if not dop -> any(d | d.type = #Remove).oclIsUndefined() then
#DELETE
else
#GET
endif
endif
endif;
I solved this problem by adding parentheses to the helper. But now, in other parts of the code I use the following code twice, over collections of the same type of elements, and in one of them it works properly, but in the other one I have that same issue:
-> select(po | po.direction = #Input)
Any ideas?
Thanks in advance.
Cheers!
|
|
|
|
Re: [EMFTVM] Comparing enum types [message #1403454 is a reply to message #1403176] |
Wed, 23 July 2014 19:31 |
|
op 22-07-14 09:13, Fernando Macias schreef:
> Solved. The problem was that some of those po elements were OclUndefined, and
> for some reason the execution didn't throw an exception like this:
>
> [emftvm.run] org.eclipse.m2m.atl.emftvm.util.VMException:
> java.lang.NoSuchFieldException: Field void::direction not found
Hmm, did you run the transformation in debug mode? In debug mode¸ the
transformation halts on an exception, and you have to switch to the debug
perspective to see it.
Cheers,
Dennis
|
|
|
|
Powered by
FUDForum. Page generated in 0.02212 seconds