/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; import org.apache.servicemix.examples.camel.Person; import org.apache.servicemix.examples.camel.Sex; import org.apache.servicemix.examples.camel.Drinks; rule "humans need water" salience 2 when p : Person() then modify(p) {setDrink(Drinks.WATER)}; end rule "boys go for Cola Zero" salience 1 when p : Person(age >= 8 && sex == Sex.MALE) then modify(p) {setDrink(Drinks.COLA_ZERO)}; end rule "girls go for Cola Light" salience 1 when p : Person(age >= 8 && sex == Sex.FEMALE) then modify(p) {setDrink(Drinks.COLA_LIGHT)}; end rule "can you drink?" when p : Person( age >= 21 && !canDrink) then modify(p) {setCanDrink(true)}; end rule "woman go for wine" when p : Person(sex == Sex.FEMALE && canDrink ) then modify(p) {setDrink(Drinks.WINE)}; end rule "men go for beer" when p : Person(sex == Sex.MALE && canDrink ) then modify(p) {setDrink(Drinks.BEER)}; end rule "Vip in the house!" salience -1 when p : Person( rich && !Vip) then modify(p) {setVip(true)}; end rule "Vip woman drink bubbles" when p : Person(Vip && sex == Sex.FEMALE && canDrink) then modify(p) {setDrink(Drinks.CHAMPAGNE)}; end rule "Vip men drink Scotch" when p : Person(Vip && sex == Sex.MALE && canDrink) then modify(p) {setDrink(Drinks.SCOTCH)}; end