Skip to content

Instantly share code, notes, and snippets.

@tkobayas
Created December 25, 2019 08:04
Show Gist options
  • Save tkobayas/ef2b946e6f4a7ac1d6cb3ebcded80806 to your computer and use it in GitHub Desktop.
Save tkobayas/ef2b946e6f4a7ac1d6cb3ebcded80806 to your computer and use it in GitHub Desktop.
package org.kie.kogito.queries;
unit LoanUnit;
import org.kie.kogito.queries.LoanApplication
rule SmallDeposit when
$l: /loanApplications[ applicant.age >= 20, deposit < 1000, amount <= 2000 ]
then
modify($l) { setApproved(true) };
end
rule LargeDeposit when
$l: /loanApplications[ applicant.age >= 20, deposit >= 1000, amount <= maxAmount ]
then
modify($l) { $l.setApproved(true) };
end
rule NotAdultApplication when
$l: /loanApplications[ applicant.age < 20 ]
then
modify($l) { $l.setApproved(false) };
end
query FindApproved
$l: /loanApplications[ approved ]
end
query FindNotApprovedIdAndAmount
/loanApplications[ !approved, $id: id, $amount : amount ]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment