13.32. Code for the Conditional Element Accumulate's Functions

Code for plugging in functions (to be entered into the config file)
jbossrules.accumulate.function.average =
   org.jbossrules.base.accumulators.AverageAccumulateFunction
Alternate Syntax: single function with return type
rule "Apply 10% discount to orders over US$ 100,00"
when
    $order : Order()
    $total : Number( doubleValue > 100 ) 
             from accumulate( OrderItem( order == $order, $value : value ),
                              sum( $value ) )
then
    # apply discount to $order
end
** item name **
** item description **