Last active
January 6, 2020 05:10
-
-
Save tkobayas/48b15f7c6a6ffac5aaf4b88ffd893ff9 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 SmallDepositApprove when | |
$l: /loanApplications[ applicant.age >= 20, deposit < 1000, amount <= 2000 ] | |
then | |
modify($l) { setApproved(true) }; | |
end | |
rule SmallDepositReject when | |
$l: /loanApplications[ applicant.age >= 20, deposit < 1000, amount > 2000 ] | |
then | |
modify($l) { setApproved(false) }; | |
end | |
rule LargeDepositApprove when | |
$l: /loanApplications[ applicant.age >= 20, deposit >= 1000, amount <= maxAmount ] | |
then | |
modify($l) { setApproved(true) }; | |
end | |
rule LargeDepositReject when | |
$l: /loanApplications[ applicant.age >= 20, deposit >= 1000, amount > maxAmount ] | |
then | |
modify($l) { setApproved(false) }; | |
end | |
rule NotAdultApplication when | |
$l: /loanApplications[ applicant.age < 20 ] | |
then | |
modify($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