cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <blackn...@gmail.com>
Subject Re: Custom Templates
Date Sat, 02 Apr 2016 00:04:28 GMT
An "Import" button on the DataDomain might be more intuitive or obvious to most people. I know
I hardly ever go into preferences. A button you see more often is more likely to be used and
remembered, plus you can still have you global file, too.

Thanks, 

mrg


Sent from my iPad

> On Apr 1, 2016, at 10:03 AM, Adrian A. <a.adrian.tech@googlemail.com> wrote:
> 
> What about both? I.e. to have "global" templates, that are saved in
> user preferences (so that the user needs to define them only once),
> and when a project is created, copy them in the project files, so that
> they can be shared?
> 
> This way, it will work for other users too that just open the project,
> but still have the advantage the the user does not need to copy and
> paste them allot.
> 
>> On Fri, Apr 1, 2016 at 3:07 PM, Michael Gentry <blacknext@gmail.com> wrote:
>> 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

Mime
View raw message