[jboss-jira] [JBoss JIRA] Commented: (JBRULES-969) To be able to access globals within functions
Mark Proctor (JIRA)
jira-events at lists.jboss.org
Wed Jul 4 22:06:30 EDT 2007
[ http://jira.jboss.com/jira/browse/JBRULES-969?page=comments#action_12367775 ]
Mark Proctor commented on JBRULES-969:
--------------------------------------
you must pass your globals specifically as a parameter.
> To be able to access globals within functions
> ---------------------------------------------
>
> Key: JBRULES-969
> URL: http://jira.jboss.com/jira/browse/JBRULES-969
> Project: JBoss Rules
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: All
> Environment: Drools version 3.0.6, Using Eclipse IDE and simple DRL file working with Global variables
> Reporter: Natraj Gudla
> Assigned To: Mark Proctor
>
> Hello,
>
> I am using Drools 3.0.6. While using a global variable in a function, the compiler complains it cannot resolve the global variable name. Something like below
>
> global com.sample.ExampleLogger customLogger;
> function void logMessage(String msg){
> customLogger.logMessage("Log Message from the function");
> }
> In the above code, it complains "customLogger cannot be resolved". I am able to refer the global in the consequence of a rule directly. What is the problem using the reference within a function.
>
> On the other hand, i am able to do something like
>
> function void logMessage(ExampleLogger custLogger,String msg){
> custLogger.logMessage(msg+" Accept gloabal as function parameter");
> }
> and call from the consequence of a rule : logMessage(customLogger); // I am passing the global to the function as an argument and then use it to log a message.
> This way is working. But not the first way of using the global in the function. It would be a good feature to have the globals accessible within functions.
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list