[rules-users] Guvnor data enumeration issue

GPatel at tsys.com GPatel at tsys.com
Thu Oct 27 23:44:20 EDT 2011


I am trying to use data enumerations and running into a problem. Following 
the Vehicle engineType/fuelType data enumeration example in the Guvnor 
manual, I created the following enumeration list and it works:

'Vehicle.engineType' : (new test.VehicleHelper()).getEngineTypes()
'Vehicle.fuelType[engineType]' : '(new 
test.VehicleHelper()).getFuelTypes("@{engineType}")'

VehicleHelper:
------------

public class VehicleHelper {
 
        public List<String> getEngineTypes(){
                List<String> engineTypes = new ArrayList<String>();
                engineTypes.add("Petrol");
                engineTypes.add("Diesel");
                return engineTypes;
        }
 
        public List<String> getFuelTypes(String engineType){
                List<String> fuelTypes = new ArrayList<String>();
                if("Petrol".equalsIgnoreCase(engineType)){
                        fuelTypes.add("ULP");
                        fuelTypes.add("PULP");
                }
                else if("Diesel".equalsIgnoreCase(engineType)){
                        fuelTypes.add("BIO");
                        fuelTypes.add("NORMAL");
                }
                else{
                        fuelTypes.add("Default Fuel 1");
                        fuelTypes.add("Default Fuel 2");
                }
                return fuelTypes;
        }

}

Above works as expected.

Problem:

I want to only have an enumeration on Vehicle.fuelType that depends on the 
value of engineType, without specifying an enumeration on engineType. So, 
I took out the first line in my enumeration list so that it is now: 

'Vehicle.fuelType[engineType]' : '(new 
test.VehicleHelper()).getFuelTypes("@{engineType}")'

But that does not work. When I create a rule, VehicleHelper.getFuelTypes 
does not get called and the dropdown for fuelType is not a list.

How do I get this working?

Thanks
G. Patel

-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111027/9d027c64/attachment.html 


More information about the rules-users mailing list