[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ganymede Dev] Sensitive Invid Field
|
On Thu, May 01, 2003 at 12:26:11AM +0000, John King wrote:
| There you go! I've got it. It's so simple I couldn't come up with it unless
| having it held under my nose :)
Good, glad to hear it.
| >| >If you look at the method signature for DBEditObject.finalizeSetValue(),
| >| >you'll see that it is defined as
| >| >
| >| > public ReturnVal finalizeSetValue(DBField field, Object value)
| >|
| >| field is in this case PARENT, value doesn't matter because I want the
| >| current value of ZONE, which is either something or null.
| >
| >The current value of ZONE? So you're saying you want the code called
| >by your finalizeSetValue() method to be able to determine the value of
| >ZONE from before the time that the PARENT field's value was changed?
| >
| >I'm confused.
|
| Ok I have to admit I wasn't really clear: This code makes up the DName for
| this domain out of the zone and the DName of the parent. So it has to know
| the this zone, and upon change of this parent invid it should get the dname
| of the parentobject.
| But this zone has to exist. This parent invid too. So I pass it the
| knowledge PARENT was changed and what the zone is, assuming it's set
| already in the easy case.
| What I should do is pass the Invid value of finalizeSetValue too and use
| that as reference to the parent DName instead of current invid of PARENT.
Right, we do a lot of that sort of stuff a lot here.
| shortcut:
| maybe a long one? I composed it quickly.
|
| public Object getFieldInTarget(short thisInvidField, short
| requestedFieldID){
|
| //declare variables
| db_field requestedField;
|
| try{
| //get the reference to our target object
| Invid targetInvid = (Invid)
| getFieldValueLocal(thisInvidField);
| if(targetInvid==null){
| Ganymede.debug("getFieldInTarget("+thisInvidField+","+requestedFieldID+"):
| target reference could not be obtained");
| return null;
| }
| // get the target object itself
| DBObject targetObject =
| getSession().viewDBObject(targetInvid);
| if(targetObject==null){
| Ganymede.debug("getFieldInTarget("+thisInvidField+","+requestedFieldID+"):
| target object could not be obtained");
| return null;
| }
| //get the level field of the parent
| requestedField = targetObject.getField(requestedFieldID);
| if(requestedField==null){
|
| Ganymede.debug("getFieldInTarget("+thisInvidField+","+requestedFieldID+"):
| target field could not be obtained");
| return null;
| }
| }
| catch(ClassCastException ex){
| throw new RuntimeException("Error while trying to
| cast in Invid field "+ex.getMessage());
| }
| return requestedField;
| }
Tsk, you don't really declare methods like this that return the
generic java.lang.Object rather than arlut.csd.ganymede.DBField, do
you? ;-)
But, yeah, if you use a method like that, you're sort of out of luck
if you need to examine the new value submitted to one of the finalize
methods.
If you had a method like
public DBField getFieldInTarget(Invid objId, short requestedFieldID)
then you could use it in either case, with the appropriate bit of
Invid field value retrieval provided as the first parameter.
Anyway, you know all this stuff now.
Good luck,
Jon
--
-------------------------------------------------------------------------------
Jonathan Abbey jonabbey@arlut.utexas.edu
Applied Research Laboratories The University of Texas at Austin
GPG Key: 71767586 at keyserver pgp.mit.edu, http://www.ganymeta.org/workkey.gpg
Attachment:
pgp00010.pgp
Description: PGP signature
Re: [Ganymede Dev] Sensitive Invid Field
- From: Jonathan Abbey <jonabbey@arlut.utexas.edu>