Enrique Medina wrote:
Hi Werner,
Could you please give us extenden information about the application of
xdoclet for standard CRUD maks and the use of IoC?
I have a slight idea of what you're talking, but to concrete ;-)
Thanks.
Yes, I started off and still am in the project as a one man team, it
started off as a project which had to be finished very swiftly and
will be dumped once a bigger system goes online, more details is NDA...
I knew xdoclet in the past from an old job where I constantly had to
fight against monetary issues, and had in the end to do the work of an
entire team.
What I did was to use xdoclet sort of as a code templating wizard, which
generated the create update delete base code and the master detail views
from the given reverse engineered database objects...
All I did was to extend it that way, that I had to add basic metadata
with form information to the database pojos and then had a run via
xdoclet over them. The result is basically a master detail module with
all the forms, some basic verification code and the dao layer, and it is
working and also with working faces-config files which were generated.
Several form parts are split apart for easier maintenance via aliasbean
includes... or general includes
No to overwrite my code again and again I used basic inheritance to add
manually the additional functionality to the java parts, nowadays if I
had to write it from scratch I probably would weave the objects into the
rest of the system via inversion of object control.
the final forms were based upon the code templates generated but
manually altered and moved into separate directories, the binding could
then be done by altering the faces-config manually...
So what happened is that you basically generate a basic application out
of an existing db schema and then start to alter the parts you need
changed and move them out of the generation base, so that you do not
overwrite them. That also means, you need at least one working project
codebase to start on to write your templates for the next project.
Once this huge task is done and the codebase is stabilized you can reuse
it for the next projects...
one of the generation classes for xdoclet looks like this:
/**
* @dbo.form.single module="gen" icon="img_institution_big"
title="Institutionsverwaltung"
* @dbo.binding.hibernate A simple changelog blog object which handles the
* change logs and infos of the system
* @author Punz
*
* <PRE>
*
* Dummy class to generate the database forms
*
* currently following tags are supported dbo.form.single marks the
class as dbo
* master object on a single master detail form dbo.method mars a
method which
* has to be parsed as dbo method (only getters have to be marked it has
* following attributes: header marks a plain text header or a ref to an
* internationalization file sortable if set marks this property as a sort
* criterion masterDisplay marks this one as displayable in the master
table
* detailDisplay marks this one as displayable in the detail table as well
* detailField gives the jsf detail field type detailFieldParams pushes the
* internal detail field params down to the template
*
* @dbo.method.validation marks that validation has to be added
* required="true/false" marks that the required
flag has
* to be set stdvalidators=" <f:validateLength
* minimum='2' maximum='40' />" a string of standard
* validators
*
* @dbo.action sets an action with following parameters
oneonmany="true" marks
* the action as simply two form oneonmany relations
* header="Kontakte" linkheader for the action
masterDisplay="true"
* display the action in the master display
detailDisplay="true"
* display the action in the detail display as well
* slave="Tblcontact" slave object in case of a simple one
on many
*
* </pre>
*/
public class Institution extends ommiddlegen.Institution {
/**
* @see ommiddlegen.AbstractDiffsyschangelog#getId()
* @dbo.method header="Id" sortable="true" masterDisplay="true"
detailDisplay="true" detailField="h:inputHidden"
detailFieldType="h:inputHidden"
*/
public Integer getId() {
return super.getId();
}
/**
* @see ommiddlegen.AbstractDiffsyschangelog#getTitle()
* @dbo.method header="Name" masterDisplay="true"
detailDisplay="true"
* @dbo.method.validation required="true"
stdvalidators="<f:validateLength minimum='2' maximum='50' />"
* @dbo.method.search likeQuery="true"
*/
public String getNachname() {
return super.getNachname();
}
/**
* @see ommiddlegen.AbstractDiffsyschangelog#getDescription()
* @dbo.method header="Beschreibung" detailDisplay="true"
detailField="h:inputTextarea rows='10' cols='30' "
detailFieldType="h:inputTextarea"
* @dbo.method.validation required="true"
stdvalidators="<f:validateLength minimum='3' maximum='512' />"
*/
public String getBeschreibung() {
return super.getBeschreibung();
}
/**
* @see ommiddlegen.AbstractDiffsyschangelog#getDescription()
* @dbo.method header="Rechtsform" detailDisplay="true"
*/
public String getRechtsform() {
// TODO Auto-generated method stub
return super.getRechtsform();
}
/**
* @see ommiddlegen.AbstractDiffsyschangelog#getDescription()
* @dbo.method header="Anschrifttitel" detailDisplay="true"
* @dbo.method.validation required="true"
stdvalidators="<f:validateLength minimum='2' maximum='50' />"
*/
public String getAnschrifttitel() {
// TODO Auto-generated method stub
return super.getAnschrifttitel();
}
/**
* @see ommiddlegen.AbstractDiffsyschangelog#getDescription()
* @dbo.method header="Gruppe" detailDisplay="true"
* @dbo.method.validation
*/
public String getGruppe() {
return super.getGruppe();
}
/**
* @see ommiddlegen.AbstractDiffsyschangelog#getDescription()
* @dbo.method header="Statut" detailDisplay="true"
*/
public Byte getStatut() {
return super.getStatut();
}
/**
* @see ommiddlegen.AbstractDiffsyschangelog#getDescription()
* @dbo.method header="Klassifikation" detailDisplay="true"
*/
public Integer getKlassifikation() {
return super.getKlassifikation();
}
/**
* @see ommiddlegen.AbstractDiffsyschangelog#getDescription()
* @dbo.method header="Straße" detailDisplay="true"
* @dbo.method.validation required="true"
stdvalidators="<f:validateLength minimum='2' maximum='100' />
*/
public String getStrasse() {
return super.getStrasse();
}
/**
* @dbo.method header="Hausnr" detailDisplay="true"
* @dbo.method.validation required="true"
stdvalidators="<f:validateLength minimum='2' maximum='100' />
*/
public String getHausnr() {
return super.getHausnr();
}
/**
* @dbo.method header="Ort" detailDisplay="true"
* @dbo.method.validation required="true"
stdvalidators="<f:validateLength minimum='2' maximum='50' />"
* @dbo.method.search likeQuery="true"
*/
public String getOrt() {
return super.getOrt();
}
/**
* @dbo.method header="Plz" detailDisplay="true"
* @dbo.method.validation required="true"
stdvalidators="<f:validateLength minimum='2' maximum='8' />"
* @dbo.method.search likeQuery="true"
*/
public String getPlz() {
return super.getPlz();
}
/**
* @dbo.method header="Bundesland" detailDisplay="true"
* @dbo.method.validation required="true"
stdvalidators="<f:validateLength minimum='1' maximum='1' />"
*/
public String getBld() {
return super.getBld();
}
/**
* @dbo.method header="Land" detailDisplay="true"
*/
public String getLand() {
return super.getLand();
}
/**
* @dbo.method header="Email-1" detailDisplay="true"
* @dbo.method.validation stdvalidators="<x:validateEmail />"
*/
public String getEmail1() {
return super.getEmail1();
}
/**
* @dbo.method header="Email-2" detailDisplay="true"
* @dbo.method.validation stdvalidators="<x:validateEmail />"
*/
public String getEmail2() {
return super.getEmail2();
}
/**
* @dbo.method header="Mobiltelefon-1" detailDisplay="true"
* @dbo.method.validation stdvalidators="<x:validateRegExpr
pattern='^[0-9\s]+' />"
*/
public String getHandy1() {
return super.getHandy1();
}
/**
* @dbo.method header="Mobiltelefon-2" detailDisplay="true"
* @dbo.method.validation stdvalidators=" <x:validateRegExpr
pattern='^[0-9\s]+' />"
*/
public String getHandy2() {
return super.getHandy2();
}
/**
* @dbo.method header="Telefon-1" detailDisplay="true"
* @dbo.method.validation stdvalidators="<x:validateRegExpr
pattern='^[0-9\s]+' />"
*/
public String getTelefon1() {
return super.getTelefon1();
}
/**
* @dbo.method header="Telefon-2" detailDisplay="true"
* @dbo.method.validation stdvalidators="<x:validateRegExpr
pattern='^[0-9\s]+' />"
*/
public String getTelefon2() {
return super.getTelefon2();
}
/**
* @see ommiddlegen.AbstractDiffsyschangelog#getDescription()
* @dbo.method header="BKZ" detailDisplay="true"
* @dbo.method.validation required="true"
stdvalidators="<f:validateLength minimum='3' maximum='3' />"
*/
public String getBkz() {
return super.getBkz();
}
}
Werner