Re: Cayenne code generation - pointers requested

From: Mike Kienenberger (mkienen..mail.com)
Date: Tue Feb 02 2010 - 12:04:03 EST

  • Next message: Joe Baldwin: "Re: BUG: Cayenne Modeler"

    I've written a great deal of templates (generated entire CRUD web apps
    straight from the model in struts and JSF) which I run from ant cgen,
    but I can't make them available.

    If you post specific questions, I can answer them.

    Basically, you need to choose whether you want to generate one file
    per entity or per data map in your ant task, then you iterate over
    either the entity list, the relationship list, the attribute list, or
    whatever else you're basing your output on.

    If you post a simple example of what you're looking for, I can give
    you more specific help.
    You say later on:

    public ClientsettingsBean getClientsettingsBean(Clientsettings settings){
                   return mapper.map(settings,ClientsettingsBean.class);
           }
           public void setClientsettings(ClientsettingsBean bean, Clientsettings
    settings){
                   mapper.map(bean,settings);
           }

    But that doesn't really help me since I don't know how that relates to
    your model.

    It sounds to me like you only need a slight variation from the
    standard entity template -- why not use that as your example?

    On Thu, Jan 28, 2010 at 3:26 AM, John Armstrong <siberia..mail.com> wrote:
    > Thanks Andrus. The cgen docs explain the process but the code pointers
    > are going to be super helpful.
    >
    > Down the rabbit hole..
    > John-
    >
    > On Thu, Jan 28, 2010 at 12:23 AM, Andrus Adamchik
    > <andru..bjectstyle.org> wrote:
    >> cgen (Ant or Maven variety) support custom templates and generation modes
    >> (either one run per DataMap or one run per ObjEntity):
    >>
    >> http://cayenne.apache.org/doc30/cgen.html
    >> http://cayenne.apache.org/doc30/maven2-cgen.html
    >>
    >> So you can definitely implement class generation around Cayenne mapping for
    >> your own purposes. A good starting point is Cayenne default templates
    >> located in the distribution under "src/dotemplates/v1_2". They also contain
    >> comments on what variables can be included in the template, etc.
    >>
    >> Andrus
    >>
    >>
    >>
    >> On Jan 28, 2010, at 9:50 AM, John Armstrong wrote:
    >>>
    >>> I'm finding myself generating a lot of Beans that mirror my cayenne
    >>> entities (plus Dozer mappings) as I delve into GWT.
    >>>
    >>> This is crying out for automation and I'm sure a few others would
    >>> enjoy it. It may even make Cayenne very GWT Friendly.
    >>>
    >>> To move this ball forward (for me minimally) can anyone point me to
    >>> either some sort of sample implementation of Cayenne velocity template
    >>> based code generation (or whatever is being used in 3.0) or a pointer
    >>> to where in the source code a sample template/generator lives that I
    >>> can explore?
    >>>
    >>> Tx. My fingers are getting sore-
    >>> John-
    >>>
    >>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Tue Feb 02 2010 - 12:04:55 EST