Mike Haberman wrote:
>
> On Tue, May 15, 2001 at 05:02:40PM -0400, Jason van Zyl wrote:
> > I don't think validation should be made part of the database model.
> > Validation has nothing to do a column in the database, you have
> > to validate a piece of information that is entered at the application
> > level.
>
> I think the line of application input validation and database input
> validation is a gray one. Saying not null, default, unique are a form
> of pushing input validation to the database server. Column.java
> is being used simply as the glue to get the data from the dtd into
> the Peer.
I don't think it's gray. I don't remember the vote but if the vote
was to happen again it would definitely be -1. You design an application
from the user's perspective and the information entered must be valid
in order for other user's in the system to use that information in
an effective manner.
If Bob is entering product information and as the designer of the
application
you decide that the product name must be unique so that information is
not stored in multiple places. This is because you want the data for
that product to have some integrity. This has nothing to do the
persistence layer. That you can enforce this at the database level
is irrelevant. You can use it as a catchall in the event that you
didn't properly trap the invalid data at the application but I don't
really think this is a form a application form validation.
It is most likely that people will use a database, but what if people
are writing simple apps where the data is stored in flat files, or
we create a Turbine app that is a front-end for modify LDAP entries?
How would we validate LDAP entries using what you have committed.
To me forms and validation are completely separate and it's not
a gray area at all.
> The whole idea is to provide a lightweight mechanism so that users
> can plug in their own form of doing input validation.
> Once you say
> <column name="email" .. inputValidator="org.apache...EmailValidator" />
>
> You can then do the following:
> iv = peer.getInputValidator(EMAIL);
> if (iv.checkInput(input) {
> }
> else {
> }
Again, what if I want to validate something in a form that is not
destined for a column in a database?
> Also, if you have a form that doesn't map 1-1 with Peers, you can
> use the InputValidators directly e.g.
I want to validate a login name against an Windows2000 server. What
does that have to do with peers?
> HashMap map ..
> map.put("email", new EmailValidator());
> map.put("name", new NotEmptyValidor());
> ..
> util.checkInput(map, parameterParser);
>
> That tool is yet to be committed. But it will also do
> util.checkInput(peer, parameterParser);
> where it will cycle through the pp checking the input against the peer
> validators.
>
> thanks for the input, I'm not totally against not
> using database/model/*. But I need some way to make the association.
I'm a very strong -1 for tying the validation into the peer system.
I think we can come up with a better model using what intake has
started.
Use simple field definitions, any form is composed of a set of simple
fields
that are mediated. The mediator contains all the form specific
validation
code so that there is no coupling between the actual field objects.
The mediator can then use the validator stuff you've made. The mediator
could dynamically load a validators objects that implement Validator so
that the mediator/validation object coupling is low between fields and
there validators.
John/Jon had the idea of placing a form description in it's own XML
file.
I think this would be good as it separates the application designers job
from the database designer (maybe one in the same in most cases). The
app
should be designed first and then these XML files describing forms and
possibly
work flow could be passed through a tool to help make the database
schema.
I don't know exactly how this would work.
I understand that you want to keep everything in one XML file, but I
don't
think it's appropriate to cram all the application's information in
there.
Struts has a nice model I think, maybe we could steal some of there
ideas.
I'm sorry I didn't pay attention when you brought this up the first
time,
but I really don't think binding the validation into the peers is really
a good idea.
--
jvz.
Jason van Zyl
[EMAIL PROTECTED]
http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://jakarta.apache.org/commons
http://tambora.zenplex.org
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]