We (in my project) have heavily modified and enhanced the functionality of seam-gen, but I think we are hitting a hard limit: we can not say "do not generate the EntityEdit.xhtml" because that is read-only. No matter what we do, all the *.ftl templates get called for all the our entites.

We use JBossTools 2.1.1 and store our seam-gen configurations in Eclipse .launch files (and call them using the Code Generation Launcher).

The initial from database to entities configuration is in a file named:projectname-generate-entities.launch, after that I create a file named: projectname-generate-pages.launch that creates from the entities to the pages .

The difference is that projectname-generate-entities.launch only uses 1 exporter, the Domain code exporter (extract of projectname-generate-entities.launch):

As you can see, the exporter configuration for EntityEdit.xhtml is very different, and one of themain differences is that it has a :

<mapEntry key="for_each" value="entity" />

now, i would like to extend this mechanism to make it possible to generate the EntityEdit.xhtml only for... for example non-readonly entities (or any other criteria that I choose):

<mapEntry key="for_each" value="readonly-entity" />

(And then create my own custom @ReadOnlyEntity annotation to control generation)

My plan to achieve that effect was to create my own exporter, to do that, I need to configure a Generic Hibernate metamodel exporter and create my own exporter class (inheriting I think)... but here is my problem... the docs only explain how to set the exporter class for ant:

Docs do not explain how to configure the exporterclass in a eclipse *.launch file (or if is even possible)...

How can I do that? (Do I need to modify the Eclipse Jboss Tools code? or this features is available but undocumented?)

Thanks Regards,

P.D. Sorry for cross posting, but I posted this question at SeamFramework.org and nobody answered, and I am starting to think that maybe that is because this forum is a better match for this kind of question because it is more related to JBoss Tools than Seam

We (in my project) have heavily modified and enhanced the functionality of seam-gen, but I think we are hitting a hard limit: we can not say "do not generate the EntityEdit.xhtml" because that is read-only. No matter what we do, all the *.ftl templates get called for all the our entites.

Yes, that is the default behavior.

We use JBossTools 2.1.1 and store our seam-gen configurations in Eclipse .launch files (and call them using the Code Generation Launcher).

Nice to see the .launch saving feature being used as intended (sharing of custom code generations)

As you can see, the exporter configuration for EntityEdit.xhtml is very different, and one of themain differences is that it has a :

<mapEntry key="for_each" value="entity" />

now, i would like to extend this mechanism to make it possible to generate the EntityEdit.xhtml only for... for example non-readonly entities (or any other criteria that I choose):

<mapEntry key="for_each" value="readonly-entity" />

For the moment for_each is hardcoded to only understand the Configuration notions of Pojo's (e.g. entity and component)

I have considered adding table, foreign_key etc. too since they are "concepts" in the Configuration API but it felt wrong to do so (entities and database level concepts being mixed up).

What I have considered was to add some way to put an expression in for_each that could be iterated but that haven't been done yet (contributions welcome! :)

That being said there is way to do what you want - read below.

(And then create my own custom @ReadOnlyEntity annotation to control generation)

Sounds doable - you could also use the mutable attribute of Hibernate to state it (if that fits the bill enough)

Custom exporters are only really needed if you want very specific iteration and setup of the contexts - you can do without it in this specific case.

Docs do not explain how to configure the exporterclass in a eclipse *.launch file (or if is even possible)...

How can I do that? (<b>Do I need to modify the Eclipse Jboss Tools code? or this features is available but undocumented?</b>)

the hbmtemplate exporter has a property exporter_class you can set - just like ant ;)

But now to how you can do it with less tweaks. I deliberatly made it so that if a template generates a trimmed empty string (e.g. a file with zero contents) then the file would not be generated.

That means you can simply put an expression in the top of the template and decide if something needs generating or not.

See http://freemarker.sourceforge.net/docs/ref_directive_if.html how to create and #if block.

P.D. Sorry for cross posting, but I posted <a href="http://www.seamframework.org/Community/LauchFilesRealControlOfSeamGen">this question</a> at <a href="www.seamframework.org">SeamFramework.org</a> and nobody answered, and I am starting to think that maybe that is because this forum is a better match for this kind of question because it is more related to JBoss Tools than Seam

No problem - you did the right thing by posting here. I try to monitor the Seam forum but I don't always catch the tool related questions, plus I just came back from vacation :)