[rules-users] Can't figure out the right syntax for this rule

Henry Canterburry canterburry at gmail.com
Mon Jan 14 11:31:59 EST 2008


Hi All,

I am trying to figure out how to do a pattern match against a collection 
and an array. Here is one of the domain model classes:

public class DecisionRequest extends Payload {

    public void addRequestObject(String key, Object value){
        this.payload.put(key, value);
    }
   
    public Object getRequestObject(String key){
        return this.payload.get(key);
    }
   
*    public Map<String, Object> getRequestObjects(){
        return Collections.unmodifiableMap(this.payload);
    }*

}

Here is my rule code for now trying to access the values in the Map 
returned by *public Map<String, Object> getRequestObjects(). As you can 
see, getRequestObjects does not have a setter so it isn't recognized a a 
javabean property. I have tried eval etc...*

global DecisionRequest request;
global DecisionResponse response;

rule "Explode Globals"
    ruleflow-group "Data Prep"
    when
        $market : Market() from collect( request.requestsObjects.values 
)* << property values isn't recognized? (expecting type LEFT_PARENT, 
mismatched token error)
        *$series : CandleSeries () from collect ( $market.candleSeries 
)* << candleSeries returns a CandleSeries[] (expecting type 
RIGHT_PARENT, mismatched token error)
  *  then
        insert ( $series );
        insert ( $market );
       
end

What would be the right way to pattern match against these values?

Thanks for any help
HC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080114/cb7f06fc/attachment.html 


More information about the rules-users mailing list