==> Enumeration:
~~~
'SimpleFact.factOne' : ['one','two','three']
~~~
==> Fact: SimpleFact
~~~
public class SimpleFact implements java.io.Serializable
{
static final long serialVersionUID = 1L;
@org.kie.api.definition.type.Label(value = "factOne")
private java.util.List<java.lang.String> factOne;
public SimpleFact()
{
}
public java.util.List<java.lang.String> getFactOne()
{
return this.factOne;
}
public void setFactOne(java.util.List<java.lang.String> factOne)
{
this.factOne = factOne;
}
public SimpleFact(java.util.List<java.lang.String> factOne)
{ this.factOne = factOne; }
}
~~~
==> Guided Rule (using above enumeration and fact):
~~~
package simplepackage;
import java.lang.Number;
rule "SimpleEnumGuidedRule"
dialect "mvel"
when
SimpleFact( factOne contains two )
then
end
~~~
Here you can see that although it is an enumeration for "factOne" , but the chosen value "two" does not contain quotes. This causes the issue given below.
Result while building project/validating the rule:
~~~
20:15:34,050 ERROR [org.drools.compiler.kie.builder.impl.AbstractKieModule] (http-127.0.0.1:8080-1) Unable to build KieBaseModel:defaultKieBase
Unable to Analyse Expression two:
[Error: unable to resolve method using strict-mode: simplepackage.SimpleFact.two()]
[Near :
{... two ....}
]
^ : [Rule name='SimpleEnumGuidedRule']
Unable to Analyse Expression factOne contains two:
[Error: unable to resolve method using strict-mode: simplepackage.SimpleFact.two()]
[Near :
{... factOne contains two ....}
]
^
[Line: 8, Column: 2] : [Rule name='SimpleEnumGuidedRule']
Unable to Analyse Expression @Modify with( f1 )
{ setFactOne( one ) };:
~~~
==> Guided Decision Table (source given below):
~~~
package simplepackage;
import java.util.List;
import java.lang.Number;
//from row number: 1
rule "Row 1 GuidedEnumerationTable"
dialect "mvel"
when
f1 : SimpleFact( factOne contains "one" )
then
modify( f1 ) {
setFactOne( one )
}
end
//from row number: 2
rule "Row 2 GuidedEnumerationTable"
dialect "mvel"
when
f1 : SimpleFact( factOne contains "two" )
then
modify( f1 ) { setFactOne( one ) }
end
//from row number: 3
rule "Row 3 GuidedEnumerationTable"
dialect "mvel"
when
f1 : SimpleFact( factOne contains "three" )
then
modify( f1 ) {
setFactOne( one )
}
end
~~~
Here you can see that although in condition section the values for enumerated field "factOne" is chosen with quotes ("three") , but in then section the setter method does not contain the value in quotes .
Result while building project/validating the rule:
~~~
[Line: 8, Column: 2] :
[Rule name='SimpleEnumGuidedRule']
Unable to Analyse Expression @Modify with( f1 ) { setFactOne( one ) }
;:
[Error: unable to resolve method using strict-mode: org.drools.core.spi.KnowledgeHelper.one()]
[Near : {... @Modify with( f1 )
{ setFactOne( one ) }
; ....}]
^
~~~
==> Guided Decision Template (source given below):
Unfortunately due to some issues , I am not able to see the rule source at my end. But I used the same enumeration as shown above and I can see that it does not cause any validation error. I also tested in a separate project as seen in the attached second archive "Model_TestProject.zip" , where I used similar tests on Guided Decision Template, and there as well the template validates fine and the project builds fine too. However as per some users, they are seeing validation errors in Guided Decision Template too.