Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] [RHDM-2006] Please backport issue DROOLS-7014 to Red Hat Decision Man… #3003

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public void disapprove() {
this.approved = false;
}

// This method duplicates with approve() and disapprove(). But added to clarify bitmask issue DROOLS-7014.
public void setApproved(Boolean approved) {
this.approved = approved;
}

public Customer getCustomer() {
return this.customer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@ rule "approve non-alcoholic drink"
when
order: Order(isApproved() == null, drink.containsAlcohol == false)
then
order.approve();
order.setApproved(true);
update(order);
end

rule "approve alcoholic drink"
when
order: Order(isApproved() == null, drink.containsAlcohol, customer.ageInYears >= 18)
then
order.approve();
order.setApproved(true);
update(order);
end

rule "disapprove alcoholic drink for too young customer"
when
order: Order(isApproved() == null, drink.containsAlcohol, customer.ageInYears < 18)
then
order.disapprove();
order.setApproved(false);
update(order);
end
Loading