[jboss-jira] [JBoss JIRA] (DROOLS-1318) Using java enum when setting a variable of type enum does not work

Nicolas Heron (JIRA) issues at jboss.org
Wed Oct 5 13:34:00 EDT 2016


    [ https://issues.jboss.org/browse/DROOLS-1318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13303136#comment-13303136 ] 

Nicolas Heron edited comment on DROOLS-1318 at 10/5/16 1:33 PM:
----------------------------------------------------------------

[~mfusco]  In your case, the enum is in the Class definition. 
The error is in the when part in the example
Period( seasonType == SeasonType.day )
SeasonType is an enum defined outside the class



was (Author: nheron):
[~mfusco]  In your case, the enum is in the Class definition. 
The error is in the when part in the example
Period( seasonType == SeasonType.day )


> Using java enum when setting a variable of type enum does not work
> ------------------------------------------------------------------
>
>                 Key: DROOLS-1318
>                 URL: https://issues.jboss.org/browse/DROOLS-1318
>             Project: Drools
>          Issue Type: Bug
>    Affects Versions: 6.4.0.Final
>            Reporter: Nicolas Heron
>            Assignee: Nicolas Heron
>              Labels: OnBoarding
>
> In project https://github.com/chtiJBUG/onboarding-nautic-project
> when running the TestBirthday reduction
> TestBirthdayReduction : [Error: could not access/write property (seasonType) in: org.chtijbug.example.swimmingpool.Period] [Near :
> the source code of the rule is 
> 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.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



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list