Created
December 25, 2019 08:04
-
-
Save tkobayas/ef2b946e6f4a7ac1d6cb3ebcded80806 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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