Maybe you will have to import Message.Type.XML in the drl file and then use it.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thierry B
Sent: Monday, December 01, 2008 3:32 PM
To: [email protected]
Subject: [rules-users] drools 4.0 and enum in java 1.5

Hello,

I'd like to use enum in java 1.5 with drools.

I try that :

A message class :
package com.pv.rules.beans;

public class Message {

        String payload;
        Type type;

        public enum Type {
           XML;
        }

        public Message(){
                this.type = Type.XML;
        }

        public Message(String payload){
                this.type = Type.XML;
                this.payload = payload;
        };

        public String getPayload(){
                return payload;
        }

        public void setPayload(String payload){
                this.payload = payload;
        }

        public Type getType(){
                return type;
        }
}

and in my drl :

rule "Contexte1"
        when
                >msg : Message(type == "XML", payload : payload)
                xpathEquals "/Root/aaaa" "bbbb"
                xpathEquals "/Root/cccc" "dddd
        then
                Log : "Contexte 1 ************* : OK";
end

but I've this error :

Unable to resolve ObjectType 'Message' : [Rule name=Contexte1,
agendaGroup=MAIN, salience=0, no-loop=false]
Rule Compilation error : [Rule name=Contexte1, agendaGroup=MAIN,
salience=0, no-loop=false]

Do you have an idea?

Thanks :-)

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

NOTICE: If received in error, please destroy and notify sender. Sender does not 
intend to waive confidentiality or privilege. Use of this email is prohibited 
when received in error.

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to