Date Validation in Tstamp
Bill Murray
bmurray at snf.stanford.edu
Wed Aug 1 18:38:01 PDT 2001
Mike,
Until we have complete input validation based on XML Schema, I have added
a new constructor to Tstamp (as we discussed). This should make date
validation much easier. The new constructor takes a date string and
a date format. If the date is valid based on the format, the new Tstamp
is set to that date. If not, the Tstamp is set to NULL. If lenient is true,
the constuctor uses heuristics to interpret inputs that do not precisely
match the specified format. Since we're using the heuristics of
SimpleDateFormat, users should be able to use almost any date format if
lenient is set to true. We should probably test this since our choice of
format may influence the flexibility.
Here's a (psuedo) code snippet you might wish to use in your client:
Tstamp date = new Tstamp("MM/dd/yy", userInputString, true);
if (date.isNull())
// print error message;
else
// call resource manager's replaceProjectForMember;
I have compiled and checked in the new Tstamp. However, I have not tested
the new constructor. If you have any problems, call me at home tomorrow
or send email.
Thanks,
Bill
PS. I like the new resource client input screen.
More information about the coral
mailing list