J,

in your action class:

do this.

...
import org.apache.turbine.om.BaseObject;
import org.apache.turbine.om.ObjectKey;
import java.math.BigDecimal;
...


ObjectKey useid = ((BaseObject)data.getUser()).getPrimaryKey();
BigDecimal id = (BigDecimal)userid.getValue();
// or whatever
// and now look ObjectKey's api doc for more what you want to do

it looks strange, but will work; or go through an extending user session, you will never have this problem again.

[EMAIL PROTECTED] wrote:
Looks like om.security.User really hates being cast ... am I doomed to
extended TurbineUser?
-j

Exception: java.lang.reflect.InvocationTargetException
Stack Trace follows:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
Caused by: java.lang.ClassCastException:
org.apache.turbine.om.security.TurbineUser
at
com.genelogic.nodedb.modules.actions.samplesets.SampleSetFormActions.doUpdate(SampleSetFormActions.java:101)
... 48 more




Bill <bhalpin@collaborative To: Turbine Users List fusion.com> <[EMAIL PROTECTED]> cc: 12/16/2002 01:02 PM Subject: Re: Access to current user ID? Please respond to "Turbine Users List"



On Mon, 2002-12-16 at 22:35, [EMAIL PROTECTED] wrote:

Sorry, I wasn't terribly specific. Yes, at the moment the compiler
doesn't

seem to mind returning the ObjectKey but getValue() returns an Object,
not

an int, and looking at the ObjectKey code it looks like nearly anything
can

be used as the primary key. I tried assuming this was an Integer, casting
and using intValue() but that didn't get me very far. I see that
NumberKey

uses BigDecimal internally to keep track of it's counter -- do you think
I'd be safe in casting ObjectKey to a NumberKey and then pulling out it's
BigDecimal and then pulling out ITS int value?


I believe that is exactly what you want to do.









--
To unsubscribe, e-mail:   <
mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>







--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to