This issue talks about custom Velocity templates:

https://issues.apache.org/jira/browse/CAY-2069

>From playing around in the Modeler:

* In Preferences, add a custom template that resides somewhere on your
filesystem and give it a symbolic name.

* When generating classes, go to the Advanced option and make sure you
select the custom templates (via your local symbolic name) before you
generate.

Pros:

* Can specify custom templates in CM's preferences.

Cons:

* The custom template preferences are for a given developer only.  Other
developers will need to make sure they create custom template preferences
and make sure they know to use the advanced option on generation, two steps
easy to overlook.

* The custom template isn't specified at all in the CM project files.


I'm thinking it might be better to do the following:

* Define custom templates in the DataDomain.

* Specify custom template to use in the DataMap.

* Allow overrides for each ObjEntity (just in case you want a specify a
given ObjEntity to use a different template).

* Save the templates and settings as part of the project files themselves
instead of individual preferences.


Pros:

* Can still specify custom templates in CM, just not in preferences.

* Since the custom templates are part of the project, other developers on
the team don't have to remember to set up their preferences or remember to
use the advanced code generation and select the proper templates -- that
will be handled in the DataDomain and DataMap and persisted in the project
files.

* If using cgen, it should see the templates that are required in the
project for each map/entity and you wouldn't have to specify additional
settings -- it could automatically handle it.

* If your project has multiple DataMaps, it is easier to specify different
templates for each map, if desired, and easier to see it visually in CM and
know what's going on.

Cons:

* Will be harder to edit the template data, potentially -- can't just edit
a plain text file, although you could copy the contents out of CM, paste
into an editor, make changes, then copy/paste back into CM.  Or, just edit
in-place in CM.

* Template data will be in the project files, which will get deployed to
production.  Of course, will face the same issue/concern with adding
JavaDoc, etc, to CM as well.  I don't see the extra size of the project
file being a concern, though, and can't think of a security issue with it
being there, either.


Thoughts?

Thanks,

mrg

Reply via email to