siwiwit / model2roo

Automatically exported from code.google.com/p/model2roo
0 stars 0 forks source link

Boolean fields are generated as Strings #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Define any entity property with no type and the 
rooStructure::RooFieldBoolean stereotype
2. Generate Roo script

What is the expected output? What do you see instead?

field string ...

What version of the product are you using? On what operating system?

field boolean ...

Please provide any additional information below.

fr.imag.model2roo.uml/ src/ fr/ imag/ model2roo/ common/ Common.mtl: 

[template private getUndefinedType(type : Type, property : Property) 
post(trim())]
[if not 
property.getAppliedStereotype('rooStructure::RooFieldDate').oclIsUndefined()] 
date --type java.util.Date
[else] [if not 
property.getAppliedStereotype('rooStructure::RooFieldFile').oclIsUndefined()] 
file
[else] [if 
property.getValue(property.getAppliedStereotype('rooStructure::RooFieldNumber'),
 '_numberType').oclIsInvalid()] string
[else] 
[property.getValue(property.getAppliedStereotype('rooStructure::RooFieldNumber')
, '_numberType').oclAsType(EnumerationLiteral).name.getRooNumberType()/]
[/if] [/if] [/if]
[/template]

I suppose an else-if is missing here. 

I understand you assumed the user would model the boolean types using UML 
primitive types. I'd say it's a bad practice to provide paths the user may 
follow that end up in the software not working as expected (if RooFieldNumber 
works without having to specify an UML primitive type, then I can't see a 
reason why RooFieldBoolean shouldn't). 

Original issue reported on code.google.com by krzyszto...@gmail.com on 21 Dec 2012 at 3:21

GoogleCodeExporter commented 9 years ago
Also, there's a similar bug related to the integer number type: the enum name 
type in the method getRooNumberType is incorrectly defined as 'Int' (should be 
'Integer') and as a result, integer fields are generated as strings. 

Original comment by krzyszto...@gmail.com on 22 Dec 2012 at 10:49

GoogleCodeExporter commented 9 years ago
Hi,

Thanks for pointing this bug out. I'll fix it as soon as possible.

Best regards,
Juan Castrejón

Original comment by jccastrejon on 23 Dec 2012 at 6:40