[Opensource] Ref: Timestamps and field default values
Raul DAVIDOVICH
R.DAVIDOVICH at caconcology.com
Thu Nov 20 02:28:23 PST 2003
Hello Folks, it's me again..
After a big cup of coffee and some diving into Expresso's code I found it.
So here it goes if there's somebody interested...
...
import com.jcorporate.expresso.core.misc.DateTime;
...
myDBObject.setField("author", params.getUser());
myDBObject.setField("creation_date",
DateTime.getDateTimeForDB(myDBObject.getDataContext()));
myDBObject.add();
...
I also found a very intereting AuditedSecuredDBObject which more or less
does this (but petter) and it writes to the AuditLog table just by
extending it instead of SecuredDBObject or DBObject. just make sure that
you do:
...
addField("AUDITLOG_ID", "integer", 38, false, "AuditLog ID");
...
or it won't work.
Personnally, what I did is to have my own AuditTrail tables filled in
manually from the controllers when CRUD'ing my DBObjects, and also to have
my DBObjects extending AuditedSecuredDBObject for a second layer of
security (and ease of use for my reportings later).
If someone needs more information on this, just drop me a line and I'll be
pleased to send you some more chunks of code.
Regards,
---------------------------------------------------
Raul Davidovich
Responsable Informatique
Cvitkovic & Associés Consultants
(33) 1 45 15 40 68
(33) 1 45 15 40 41 Fax
-------------------------------------------------------
http://www.caconcology.com
More information about the Opensource
mailing list