Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.training.leisure.swimmingpool;
- import java.lang.Number;
- import org.chtijbug.example.swimmingpool.CalculatedAttribute;
- import org.chtijbug.example.swimmingpool.Price;
- import org.chtijbug.example.swimmingpool.Person;
- import org.chtijbug.example.swimmingpool.Period;
- import org.chtijbug.example.swimmingpool.SeasonType;
- import org.chtijbug.example.swimmingpool.PriceType;
- rule "BirthdayReduction"
- dialect "mvel"
- ruleflow-group "reduction"
- when
- ccat : CalculatedAttribute( key == "IsPersonBirthday" , stringValue == "true" )
- pper : Person( calculatedAttributeList contains ccat , sprice : standardPrice > 0.0B )
- not (pprice : Price( description == "BirthdayReduction" ) and Person( priceList contains pprice , this == pper ))
- Period( seasonType == SeasonType.day )
- then
- Price nprice = new Price();
- nprice.setDescription( "BirthdayReduction" );
- nprice.setAmount( sprice.divide(new BigDecimal("10.0"),BigDecimal.ROUND_HALF_UP) );
- nprice.setPriceType( PriceType.promotion );
- insert( nprice );
- pper.addPrice( nprice );
- modify( pper ) {
- setPriceList( pper.getPriceList() )
- }
- end
Advertisement
Add Comment
Please, Sign In to add comment