> -----Original Message-----
> From: Jeffery Painter [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 18, 2003 9:51 AM
> To: Turbine Users List
> Subject: extending user question
>
>
>
> I have successfully extended my user with both boolean fields
> and String
> fields but I'm having trouble with field types of DOUBLE
>
> Can anyone send me some code snippets or look at mine to see what is
> wrong. I have tried variations on getPerm() setPerm() but it
> seems to only like String types in the setPerm() method...
>
> my boolean type works fine using the String method.
>
> any help would be appreciated... I'm still using TDK 2.1.. I
> know it is
> getting dated, but I can't upgrade at this point...
>
> also, on another note, I have tried adding some logging info to my
> extended user class and it is not getting called. I fear it
> has to do with
> the way the user is actually accessed through turbine and all
> this flux
> stuff... has anyone gotten logging within their extended user to work?
>
>
> Error:
>
> Caused by: java.lang.NumberFormatException: For input string:
> "TURBINE_USER.COMMISSION_PERCENT" at
> java.lang.NumberFormatException.forInputString(NumberFormatExc
> eption.java:48)
> at
> java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal
> .java:1213)
> at java.lang.Double.valueOf(Double.java:184)
> at java.lang.Double.<init>(Double.java:259)
> at
> com.kiasoft.ipmanager.util.db.map.TurbineMapBuilderAdapter.get
> User_CommissionPercent(TurbineMapBuilderAdapter.java:123)
> at
> com.kiasoft.ipmanager.om.TurbineUserPeerAdapter.<clinit>(Turbi
> neUserPeerAdapter.java:23)
>
>
> --------------------------------------------------------------
> ----------------------------
> public class TurbineUserPeerAdapter extends TurbineUserPeer
> {
> public static final double COMMISSION_PERCENT =
> mapBuilder.getUser_CommissionPercent();
> }
This code should read as follows:
public class TurbineUserPeerAdapter extends TurbineUserPeer
{
public static final String COMMISSION_PERCENT =
mapBuilder.getUser_CommissionPercent();
}
>
> --------------------------------------------------------------
> ----------------------------
> TurbineUserAdapter.java
>
> public void setCommissionPercent(String percent)
> {
> setPerm(COMMISSION_PERCENT, percent);
> }
Try this:
public void setCommissionPercent(double percent)
{
setPerm(COMMISSION_PERCENT, new Double(percent));
}
>
> public double getCommissionPercent()
> {
> double tmp = 0.0;
> try { tmp = new Double ( (String)
> getPerm(COMMISSION_PERCENT) ).doubleValue(); }
> catch ( Exception e ) {}
> return tmp;
> }
Change to:
public double getCommissionPercent()
{
Double temp = getPerm(COMMISSION_PERCENT);
return (temp==null ? 0.0 : temp.doubleValue() );
}
>
> --------------------------------------------------------------
> ----------------------------
> TurbineMapBuilderAdapter.java
>
> public String getCommissionPercent()
> {
> return "COMMISSION_PERCENT";
> }
>
> public double getUser_CommissionPercent()
> {
> double tmp = 0.0;
> tmp = new Double( getTableUser() + '.' +
> getCommissionPercent() ).doubleValue();
> return tmp;
> }
This method should return a String not a double. Try the following:
public String getUser_CommissionPercent()
{
return getTableUSer() + "." + getCommissionPercent();
}
> --------------------------------------------------------------
> ----------------------------
>
>
>
> --
>
> Jeff Painter
> ------------
> [EMAIL PROTECTED]
>
http://kiasoft.com
(919) 677-8525
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]