I'm not certain, but it looks like the Operator "not contains"[1] works
fine with strings but not Enumerations. Would someone please confirm or
correct the rule syntax? Thank you.
Given:
rule "Absence_Accumulation_Rule"
when
$slice : TimeSlice(
classifiers contains(TimeSliceClassifiers.ABSENCE),
classifiers contains(TimeSliceClassifiers.OT),
classifiers not contains (TimeSliceClassifiers.COUNT_TO_FLSA),
then
System.out.println("Absence: Count to overtime but not FLSA");
end
public enum TimeSliceClassifiers {
INSIDE_SCHEDULE,
OUTSIDE_SCHEDULE,
WORKED,
ABSENCE,
APPROVED,
OVERTIME_REQUEST,
CASH,INVOLUNTARY,
COUNT_TO_OT,
COUNT_TO_FLSA,
OT,
STRAIGHT,
PREMIUM,
EC0100,
EC1400,
EC1405
}
public class TimeSlice {
private Date start;
private Date end;
private int elapsed;
private Set<TimeSliceClassifiers> classifiers;
private boolean sliceCreatedByRules = false;
}
Provides the following error:
[ERR 103] Line 110:21 rule 'in_key' failed predicate:
{(validateIdentifierKey(DroolsSoftKeywords.IN))}? in rule
"Absence_Accumulation_Rule" in pattern TimeSlice