Right now AndroMDAGenTask pass to velocity engine the following objects:
velocityContext.put("model", context.scriptHelper.getModel());
velocityContext.put("transform", context.scriptHelper);
velocityContext.put("str", new StringUtilsHelper());
velocityContext.put("class", modelElement);
velocityContext.put("date", new java.util.Date());
(see processModelElementWithOneTemplate)
In andromda-cartridge.xml I can define in template/@transformClass any class instance
of which will create as $transform-object to velocity engine. In this class I can
override getModel-method and create instance of other my class for model... But I
can't to do this for "str", "class" and "date" objects.
So, I have question:
1. May be better to do this more controllable? I mean... right now in velocity engine
we pass only predefined set of object... But if I would like to write some
util-classes... and add them to engine?
"math" or "myStrUtil" for example? ;)
2. I would like make possibility for wrapping modelElement to my class and public it
as $class in template. Example: right now this is always instance of
org.andromda.core.simpleuml.PClassifier class. This class have getOperations() method.
And I have to write in velocity-template the following code:
############################# finder methods ###################################
#foreach ( $op in $class.operations )
#if ($transform.getStereotype($op.id) == "FinderMethod")
...something
#end
#end
But... the following code better:
############################# finder methods ###################################
#foreach ( $op in $class.finders )
...something
#end
The same with ejbCreates-methods, home-methods, select-methods and so on...
If we will always check on stereotype then... how about negation? I mean BUSINESS
methods?
Right now I see the following code in template:
#foreach ( $op in $class.operations)
#if ($transform.getStereotype($op.id) != "FinderMethod")
which in general is not correct! Right now it's correct, until we didn't introduce
stereotypes "SelectMethod", "HomeMethod"...
So, my suggestion:
if I will have control on this code:
velocityContext.put("class", modelElement);
then I will be able to wrap modelElement in instance of my class for current template,
which have getFinders, getHomeMethods, getSelectMethods and so on...
What do you think about this?
With best regards,
Maxim Petrashev
Sr. J2EE Developer
Database Technologies Department
LUXOFT,
IBS Group of Companies
http://www.luxoft.com
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Andromda-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-devel