precisions on modifying classes using XDoclet

From: denis (blured75_at_hotmail.com)
Date: 10/26/04


Date: 26 Oct 2004 09:34:17 -0700

Hi,

I've got series of classes (EJBs) which their home & remote interface
are generated by XDoclet1.2.1. And, I'd like to modifiy the ejbCreate
of the EJB method if a specific argument is passed to the ant
instruction.

So I've decided to use :
<template destinationFile="{0}.java"
templateFile="transform-ejb-cmp.xdt" mergeDir="${merge.dir}"/>

My question :
    is it possible to have the transform-ejb-cmp.xdt file like that
    -->

    <XDtEjbComment:comment>
    As there is a lot of different file in the project, I only need to
modify the one which are of a CMP entity type
    </XDtEjbComment:comment>
    <XDtEjbCmp:ifEntity>
       [here I need to recopy all the stuff from the original file to
the last line of ejbCreate()]
                   // several specific java instruction
                   System.out.println("test");
       [here I need to recopy all the stuff from the original file to
the last line of ejbCreate() to the last line of file]
    </XDtEjbCmp:ifEntity>

    Another solution was to take original entity-cmp.xdt files and
modify then but it doesn't fit my needs cause the process for this
subtask is treating only files ending with CMP moreover I only need to
modify the ejbCreate method and the original entity-cmp.xdt file
modify a lot of other things like methods signature, extension of
class and so on.

    Have you got any clues wich could help me in resolving this issue
?

    Thanks a lot for all you can do.

    Regards,
    blured.

    The following EJB class is originally like that :

    package ....
    ....

    public abstract class Toto implements EntityBean {
          ....
          ....
      
          /**
           *
           *
           */
          public abstract ejbCreate() {
                setId(1);
                setToto("3");
          }
          ....
    }

    The result file I'd like to have is :

    package ....
    ....

    public abstract class Toto implements EntityBean {
          ....
          ....
      
          /**
           *
           *
           */
          public abstract ejbCreate() {
                setId(1);
                setToto("3");

                // several specific java instruction
                System.out.println("test");
          }
          ....
    }