Oana,
Thank you very much for your response and clarification.
The point i was trying to make is that we are comparing values of attributes
in our bean object with a specified value. It is not necessary that this
specific value will be known in advance. It may be obtained only through some
computations or fetches from data-base.
Say in our example-
eval(instance_of_Country.getCountryName() == "Australia")
Here the value "Australia" is the rule input data. This value may be obtained
from some basic computations or from the data-base. Hence it would be required
to make a functional call to retrieve the value "Australia".
Thus the above example has to be modified as -
eval(instance_of_Country.getCountryName() == Dao.getCountryName())
I understand the above type of rule does not work.
The overall idea that i would like to bring out is that it would be essential
to make function calls to define rule input data for applications. I would like
to know if this is possible.
Thanks & Regards,
Sriram
nicolae oana <[EMAIL PROTECTED]> wrote:
Sriram,
I think that the entire expression from eval should return a boolean value.So,
if you use a function in your expression which return a value (primitive value
or object value) is not a problem.
You can use one of the accessors functions of your bean objects :
getCountryName() which I suppose will return a String value. You can test if
this value if the one you want. e.g. eval(instance_of_Country.getCountryName()
== "Australia").
Regards, Oana
sriram <[EMAIL PROTECTED]> wrote: Hi,
I have the following queries regarding implementation using JBoss Rules.
In the LHS part how does one make function calls? I understand that one can
use the eval( function-call ). But this i guess is applicable to only those
functions which have a boolean return type. Say i need to call methods which
need not have a boolean return type in the LHS part, then how do i implement it?
Sample Example
Consider a business/data object "County" with attribute "countryName".
Suppose i need to check if the countryName should match with a predefined name
which will be picked up from the application database :-
rule "DMC validation on chapter value"
when
$country: DataModuleBusinessObject(chapter == Dao.getCountryName());
then
System.out.println("Country does not start with A");
end
Here Dao.getCountryName() is the call to get countryName from database. This
method would return a String value. The above rule does not seem to work.
Please guide me and let me know how to solve this problem and any possible
workarounds. Let me know if the following are possible -
1. To make method calls which do not have a boolean return type.
2. Should all method calls be presented inside eval() ?
Thanks & Regards,
Sriram
---------------------------------
Find out what India is talking about on - Yahoo! Answers India
Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it
NOW
---------------------------------
Sponsored Link
Get an Online or Campus degree - Associate's, Bachelor's, or Master's -in less
than one year.
---------------------------------
Find out what India is talking about on - Yahoo! Answers India
Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it
NOW