That's exactly right.After I have batched the clp file and before I run it,
I add a JessUser instance in the jess memory.Then I want to retreive a
field(java bean-specificUser) of this instance from the jess memory via the 
defrule(as an argument of my userfunction). 
public class JessUser {    private boolean reportsLock;    private User 
specificUser;//<--this field I want to put as second argument        public 
JessUser() {        this.reportsLock=false;    }        public boolean 
isReportsLock(){        return this.specificUser.hasReportsLock();    }    
public void setReportsLock(boolean rep){        this.reportsLock=rep;    }    
public User getSpecificUser(){        return this.specificUser;    }    public 
void setSpecificUser(User usr){        this.specificUser=usr;    }  }
 
If I finally get this specificUser field,will it be the field of the exact 
JessUser instance that I added in the engine before running it?
> From: [EMAIL PROTECTED]> Subject: Re: JESS: Userfunction arguments> Date: 
> Wed, 9 Jan 2008 11:04:51 -0500> To: [email protected]> > On Jan 9, 2008, 
> at 10:14 AM, Manolis Nikoloudakis wrote:> > > (defrule lockRule> > "Testing 
> the rule."> > (JessUser { reportsLock == TRUE } (reportsLock ?value))=> > > 
> (printout t "ReportsLock: " ?value crlf)(calling DynamicReplanning > > 
> specificUser)> > )> > where i want to express that if reportsLock bean of 
> JessUser class > > is true,call(through calling variable) JessCaller file 
> with a > > String argument(DynamicReplanning) and a User Object argument > > 
> (specificUser).> >> > When I batch and run the clp file,I get the first 
> argument > > right,but when I get the java object:> > 'User 
> specificUser=(User)vv.get(2).javaObjectValue(context);'> > I have a 
> java.lang.ClassCastException: java.lang.String cannot be > > cast to 
> ProtegeCode.User.> > I imagine that the wrong part is in the defrule and I 
> should > > declare 'specificUser' Object in another way,but I don't know 
> exactly.> > OK. In the rule as you've written it, "specificUser" is just a 
> Jess > symbol; calling javaObjectValue() is indeed going to convert that > 
> symbol to a String. What you want there instead is something that > refers to 
> an instance of your User class, yes? So where should this > User object come 
> from? Is is a property of the JessUser object, or > would it come from 
> somewhere else?> > > > 
> ---------------------------------------------------------> Ernest 
> Friedman-Hill> Informatics & Decision Sciences Phone: (925) 294-2154> Sandia 
> National Labs FAX: (925) 294-2234> PO Box 969, MS 9012 [EMAIL PROTECTED]> 
> Livermore, CA 94550 http://www.jessrules.com> > 
> --------------------------------------------------------------------> To 
> unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'> in 
> the BODY of a message to [EMAIL PROTECTED], NOT to the list> (use your own 
> address!) List problems? Notify [EMAIL PROTECTED]> 
> --------------------------------------------------------------------> 
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

Reply via email to