Skip to content

Instantly share code, notes, and snippets.

@tkobayas
Created December 25, 2019 08:05
Show Gist options
  • Save tkobayas/710a02d487615d1386d0f044e0424b0e to your computer and use it in GitHub Desktop.
Save tkobayas/710a02d487615d1386d0f044e0424b0e 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