From d02a04178b7fc57c2b13b19e56afebe6336097f6 Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Thu, 28 Mar 2024 08:01:35 +0100 Subject: [PATCH 01/12] [DROOLS-7616][DROOLS-7617] minor documentation fixes (#5809) --- .../_drl-declarations-enumerative-con.adoc | 2 +- .../src/modules/ROOT/pages/language-reference/_drl-rules.adoc | 2 +- .../modules/ROOT/pages/rule-engine/_execution-control-con.adoc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drools-docs/src/modules/ROOT/pages/language-reference-traditional/_drl-declarations-enumerative-con.adoc b/drools-docs/src/modules/ROOT/pages/language-reference-traditional/_drl-declarations-enumerative-con.adoc index d1dc314537f..9300b67e0c4 100644 --- a/drools-docs/src/modules/ROOT/pages/language-reference-traditional/_drl-declarations-enumerative-con.adoc +++ b/drools-docs/src/modules/ROOT/pages/language-reference-traditional/_drl-declarations-enumerative-con.adoc @@ -16,7 +16,7 @@ end rule "Using a declared Enum" when - $emp : Employee( dayOff == DaysOfWeek.MONDAY ) + $emp : Employee( dayOff == DaysOfWeek.MON ) then ... end diff --git a/drools-docs/src/modules/ROOT/pages/language-reference/_drl-rules.adoc b/drools-docs/src/modules/ROOT/pages/language-reference/_drl-rules.adoc index 33aa0bd0147..7c06016c2dd 100644 --- a/drools-docs/src/modules/ROOT/pages/language-reference/_drl-rules.adoc +++ b/drools-docs/src/modules/ROOT/pages/language-reference/_drl-rules.adoc @@ -379,7 +379,7 @@ end rule "Using a declared Enum" when - $emp : /employees[ dayOff == DaysOfWeek.MONDAY ] + $emp : /employees[ dayOff == DaysOfWeek.MON ] then ... end diff --git a/drools-docs/src/modules/ROOT/pages/rule-engine/_execution-control-con.adoc b/drools-docs/src/modules/ROOT/pages/rule-engine/_execution-control-con.adoc index b4e4670801d..5eb5d043fc9 100644 --- a/drools-docs/src/modules/ROOT/pages/rule-engine/_execution-control-con.adoc +++ b/drools-docs/src/modules/ROOT/pages/rule-engine/_execution-control-con.adoc @@ -87,7 +87,7 @@ then end ---- -For this example, the rules in the `"report"` agenda group must always be executed first and the rules in the `"calculation"` agenda group must always be executed second. Any remaining rules in other agenda groups can then be executed. Therefore, the `"report"` and `"calculation"` groups must receive the focus to be executed in that order, before other rules can be executed: +For this example, the rules in the `"calculation"` agenda group must always be executed first and the rules in the `"report"` agenda group must always be executed second. Any remaining rules in other agenda groups can then be executed. Therefore, the `"report"` and `"calculation"` groups must receive the focus to be executed in reverse order (due to the fact that the agenda groups are placed on a stack), before other rules can be executed: .Set the focus for the order of agenda group execution [source,java] From 9500edcb387d9065573b522693107d394d3a42d2 Mon Sep 17 00:00:00 2001 From: Gabriele Cardosi Date: Tue, 2 Apr 2024 15:18:06 +0200 Subject: [PATCH 02/12] [incubator-kie-issues#1044] DMN: Copy shared models from kogito-examples (#5810) * [incubator-kie-issues#1044] WIP * [incubator-kie-issues#1044] WIP * [incubator-kie-issues#1044] WIP - all valid models validated * [incubator-kie-issues#1044] Fix tags * [incubator-kie-issues#1044] Validate all valid models from shared module --------- Co-authored-by: Gabriele-Cardosi --- .../core/stronglytyped/Traffic Violation.dmn | 13 +- .../AllowedValuesChecksInsideCollection.dmn | 68 +- .../DMNv1_5/DateToDateTimeFunction.dmn | 10 +- .../DMNv1_5/Importing_EmptyNamed_Model.dmn | 2 +- .../DMNv1_5/Importing_Named_Model.dmn | 4 +- .../Importing_OverridingEmptyNamed_Model.dmn | 2 +- .../DMNv1_5/TypeConstraintsChecks.dmn | 70 +- .../valid_models/DMNv1_x/LoanEligibility.dmn | 432 +++++++++ .../valid_models/DMNv1_x/Prequalification.dmn | 837 ++++++++++++++++++ .../DMNv1_x/Traffic Violation Simple.dmn | 240 +++++ .../DMNv1_x/Traffic Violation.dmn | 313 +++++++ .../valid_models/DMNv1_x/allTypes.dmn | 12 +- .../valid_models/DMNv1_x/dtevent.dmn | 137 +++ .../valid_models/DMNv1_x/habitability.dmn | 134 +++ .../DMNv1_x/multiple/Financial.dmn | 57 +- .../multiple/Imported_Traffic_Violation.dmn | 35 + .../Traffic Violation With Import.dmn | 221 +++++ .../valid_models/DMNv1_x/multiple/stdlib.dmn | 12 +- kie-dmn/kie-dmn-validation/pom.xml | 40 +- .../org/kie/dmn/validation/ValidatorTest.java | 107 ++- 20 files changed, 2620 insertions(+), 126 deletions(-) create mode 100644 kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/LoanEligibility.dmn create mode 100644 kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/Prequalification.dmn create mode 100644 kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/Traffic Violation Simple.dmn create mode 100644 kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/Traffic Violation.dmn create mode 100644 kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/dtevent.dmn create mode 100644 kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/habitability.dmn create mode 100644 kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/Imported_Traffic_Violation.dmn create mode 100644 kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/Traffic Violation With Import.dmn diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/Traffic Violation.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/Traffic Violation.dmn index b24fed0d258..1f8f002a13b 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/Traffic Violation.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/Traffic Violation.dmn @@ -1,5 +1,16 @@ - + diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/AllowedValuesChecksInsideCollection.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/AllowedValuesChecksInsideCollection.dmn index fca927bc707..d0bddbe7989 100644 --- a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/AllowedValuesChecksInsideCollection.dmn +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/AllowedValuesChecksInsideCollection.dmn @@ -1,58 +1,58 @@ - - - + - string - - string + + - tInterests - - - - string - - - tInterest - tInterests + + + + string + + + tInterest + - "Golf","Computer","Hockey","Jogging" - - - "Golf","Computer","Hockey","Jogging" + + + - - - - - - "The Person " + p1.Name + " likes " + string(count( p1.Interests )) + " thing(s)." - - - + + + + "The Person " + p1.Name + " likes " + string(count( p1.Interests )) + " thing(s)." + + + - - - + + diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/DateToDateTimeFunction.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/DateToDateTimeFunction.dmn index 69986be5faf..31048608aea 100644 --- a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/DateToDateTimeFunction.dmn +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/DateToDateTimeFunction.dmn @@ -1,11 +1,13 @@ - + id="_14BDA5CA-C87F-448D-AF75-F976A9E0EF83" + name="new-file" + typeLanguage="http://www.omg.org/spec/DMN/20230324/FEEL/" + namespace="https://kiegroup.org/dmn/_A7F17D7B-F0AB-4C0B-B521-02EA26C2FBEE"> diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Importing_EmptyNamed_Model.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Importing_EmptyNamed_Model.dmn index ae2fa55bdc5..6bcd6e18387 100644 --- a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Importing_EmptyNamed_Model.dmn +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Importing_EmptyNamed_Model.dmn @@ -2,7 +2,7 @@ - - - + - string - - string + + - tInterests - - - - string - - - tInterest - - count (?) = 1 - - - tInterests + + + + string + + + tInterest + + count (?) = 1 + + + - - - - - - "The Person " + p1.Name + " likes " + string(count( p1.Interests )) + " thing(s)." - - - + + + + "The Person " + p1.Name + " likes " + string(count( p1.Interests )) + " thing(s)." + + + - - - + + diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/LoanEligibility.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/LoanEligibility.dmn new file mode 100644 index 00000000000..9e57a3a2205 --- /dev/null +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/LoanEligibility.dmn @@ -0,0 +1,432 @@ + + + + + number + + [18..80] + + + + number + + > 0 + + + + number + + >= 0 + + + + + + number + + > 0 + + + + number + + > 0 + + + + + + + + + + + + + + Is the client eligible for the loan? + "Yes" "No" + + + + + + + + + + + Client.salary + + + + + Client.age + Loan.duration + + + + + ((Client.existing payments + Loan.installment) / Client.salary) * 100 + + + + + "No" + + + + + (0..2000] + + + <= 80 + + + <= 20 + + + "Yes" + + + + + (2000..3000] + + + <= 80 + + + <= 25 + + + "Yes" + + + + + > 3000 + + + <= 80 + + + <= 35 + + + "Yes" + + + + + + + + + + + does the director approve it? + "yes" , "no" + + + + + + + + + + + Eligibility + + + + + SupremeDirector + + + + + + "Yes" + + + "No" + + + "No" + + + + + "No" + + + "Yes" + + + "Yes" + + + + + "No" + + + "No" + + + "No" + + + + + "Yes" + + + "Yes" + + + "Yes" + + + + + + + + + + + + + + + + + + Bribe + + + + + + <= 100 + + + 0 + + + + + > 100 + + + 100 + + + + + + + + + + + + + + + + + Is Enough? + + + + + Judgement + + + + + + 100 + + + "Yes" + + + true + + + + + 100 + + + "No" + + + true + + + + + 0 + + + "Yes" + + + true + + + + + 0 + + + "No" + + + false + + + + + + + + + + 50 + 100 + 100 + 100 + 100 + 100 + + + 50 + 100 + 100 + 100 + 100 + + + 50 + 100 + 100 + 100 + + + 50 + 100 + 100 + 100 + 100 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/Prequalification.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/Prequalification.dmn new file mode 100644 index 00000000000..97a3340dc23 --- /dev/null +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/Prequalification.dmn @@ -0,0 +1,837 @@ + + + + + string + + + + "High", "Medium", "Low" + + "High" + "High" + + + "Medium" + "Medium" + + + "Low" + "Low" + + + + "High","Medium","Low" + + + + number + + + + [300..850] + + + [300..850] + + + + string + + + + "Excellent", "Good", "Problem", "Not a client" + + "Excellent" + "Excellent" + + + "Good" + "Good" + + + "Problem" + "Problem" + + + "Not a client" + "Not a client" + + + + "Excellent","Good","Problem","Not a client" + + + + + number + + + number + + + number + + + + string + + + + "Approved", "Declined" + + "Approved" + "Approved" + + + "Declined" + "Declined" + + + + "Approved","Declined" + + + + + number + + + number + + + + string + + + + "Approved", "Declined" + + "Approved" + "Approved" + + + "Declined" + "Declined" + + + + "Approved","Declined" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LTV + + + + + DTI + + + + + Credit Score + + + [300..850] + + + + + "Approved","Declined" + + + + + + <=0.75 + + + <=0.36 + + + >=620 + + + "Approved" + + + + + + + + <=0.75 + + + (0.36..0.45] + + + >=640 + + + "Approved" + + + + + + + + (0.75..0.80] + + + <=0.36 + + + >=680 + + + "Approved" + + + + + + + + (0.75..0.80] + + + (0.36..0.45] + + + >=700 + + + "Approved" + + + + + + + + - + + + - + + + - + + + "Declined" + + + + + + + + + + Qualification = "Approved" + + + + + + + + + + + + + + (Loan Payment+Borrower.Monthly Other Debt)/Borrower.Monthly Income + + + + + + + + + + + + + + + + + + + + + + + + LLPA*.00125 + Best Rate + + + + + + + payment + + + + + Loan Amount + + + + + + adjustedRate + + + + + + 360 + + + + + + + decimal( amount, 2 ) + + + + + + + + + + + + + + + + + + + + Loan Amount/Appraised Value + + + + + + + + + + + + + + + + principal*rate/12/(1-(1+rate/12)**-term) + + + + + + + + + + + + + + + LTV + + + + + Credit Score + + + [300..850] + + + + + + + <=0.60 + + + >=660 + + + 0 + + + + + + + + <=0.60 + + + [620..660) + + + 0.5 + + + + + + + + (0.60..0.70] + + + >=720 + + + 0.25 + + + + + + + + (0.60..0.70] + + + [680..720) + + + 0.5 + + + + + + + + (0.60..0.70] + + + [660..680) + + + 1.0 + + + + + + + + (0.60..0.70] + + + [640..660) + + + 1.25 + + + + + + + + (0.60..0.70] + + + [620..640) + + + 1.5 + + + + + + + + (0.70..0.75] + + + >=740 + + + 0.25 + + + + + + + + (0.70..0.75] + + + [720..740) + + + 0.5 + + + + + + + + (0.70..0.75] + + + [700..720) + + + 1.0 + + + + + + + + (0.70..0.75] + + + [680..700) + + + 1.25 + + + + + + + + (0.70..0.75] + + + [660..680) + + + 2.25 + + + + + + + + (0.70..0.75] + + + [640..660) + + + 2.75 + + + + + + + + (0.70..0.75] + + + [620..640) + + + 3.0 + + + + + + + + (0.75..0.80] + + + >=740 + + + 0.5 + + + + + + + + (0.75..0.80] + + + [720..740) + + + 0.75 + + + + + + + + (0.75..0.80] + + + [700..720) + + + 1.25 + + + + + + + + (0.75..0.80] + + + [680..700) + + + 1.75 + + + + + + + + (0.75..0.80] + + + [660..680) + + + 2.75 + + + + + + + + (0.75..0.80] + + + [620..660) + + + 3.0 + + + + + + + + - + + + <620 + + + 4 + + + + + + + + >0.80 + + + - + + + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/Traffic Violation Simple.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/Traffic Violation Simple.dmn new file mode 100644 index 00000000000..874e228580c --- /dev/null +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/Traffic Violation Simple.dmn @@ -0,0 +1,240 @@ + + + + + string + + + number + + + string + + + string + + + number + + + + + string + + + date + + + string + + "speed", "parking", "driving under the influence" + + + + number + + + number + + + + + number + + + number + + + + + + + + + + + + + + Violation.Type + + + + + Violation.Actual Speed - Violation.Speed Limit + + + + + + + "speed" + + + [10..30) + + + 500 + + + 3 + + + + + "speed" + + + >= 30 + + + 1000 + + + 7 + + + + + "parking" + + + - + + + 100 + + + 1 + + + + + "driving under the influence" + + + - + + + 1000 + + + 5 + + + + + + + + + Should the driver be suspended due to points on his license? + "Yes", "No" + + + + + + + + + + + + Driver.Points + Fine.Points + + + + + if Total Points >= 20 then "Yes" else "No" + + + + + + + + + + 50.0 + 254.0 + 329.0 + 119.0 + 100.0 + 186.0 + + + 50.0 + 100.0 + 398.0 + + + 398.0 + + + 398.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/Traffic Violation.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/Traffic Violation.dmn new file mode 100644 index 00000000000..c15afa09aae --- /dev/null +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/Traffic Violation.dmn @@ -0,0 +1,313 @@ + + + + + string + + + number + + [18..90] + + + + string + + + string + + + number + + + + + string + + + date + + + string + + "speed", "parking", "driving under the influence" + + + + number + + + number + + + + + number + + + number + + + + + + + + + + + + + + + + + + + + + + Violation.Type + + + + + Violation.Actual Speed - Violation.Speed Limit + + + + + + + + "speed" + + + [10..30) + + + 500 + + + 3 + + + + + + + + "speed" + + + >= 30 + + + 1000 + + + 7 + + + + + + + + "parking" + + + - + + + 100 + + + 1 + + + + + + + + "driving under the influence" + + + - + + + 1000 + + + 5 + + + + + + + + + + + + + + Should the driver be suspended due to points on his license? + "Yes", "No" + + + + + + + + + + + + + + + calculateTotalPoints(Driver, Fine) + + + + + if Total Points >= 20 then "Yes" else "No" + + + + + + + + + + + + fine.Points * (if driver.Age >= 22 then 1 else 2) + driver.Points + + + + + + + + + 50 + 254 + 329 + 119 + 100 + 186 + + + 50 + 100 + 398 + + + 398 + + + 398 + + + 300 + + + 50 + 300 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/allTypes.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/allTypes.dmn index 826666a894f..418f4f3468e 100644 --- a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/allTypes.dmn +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/allTypes.dmn @@ -1,4 +1,14 @@ - + string diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/dtevent.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/dtevent.dmn new file mode 100644 index 00000000000..ed42e5d3d62 --- /dev/null +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/dtevent.dmn @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + a + + + + + b + + + + + + + >0 + + + - + + + "a gt 0" + + + + + + + + - + + + >0 + + + "b gt 0" + + + + + + + + >0 + + + >0 + + + "a and b gt 0" + + + + + + + + + + + + + + + + a + + + + + + + >0 + + + "r1" + + + + + + + + <=0 + + + "r2" + + + + + + + + + + e1 + + + + + + + \ No newline at end of file diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/habitability.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/habitability.dmn new file mode 100644 index 00000000000..2d3d0cd262c --- /dev/null +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/habitability.dmn @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + oxygene + + + + + temperature + + + + + + + [10..100] + + + < 40 + + + "somehow doable" + + + + + + + + <10 + + + < 40 + + + "hardly doable" + + + + + + + + - + + + >= 40 + + + "too hot" + + + + + + + + + + + + + 50 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/Financial.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/Financial.dmn index 5a722a9bc2a..a3f7b71098c 100644 --- a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/Financial.dmn +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/Financial.dmn @@ -1,22 +1,39 @@ - - - - - - - - - <p><span lang="JA">Standard calculation of monthly installment&nbsp;</span>from Rate, Term and Amount.</p> - - - - - - - (Amount *Rate/12) / (1 - (1 + Rate/12)**-Term) - - - + + + + + + + + + <p><span lang="JA">Standard calculation of monthly installment&nbsp;</span>from Rate, Term and Amount.</p> + + + + + + + (Amount *Rate/12) / (1 - (1 + Rate/12)**-Term) + + + @@ -28,4 +45,4 @@ - + diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/Imported_Traffic_Violation.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/Imported_Traffic_Violation.dmn new file mode 100644 index 00000000000..8915f813c39 --- /dev/null +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/Imported_Traffic_Violation.dmn @@ -0,0 +1,35 @@ + + + + + + + string + + + number + + + string + + + string + + + number + + + diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/Traffic Violation With Import.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/Traffic Violation With Import.dmn new file mode 100644 index 00000000000..1deb997831f --- /dev/null +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/Traffic Violation With Import.dmn @@ -0,0 +1,221 @@ + + + + + + + string + + + date + + + string + + "speed", "parking", "driving under the influence" + + + + number + + + number + + + + + number + + + number + + + + + + + + + + + + + + Violation.Type + + + + + Violation.Actual Speed - Violation.Speed Limit + + + + + + + "speed" + + + [10..30) + + + 500 + + + 3 + + + + + "speed" + + + >= 30 + + + 1000 + + + 7 + + + + + "parking" + + + - + + + 100 + + + 1 + + + + + "driving under the influence" + + + - + + + 1000 + + + 5 + + + + + + + + + Should the driver be suspended due to points on his license? + "Yes", "No" + + + + + + + + + + + + Driver.Points + Fine.Points + + + + + if Total Points >= 20 then "Yes" else "No" + + + + + + + + + + 50.0 + 254.0 + 329.0 + 119.0 + 100.0 + 186.0 + + + 50.0 + 100.0 + 398.0 + + + 398.0 + + + 398.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/stdlib.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/stdlib.dmn index 19aa5a3ac60..eada692b0ce 100644 --- a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/stdlib.dmn +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_x/multiple/stdlib.dmn @@ -1,4 +1,14 @@ - + diff --git a/kie-dmn/kie-dmn-validation/pom.xml b/kie-dmn/kie-dmn-validation/pom.xml index 838b3198021..3dfc05eb19a 100644 --- a/kie-dmn/kie-dmn-validation/pom.xml +++ b/kie-dmn/kie-dmn-validation/pom.xml @@ -33,6 +33,7 @@ org.kie.dmn.validation true + 3.6.1 @@ -176,7 +177,44 @@ + + + src/test/resources + + + ${project.build.directory}/generated-test-resources + + + + + org.apache.maven.plugins + maven-dependency-plugin + ${dependency-plugin.version} + + + unpack + generate-test-resources + + unpack + + + + + org.kie + kie-dmn-test-resources + ${project.version} + tests + jar + true + ${project.build.directory}/generated-test-resources + valid_models/**/*.dmn + + + + + + org.codehaus.mojo exec-maven-plugin @@ -199,7 +237,7 @@ true ${project.basedir}/src/test/resources/ - + diff --git a/kie-dmn/kie-dmn-validation/src/test/java/org/kie/dmn/validation/ValidatorTest.java b/kie-dmn/kie-dmn-validation/src/test/java/org/kie/dmn/validation/ValidatorTest.java index f19151aa408..9096a81755a 100644 --- a/kie-dmn/kie-dmn-validation/src/test/java/org/kie/dmn/validation/ValidatorTest.java +++ b/kie-dmn/kie-dmn-validation/src/test/java/org/kie/dmn/validation/ValidatorTest.java @@ -23,11 +23,23 @@ import java.io.InputStreamReader; import java.io.Reader; import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.DirectoryIteratorException; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import java.util.stream.StreamSupport; +import org.drools.io.FileSystemResource; import org.junit.Ignore; import org.junit.Test; import org.kie.api.builder.Message.Level; +import org.kie.api.io.Resource; import org.kie.dmn.api.core.DMNMessage; import org.kie.dmn.api.core.DMNMessageType; import org.kie.dmn.api.core.DMNModel; @@ -36,6 +48,7 @@ import org.kie.dmn.backend.marshalling.v1x.DMNMarshallerFactory; import org.kie.dmn.core.DMNInputRuntimeTest; import org.kie.dmn.core.DMNRuntimeTest; +import org.kie.dmn.core.compiler.profiles.ExtendedDMNProfile; import org.kie.dmn.core.decisionservices.DMNDecisionServicesTest; import org.kie.dmn.core.imports.ImportsTest; import org.kie.dmn.core.util.DMNRuntimeUtil; @@ -43,15 +56,24 @@ import org.kie.dmn.model.api.DMNElement; import org.kie.dmn.model.api.DMNModelInstrumentedBase; import org.kie.dmn.model.api.Definitions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION; import static org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL; import static org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_SCHEMA; public class ValidatorTest extends AbstractValidatorTest { + private static final Logger LOGGER = LoggerFactory.getLogger(ValidatorTest.class); + + static final DMNValidator validator = DMNValidatorFactory.newValidator(List.of(new ExtendedDMNProfile())); + static final DMNValidator.ValidatorBuilder validatorBuilder = validator.validateUsing(DMNValidator.Validation.VALIDATE_SCHEMA, DMNValidator.Validation.VALIDATE_MODEL); + @Test public void testDryRun() { DMNRuntime runtime = DMNRuntimeUtil.createRuntime( "0001-input-data-string.dmn", DMNInputRuntimeTest.class ); @@ -80,33 +102,11 @@ public void testMACDInputDefinitions() { @Test public void testMACDInputReader() throws IOException { - try (final Reader reader = new InputStreamReader(getClass().getResourceAsStream("/org/kie/dmn/core/MACD-enhanced_iteration.dmn") )) { + try (final Reader reader = new InputStreamReader(Objects.requireNonNull(getClass().getResourceAsStream("/org/kie/dmn/core/MACD-enhanced_iteration.dmn")))) { List messages = DMNValidatorFactory.newValidator().validate(reader, VALIDATE_MODEL, VALIDATE_COMPILATION); assertThat(messages).withFailMessage(messages.toString()).hasSize(0); } } - - private Definitions utilDefinitions(String filename, String modelName) { -// List validateXML; -// try { -// validateXML = validator.validate( new File(this.getClass().getResource(filename).toURI()), DMNValidator.Validation.VALIDATE_SCHEMA ); -// assertThat( "using unit test method utilDefinitions must received a XML valid DMN file", validateXML, IsEmptyCollection.empty() ); -// } catch (URISyntaxException e) { -// e.printStackTrace(); -// fail("Unable for the test suite to locate the file for XML validation."); -// } - - DMNMarshaller marshaller = DMNMarshallerFactory.newDefaultMarshaller(); - try( InputStreamReader isr = new InputStreamReader( getClass().getResourceAsStream( filename ) ) ) { - Definitions definitions = marshaller.unmarshal( isr ); - assertThat(definitions).isNotNull(); - return definitions; - } catch ( IOException e ) { - e.printStackTrace(); - fail("Unable for the test suite to locate the file for validation."); - } - return null; - } @Test public void testInvalidXml() throws URISyntaxException { @@ -169,7 +169,7 @@ public void testINVOCATION_INCONSISTENT_PARAM_NAMES() { @Test @Ignore( "Needs to be improved as invocations can be used to invoke functions node defined in BKMs. E.g., FEEL built in functions, etc.") public void testINVOCATION_MISSING_TARGET() { - Definitions definitions = utilDefinitions( "INVOCATION_MISSING_TARGET.dmn", "INVOCATION_MISSING_TARGET" ); + Definitions definitions = utilDefinitions( "INVOCATION_MISSING_TARGET.dmn" ); List validate = validator.validate(definitions); // assertTrue( validate.stream().anyMatch( p -> p.getMessageType().equals( DMNMessageType.INVOCATION_MISSING_TARGET ) ) ); @@ -178,7 +178,7 @@ public void testINVOCATION_MISSING_TARGET() { @Ignore("known current limitation") @Test public void testINVOCATION_MISSING_TARGETRbis() { - Definitions definitions = utilDefinitions( "INVOCATION_MISSING_TARGETbis.dmn", "INVOCATION_MISSING_TARGETbis" ); + Definitions definitions = utilDefinitions( "INVOCATION_MISSING_TARGETbis.dmn"); List validate = validator.validate(definitions); // assertTrue( validate.stream().anyMatch( p -> p.getMessageType().equals( DMNMessageType.INVOCATION_MISSING_TARGET ) ) ); @@ -532,6 +532,63 @@ public void testInformationItemMissingTypeRef_SMC() { checkInformationItemMissingTypeRef(VALIDATE_SCHEMA, VALIDATE_MODEL, VALIDATE_COMPILATION); } + @Test + public void validateAllValidSharedModels() throws URISyntaxException, IOException { + String modelFilesPath = "valid_models"; + URL modelFilesUrl = + Collections.list(Thread.currentThread().getContextClassLoader().getResources(modelFilesPath)) + .stream() + .filter(url -> url.getProtocol().equals("file")) + .findFirst() + .orElseThrow(() -> new RuntimeException("Failed to retrieve " + modelFilesPath)); + Path modelsPath = Path.of(modelFilesUrl.toURI()); + testDirectory(modelsPath); + } + + private void testDirectory(Path modelsPath) { + try (DirectoryStream pathIterator = Files.newDirectoryStream(modelsPath)) { + Map> allFiles = StreamSupport.stream(pathIterator.spliterator(), false) + .collect(Collectors.groupingBy(path -> path.toFile().isDirectory())); + if (allFiles.containsKey(true)) { + allFiles.get(true).forEach(this::testDirectory); + } + if (allFiles.containsKey(false)) { + testFiles(allFiles.get(false)); + } + } catch (IOException | DirectoryIteratorException e) { + String messageToShow = e.getMessage() != null && !e.getMessage().isEmpty() ? e.getMessage() : String.format("Unable to navigate directory %s", modelsPath); + LOGGER.error(messageToShow); + LOGGER.debug(messageToShow, e); + fail(messageToShow); + } + } + + private void testFiles(List modelPaths) { + Resource[] resources = modelPaths.stream() + .map(path -> new FileSystemResource(path.toFile())) + .toArray(value -> new Resource[modelPaths.size()]); + List dmnMessages = validatorBuilder.theseModels(resources); + assertNotNull(dmnMessages); + dmnMessages.forEach(dmnMessage -> LOGGER.error(dmnMessage.toString())); + assertTrue(dmnMessages.isEmpty()); + } + + + private Definitions utilDefinitions(String filename) { + DMNMarshaller marshaller = DMNMarshallerFactory.newDefaultMarshaller(); + try( InputStreamReader isr = new InputStreamReader(Objects.requireNonNull(getClass().getResourceAsStream(filename))) ) { + Definitions definitions = marshaller.unmarshal( isr ); + assertThat(definitions).isNotNull(); + return definitions; + } catch ( IOException e ) { + String messageToShow = e.getMessage() != null && !e.getMessage().isEmpty() ? e.getMessage() : String.format("Unable to find file %s", filename); + LOGGER.error(messageToShow); + LOGGER.debug(messageToShow, e); + fail(String.format("Unable for the test suite to locate the file %s for validation.", filename)); + return null; + } + } + private void checkInformationItemMissingTypeRef(DMNValidator.Validation... options) { List validate = validator.validate(getReader("variableMissingTypeRef.dmn"), options); From fe80cc19cb117ef064308da163997b6fbc531a4a Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Wed, 3 Apr 2024 08:32:04 +0200 Subject: [PATCH 03/12] [KIE-1062] PhreakActivationIterator collects duplicated activations when serializing a KieSession (#5817) --- .../iterators/PhreakActivationIterator.java | 26 ++++- .../common/InternalMatchIteratorTest.java | 110 +++++++++++++++++- 2 files changed, 127 insertions(+), 9 deletions(-) diff --git a/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/iterators/PhreakActivationIterator.java b/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/iterators/PhreakActivationIterator.java index a768f27e24c..b12da2c0127 100644 --- a/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/iterators/PhreakActivationIterator.java +++ b/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/iterators/PhreakActivationIterator.java @@ -18,6 +18,13 @@ */ package org.drools.serialization.protobuf.iterators; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.InternalWorkingMemory; @@ -26,14 +33,25 @@ import org.drools.core.impl.InternalRuleBase; import org.drools.core.reteoo.AccumulateNode.AccumulateContext; import org.drools.core.reteoo.AccumulateNode.AccumulateMemory; -import org.drools.core.reteoo.*; +import org.drools.core.reteoo.BetaMemory; +import org.drools.core.reteoo.BetaNode; import org.drools.core.reteoo.FromNode.FromMemory; +import org.drools.core.reteoo.LeftInputAdapterNode; +import org.drools.core.reteoo.LeftTuple; +import org.drools.core.reteoo.LeftTupleSink; +import org.drools.core.reteoo.LeftTupleSource; +import org.drools.core.reteoo.ObjectSource; +import org.drools.core.reteoo.ObjectTypeNode; +import org.drools.core.reteoo.RightTuple; +import org.drools.core.reteoo.RuleTerminalNode; +import org.drools.core.reteoo.TerminalNode; +import org.drools.core.reteoo.Tuple; +import org.drools.core.reteoo.TupleImpl; +import org.drools.core.reteoo.TupleMemory; import org.drools.core.rule.consequence.InternalMatch; import org.drools.core.util.FastIterator; import org.drools.core.util.Iterator; -import java.util.*; - public class PhreakActivationIterator implements Iterator { @@ -208,7 +226,7 @@ private static void collectFromPeers(TupleImpl peer, List interna } } else if ( peer.getFirstChild() != null ) { for (TupleImpl childLt = peer.getFirstChild(); childLt != null; childLt = childLt.getHandleNext()) { - collectFromLeftInput(childLt, internalMatches, nodeSet, reteEvaluator); + collectFromPeers(childLt, internalMatches, nodeSet, reteEvaluator); } } else if (peer.getSink().getType() == NodeTypeEnums.RuleTerminalNode ) { internalMatches.add((InternalMatch) peer); diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/common/InternalMatchIteratorTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/common/InternalMatchIteratorTest.java index 06b52dce024..88d13384662 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/common/InternalMatchIteratorTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/common/InternalMatchIteratorTest.java @@ -18,16 +18,17 @@ */ package org.drools.mvel.compiler.common; +import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.drools.core.rule.consequence.InternalMatch; -import org.drools.serialization.protobuf.iterators.ActivationIterator; import org.drools.core.common.InternalAgenda; import org.drools.core.common.InternalWorkingMemory; import org.drools.core.impl.RuleBaseFactory; +import org.drools.core.rule.consequence.InternalMatch; import org.drools.core.util.Iterator; +import org.drools.serialization.protobuf.iterators.ActivationIterator; import org.drools.testcoverage.common.util.KieBaseTestConfiguration; import org.drools.testcoverage.common.util.KieBaseUtil; import org.drools.testcoverage.common.util.TestParametersUtil; @@ -654,9 +655,9 @@ public void testAccnSharingWithMixedDormantAndActive() { KieBase kbase = KieBaseUtil.getKieBaseFromKieModuleFromDrl("test", kieBaseTestConfiguration, str); KieSession ksession = kbase.newKieSession(); - ksession.insert( new Integer( 1 ) ); - ksession.insert( new Integer( 2 ) ); - ksession.insert( new Integer( 3 ) ); + ksession.insert( 1 ); + ksession.insert( 2 ); + ksession.insert( 3 ); ksession.fireAllRules(); @@ -754,4 +755,103 @@ public void matchCreated(org.kie.api.event.rule.MatchCreatedEvent event) { assertThat(list.size()).isEqualTo(1); } + + @Test + public void testCollectAndCountActivationsWithNodesSharing() { + // KIE-1062 + String str = + "import " + CartLineDetails.class.getCanonicalName() + ";" + + "\n" + + "rule R1 when\n" + + " exists($cartLineDetails1 : CartLineDetails(cartLineProductId in (\"Product1\" ) &&\n" + + " cartLineProductCategoryId == \"Category1\"))\n" + + " Number(doubleValue() > 1) from\n" + + " accumulate ( CartLineDetails(cartLineProductId in (\"Product1\" , \"NotUsedProduct\" ) &&\n" + + " $qty : cartLineItemQuantity != null), sum($qty) )\n" + + " Number(doubleValue() > 1) from\n" + + " accumulate ( CartLineDetails(cartLineProductId in (\"Product2\" ) &&\n" + + " $qty : cartLineItemQuantity != null), sum($qty) )\n" + + " Boolean(this == true)\n" + + " $cartLineDetails4 : CartLineDetails(cartLineProductCategoryId == \"Category1\")\n" + + " then\n" + + "end\n" + + "\n" + + "rule R2 when\n" + + " exists($cartLineDetails1 : CartLineDetails(cartLineProductId in (\"Product1\" ) &&\n" + + " cartLineProductCategoryId == \"Category1\"))\n" + + " Number(doubleValue() > 1) from\n" + + " accumulate ( CartLineDetails(cartLineProductId in (\"Product1\" , \"NotUsedProduct\" ) &&\n" + + " $qty : cartLineItemQuantity != null), sum($qty) )\n" + + " Number(doubleValue() > 1) from\n" + + " accumulate ( CartLineDetails(cartLineProductId in (\"Product2\" ) &&\n" + + " $qty : cartLineItemQuantity != null), sum($qty) )\n" + + " Boolean(this == false)\n" + + " $cartLineDetails4 : CartLineDetails(cartLineProductCategoryId == \"Category1\")\n" + + " then\n" + + "end"; + + KieBase kbase = KieBaseUtil.getKieBaseFromKieModuleFromDrl("test", kieBaseTestConfiguration, str); + KieSession kieSession = kbase.newKieSession(); + + int totalMatchingLineItems = 4; + List cartLineDetails = generateCartDetails(totalMatchingLineItems); + + for (CartLineDetails lineItem : cartLineDetails) { + kieSession.insert(lineItem); + } + kieSession.insert(true); + + kieSession.fireAllRules(); + + Iterator it = ActivationIterator.iterator( kieSession ); + List matches = new ArrayList<>(); + for (InternalMatch act = (InternalMatch) it.next(); act != null; act = (InternalMatch) it.next() ) { + matches.add( act ); + } + + assertThat(matches.size()).isEqualTo(totalMatchingLineItems); + } + + private List generateCartDetails(int totalMatchingLineItems) { + List lineItemList = new ArrayList<>(); + for(int i = 1 ; i <= totalMatchingLineItems; i++){ + CartLineDetails lineItem = new CartLineDetails(); + lineItem.setCartLineProductId("Product" + i); + lineItem.setCartLineProductCategoryId("Category" + "1"); + lineItem.setCartLineItemQuantity(10.0); + lineItemList.add(lineItem); + } + return lineItemList; + } + + public static class CartLineDetails implements Serializable { + private static final long serialVersionUID = 1L; + private String cartLineProductCategoryId; + private Double cartLineItemQuantity; + private String cartLineProductId; + + public String getCartLineProductCategoryId(){ + return cartLineProductCategoryId; + } + + public void setCartLineProductCategoryId( String cartLineProductCategoryId ){ + this.cartLineProductCategoryId = cartLineProductCategoryId; + } + + public Double getCartLineItemQuantity(){ + return cartLineItemQuantity; + } + + public void setCartLineItemQuantity( Double cartLineItemQuantity ){ + this.cartLineItemQuantity = cartLineItemQuantity; + } + + public String getCartLineProductId(){ + return cartLineProductId; + } + + public void setCartLineProductId( String cartLineProductId ){ + this.cartLineProductId = cartLineProductId; + } + } } From 52033404b9e237aaf8d6c66afd09264f9a30a547 Mon Sep 17 00:00:00 2001 From: Enrique Date: Mon, 8 Apr 2024 08:27:00 +0200 Subject: [PATCH 04/12] [incubator-kie-issues-861] PIM for kogito workflow / remove unused kie api / kie internal api (#5685) * [incubator-kie-issues-916] PIM for kogito workflow / remove unused kie api / kie internal api * [incubator-kie-issues-916] add process event data state change --- .../drools/core/process/ProcessContext.java | 20 -- .../org/drools/core/process/WorkItem.java | 6 +- .../core/process/impl/WorkItemImpl.java | 9 +- .../drools/kiesession/ProcessContextTest.java | 182 ----------- .../kie/api/cluster/ClusterAwareService.java | 63 ---- .../org/kie/api/cluster/ClusterListener.java | 27 -- .../java/org/kie/api/cluster/ClusterNode.java | 73 ----- .../api/definition/process/Connection.java | 2 +- .../org/kie/api/definition/process/Node.java | 14 +- .../api/definition/process/NodeContainer.java | 2 +- .../definition/process/WorkflowElement.java | 21 +- .../process/WorkflowElementIdentifier.java | 30 +- .../event/process/ProcessEventListener.java | 5 + .../event/process/ProcessMigrationEvent.java | 11 +- .../persistence/ObjectStoringStrategy.java | 52 --- .../org/kie/api/runtime/manager/Context.java | 36 --- .../manager/RegisterableItemsFactory.java | 89 ------ .../api/runtime/manager/RuntimeEngine.java | 52 --- .../runtime/manager/RuntimeEnvironment.java | 83 ----- .../manager/RuntimeEnvironmentBuilder.java | 127 -------- .../RuntimeEnvironmentBuilderFactory.java | 143 --------- .../api/runtime/manager/RuntimeManager.java | 98 ------ .../manager/RuntimeManagerFactory.java | 162 ---------- .../runtime/manager/audit/AuditService.java | 127 -------- .../manager/audit/NodeInstanceLog.java | 129 -------- .../manager/audit/ProcessInstanceLog.java | 115 ------- .../manager/audit/VariableInstanceLog.java | 70 ---- .../api/runtime/process/CaseAssignment.java | 71 ---- .../org/kie/api/runtime/process/CaseData.java | 62 ---- .../kie/api/runtime/process/NodeInstance.java | 3 +- .../api/runtime/process/ProcessContext.java | 4 - .../runtime/query/AdvancedQueryContext.java | 70 ---- .../kie/api/runtime/query/QueryContext.java | 117 ------- .../java/org/kie/api/task/TaskContext.java | 44 --- .../main/java/org/kie/api/task/TaskEvent.java | 35 -- .../api/task/TaskLifeCycleEventListener.java | 81 ----- .../java/org/kie/api/task/TaskService.java | 113 ------- .../org/kie/api/task/UserGroupCallback.java | 45 --- .../main/java/org/kie/api/task/UserInfo.java | 38 --- .../org/kie/api/task/model/Attachment.java | 40 --- .../java/org/kie/api/task/model/Comment.java | 35 -- .../java/org/kie/api/task/model/Content.java | 29 -- .../java/org/kie/api/task/model/Email.java | 24 -- .../java/org/kie/api/task/model/Group.java | 24 -- .../java/org/kie/api/task/model/I18NText.java | 31 -- .../api/task/model/OrganizationalEntity.java | 27 -- .../kie/api/task/model/PeopleAssignments.java | 33 -- .../kie/api/task/model/QuickTaskSummary.java | 52 --- .../java/org/kie/api/task/model/Status.java | 27 -- .../java/org/kie/api/task/model/Task.java | 54 ---- .../java/org/kie/api/task/model/TaskData.java | 78 ----- .../org/kie/api/task/model/TaskSummary.java | 48 --- .../java/org/kie/api/task/model/User.java | 23 -- .../process/ProcessVariableIndexer.java | 31 -- .../ExtendedParametrizedQueryBuilder.java | 62 ---- .../internal/query/InternalQueryService.java | 28 -- .../kie/internal/query/ParametrizedQuery.java | 46 --- .../query/ParametrizedQueryBuilder.java | 194 ----------- .../internal/query/ParametrizedUpdate.java | 24 -- .../query/ProcessInstanceIdQueryBuilder.java | 55 ---- .../org/kie/internal/query/QueryContext.java | 52 --- .../org/kie/internal/query/QueryFilter.java | 111 ------- .../query/QueryParameterIdentifiers.java | 154 --------- .../kie/internal/query/data/QueryData.java | 57 ---- .../internal/query/data/QueryParameters.java | 298 ----------------- .../runtime/error/ExecutionError.java | 302 ------------------ .../runtime/error/ExecutionErrorContext.java | 64 ---- .../runtime/error/ExecutionErrorFilter.java | 80 ----- .../runtime/error/ExecutionErrorHandler.java | 36 --- .../runtime/error/ExecutionErrorListener.java | 25 -- .../runtime/error/ExecutionErrorManager.java | 27 -- .../runtime/error/ExecutionErrorStorage.java | 38 --- .../runtime/manager/CacheManager.java | 56 ---- .../internal/runtime/manager/Disposable.java | 39 --- .../runtime/manager/DisposeListener.java | 35 -- .../manager/EventListenerProducer.java | 51 --- .../runtime/manager/GlobalProducer.java | 50 --- .../manager/InternalRuntimeEngine.java | 35 -- .../kie/internal/runtime/manager/Mapper.java | 63 ---- .../runtime/manager/RuntimeEnvironment.java | 34 -- .../manager/RuntimeManagerFactory.java | 72 ----- .../manager/RuntimeManagerIdFilter.java | 36 --- .../manager/RuntimeManagerRegistry.java | 75 ----- .../runtime/manager/SessionFactory.java | 53 --- .../runtime/manager/TaskServiceFactory.java | 39 --- .../manager/WorkItemHandlerProducer.java | 53 --- .../audit/query/AuditDateDeleteBuilder.java | 52 --- .../audit/query/AuditDeleteBuilder.java | 80 ----- .../audit/query/AuditLogQueryBuilder.java | 59 ---- .../audit/query/ErrorInfoDeleteBuilder.java | 24 -- .../query/NodeInstanceLogDeleteBuilder.java | 59 ---- .../query/NodeInstanceLogQueryBuilder.java | 85 ----- .../audit/query/ProcessIdQueryBuilder.java | 40 --- .../ProcessInstanceLogDeleteBuilder.java | 115 ------- .../query/ProcessInstanceLogQueryBuilder.java | 141 -------- .../VariableInstanceLogDeleteBuilder.java | 32 -- .../VariableInstanceLogQueryBuilder.java | 104 ------ .../runtime/manager/context/CaseContext.java | 57 ---- .../context/CorrelationKeyContext.java | 68 ---- .../runtime/manager/context/EmptyContext.java | 55 ---- .../context/ProcessInstanceIdContext.java | 72 ----- .../org/kie/internal/task/api/AuditTask.java | 89 ------ .../task/api/ContentMarshallerContext.java | 51 --- .../kie/internal/task/api/EventService.java | 32 -- .../task/api/InternalTaskService.java | 218 ------------- .../internal/task/api/TaskAdminService.java | 52 --- .../task/api/TaskAttachmentService.java | 41 --- .../internal/task/api/TaskCommentService.java | 39 --- .../internal/task/api/TaskContentService.java | 58 ---- .../kie/internal/task/api/TaskContext.java | 34 -- .../task/api/TaskDeadlinesService.java | 54 ---- .../kie/internal/task/api/TaskDefService.java | 42 --- .../org/kie/internal/task/api/TaskEvent.java | 24 -- .../internal/task/api/TaskEventsService.java | 38 --- .../task/api/TaskIdentityService.java | 56 ---- .../task/api/TaskInstanceService.java | 135 -------- .../internal/task/api/TaskModelFactory.java | 107 ------- .../internal/task/api/TaskModelProvider.java | 37 --- .../task/api/TaskModelProviderService.java | 27 -- .../task/api/TaskPersistenceContext.java | 183 ----------- .../internal/task/api/TaskQueryService.java | 118 ------- .../task/api/TaskStatisticsService.java | 32 -- .../kie/internal/task/api/TaskVariable.java | 91 ------ .../task/api/TaskVariableIndexer.java | 29 -- .../internal/task/api/UserGroupCallback.java | 23 -- .../org/kie/internal/task/api/UserInfo.java | 40 --- .../task/api/assignment/Assignment.java | 80 ----- .../api/assignment/AssignmentStrategy.java | 59 ---- .../internal/task/api/model/AccessType.java | 29 -- .../task/api/model/AllowedToDelegate.java | 26 -- .../task/api/model/BooleanExpression.java | 38 --- .../internal/task/api/model/CommandName.java | 117 ------- .../internal/task/api/model/ContentData.java | 40 --- .../kie/internal/task/api/model/Deadline.java | 50 --- .../task/api/model/DeadlineSummary.java | 36 --- .../internal/task/api/model/Deadlines.java | 35 -- .../internal/task/api/model/Delegation.java | 37 --- .../task/api/model/EmailNotification.java | 32 -- .../api/model/EmailNotificationHeader.java | 52 --- .../internal/task/api/model/Escalation.java | 46 --- .../internal/task/api/model/FaultData.java | 29 -- .../task/api/model/InternalAttachment.java | 49 --- .../task/api/model/InternalComment.java | 37 --- .../task/api/model/InternalContent.java | 29 -- .../task/api/model/InternalI18NText.java | 31 -- .../model/InternalOrganizationalEntity.java | 27 -- .../api/model/InternalPeopleAssignments.java | 48 --- .../internal/task/api/model/InternalTask.java | 68 ---- .../task/api/model/InternalTaskData.java | 162 ---------- .../task/api/model/InternalTaskSummary.java | 71 ---- .../kie/internal/task/api/model/Language.java | 30 -- .../internal/task/api/model/Notification.java | 63 ---- .../task/api/model/NotificationEvent.java | 67 ---- .../task/api/model/NotificationType.java | 23 -- .../internal/task/api/model/Operation.java | 40 --- .../internal/task/api/model/Reassignment.java | 41 --- .../task/api/model/SubTasksStrategy.java | 26 -- .../kie/internal/task/api/model/TaskDef.java | 38 --- .../internal/task/api/model/TaskEvent.java | 53 --- .../api/prediction/PredictionOutcome.java | 85 ----- .../api/prediction/PredictionService.java | 50 --- .../task/query/AuditTaskDeleteBuilder.java | 35 -- .../task/query/AuditTaskQueryBuilder.java | 201 ------------ .../task/query/TaskAuditQueryBuilder.java | 52 --- .../task/query/TaskEventDeleteBuilder.java | 28 -- .../task/query/TaskEventQueryBuilder.java | 132 -------- .../task/query/TaskSummaryQueryBuilder.java | 296 ----------------- .../task/query/TaskVariableDeleteBuilder.java | 28 -- .../task/query/TaskVariableQueryBuilder.java | 133 -------- .../internal/utils/NotificationPublisher.java | 63 ---- 170 files changed, 54 insertions(+), 10682 deletions(-) delete mode 100644 drools-kiesession/src/test/java/org/drools/kiesession/ProcessContextTest.java delete mode 100644 kie-api/src/main/java/org/kie/api/cluster/ClusterAwareService.java delete mode 100644 kie-api/src/main/java/org/kie/api/cluster/ClusterListener.java delete mode 100644 kie-api/src/main/java/org/kie/api/cluster/ClusterNode.java rename kie-internal/src/main/java/org/kie/internal/task/api/TaskPersistenceContextManager.java => kie-api/src/main/java/org/kie/api/definition/process/WorkflowElement.java (69%) rename kie-internal/src/main/java/org/kie/internal/runtime/manager/SessionNotFoundException.java => kie-api/src/main/java/org/kie/api/definition/process/WorkflowElementIdentifier.java (62%) rename kie-internal/src/main/java/org/kie/internal/builder/fluent/TaskFluent.java => kie-api/src/main/java/org/kie/api/event/process/ProcessMigrationEvent.java (83%) delete mode 100644 kie-api/src/main/java/org/kie/api/persistence/ObjectStoringStrategy.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/manager/Context.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/manager/RegisterableItemsFactory.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEngine.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEnvironment.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEnvironmentBuilder.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEnvironmentBuilderFactory.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeManager.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeManagerFactory.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/manager/audit/AuditService.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/manager/audit/NodeInstanceLog.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/manager/audit/ProcessInstanceLog.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/manager/audit/VariableInstanceLog.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/process/CaseAssignment.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/process/CaseData.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/query/AdvancedQueryContext.java delete mode 100644 kie-api/src/main/java/org/kie/api/runtime/query/QueryContext.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/TaskContext.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/TaskEvent.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/TaskLifeCycleEventListener.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/TaskService.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/UserGroupCallback.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/UserInfo.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/model/Attachment.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/model/Comment.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/model/Content.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/model/Email.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/model/Group.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/model/I18NText.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/model/OrganizationalEntity.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/model/PeopleAssignments.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/model/QuickTaskSummary.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/model/Status.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/model/Task.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/model/TaskData.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/model/TaskSummary.java delete mode 100644 kie-api/src/main/java/org/kie/api/task/model/User.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/process/ProcessVariableIndexer.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/query/ExtendedParametrizedQueryBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/query/InternalQueryService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/query/ParametrizedQuery.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/query/ParametrizedQueryBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/query/ParametrizedUpdate.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/query/ProcessInstanceIdQueryBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/query/QueryContext.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/query/QueryFilter.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/query/QueryParameterIdentifiers.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/query/data/QueryData.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/query/data/QueryParameters.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionError.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorContext.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorFilter.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorHandler.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorListener.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorManager.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorStorage.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/CacheManager.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/Disposable.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/DisposeListener.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/EventListenerProducer.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/GlobalProducer.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/InternalRuntimeEngine.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/Mapper.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeEnvironment.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeManagerFactory.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeManagerIdFilter.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeManagerRegistry.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/SessionFactory.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/TaskServiceFactory.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/WorkItemHandlerProducer.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/AuditDateDeleteBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/AuditDeleteBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/AuditLogQueryBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ErrorInfoDeleteBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/NodeInstanceLogDeleteBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/NodeInstanceLogQueryBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ProcessIdQueryBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ProcessInstanceLogDeleteBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ProcessInstanceLogQueryBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/VariableInstanceLogDeleteBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/VariableInstanceLogQueryBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/context/CaseContext.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/context/CorrelationKeyContext.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/context/EmptyContext.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/runtime/manager/context/ProcessInstanceIdContext.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/AuditTask.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/ContentMarshallerContext.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/EventService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/InternalTaskService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskAdminService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskAttachmentService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskCommentService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskContentService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskContext.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskDeadlinesService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskDefService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskEvent.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskEventsService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskIdentityService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskInstanceService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskModelFactory.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskModelProvider.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskModelProviderService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskPersistenceContext.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskQueryService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskStatisticsService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskVariable.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/TaskVariableIndexer.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/UserGroupCallback.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/UserInfo.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/assignment/Assignment.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/assignment/AssignmentStrategy.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/AccessType.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/AllowedToDelegate.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/BooleanExpression.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/CommandName.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/ContentData.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/Deadline.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/DeadlineSummary.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/Deadlines.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/Delegation.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/EmailNotification.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/EmailNotificationHeader.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/Escalation.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/FaultData.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/InternalAttachment.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/InternalComment.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/InternalContent.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/InternalI18NText.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/InternalOrganizationalEntity.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/InternalPeopleAssignments.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/InternalTask.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/InternalTaskData.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/InternalTaskSummary.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/Language.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/Notification.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/NotificationEvent.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/NotificationType.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/Operation.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/Reassignment.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/SubTasksStrategy.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/TaskDef.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/model/TaskEvent.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/prediction/PredictionOutcome.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/api/prediction/PredictionService.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/query/AuditTaskDeleteBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/query/AuditTaskQueryBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/query/TaskAuditQueryBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/query/TaskEventDeleteBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/query/TaskEventQueryBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/query/TaskSummaryQueryBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/query/TaskVariableDeleteBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/task/query/TaskVariableQueryBuilder.java delete mode 100644 kie-internal/src/main/java/org/kie/internal/utils/NotificationPublisher.java diff --git a/drools-core/src/main/java/org/drools/core/process/ProcessContext.java b/drools-core/src/main/java/org/drools/core/process/ProcessContext.java index f866cd609d9..da3567ed9c8 100644 --- a/drools-core/src/main/java/org/drools/core/process/ProcessContext.java +++ b/drools-core/src/main/java/org/drools/core/process/ProcessContext.java @@ -20,32 +20,12 @@ import java.util.Collection; -import org.kie.api.runtime.ClassObjectFilter; import org.kie.api.runtime.KieRuntime; -import org.kie.api.runtime.process.CaseAssignment; -import org.kie.api.runtime.process.CaseData; public class ProcessContext extends AbstractProcessContext { public ProcessContext(KieRuntime kruntime) { super(kruntime); } - public CaseData getCaseData() { - Collection objects = getKieRuntime().getObjects(new ClassObjectFilter(CaseData.class)); - if (objects.size() == 0) { - return null; - } - - return (CaseData) objects.iterator().next(); - } - - public CaseAssignment getCaseAssignment() { - Collection objects = getKieRuntime().getObjects(new ClassObjectFilter(CaseAssignment.class)); - if (objects.size() == 0) { - return null; - } - - return (CaseAssignment) objects.iterator().next(); - } } diff --git a/drools-core/src/main/java/org/drools/core/process/WorkItem.java b/drools-core/src/main/java/org/drools/core/process/WorkItem.java index 9fdef51c6d6..1f65717c7f4 100644 --- a/drools-core/src/main/java/org/drools/core/process/WorkItem.java +++ b/drools-core/src/main/java/org/drools/core/process/WorkItem.java @@ -20,6 +20,8 @@ import java.util.Map; +import org.kie.api.definition.process.WorkflowElementIdentifier; + public interface WorkItem extends org.kie.api.runtime.process.WorkItem { void setName(String name); @@ -38,11 +40,11 @@ public interface WorkItem extends org.kie.api.runtime.process.WorkItem { void setNodeInstanceId(long deploymentId); - void setNodeId(long deploymentId); + void setNodeId(WorkflowElementIdentifier nodeIdentifier); String getDeploymentId(); long getNodeInstanceId(); - long getNodeId(); + WorkflowElementIdentifier getNodeId(); } diff --git a/drools-core/src/main/java/org/drools/core/process/impl/WorkItemImpl.java b/drools-core/src/main/java/org/drools/core/process/impl/WorkItemImpl.java index 1a080ceeaa4..c5f02fbedcc 100644 --- a/drools-core/src/main/java/org/drools/core/process/impl/WorkItemImpl.java +++ b/drools-core/src/main/java/org/drools/core/process/impl/WorkItemImpl.java @@ -24,6 +24,7 @@ import java.util.Map; import org.drools.core.process.WorkItem; +import org.kie.api.definition.process.WorkflowElementIdentifier; public class WorkItemImpl implements WorkItem, Serializable { @@ -37,7 +38,7 @@ public class WorkItemImpl implements WorkItem, Serializable { private String processInstanceId; private String deploymentId; private long nodeInstanceId; - private long nodeId; + private WorkflowElementIdentifier nodeId; public void setId(long id) { this.id = id; @@ -121,11 +122,13 @@ public void setNodeInstanceId(long nodeInstanceId) { this.nodeInstanceId = nodeInstanceId; } - public long getNodeId() { + @Override + public WorkflowElementIdentifier getNodeId() { return nodeId; } - public void setNodeId(long nodeId) { + @Override + public void setNodeId(WorkflowElementIdentifier nodeId) { this.nodeId = nodeId; } diff --git a/drools-kiesession/src/test/java/org/drools/kiesession/ProcessContextTest.java b/drools-kiesession/src/test/java/org/drools/kiesession/ProcessContextTest.java deleted file mode 100644 index 3820ecf1590..00000000000 --- a/drools-kiesession/src/test/java/org/drools/kiesession/ProcessContextTest.java +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.drools.kiesession; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.drools.core.process.ProcessContext; -import org.drools.kiesession.rulebase.KnowledgeBaseFactory; -import org.junit.Test; -import org.kie.api.KieBase; -import org.kie.api.runtime.KieSession; -import org.kie.api.runtime.process.CaseAssignment; -import org.kie.api.runtime.process.CaseData; -import org.kie.api.task.model.OrganizationalEntity; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ProcessContextTest { - - - @Test - public void testProcessContextGetAssignment() { - - KieBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); - KieSession ksession = kbase.newKieSession(); - assertThat(ksession).isNotNull(); - - CaseInformation caseInfo = new CaseInformation(); - caseInfo.assign("owner", new OrganizationalEntity() { - @Override - public String getId() { - return "testUser"; - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException { - - } - - @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - - } - }); - ksession.insert(caseInfo); - - ProcessContext processContext = new ProcessContext(ksession); - - CaseAssignment caseAssignment = processContext.getCaseAssignment(); - assertThat(caseAssignment).isNotNull(); - Collection forRole = caseAssignment.getAssignments("owner"); - assertThat(forRole).isNotNull(); - assertThat(forRole.size()).isEqualTo(1); - } - - @Test - public void testProcessContextGetData() { - - KieBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); - KieSession ksession = kbase.newKieSession(); - assertThat(ksession).isNotNull(); - - CaseInformation caseInfo = new CaseInformation(); - caseInfo.add("test", "value"); - - ksession.insert(caseInfo); - - ProcessContext processContext = new ProcessContext(ksession); - - CaseData caseData = processContext.getCaseData(); - assertThat(caseData).isNotNull(); - Map allData = caseData.getData(); - assertThat(allData).isNotNull(); - assertThat(allData.size()).isEqualTo(1); - assertThat(caseData.getData("test")).isEqualTo("value"); - } - - @Test - public void testProcessContextGetDataAndAssignmentWithoutInsert() { - - KieBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); - KieSession ksession = kbase.newKieSession(); - assertThat(ksession).isNotNull(); - - ProcessContext processContext = new ProcessContext(ksession); - - CaseData caseData = processContext.getCaseData(); - assertThat(caseData).isNull(); - - CaseAssignment caseAssignment = processContext.getCaseAssignment(); - assertThat(caseAssignment).isNull(); - } - - private class CaseInformation implements CaseData, CaseAssignment { - - private String definitionId; - private Map data = new HashMap<>(); - private Map assignment = new HashMap<>(); - - @Override - public void assign(String roleName, OrganizationalEntity entity) { - assignment.put(roleName, entity); - } - - @Override - public void assignUser(String roleName, String userId) { - } - - @Override - public void assignGroup(String roleName, String groupId) { - } - - @Override - public void remove(String roleName, OrganizationalEntity entity) { - assignment.remove(roleName); - } - - @Override - public Collection getAssignments(String roleName) { - OrganizationalEntity entity = assignment.get(roleName); - if (entity == null) { - return Collections.emptyList(); - } - - return List.of(entity); - } - - @Override - public Collection getRoles() { - return assignment.keySet(); - } - - @Override - public Map getData() { - return data; - } - - @Override - public Object getData(String name) { - return data.get(name); - } - - @Override - public void add(String name, Object data) { - this.data.put(name, data); - } - - @Override - public void remove(String name) { - this.data.remove(name); - } - - @Override - public String getDefinitionId() { - return definitionId; - } - } -} diff --git a/kie-api/src/main/java/org/kie/api/cluster/ClusterAwareService.java b/kie-api/src/main/java/org/kie/api/cluster/ClusterAwareService.java deleted file mode 100644 index e205821e597..00000000000 --- a/kie-api/src/main/java/org/kie/api/cluster/ClusterAwareService.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.cluster; - -import java.util.Collection; -import java.util.List; - -import org.kie.api.internal.utils.KieService; - -/** - * Interface that allows to rise some awareness about the cluster environment - * - */ -public interface ClusterAwareService extends KieService { - - String CLUSTER_NODES_KEY = "nodes"; - String CLUSTER_JOBS_KEY = "jobs"; - - ClusterNode getThisNode(); - /** - * Computes whether the jbpm engine instance is the coordinator therefore the one to - * provide singleton cluster active features. - * @return whether this instance of jbpm engine is the one coordinating or not. - */ - - boolean isCoordinator(); - - /** - * Get all active members of the cluster - */ - Collection getActiveClusterNodes(); - - void removeData(String key, String partition, T value); - - void addData(String key, String partition, T value); - - List getData(String key); - - List getDataFromPartition(String key, String partition); - - /** - * Add cluster listener for join and left members - * @param listener - */ - void addClusterListener(ClusterListener listener); - -} diff --git a/kie-api/src/main/java/org/kie/api/cluster/ClusterListener.java b/kie-api/src/main/java/org/kie/api/cluster/ClusterListener.java deleted file mode 100644 index ede4c5892b1..00000000000 --- a/kie-api/src/main/java/org/kie/api/cluster/ClusterListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.cluster; - -public interface ClusterListener { - - void nodeJoined(ClusterNode node); - - void nodeLeft(ClusterNode node); - -} \ No newline at end of file diff --git a/kie-api/src/main/java/org/kie/api/cluster/ClusterNode.java b/kie-api/src/main/java/org/kie/api/cluster/ClusterNode.java deleted file mode 100644 index cd68aaf4eab..00000000000 --- a/kie-api/src/main/java/org/kie/api/cluster/ClusterNode.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.cluster; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; - -public final class ClusterNode implements Externalizable { - - private String location; - - private String serverId; - - - public ClusterNode() { - // for serializing - } - - public ClusterNode(String serverId, String location) { - this.serverId = serverId; - this.location = location; - } - - public String getLocation() { - return location; - } - - public String getServerId() { - return serverId; - } - - public String toKey() { - return serverId + "-" + location; - } - - @Override - public String toString() { - return "Cluster Node [" + toKey() + "]"; - } - - @Override - public void readExternal(ObjectInput input) throws IOException, ClassNotFoundException { - input.read(); // skip version - serverId = (String) input.readObject(); - location = (String) input.readObject(); - } - - @Override - public void writeExternal(ObjectOutput output) throws IOException { - output.write(1); // read version - output.writeObject(serverId); - output.writeObject(location); - } - -} diff --git a/kie-api/src/main/java/org/kie/api/definition/process/Connection.java b/kie-api/src/main/java/org/kie/api/definition/process/Connection.java index 32fd57cb1a4..7c53ec6f04e 100644 --- a/kie-api/src/main/java/org/kie/api/definition/process/Connection.java +++ b/kie-api/src/main/java/org/kie/api/definition/process/Connection.java @@ -23,7 +23,7 @@ /** * A connection is a link from one Node to another. */ -public interface Connection { +public interface Connection extends WorkflowElement { /** * The Node the connection starts from. diff --git a/kie-api/src/main/java/org/kie/api/definition/process/Node.java b/kie-api/src/main/java/org/kie/api/definition/process/Node.java index 68e4830d04d..79f9233dbd6 100644 --- a/kie-api/src/main/java/org/kie/api/definition/process/Node.java +++ b/kie-api/src/main/java/org/kie/api/definition/process/Node.java @@ -25,19 +25,7 @@ * A Node represents an activity in the process flow chart. * Many different predefined nodes are supported out-of-the-box. */ -public interface Node { - - /** - * The id of the node. This is unique within its NodeContainer. - * @return the id of the node - */ - long getId(); - - /** - * the node id in the bpmn - * @return - */ - String getNodeUniqueId(); +public interface Node extends WorkflowElement { /** * The name of the node diff --git a/kie-api/src/main/java/org/kie/api/definition/process/NodeContainer.java b/kie-api/src/main/java/org/kie/api/definition/process/NodeContainer.java index 46f2f5ca3ce..86405c1b996 100644 --- a/kie-api/src/main/java/org/kie/api/definition/process/NodeContainer.java +++ b/kie-api/src/main/java/org/kie/api/definition/process/NodeContainer.java @@ -36,7 +36,7 @@ public interface NodeContainer { * * @return the node with the given id */ - Node getNode(long id); + Node getNode(WorkflowElementIdentifier id); /** * the node in this NodeContainer with the give unique id diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskPersistenceContextManager.java b/kie-api/src/main/java/org/kie/api/definition/process/WorkflowElement.java similarity index 69% rename from kie-internal/src/main/java/org/kie/internal/task/api/TaskPersistenceContextManager.java rename to kie-api/src/main/java/org/kie/api/definition/process/WorkflowElement.java index 32a32ba0267..475eb015b2c 100644 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskPersistenceContextManager.java +++ b/kie-api/src/main/java/org/kie/api/definition/process/WorkflowElement.java @@ -16,18 +16,23 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.internal.task.api; -public interface TaskPersistenceContextManager { +package org.kie.api.definition.process; - TaskPersistenceContext getPersistenceContext(); +public interface WorkflowElement { - void beginCommandScopedEntityManager(); - - void endCommandScopedEntityManager(); + /** + * The id of the node. This is unique within its NodeContainer. + * @return the id of the node + */ + WorkflowElementIdentifier getId(); /** - * Executes the necessary actions in order to clean up and dispose of the internal fields of this instance. + * the node id in the bpmn + * @return */ - void dispose(); + default String getUniqueId() { + return this.getId().toExternalFormat(); + } + } diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/SessionNotFoundException.java b/kie-api/src/main/java/org/kie/api/definition/process/WorkflowElementIdentifier.java similarity index 62% rename from kie-internal/src/main/java/org/kie/internal/runtime/manager/SessionNotFoundException.java rename to kie-api/src/main/java/org/kie/api/definition/process/WorkflowElementIdentifier.java index 72e0e16cf48..c2d7f5143fb 100644 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/SessionNotFoundException.java +++ b/kie-api/src/main/java/org/kie/api/definition/process/WorkflowElementIdentifier.java @@ -16,26 +16,28 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.internal.runtime.manager; -/** - * Exception that indicates that ksession could not be found - * - */ -public class SessionNotFoundException extends RuntimeException { +package org.kie.api.definition.process; - private static final long serialVersionUID = 1L; +public interface WorkflowElementIdentifier extends Comparable { - public SessionNotFoundException(String message, Throwable cause) { - super(message, cause); - } + T toValue(); - public SessionNotFoundException(String message) { - super(message); + @Override + int hashCode(); + + @Override + boolean equals(Object obj); + + @Override + default int compareTo(WorkflowElementIdentifier o) { + return this.toExternalFormat().compareTo(o.toExternalFormat()); } - public SessionNotFoundException(Throwable cause) { - super(cause); + default String toExternalFormat() { + return toValue().toString(); } + String toSanitizeString(); + } diff --git a/kie-api/src/main/java/org/kie/api/event/process/ProcessEventListener.java b/kie-api/src/main/java/org/kie/api/event/process/ProcessEventListener.java index 085f7a34a3b..6ad3c467c14 100644 --- a/kie-api/src/main/java/org/kie/api/event/process/ProcessEventListener.java +++ b/kie-api/src/main/java/org/kie/api/event/process/ProcessEventListener.java @@ -111,6 +111,11 @@ default void afterSLAViolated(SLAViolatedEvent event) {} */ default void onSignal(SignalEvent event) {} + /** + * This listeners is triggered when a migration occurs + * @param event + */ + default void onMigration(ProcessMigrationEvent event) { } /** * This listener method is invoked when a message is sent * @param event diff --git a/kie-internal/src/main/java/org/kie/internal/builder/fluent/TaskFluent.java b/kie-api/src/main/java/org/kie/api/event/process/ProcessMigrationEvent.java similarity index 83% rename from kie-internal/src/main/java/org/kie/internal/builder/fluent/TaskFluent.java rename to kie-api/src/main/java/org/kie/api/event/process/ProcessMigrationEvent.java index f62ecca7daf..b57ca5475f1 100644 --- a/kie-internal/src/main/java/org/kie/internal/builder/fluent/TaskFluent.java +++ b/kie-api/src/main/java/org/kie/api/event/process/ProcessMigrationEvent.java @@ -16,14 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.internal.builder.fluent; - -import org.kie.api.task.TaskService; +package org.kie.api.event.process; /** - * See {@link TaskService} - * + * An event when a process instance has been started. */ -public interface TaskFluent { +public interface ProcessMigrationEvent + extends + ProcessEvent { } diff --git a/kie-api/src/main/java/org/kie/api/persistence/ObjectStoringStrategy.java b/kie-api/src/main/java/org/kie/api/persistence/ObjectStoringStrategy.java deleted file mode 100644 index 4a9cdb63795..00000000000 --- a/kie-api/src/main/java/org/kie/api/persistence/ObjectStoringStrategy.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.persistence; - -public interface ObjectStoringStrategy { - - /** - * Similar to ObjectMarshallingStrategy, it is used to - * decide whether this implementation is going to work for - * the given Object. - * @param obj a given object - * @return true if it can persist the given object. - */ - boolean accept(Object obj); - - /** - * Returns the key for the persisted object. - * @param persistable the object to persist. - * @return the key of the persisted object. - */ - Object persist(Object persistable); - - /** - * Returns the key for the persisted object. - * @param persistable the object to persist. - * @return the key of the persisted object. - */ - Object update(Object persistable); - - /** - * Returns the persisted object. - * @param key the key of the persisted object. - * @return a persisted object or null. - */ - Object read(Object key); -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/manager/Context.java b/kie-api/src/main/java/org/kie/api/runtime/manager/Context.java deleted file mode 100644 index ecbd53e67ce..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/manager/Context.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.manager; - -/** - * Context represents to highest level hierarchy of contextual data that might be used - * when working with RuntimeManager that is then relying on the context to look up correct - * instances of RuntimeEngine. - * - * @param - represents the actual type of data context implements as an identifier - */ -public interface Context { - - /** - * See concrete implementation for available types - * - * @return the id of context which is specific to the type of context. - */ - T getContextId(); -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/manager/RegisterableItemsFactory.java b/kie-api/src/main/java/org/kie/api/runtime/manager/RegisterableItemsFactory.java deleted file mode 100644 index 0bfefd0447f..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/manager/RegisterableItemsFactory.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.manager; - -import java.util.List; -import java.util.Map; - -import org.kie.api.event.process.ProcessEventListener; -import org.kie.api.event.rule.AgendaEventListener; -import org.kie.api.event.rule.RuleRuntimeEventListener; -import org.kie.api.runtime.process.WorkItemHandler; -import org.kie.api.task.TaskLifeCycleEventListener; - -/** - * Factory that is used by RuntimeManager to configure RuntimeEngine - * (especially KieSession) with various registerable items: - *
    - *
  • Work item handlers
  • - *
  • Process event listeners
  • - *
  • Agenda event listeners
  • - *
  • Working memory event listeners
  • - *
- * Implementations of this interface shall decide what shall be registered for given RuntimeEngine. - * If there are any needs to be bound handlers or listeners to eny parts of runtime engine these can be obtained: - *
    - *
  • KieSession
  • - *
  • TaskService
  • - *
- * Although it's possible to get individual instance from runtime engine it's recommended to use RuntimeEngine - * instance instead to allow most flexible behavior. - */ -public interface RegisterableItemsFactory { - - /** - * Returns new instances of WorkItemHandler that will be registered on RuntimeEngine - * @param runtime provides RuntimeEngine in case handler need to make use of it internally - * @return map of handlers to be registered - in case of no handlers empty map shall be returned. - */ - Map getWorkItemHandlers(RuntimeEngine runtime); - - /** - * Returns new instances of ProcessEventListener that will be registered on RuntimeEngine - * @param runtime provides RuntimeEngine in case listeners need to make use of it internally - * @return list of listeners to be registered - in case of no listeners empty list shall be returned. - */ - List getProcessEventListeners(RuntimeEngine runtime); - - /** - * Returns new instances of AgendaEventListener that will be registered on RuntimeEngine - * @param runtime provides RuntimeEngine in case listeners need to make use of it internally - * @return list of listeners to be registered - in case of no listeners empty list shall be returned. - */ - List getAgendaEventListeners(RuntimeEngine runtime); - - /** - * Returns new instances of RuleRuntimeEventListener that will be registered on RuntimeEngine - * @param runtime provides RuntimeEngine in case listeners need to make use of it internally - * @return list of listeners to be registered - in case of no listeners empty list shall be returned. - */ - List getRuleRuntimeEventListeners(RuntimeEngine runtime); - - /** - * Returns globals that shall be registered on KieSession. - * @param runtime provides RuntimeEngine in case globals need to make use of it internally - * @return map of globals to be registered - in case of no globals empty map shall be returned. - */ - Map getGlobals(RuntimeEngine runtime); - - /** - * @return new instances of TaskLifeCycleEventListener that will be registered on RuntimeEngine. - */ - List getTaskListeners(); -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEngine.java b/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEngine.java deleted file mode 100644 index 7124d7d9cca..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEngine.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.manager; - -import org.kie.api.runtime.KieSession; -import org.kie.api.runtime.manager.audit.AuditService; -import org.kie.api.task.TaskService; - -/** - * RuntimeEngine is the main entry point to interact with the process engine and task - * service. It's responsibility is to ensure that process engine and task service - * are properly configured and know about each other which eliminate the need to - * manually setup the integration between these two.
- * RuntimeEngines are always produced by RuntimeManager and thus shall never be - * created manually. RuntimeManager provides all required information to build - * and bootstrap the RuntimeEngine so it is configured and ready to be used - * regardless of when it is invoked. - */ -public interface RuntimeEngine { - - /** - * @return KieSession configured for this RuntimeEngine - */ - KieSession getKieSession(); - - /** - * @return TaskService configured for this RuntimeEngine - */ - TaskService getTaskService(); - - /** - * @return AuditService that gives access to underlying runtime data such - * as process instance, node instance and variable log entries. - */ - AuditService getAuditService(); -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEnvironment.java b/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEnvironment.java deleted file mode 100644 index 444ea30410a..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEnvironment.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.manager; - -import org.kie.api.KieBase; -import org.kie.api.runtime.Environment; -import org.kie.api.runtime.KieSessionConfiguration; -import org.kie.api.task.UserGroupCallback; -import org.kie.api.task.UserInfo; - -/** - * Definition of the runtime environment that will be used by instance of RuntimeManager. - * RuntimeEnvironment delivers all information to the runtime manager to be able to properly - * configure and bootstrap the manager and then runtime engine instances.
- * It shall be considered as template of the configuration used by the manager that is read only and shall - * not be changed once RuntimeManager has been created. - */ -public interface RuntimeEnvironment { - - /** - * @return KieBase that shall be used by the manager - */ - KieBase getKieBase(); - - /** - * @return environment that shall be used to create instances of KieSession - */ - Environment getEnvironment(); - - /** - * @return KieSession configuration that shall be used to create instances of KieSession - */ - KieSessionConfiguration getConfiguration(); - - /** - * @return indicates if persistence shall be used for the KieSession instances - */ - boolean usePersistence(); - - /** - * @return concrete implementation of RegisterableItemsFactory to obtain handlers and listeners - * that shall be registered on instances of KieSession - */ - RegisterableItemsFactory getRegisterableItemsFactory(); - - /** - * @return concrete implementation of UserGroupCallback that shall be registered on instances - * of TaskService for managing users and groups. - */ - UserGroupCallback getUserGroupCallback(); - - /** - * @return concrete implementation of UserInfo that shall be registered on instances - * of TaskService for managing user info. - */ - UserInfo getUserInfo(); - - /** - * @return custom class loader that shall be used by the process engine and task service instances - */ - ClassLoader getClassLoader(); - - /** - * Closes the environment allowing to close all depending components such as ksession factories, etc - */ - void close(); -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEnvironmentBuilder.java b/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEnvironmentBuilder.java deleted file mode 100644 index b13582730b4..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEnvironmentBuilder.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.manager; - -import org.kie.api.KieBase; -import org.kie.api.builder.ReleaseId; -import org.kie.api.io.Resource; -import org.kie.api.io.ResourceType; -import org.kie.api.task.UserGroupCallback; -import org.kie.api.task.UserInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public interface RuntimeEnvironmentBuilder { - - public RuntimeEnvironmentBuilder persistence(boolean persistenceEnabled); - - public RuntimeEnvironmentBuilder entityManagerFactory(Object emf); - - public RuntimeEnvironmentBuilder addAsset(Resource asset, ResourceType type); - - public RuntimeEnvironmentBuilder addEnvironmentEntry(String name, Object value); - - public RuntimeEnvironmentBuilder addConfiguration(String name, String value); - - public RuntimeEnvironmentBuilder knowledgeBase(KieBase kbase); - - public RuntimeEnvironmentBuilder userGroupCallback(UserGroupCallback callback); - - public RuntimeEnvironmentBuilder userInfo(UserInfo userInfo); - - public RuntimeEnvironmentBuilder registerableItemsFactory(RegisterableItemsFactory factory); - - public RuntimeEnvironment get(); - - public RuntimeEnvironmentBuilder classLoader(ClassLoader cl); - - public RuntimeEnvironmentBuilder schedulerService(Object globalScheduler); - - public static class Factory implements RuntimeEnvironmentBuilderFactory { - private static RuntimeEnvironmentBuilderFactory INSTANCE; - private static Logger logger = LoggerFactory.getLogger(Factory.class); - - static { - try { - INSTANCE = ( RuntimeEnvironmentBuilderFactory ) - Class.forName(System.getProperty("org.jbpm.runtime.env.builder.class", - "org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder")).newInstance(); - } catch (Exception e) { - logger.error("Unable to instance RuntimeEnvironmentBuilderFactory due to " + e.getMessage()); - } - } - - /** - * Returns a reference to the RuntimeEnvironmentBuilderFactory singleton - */ - public static RuntimeEnvironmentBuilderFactory get() { - if (INSTANCE == null) { - throw new RuntimeException("RuntimeEnvironmentBuilder was not initialized, see previous errors"); - } - return INSTANCE; - } - - @Override - public RuntimeEnvironmentBuilder newEmptyBuilder() { - return get().newEmptyBuilder(); - } - - @Override - public RuntimeEnvironmentBuilder newDefaultBuilder() { - return get().newDefaultBuilder(); - } - - @Override - public RuntimeEnvironmentBuilder newDefaultInMemoryBuilder() { - return get().newDefaultInMemoryBuilder(); - } - - @Override - public RuntimeEnvironmentBuilder newDefaultBuilder(String groupId, String artifactId, String version) { - return get().newDefaultBuilder(groupId, artifactId, version); - } - - @Override - public RuntimeEnvironmentBuilder newDefaultBuilder(String groupId, String artifactId, String version, String kbaseName, String ksessionName) { - return get().newDefaultBuilder(groupId, artifactId, version, kbaseName, ksessionName); - } - - @Override - public RuntimeEnvironmentBuilder newDefaultBuilder(ReleaseId releaseId) { - return get().newDefaultBuilder(releaseId); - } - - @Override - public RuntimeEnvironmentBuilder newDefaultBuilder(ReleaseId releaseId, String kbaseName, String ksessionName) { - return get().newDefaultBuilder(releaseId, kbaseName, ksessionName); - } - - @Override - public RuntimeEnvironmentBuilder newClasspathKmoduleDefaultBuilder() { - return get().newClasspathKmoduleDefaultBuilder(); - } - - @Override - public RuntimeEnvironmentBuilder newClasspathKmoduleDefaultBuilder(String kbaseName, String ksessionName) { - return get().newClasspathKmoduleDefaultBuilder(kbaseName, ksessionName); - } - - - } -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEnvironmentBuilderFactory.java b/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEnvironmentBuilderFactory.java deleted file mode 100644 index 8e4502c9d1f..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeEnvironmentBuilderFactory.java +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.manager; - -import org.kie.api.builder.ReleaseId; - -public interface RuntimeEnvironmentBuilderFactory { - - /** - * Provides completely empty RuntimeEnvironmentBuilder instance that allows to manually - * set all required components instead of relying on any defaults. - * @return new instance of RuntimeEnvironmentBuilder - */ - public RuntimeEnvironmentBuilder newEmptyBuilder(); - - /** - * Provides default configuration of RuntimeEnvironmentBuilder that is based on: - *
    - *
  • DefaultRuntimeEnvironment
  • - *
- * @return new instance of RuntimeEnvironmentBuilder that is already preconfigured with defaults - * - * see DefaultRuntimeEnvironment - */ - public RuntimeEnvironmentBuilder newDefaultBuilder(); - - /** - * Provides default configuration of RuntimeEnvironmentBuilder that is based on: - *
    - *
  • DefaultRuntimeEnvironment
  • - *
- * but it does not have persistence for process engine configured so it will only store process instances in memory - * @return new instance of RuntimeEnvironmentBuilder that is already preconfigured with defaults - * - * see DefaultRuntimeEnvironment - */ - public RuntimeEnvironmentBuilder newDefaultInMemoryBuilder(); - - /** - * Provides default configuration of RuntimeEnvironmentBuilder that is based on: - *
    - *
  • DefaultRuntimeEnvironment
  • - *
- * This one is tailored to works smoothly with kjars as the notion of kbase and ksessions - * @param groupId group id of kjar - * @param artifactId artifact id of kjar - * @param version version number of kjar - * @return new instance of RuntimeEnvironmentBuilder that is already preconfigured with defaults - * - * see DefaultRuntimeEnvironment - */ - public RuntimeEnvironmentBuilder newDefaultBuilder(String groupId, String artifactId, String version); - - /** - * Provides default configuration of RuntimeEnvironmentBuilder that is based on: - *
    - *
  • DefaultRuntimeEnvironment
  • - *
- * This one is tailored to works smoothly with kjars as the notion of kbase and ksessions - * @param groupId group id of kjar - * @param artifactId artifact id of kjar - * @param version version number of kjar - * @param kbaseName name of the kbase defined in kmodule.xml stored in kjar - * @param ksessionName name of the ksession define in kmodule.xml stored in kjar - * @return new instance of RuntimeEnvironmentBuilder that is already preconfigured with defaults - * - * see DefaultRuntimeEnvironment - */ - public RuntimeEnvironmentBuilder newDefaultBuilder(String groupId, String artifactId, String version, String kbaseName, String ksessionName); - - /** - * Provides default configuration of RuntimeEnvironmentBuilder that is based on: - *
    - *
  • DefaultRuntimeEnvironment
  • - *
- * This one is tailored to works smoothly with kjars as the notion of kbase and ksessions - * @param releaseId ReleaseId that described the kjar - * @return new instance of RuntimeEnvironmentBuilder that is already preconfigured with defaults - * - * see DefaultRuntimeEnvironment - */ - public RuntimeEnvironmentBuilder newDefaultBuilder(ReleaseId releaseId); - - /** - * Provides default configuration of RuntimeEnvironmentBuilder that is based on: - *
    - *
  • DefaultRuntimeEnvironment
  • - *
- * This one is tailored to works smoothly with kjars as the notion of kbase and ksessions - * @param releaseId ReleaseId that described the kjar - * @param kbaseName name of the kbase defined in kmodule.xml stored in kjar - * @param ksessionName name of the ksession define in kmodule.xml stored in kjar - * @return new instance of RuntimeEnvironmentBuilder that is already preconfigured with defaults - * - * see DefaultRuntimeEnvironment - */ - public RuntimeEnvironmentBuilder newDefaultBuilder(ReleaseId releaseId, String kbaseName, String ksessionName); - - /** - * Provides default configuration of RuntimeEnvironmentBuilder that is based on: - *
    - *
  • DefaultRuntimeEnvironment
  • - *
- * It relies on KieClasspathContainer that requires to have kmodule.xml present in META-INF folder which - * defines the kjar itself. - * Expects to use default kbase and ksession from kmodule. - * @return new instance of RuntimeEnvironmentBuilder that is already preconfigured with defaults - * - * see DefaultRuntimeEnvironment - */ - public RuntimeEnvironmentBuilder newClasspathKmoduleDefaultBuilder(); - - /** - * Provides default configuration of RuntimeEnvironmentBuilder that is based on: - *
    - *
  • DefaultRuntimeEnvironment
  • - *
- * It relies on KieClasspathContainer that requires to have kmodule.xml present in META-INF folder which - * defines the kjar itself. - * @param kbaseName name of the kbase defined in kmodule.xml - * @param ksessionName name of the ksession define in kmodule.xml - * @return new instance of RuntimeEnvironmentBuilder that is already preconfigured with defaults - * - * see DefaultRuntimeEnvironment - */ - public RuntimeEnvironmentBuilder newClasspathKmoduleDefaultBuilder(String kbaseName, String ksessionName); -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeManager.java b/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeManager.java deleted file mode 100644 index 8580c5975e9..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeManager.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.manager; - -/** - * RuntimeManager manages RuntimeEngines that are essentially build with - * KieSession and TaskService to deliver executable environments for - * processes and user tasks.
- * Moreover RuntimeManager ensures that all components are configured and bootstrapped - * as soon as manager is instantiated to ensure its fully featured functionality right from the start. - * That includes: - *
    - *
  • timer service
  • - *
  • task service
  • - *
  • finds and initializes timer start events based processes
  • - *
- * RuntimeManager shall always be closed whenever it's not needed any more to free up resources it allocated.
- * RuntimeManagers are identified by unique identifiers and thus there cannot be two RuntimeManagers - * with the same id active at the same time in the same system.
- * RuntimeManager implements runtime strategy that provides certain management capabilities to reduce manual - * work needed to control ksession behavior. Which mainly covers when to create, dispose and when to use which ksession. - * Currently there are three predefined strategies: - *
    - *
  • Singleton - there is only one, always active ksession for the manager, - * access to it is thread safe that is achieved by synchronization which applies to both - * ksession and task service
  • - *
  • PerRequest - new ksession and task service instances will be returned for every invocation of the - * getRuntimeEngine(Context) method. Important to know is same instance of RuntimeEngine will - * be returned through out transaction to avoid issues with persistence context.
  • - *
  • PerProcessInstance - most advanced strategy that keeps track of which ksession was used to work with - * given process instance. It lives as long as process instance is alive and is destroyed - * when process instance is completed/aborted.
  • - *
- */ -public interface RuntimeManager { - - /** - * Returns RuntimeEngine instance that is fully initialized: - *
    - *
  • KiseSession is created or loaded depending on the strategy
  • - *
  • TaskService is initialized and attached to ksession (via listener)
  • - *
  • WorkItemHandlers are initialized and registered on ksession
  • - *
  • EventListeners (process, agenda, working memory) are initialized and added to ksession
  • - *
- * @param context the concrete implementation of the context that is supported by given RuntimeManager - * @return instance of the RuntimeEngine - */ - RuntimeEngine getRuntimeEngine(Context context); - - /** - * @return unique identifier of this RuntimeManager - */ - String getIdentifier(); - - /** - * Disposes RuntimeEngine and notifies all listeners about that fact. - * This method should always be used to dispose RuntimeEngine that is not needed - * anymore.
- * ksession.dispose() shall never be used with RuntimeManager as it will break the internal - * mechanisms of the manager responsible for clear and efficient disposal.
- * Dispose is not needed if RuntimeEngine was obtained within active JTA transaction, - * this means that when getRuntimeEngine method was invoked during active JTA transaction then dispose of - * the runtime engine will happen automatically on transaction completion. - * @param runtime - */ - void disposeRuntimeEngine(RuntimeEngine runtime); - - /** - * Closes RuntimeManager and releases it's resources. Shall always be called when - * runtime manager is not needed any more. Otherwise it will still be active and operational. - */ - void close(); - - /** - * Allows to signal event on runtime manager level which in turn allows to broadcast given event to all listening - * components managed by this RuntimeManager - * @param type type of the signal - * @param event actual event data - */ - void signalEvent(String type, Object event); - -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeManagerFactory.java b/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeManagerFactory.java deleted file mode 100644 index e5bfc516f3b..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/manager/RuntimeManagerFactory.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.manager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Factory that produces instances of RuntimeManager. It allows to produce - * runtime managers based on predefined strategies: - *
    - *
  • Singleton
  • - *
  • PerRequest
  • - *
  • PerProcessInstance
  • - *
- * By default uses org.jbpm.runtime.manager.impl.RuntimeManagerFactoryImpl as implementation - * of the factory but can be overridden using system property org.jbpm.runtime.manager.class - * that should provide fully qualified class name of the class that implements this factory. - */ -public interface RuntimeManagerFactory { - - /** - * Produces new instance of singleton RuntimeManager with default identifier. - * Since it relies on default identifier it can only be invoked once unless previously produced - * manager is closed. Otherwise error will be thrown indicating that managers must be identifier uniquely. - * @param environment environment instance for the new runtime manager - * @return new instance of RuntimeManager - */ - RuntimeManager newSingletonRuntimeManager(RuntimeEnvironment environment); - - /** - * Produces new instance of singleton RuntimeManager with custom identifier. - * In case the given identifier is already in use error will be thrown indicating that managers must be identifier uniquely. - * @param environment environment instance for the new runtime manager - * @param identifier custom identifier for the manager - * @return new instance of RuntimeManager - */ - RuntimeManager newSingletonRuntimeManager(RuntimeEnvironment environment, String identifier); - - /** - * Produces new instance of per request RuntimeManager with default identifier. - * Since it relies on default identifier it can only be invoked once unless previously produced - * manager is closed. Otherwise error will be thrown indicating that managers must be identifier uniquely. - * @param environment environment instance for the new runtime manager - * @return new instance of RuntimeManager - */ - RuntimeManager newPerRequestRuntimeManager(RuntimeEnvironment environment); - - /** - * Produces new instance of per request RuntimeManager with custom identifier. - * In case the given identifier is already in use error will be thrown indicating that managers must be identifier uniquely. - * @param environment environment instance for the new runtime manager - * @param identifier custom identifier for the manager - * @return new instance of RuntimeManager - */ - RuntimeManager newPerRequestRuntimeManager(RuntimeEnvironment environment, String identifier); - - /** - * Produces new instance of per process instance RuntimeManager with default identifier. - * Since it relies on default identifier it can only be invoked once unless previously produced - * manager is closed. Otherwise error will be thrown indicating that managers must be identifier uniquely. - * @param environment environment instance for the new runtime manager - * @return new instance of RuntimeManager - */ - RuntimeManager newPerProcessInstanceRuntimeManager(RuntimeEnvironment environment); - - /** - * Produces new instance of per process instance RuntimeManager with custom identifier. - * In case the given identifier is already in use error will be thrown indicating that managers must be identifier uniquely. - * @param environment environment instance for the new runtime manager - * @param identifier custom identifier for the manager - * @return new instance of RuntimeManager - */ - RuntimeManager newPerProcessInstanceRuntimeManager(RuntimeEnvironment environment, String identifier); - - /** - * Produces new instance of per case RuntimeManager with default identifier. - * Since it relies on default identifier it can only be invoked once unless previously produced - * manager is closed. Otherwise error will be thrown indicating that managers must be identifier uniquely. - * @param environment environment instance for the new runtime manager - * @return new instance of RuntimeManager - */ - public RuntimeManager newPerCaseRuntimeManager(RuntimeEnvironment environment); - - /** - * Produces new instance of per case RuntimeManager with custom identifier. - * In case the given identifier is already in use error will be thrown indicating that managers must be identifier uniquely. - * @param environment environment instance for the new runtime manager - * @param identifier custom identifier for the manager - * @return new instance of RuntimeManager - */ - public RuntimeManager newPerCaseRuntimeManager(RuntimeEnvironment environment, String identifier); - - /** - * A Factory for this RuntimeManagerFactory - */ - public static class Factory { - private static boolean initialized = false; - private static RuntimeManagerFactory INSTANCE; - private static Logger logger = LoggerFactory.getLogger(Factory.class); - - private static Exception initializationException; - - /** - * Returns a reference to the RuntimeManagerFactory singleton - */ - public static RuntimeManagerFactory get() { - return get(null); - } - - public synchronized static RuntimeManagerFactory get(ClassLoader classLoader) { - if (!initialized) { - INSTANCE = create(classLoader); - } else if (INSTANCE == null) { - throw new RuntimeException("RuntimeManagerFactory was not initialized due to "+ initializationException.getMessage(), initializationException); - } - return INSTANCE; - } - - private static RuntimeManagerFactory create(ClassLoader classLoader) { - initialized = true; - try { - String className = System.getProperty("org.jbpm.runtime.manager.class", - "org.jbpm.runtime.manager.impl.RuntimeManagerFactoryImpl" ); - return classLoader != null ? - ( RuntimeManagerFactory ) Class.forName( className, true, classLoader ).newInstance() : - ( RuntimeManagerFactory ) Class.forName( className ).newInstance(); - } catch (Exception e) { - initializationException = e; - logger.error("Unable to instance RuntimeManagerFactory due to " + e.getMessage()); - } - return null; - } - - /** - * This method is used in jBPM OSGi Activators as we need a way to force reset when starting - * the bundles in case it failed previously. - */ - public static synchronized void reset() { - if (initializationException != null) { - initializationException = null; - initialized = false; - } - } - } -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/manager/audit/AuditService.java b/kie-api/src/main/java/org/kie/api/runtime/manager/audit/AuditService.java deleted file mode 100644 index 11e5ec34491..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/manager/audit/AuditService.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.manager.audit; - -import java.util.List; - -/** - * AuditService provides access to active and already completed process (and its components) data. - * Delivers data about: - *
    - *
  • Process instances
  • - *
  • Node instances
  • - *
  • Variable instances
  • - *
- * there might be some limitations in various implementations thus some of the methods might throw - * UnsupportedOperationException - */ -public interface AuditService { - - /** - * Returns all known process instances currently available to the audit service - * @return all process instance logs or empty list if none were found - */ - List findProcessInstances(); - - /** - * Returns all known process instances for given process id - * @param processId identifier of the process definition - * @return all process instance logs for given process id or empty list if none were found - */ - List findProcessInstances(String processId); - - /** - * Returns all active process instances for given process id - * @param processId identifier of the process definition - * @return all active process instance logs for given process id or empty list if none were found - */ - List findActiveProcessInstances(String processId); - - /** - * Returns process instance log for given process instance id - * @param processInstanceId unique identifier of process instance - * @return process instance log for given process instance id or null if not found - */ - ProcessInstanceLog findProcessInstance(String processInstanceId); - - /** - * Returns all known subprocess instance logs for given process instance id - considered parent process instance id - * @param processInstanceId identifier of the parent process instance id - * @return all process instance logs that are subprocess to a given process instance id - */ - List findSubProcessInstances(String processInstanceId); - - /** - * Returns all node instances that were already triggered for given process instance id - * @param processInstanceId unique identifier of process instance - * @return all node instance logs for given process instance id - */ - List findNodeInstances(String processInstanceId); - - /** - * @param processInstanceId unique identifier of process instance - * @param nodeId node identifier - by default it should be unique id (from process definition) - * but if not available regular node id shall be used - * @return all node instances that were already triggered for given process instance id and node identifier - */ - List findNodeInstances(String processInstanceId, String nodeId); - - /** - * Returns all variable logs for given process instance id - * @param processInstanceId unique identifier of process instance - * @return all variables logs for given process instance or empty list of none were found - */ - List findVariableInstances(String processInstanceId); - - /** - * Returns all variable logs for given process instance id and variable identifier - * @param processInstanceId unique identifier of process instance - * @param variableId variable name - * @return all variable logs for given process instance and variable identifier or empty list if none were found - */ - List findVariableInstances(String processInstanceId, String variableId); - - /** - * Returns all variable logs that are identified by variable id regardless of what process instance they belong to - * @param variableId variable name - * @param onlyActiveProcesses indicates if only active process instances should be considered or both active and completed - * @return all variable logs for given variable id or empty list if none were found - */ - List findVariableInstancesByName(String variableId, boolean onlyActiveProcesses); - - /** - * Returns all variable logs that are identified by variable id and has given value - * regardless of what process instance they belong to - * @param variableId variable name - * @param value value of the variable - * @param onlyActiveProcesses indicates if only active process instances should be considered or both active and completed - * @return all variable logs for given variable id and its value matches given value or empty list if none were found - */ - List findVariableInstancesByNameAndValue(String variableId, String value, boolean onlyActiveProcesses); - - /** - * Removes all entries from audit data store - */ - void clear(); - - /** - * Indicates that work with this instance of AuditService is completed and can be disposed (release resources) - */ - void dispose(); -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/manager/audit/NodeInstanceLog.java b/kie-api/src/main/java/org/kie/api/runtime/manager/audit/NodeInstanceLog.java deleted file mode 100644 index cd3e4294b68..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/manager/audit/NodeInstanceLog.java +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.manager.audit; - -import java.util.Date; -/** - * Audit view of node instance where each node instance (in most of the cases) will have two entries: - *
    - *
  • when node instance was triggered
  • - *
  • when node instance was left - completed
  • - *
- */ -public interface NodeInstanceLog { - - /** - * Indicates that node instance was triggered - */ - public static final int TYPE_ENTER = 0; - - /** - * Indicates that node instance was left (it's no more active) - */ - public static final int TYPE_EXIT = 1; - - /** - * Indicates that the node instance was left because an abort operation (it is not active anymore) - */ - public static final int TYPE_ABORTED = 2; - - /** - * Indicates that the node was taking another route because a signal, timeout, escanalation. - */ - - public static final int TYPE_SKIPPED = 3; - - /** - * Indicates that the node was left because of the workflow considered not needed to be executed - */ - - public static final int TYPE_OBSOLETE = 4; - - /** - * indicates that the node was left because an error - */ - public static final int TYPE_ERROR = 5; - - /** - * @return process instance identifier - */ - Long getProcessInstanceId(); - - /** - * @return id of the definition - */ - String getProcessId(); - - /** - * @return identifier of the node instance - */ - String getNodeInstanceId(); - - /** - * @return identifier of the node which usually is the unique identifier from process definition, - * but can be unique identifier assigned by the engine when unique id is not available - */ - String getNodeId(); - - /** - * @return name of the node from process definition - */ - String getNodeName(); - - /** - * @return date on when this node was triggered - */ - Date getDate(); - - /** - * @return identifier of work item that this node refers to, might be null if it's not work item based node - */ - Long getWorkItemId(); - - /** - * Incoming or outgoing connection identifier (sequence flow) for given node. - * Incoming or outgoing depends on the type of the node instance log entry where - *
    - *
  • entry type will contain incoming sequence flow
  • - *
  • exit type will contain outgoing sequence flow
  • - *
- * @return Incoming or outgoing connection identifier - * - * @see NodeInstanceLog#getType() - */ - String getConnection(); - - /** - * @return external (optional) identifier associated with this process instance - */ - String getExternalId(); - - /** - * @return Node type that indicates what sort of activity it was e.g. Human Task, Script Task, etc - */ - String getNodeType(); - - /** - * @return Type of the node instance log entry - Entry or Exit - * @see NodeInstanceLog#TYPE_ENTER - * @see NodeInstanceLog#TYPE_EXIT - */ - Integer getType(); - -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/manager/audit/ProcessInstanceLog.java b/kie-api/src/main/java/org/kie/api/runtime/manager/audit/ProcessInstanceLog.java deleted file mode 100644 index e9bebcb91a4..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/manager/audit/ProcessInstanceLog.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.manager.audit; - -import java.util.Date; - -/** - * Audit view of process instance - * - */ -public interface ProcessInstanceLog { - - /** - * Process instance identifier - * @return the {@link Long} value - */ - Long getProcessInstanceId(); - - /** - * Process id of the definition - * @return the {@link String} value - */ - String getProcessId(); - - /** - * Start date of this process instance - * @return the {@link Date} value - */ - Date getStart(); - - /** - * End date of this process instance, null if process instance is still active - * @return the {@link Date} value - */ - Date getEnd(); - - /** - * Status of the process instance and might be one of: - *
    - *
  • ProcessInstance.STATE_ACTIVE
  • - *
  • ProcessInstance.STATE_COMPLETED
  • - *
  • ProcessInstance.STATE_ABORTED
  • - *
  • ProcessInstance.STATE_SUSPENDED
  • - *
- * @return the {@link Integer} value - */ - Integer getStatus(); - - /** - * Parent process instance id, will be null for top level process instance - * @return the {@link Long} value - */ - Long getParentProcessInstanceId(); - - /** - * Outcome of the process instance that is providing error information in case process - * instance completed with an error - * @return the {@link String} value - */ - String getOutcome(); - - /** - * Amount of time (in milliseconds) that process instance took to complete. - * Available only when process instance is completed. - * @return the {@link String} value - */ - Long getDuration(); - - /** - * Identifier of a entity (user) who initiated this process instance. - * @return the {@link String} value - */ - String getIdentity(); - - /** - * External (optional) identifier associated with this process instance - * @return the {@link String} value - */ - String getExternalId(); - - /** - * Version of the process definition - * @return the {@link String} value - */ - String getProcessVersion(); - - /** - * Name of the process definition - * @return the {@link String} value - */ - String getProcessName(); - - /** - * Description of the process instance - * @return the {@link String} value - */ - String getProcessInstanceDescription(); - -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/manager/audit/VariableInstanceLog.java b/kie-api/src/main/java/org/kie/api/runtime/manager/audit/VariableInstanceLog.java deleted file mode 100644 index da38c29c30b..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/manager/audit/VariableInstanceLog.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.manager.audit; - -import java.util.Date; - -/** - * Audit view of variables that keeps track of all changes of variable identified by given name/id. - * This means that variable log will contain both current and previous (if exists) value of the variable. - * - */ -public interface VariableInstanceLog { - - /** - * @return process instance identifier - */ - Long getProcessInstanceId(); - - /** - * @return process id of the definition - */ - String getProcessId(); - - /** - * @return additional information in case variable is defined on composite node level to be able to distinguish - * it between top level and embedded level variables - */ - String getVariableInstanceId(); - - /** - * @return identifier of the variable aka variable name - */ - String getVariableId(); - - /** - * @return current value of the variable - */ - String getValue(); - - /** - * @return previous value of the variable (if any) - */ - String getOldValue(); - - /** - * @return date when the variable was set (to current value) - */ - Date getDate(); - - /** - * @return external (optional) identifier associated with this process instance - */ - String getExternalId(); -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/process/CaseAssignment.java b/kie-api/src/main/java/org/kie/api/runtime/process/CaseAssignment.java deleted file mode 100644 index fb159a4c9b0..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/process/CaseAssignment.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.process; - -import java.util.Collection; - -import org.kie.api.task.model.OrganizationalEntity; - -/** - * Represents case assignment which usually means named role to individuals or groups. - * - */ -public interface CaseAssignment { - - /** - * Assigns given entity (either user or group) to given role - * @param roleName name of the role entity should be assigned to - * @param entity user or group to be assigned - */ - void assign(String roleName, OrganizationalEntity entity); - - /** - * Assigns given user to given role - * @param roleName name of the role user should be assigned to - * @param userId user to be assigned - */ - void assignUser(String roleName, String userId); - - /** - * Assigns given group to given role - * @param roleName name of the role group should be assigned to - * @param groupId group to be assigned - */ - void assignGroup(String roleName, String groupId); - - /** - * Removes given entity from the role - * @param roleName name of the role that given entity should be removed from - * @param entity use or group to be removed - */ - void remove(String roleName, OrganizationalEntity entity); - - /** - * Returns assigned entities for given role - * @param roleName name of the role assignment should be returned for - * @return returns all assignments for the given role - */ - Collection getAssignments(String roleName); - - /** - * Returns defined roles - * @return returns all roles - */ - Collection getRoles(); -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/process/CaseData.java b/kie-api/src/main/java/org/kie/api/runtime/process/CaseData.java deleted file mode 100644 index 7e5441799bc..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/process/CaseData.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.process; - -import java.util.Map; - -/** - * Top level of Case(File)Data that holds all shared information within a case. - * - */ -public interface CaseData { - - /** - * Returns all available case data for given case. - * @return - */ - Map getData(); - - /** - * Returns case data for given case registered under given name. - * @return - */ - Object getData(String name); - - - /** - * Add single data item into existing case file - * (replaces already existing data that matches with input) - * @param name - * @param data - */ - void add(String name, Object data); - - /** - * Remove permanently given data from existing case file - * @param name - */ - void remove(String name); - - - /** - * Returns case definition id of this case file - * @return - */ - String getDefinitionId(); -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/process/NodeInstance.java b/kie-api/src/main/java/org/kie/api/runtime/process/NodeInstance.java index 52269e49948..b6c5271c6c5 100644 --- a/kie-api/src/main/java/org/kie/api/runtime/process/NodeInstance.java +++ b/kie-api/src/main/java/org/kie/api/runtime/process/NodeInstance.java @@ -19,6 +19,7 @@ package org.kie.api.runtime.process; import org.kie.api.definition.process.Node; +import org.kie.api.definition.process.WorkflowElementIdentifier; /** * A node instance represents the execution of one specific node @@ -53,7 +54,7 @@ public interface NodeInstance { * * @return the id of the node this node instance refers to */ - long getNodeId(); + WorkflowElementIdentifier getNodeId(); /** * Return the node this node instance refers to. The node diff --git a/kie-api/src/main/java/org/kie/api/runtime/process/ProcessContext.java b/kie-api/src/main/java/org/kie/api/runtime/process/ProcessContext.java index 512747daf5a..4e0fa73609c 100644 --- a/kie-api/src/main/java/org/kie/api/runtime/process/ProcessContext.java +++ b/kie-api/src/main/java/org/kie/api/runtime/process/ProcessContext.java @@ -72,9 +72,5 @@ public interface ProcessContext extends KieContext { */ void setVariable(String variableName, Object value); - - CaseAssignment getCaseAssignment(); - - CaseData getCaseData(); } diff --git a/kie-api/src/main/java/org/kie/api/runtime/query/AdvancedQueryContext.java b/kie-api/src/main/java/org/kie/api/runtime/query/AdvancedQueryContext.java deleted file mode 100644 index ca11d491569..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/query/AdvancedQueryContext.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.query; - -/** - * - * Extension class to the basic ordering and pagination queries which use QueryContext. - * The AdvancedQueryContext is intended for use wherever advanced query functionality provided by the - * KIE Query Service which provides advanced search capabilities that are based on Dashbuilder DataSets. - * - */ -public class AdvancedQueryContext extends QueryContext { - - private String orderByClause; - - public AdvancedQueryContext() { - super(); - } - - public AdvancedQueryContext(QueryContext queryContext) { - super(queryContext); - } - - public AdvancedQueryContext(QueryContext queryContext, String orderByClause) { - super(queryContext); - this.orderByClause = orderByClause; - } - - public AdvancedQueryContext(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * @return the SQL Order By clause - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * Set the ORDER BY clause for advanced query. For instance: - * - * SELECT * FROM PROCESSINSTANCELOG - * ORDER BY PROCESSID ASC, PROCESSINSTANCEID DESC - * - * has orderByClause of "PROCESSID ASC, PROCESSINSTANCEID DESC" - * - * @param orderByClause the SQL Order By clause to set - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - -} diff --git a/kie-api/src/main/java/org/kie/api/runtime/query/QueryContext.java b/kie-api/src/main/java/org/kie/api/runtime/query/QueryContext.java deleted file mode 100644 index 77968f77a3a..00000000000 --- a/kie-api/src/main/java/org/kie/api/runtime/query/QueryContext.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.runtime.query; - -import java.io.Serializable; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlSchemaType; -import jakarta.xml.bind.annotation.XmlType; - -@XmlType(name="kieQueryContext") -@XmlAccessorType(XmlAccessType.FIELD) -public class QueryContext implements Serializable { - - private static final long serialVersionUID = -3174717972613778773L; - - @XmlElement - @XmlSchemaType(name="int") - protected Integer offset = 0; - - @XmlElement - @XmlSchemaType(name="int") - protected Integer count = 10; - - @XmlElement - @XmlSchemaType(name="int") - protected String orderBy; - - @XmlElement - @XmlSchemaType(name="boolean") - protected Boolean ascending; - - public QueryContext() { - // default JAXB constructor - } - - public QueryContext(QueryContext queryContext) { - this.offset = queryContext.offset; - this.count = queryContext.count; - this.orderBy = queryContext.orderBy; - this.ascending = queryContext.ascending; - } - - public QueryContext(Integer offset, Integer count) { - this.offset = offset; - this.count = count; - } - - public QueryContext(String orderBy, boolean asc) { - this.orderBy = orderBy; - this.ascending = asc; - } - - public QueryContext(Integer offset, Integer count, String orderBy, boolean asc) { - this.offset = offset; - this.count = count; - this.orderBy = orderBy; - this.ascending = asc; - } - - public Integer getOffset() { - return offset; - } - - public void setOffset( Integer offset ) { - this.offset = offset; - } - - public Integer getCount() { - return count; - } - - public void setCount( Integer count ) { - this.count = count; - } - - public String getOrderBy() { - return orderBy; - } - - public void setOrderBy( String orderBy ) { - this.orderBy = orderBy; - } - - public Boolean isAscending() { - return ascending; - } - - public void setAscending( Boolean ascending ) { - this.ascending = ascending; - } - - public void clear() { - this.ascending = null; - this.count = 10; - this.offset = 0; - this.orderBy = null; - } -} diff --git a/kie-api/src/main/java/org/kie/api/task/TaskContext.java b/kie-api/src/main/java/org/kie/api/task/TaskContext.java deleted file mode 100644 index 49be748e893..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/TaskContext.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task; - -import org.kie.api.task.model.Task; - -public interface TaskContext { - - /** - * Returns currently configured UserGroupCallback. - * @return returns user group callback - */ - UserGroupCallback getUserGroupCallback(); - - /** - * Loads task (given as argument) variables - both input and output if exists. - * In case variables are already set they are not reread from data store. - * @param task task which should have variables (both input and output) set - * @return returns task with variables set - */ - Task loadTaskVariables(Task task); - - /** - * Returns user id who performs the operation - * @return user id of the caller - */ - String getUserId(); -} diff --git a/kie-api/src/main/java/org/kie/api/task/TaskEvent.java b/kie-api/src/main/java/org/kie/api/task/TaskEvent.java deleted file mode 100644 index 24659b88291..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/TaskEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task; - -import java.util.Date; -import java.util.Map; - -import org.kie.api.task.model.Task; - -public interface TaskEvent { - - Map getMetadata(); - - Task getTask(); - - TaskContext getTaskContext(); - - Date getEventDate(); -} diff --git a/kie-api/src/main/java/org/kie/api/task/TaskLifeCycleEventListener.java b/kie-api/src/main/java/org/kie/api/task/TaskLifeCycleEventListener.java deleted file mode 100644 index 65276688179..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/TaskLifeCycleEventListener.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task; - -import java.util.EventListener; -import java.util.List; -import java.util.Map; - -import org.kie.api.task.model.OrganizationalEntity; - -public interface TaskLifeCycleEventListener extends EventListener { - - public enum AssignmentType { - POT_OWNER, - EXCL_OWNER, - ADMIN; - } - - public void beforeTaskActivatedEvent(TaskEvent event); - public void beforeTaskClaimedEvent(TaskEvent event); - public void beforeTaskSkippedEvent(TaskEvent event); - public void beforeTaskStartedEvent(TaskEvent event); - public void beforeTaskStoppedEvent(TaskEvent event); - public void beforeTaskCompletedEvent(TaskEvent event); - public void beforeTaskFailedEvent(TaskEvent event); - public void beforeTaskAddedEvent(TaskEvent event); - public void beforeTaskExitedEvent(TaskEvent event); - public void beforeTaskReleasedEvent(TaskEvent event); - public void beforeTaskResumedEvent(TaskEvent event); - public void beforeTaskSuspendedEvent(TaskEvent event); - public void beforeTaskForwardedEvent(TaskEvent event); - public void beforeTaskDelegatedEvent(TaskEvent event); - public void beforeTaskNominatedEvent(TaskEvent event); - public default void beforeTaskUpdatedEvent(TaskEvent event){}; - public default void beforeTaskReassignedEvent(TaskEvent event){}; - public default void beforeTaskNotificationEvent(TaskEvent event){}; - public default void beforeTaskInputVariableChangedEvent(TaskEvent event, Map variables){}; - public default void beforeTaskOutputVariableChangedEvent(TaskEvent event, Map variables){}; - public default void beforeTaskAssignmentsAddedEvent(TaskEvent event, AssignmentType type, List entities){}; - public default void beforeTaskAssignmentsRemovedEvent(TaskEvent event, AssignmentType type, List entities){}; - - public void afterTaskActivatedEvent(TaskEvent event); - public void afterTaskClaimedEvent(TaskEvent event); - public void afterTaskSkippedEvent(TaskEvent event); - public void afterTaskStartedEvent(TaskEvent event); - public void afterTaskStoppedEvent(TaskEvent event); - public void afterTaskCompletedEvent(TaskEvent event); - public void afterTaskFailedEvent(TaskEvent event); - public void afterTaskAddedEvent(TaskEvent event); - public void afterTaskExitedEvent(TaskEvent event); - public void afterTaskReleasedEvent(TaskEvent event); - public void afterTaskResumedEvent(TaskEvent event); - public void afterTaskSuspendedEvent(TaskEvent event); - public void afterTaskForwardedEvent(TaskEvent event); - public void afterTaskDelegatedEvent(TaskEvent event); - public void afterTaskNominatedEvent(TaskEvent event); - public default void afterTaskReassignedEvent(TaskEvent event){}; - public default void afterTaskUpdatedEvent(TaskEvent event){}; - public default void afterTaskNotificationEvent(TaskEvent event){}; - public default void afterTaskInputVariableChangedEvent(TaskEvent event, Map variables){}; - public default void afterTaskOutputVariableChangedEvent(TaskEvent event, Map variables){}; - public default void afterTaskAssignmentsAddedEvent(TaskEvent event, AssignmentType type, List entities){}; - public default void afterTaskAssignmentsRemovedEvent(TaskEvent event, AssignmentType type, List entities){}; - -} diff --git a/kie-api/src/main/java/org/kie/api/task/TaskService.java b/kie-api/src/main/java/org/kie/api/task/TaskService.java deleted file mode 100644 index 6a8670ddb42..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/TaskService.java +++ /dev/null @@ -1,113 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task; - -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.kie.api.runtime.CommandExecutor; -import org.kie.api.task.model.Attachment; -import org.kie.api.task.model.Comment; -import org.kie.api.task.model.Content; -import org.kie.api.task.model.OrganizationalEntity; -import org.kie.api.task.model.Status; -import org.kie.api.task.model.Task; -import org.kie.api.task.model.TaskSummary; - -/** - * The Task Service Entry Point serves as - * facade of all the other services, providing a single entry point - * to access to all the services - */ -public interface TaskService extends CommandExecutor { - - void activate(long taskId, String userId); - - void claim(long taskId, String userId); - - void claimNextAvailable(String userId, String language); - - void complete(long taskId, String userId, Map data); - - void delegate(long taskId, String userId, String targetUserId); - - void exit(long taskId, String userId); - - void fail(long taskId, String userId, Map faultData); - - void forward(long taskId, String userId, String targetEntityId); - - Task getTaskByWorkItemId(long workItemId); - - Task getTaskById(long taskId); - - List getTasksAssignedAsBusinessAdministrator(String userId, String language); - - List getTasksAssignedAsPotentialOwner(String userId, String language); - - @Deprecated - List getTasksAssignedAsPotentialOwner(String userId, List groupIds, String language, int firstResult, int maxResults); - - List getTasksAssignedAsPotentialOwnerByStatus(String userId, List status, String language); - - List getTasksOwned(String userId, String language); - - List getTasksOwnedByStatus(String userId, List status, String language); - - List getTasksByStatusByProcessInstanceId(String processInstanceId, List status, String language); - - List getTasksAssignedAsPotentialOwnerByProcessId(String userId, String processId); - - List getTasksByProcessInstanceId(String processInstanceId); - - long addTask(Task task, Map params); - - void release(long taskId, String userId); - - void resume(long taskId, String userId); - - void skip(long taskId, String userId); - - void start(long taskId, String userId); - - void stop(long taskId, String userId); - - void suspend(long taskId, String userId); - - void nominate(long taskId, String userId, List potentialOwners); - - Content getContentById(long contentId); - - Attachment getAttachmentById(long attachId); - - Map getTaskContent(long taskId); - - Long addComment(long taskId, Comment comment); - - Long addComment(long taskId, String addedByUserId, String commentText); - - void deleteComment(long taskId, long commentId); - - List getAllCommentsByTaskId(long taskId); - - Comment getCommentById(long commentId); - - void setExpirationDate(long taskId, Date date); -} \ No newline at end of file diff --git a/kie-api/src/main/java/org/kie/api/task/UserGroupCallback.java b/kie-api/src/main/java/org/kie/api/task/UserGroupCallback.java deleted file mode 100644 index f1443f35aef..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/UserGroupCallback.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task; - -import java.util.List; - -public interface UserGroupCallback { - /** - * Resolves existence of user id. - * @param userId the user id assigned to the task - * @return true if userId exists, false otherwise. - */ - boolean existsUser(String userId); - - /** - * Resolves existence of group id. - * @param groupId the group id assigned to the task - * @return true if groupId exists, false otherwise. - */ - boolean existsGroup(String groupId); - - /** - * Returns list of group ids for specified user id. - * @param userId the user id assigned to the task - * @return List of group ids. - */ - List getGroupsForUser(String userId); - -} diff --git a/kie-api/src/main/java/org/kie/api/task/UserInfo.java b/kie-api/src/main/java/org/kie/api/task/UserInfo.java deleted file mode 100644 index 955e1b603bb..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/UserInfo.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task; - -import java.util.Iterator; - -import org.kie.api.task.model.Group; -import org.kie.api.task.model.OrganizationalEntity; - -public interface UserInfo { - - String getDisplayName(OrganizationalEntity entity); - - Iterator getMembersForGroup(Group group); - - boolean hasEmail(Group group); - - String getEmailForEntity(OrganizationalEntity entity); - - String getLanguageForEntity(OrganizationalEntity entity); - -} diff --git a/kie-api/src/main/java/org/kie/api/task/model/Attachment.java b/kie-api/src/main/java/org/kie/api/task/model/Attachment.java deleted file mode 100644 index 31dfdeae917..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/model/Attachment.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task.model; - -import java.io.Externalizable; -import java.util.Date; - -public interface Attachment extends Externalizable { - - Long getId(); - - String getName(); - - String getContentType(); - - Date getAttachedAt(); - - User getAttachedBy(); - - int getSize(); - - long getAttachmentContentId(); - -} diff --git a/kie-api/src/main/java/org/kie/api/task/model/Comment.java b/kie-api/src/main/java/org/kie/api/task/model/Comment.java deleted file mode 100644 index f95f806954c..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/model/Comment.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task.model; - -import java.io.Externalizable; -import java.util.Date; - - -public interface Comment extends Externalizable { - - Long getId(); - - String getText(); - - Date getAddedAt(); - - User getAddedBy(); - -} diff --git a/kie-api/src/main/java/org/kie/api/task/model/Content.java b/kie-api/src/main/java/org/kie/api/task/model/Content.java deleted file mode 100644 index ce35d6365ed..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/model/Content.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task.model; - -import java.io.Externalizable; - -public interface Content extends Externalizable { - - Long getId(); - - byte[] getContent(); - -} diff --git a/kie-api/src/main/java/org/kie/api/task/model/Email.java b/kie-api/src/main/java/org/kie/api/task/model/Email.java deleted file mode 100644 index 09ce3cd6c74..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/model/Email.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task.model; - - -public interface Email extends OrganizationalEntity { - -} diff --git a/kie-api/src/main/java/org/kie/api/task/model/Group.java b/kie-api/src/main/java/org/kie/api/task/model/Group.java deleted file mode 100644 index 8bd2d1ada6c..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/model/Group.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task.model; - - -public interface Group extends OrganizationalEntity { - -} diff --git a/kie-api/src/main/java/org/kie/api/task/model/I18NText.java b/kie-api/src/main/java/org/kie/api/task/model/I18NText.java deleted file mode 100644 index a383ae73045..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/model/I18NText.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task.model; - -import java.io.Externalizable; - -public interface I18NText extends Externalizable { - - Long getId(); - - String getLanguage(); - - String getText(); - -} diff --git a/kie-api/src/main/java/org/kie/api/task/model/OrganizationalEntity.java b/kie-api/src/main/java/org/kie/api/task/model/OrganizationalEntity.java deleted file mode 100644 index b39e0e4c761..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/model/OrganizationalEntity.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task.model; - -import java.io.Externalizable; - -public interface OrganizationalEntity extends Externalizable { - - String getId(); - -} diff --git a/kie-api/src/main/java/org/kie/api/task/model/PeopleAssignments.java b/kie-api/src/main/java/org/kie/api/task/model/PeopleAssignments.java deleted file mode 100644 index 4f1ee657e1a..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/model/PeopleAssignments.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task.model; - -import java.io.Externalizable; -import java.util.List; - - -public interface PeopleAssignments extends Externalizable { - - User getTaskInitiator(); - - List getPotentialOwners(); - - List getBusinessAdministrators(); - -} diff --git a/kie-api/src/main/java/org/kie/api/task/model/QuickTaskSummary.java b/kie-api/src/main/java/org/kie/api/task/model/QuickTaskSummary.java deleted file mode 100644 index b00915f4925..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/model/QuickTaskSummary.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task.model; - -import java.io.Externalizable; -import java.util.Date; - -public interface QuickTaskSummary extends Externalizable { - - Long getId(); - - String getName(); - - String getStatusId(); - - Integer getPriority(); - - String getActualOwnerId(); - - String getCreatedById(); - - Date getCreatedOn(); - - Date getActivationTime(); - - Date getExpirationTime(); - - String getProcessId(); - - Long getProcessInstanceId(); - - String getDeploymentId(); - - Long getParentId(); - -} diff --git a/kie-api/src/main/java/org/kie/api/task/model/Status.java b/kie-api/src/main/java/org/kie/api/task/model/Status.java deleted file mode 100644 index 7dc485aa7d5..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/model/Status.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task.model; - -import jakarta.xml.bind.annotation.XmlType; - - -@XmlType -public enum Status { - Created, Ready, Reserved, InProgress, Suspended, Completed, Failed, Error, Exited, Obsolete -} diff --git a/kie-api/src/main/java/org/kie/api/task/model/Task.java b/kie-api/src/main/java/org/kie/api/task/model/Task.java deleted file mode 100644 index 58e9670f782..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/model/Task.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task.model; - -import java.io.Externalizable; -import java.util.List; - -public interface Task extends Externalizable { - - Long getId(); - - Integer getPriority(); - - List getNames(); - - List getSubjects(); - - List getDescriptions(); - - String getName(); - - String getSubject(); - - String getDescription(); - - PeopleAssignments getPeopleAssignments(); - - TaskData getTaskData(); - - String getTaskType(); - - Boolean isArchived(); - - Integer getVersion(); - - String getFormName(); - -} diff --git a/kie-api/src/main/java/org/kie/api/task/model/TaskData.java b/kie-api/src/main/java/org/kie/api/task/model/TaskData.java deleted file mode 100644 index 3b229afa294..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/model/TaskData.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task.model; - -import java.io.Externalizable; -import java.util.Date; -import java.util.List; -import java.util.Map; - -public interface TaskData extends Externalizable { - - Status getStatus(); - - Status getPreviousStatus(); - - User getActualOwner(); - - User getCreatedBy(); - - Date getCreatedOn(); - - Date getActivationTime(); - - Date getExpirationTime(); - - boolean isSkipable(); - - long getWorkItemId(); - - long getProcessInstanceId(); - - String getProcessId(); - - String getDeploymentId(); - - long getProcessSessionId(); - - String getDocumentType(); - - long getDocumentContentId(); - - String getOutputType(); - - Long getOutputContentId(); - - String getFaultName(); - - String getFaultType(); - - long getFaultContentId(); - - List getComments(); - - List getAttachments(); - - long getParentId(); - - Map getTaskInputVariables(); - - Map getTaskOutputVariables(); - -} diff --git a/kie-api/src/main/java/org/kie/api/task/model/TaskSummary.java b/kie-api/src/main/java/org/kie/api/task/model/TaskSummary.java deleted file mode 100644 index 219c44f4858..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/model/TaskSummary.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task.model; - -import java.util.List; - -public interface TaskSummary extends QuickTaskSummary { - - String getSubject(); - - String getDescription(); - - Status getStatus(); - - Boolean isSkipable(); - - User getActualOwner(); - - User getCreatedBy(); - - Long getProcessSessionId(); - - @Deprecated // remove in 7.0 since this field is never filled - List getPotentialOwners(); - - Boolean isQuickTaskSummary(); - - String getCorrelationKey(); - - Integer getProcessType(); - -} diff --git a/kie-api/src/main/java/org/kie/api/task/model/User.java b/kie-api/src/main/java/org/kie/api/task/model/User.java deleted file mode 100644 index 5082abb1d50..00000000000 --- a/kie-api/src/main/java/org/kie/api/task/model/User.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.api.task.model; - -public interface User extends OrganizationalEntity { - -} diff --git a/kie-internal/src/main/java/org/kie/internal/process/ProcessVariableIndexer.java b/kie-internal/src/main/java/org/kie/internal/process/ProcessVariableIndexer.java deleted file mode 100644 index 2c18e9c5080..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/process/ProcessVariableIndexer.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.process; - -import org.kie.api.runtime.manager.audit.VariableInstanceLog; -import org.kie.internal.utils.VariableIndexer; - - -/** - * Dedicated type for custom implementations of VariableIndexer for process variables - * - */ -public interface ProcessVariableIndexer extends VariableIndexer { - -} diff --git a/kie-internal/src/main/java/org/kie/internal/query/ExtendedParametrizedQueryBuilder.java b/kie-internal/src/main/java/org/kie/internal/query/ExtendedParametrizedQueryBuilder.java deleted file mode 100644 index 83a7fd75a63..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/query/ExtendedParametrizedQueryBuilder.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.query; - -/** - * This is the base interface for all {@link ParametrizedQueryBuilder} implementations. - *

- * It includes the basic query functions. - * - * @param The type of {@link ParametrizedQueryBuilder} instance being implemented. This type - * is here to facilitate the building of a fluent interface. - * @param The type of the result list being returned by the generated {@link ParametrizedQuery} - */ -public interface ExtendedParametrizedQueryBuilder extends ParametrizedQueryBuilder { - - /** - * Query criteria which are added to the query after this method - * are "AND" or "intersection" criteria. In other words, the query - * will only return results which match all of the criteria added - * (as opposed to returning results that match any of the - * criteria added). - * @return the current query builder instance - */ - public T newGroup(); - - /** - * Query criteria which are added to the query after this method - * are "AND" or "intersection" criteria. In other words, the query - * will only return results which match all of the criteria added - * (as opposed to returning results that match any of the - * criteria added). - * @return the current query builder instance - */ - public T endGroup(); - - /** - * Create the {@link ParametrizedQuery} instance that can be used - * to retrieve the results, a {@link List<TaskSummary>} instance. - *

- * Further modifications to the {@link TaskQueryBuilder} instance - * will not affect the query criteria used in the {@link ParametrizedQuery} - * produced by this method. - * @return The results of the query - */ - public ParametrizedQuery build(); -} diff --git a/kie-internal/src/main/java/org/kie/internal/query/InternalQueryService.java b/kie-internal/src/main/java/org/kie/internal/query/InternalQueryService.java deleted file mode 100644 index 7c74796c8d0..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/query/InternalQueryService.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.query; - -import java.util.List; - -public interface InternalQueryService { - - // The query methods should not be available in any public API's - public List query(Object queryWhere, Class queryType, Class resultType); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/query/ParametrizedQuery.java b/kie-internal/src/main/java/org/kie/internal/query/ParametrizedQuery.java deleted file mode 100644 index dc382b53beb..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/query/ParametrizedQuery.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.query; - -import java.util.List; - -/** - * Instances of this class can be built by various {@link ParametrizedQueryBuilder} implemetnations, - * including those in the jbpm-audit or jbpm-human-task-core modules. - *

- * {@link ParametrizedQueryBuilder} implementations are responsible for allowing a user - * to dynamically (at compile-time) specify the criteria to be used in querying various - * data sources. - *

- * The result of the {@link ParametrizedQueryBuilder} is an instance of this class, which contains - * the criteria specified in the {@link ParametrizedQueryBuilder} instance. When the - * {@link ParametrizedQuery#getResultList()} method is called, the specified query will - * be executed, returning a (possibly empty) list of the data that fulfills the query criteria. - * - * @param The type being queried and of the (results) list being returned. - */ -public interface ParametrizedQuery { - - /** - * Execute the query and return the list of entities found by the query. - * @return The query result - */ - List getResultList(); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/query/ParametrizedQueryBuilder.java b/kie-internal/src/main/java/org/kie/internal/query/ParametrizedQueryBuilder.java deleted file mode 100644 index 285e491d01f..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/query/ParametrizedQueryBuilder.java +++ /dev/null @@ -1,194 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.query; - - -/** - * This is the base interface for all {@link ParametrizedQueryBuilder} implementations. - *

- * It includes the basic query functions. - * - * @param The type of {@link ParametrizedQueryBuilder} instance being implemented. This type - * is here to facilitate the building of a fluent interface. - */ -public interface ParametrizedQueryBuilder { - - /** - * Synonym for {@link #or()} - *

- * Query criteria which are added to the query after this method - * are "OR" or "union" criteria. - *

- * Since this is based on SQL, please remember that intersection operands - * have precedence over union operands. - *

- * In other words,
    - *
  • A or B and C == A or (B and C)
  • - *
  • A and B or C == (A and B) or C
  • - *
- *

- * This is the default mode for all query builders. - * @return the current query builder instance - */ - public T union(); - - - /** - * Synonym for {@link #union()} - *

- * Query criteria which are added to the query after this method - * are "OR" or "union" criteria. - *

- * Since this is based on SQL, please remember that intersection operands - * have precedence over union operands. - *

- * In other words,
    - *
  • A or B and C == A or (B and C)
  • - *
  • A and B or C == (A and B) or C
  • - *
- *

- * This is the default mode for all query builders. - * @return the current query builder instance - */ - public T or(); - - /** - * Synonym for {@link #and()} - *

- * Query criteria which are added to the query after this method - * are "AND" or "intersection" criteria. - *

- * Since this is based on SQL, please remember that intersection operands - * have precedence over union operands. - *

- * In other words,
    - *
  • A or B and C == A or (B and C)
  • - *
  • A and B or C == (A and B) or C
  • - *
- *

- * @return the current query builder instance - */ - public T intersect(); - - /** - * Synonym for {@link #intersect()} - *

- * Query criteria which are added to the query after this method - * are "AND" or "intersection" criteria. - *

- * Since this is based on SQL, please remember that intersection operands - * have precedence over union operands. - *

- * In other words,
    - *
  • A or B and C == A or (B and C)
  • - *
  • A and B or C == (A and B) or C
  • - *
- *

- * @return the current query builder instance - */ - public T and(); - - /** - * Query criteria which are added to the query after this method - * are regular expression (a.k.a "regex") criteria. In other words, - * the query will return results which match the regular expressions - * specified. - *

- * Only String criteria may be added after using this method. In order - * to go back to adding normal or non-regex criteria, use the {@link #equals()} - * method. - *

- * The following characters may be used:
    - *
  • .
      - *
    • This character matches any single character.
    • - *
  • - *
  • *
      - *
    • This character matches zero or more characters.
    • - *
  • - *
- * - * @deprecated will be deleted in 7.0 - * @see {@code #regex()} - * @return the current query builder instance - */ - @Deprecated - public T like(); - - /** - * Query criteria which are added to the query after this method - * are regular expression (a.k.a "regex") criteria. In other words, - * the query will return results which match the regular expressions - * specified. - *

- * Only String criteria may be added after using this method. In order - * to go back to adding normal or non-regex criteria, use the {@link #equals()} - * method. - *

- * The following characters may be used:
    - *
  • .
      - *
    • This character matches any single character.
    • - *
  • - *
  • *
      - *
    • This character matches zero or more characters.
    • - *
  • - *
- * - * @see {@code #like()} - * @return the current query builder instance - */ - public T regex(); - - /** - * Results retrieved using query criteria added after this method - * is used, must exactly match the criteria given. - *

- * If the {@link #like()} method has been used, using this method - * will ensure that criteria added after this method are literally - * interpreted, and not seen as regular expressions. - *

- * This is the default mode for all query builders. - * @return the current query builder instance - */ - public T equals(); - - /** - * Clear all parameters and meta-criteria - * @return the current query builder instance - */ - public T clear(); - - /** - * Limit the number of results returned by the query to the specified maximum. - * @param maxResults The maximum number of results to return - * - * @return the current query builder instance - */ - public T maxResults(int maxResults); - - /** - * Limit the results returned by excluding the specified number of results (the offset), - * from the start of the result list. - *

- * Which results are excluded (offset) is dependent on the order of the results returned. - * See the orderBy(enum) methods as well as {@link #ascending()} and {@link #descending()}. - * @param offset The number of elements skipped before the first element in the result - * @return the current query builder instance - */ - public T offset(int offset); -} diff --git a/kie-internal/src/main/java/org/kie/internal/query/ParametrizedUpdate.java b/kie-internal/src/main/java/org/kie/internal/query/ParametrizedUpdate.java deleted file mode 100644 index 88c5d2a1dc1..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/query/ParametrizedUpdate.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.query; - -public interface ParametrizedUpdate { - - int execute(); -} diff --git a/kie-internal/src/main/java/org/kie/internal/query/ProcessInstanceIdQueryBuilder.java b/kie-internal/src/main/java/org/kie/internal/query/ProcessInstanceIdQueryBuilder.java deleted file mode 100644 index 80a6a11e14d..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/query/ProcessInstanceIdQueryBuilder.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.query; - - - - - -/** - * This is the base interface for all {@link ParametrizedQueryBuilder} implementations. - *

- * It includes the basic query functions. - * - * @param The type of {@link ParametrizedQueryBuilder} instance being implemented. This type - * is here to facilitate the building of a fluent interface. - * @param The type of the result list being returned by the generated {@link ParametrizedQuery} - */ -public interface ProcessInstanceIdQueryBuilder extends ExtendedParametrizedQueryBuilder { - - /** - * Specify one or more process instance ids as criteria in the query - * @param processInstanceId one or more a process instance ids - * @return The current query builder instance - */ - public T processInstanceId(long... processInstanceId); - - /** - * Specify an inclusive range of process instance ids to use as a criteria - *

- * If the lower or upper end of the range is given as null, - * then an open-ended range using the non-null range end is used - * as the criteria - * @param processInstanceIdMin the minimal (lower) date to use in the range - * @param processInstanceIdMax the max (upper) date to use in the range - * @return The current query builder instance - */ - public T processInstanceIdRange(String processInstanceIdMin, String processInstanceIdMax); - -} \ No newline at end of file diff --git a/kie-internal/src/main/java/org/kie/internal/query/QueryContext.java b/kie-internal/src/main/java/org/kie/internal/query/QueryContext.java deleted file mode 100644 index 125af0455ab..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/query/QueryContext.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.query; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlType; - -@XmlType -@XmlAccessorType(XmlAccessType.FIELD) -public class QueryContext extends org.kie.api.runtime.query.QueryContext { - - private static final long serialVersionUID = -3174717972613778773L; - - public QueryContext() { - super(); - } - - public QueryContext(Integer offset, Integer count, String orderBy, boolean asc) { - super(offset, count, orderBy, asc); - } - - public QueryContext(Integer offset, Integer count) { - super(offset, count); - } - - public QueryContext(org.kie.api.runtime.query.QueryContext queryContext) { - super(queryContext); - } - - public QueryContext(String orderBy, boolean asc) { - super(orderBy, asc); - } - - -} diff --git a/kie-internal/src/main/java/org/kie/internal/query/QueryFilter.java b/kie-internal/src/main/java/org/kie/internal/query/QueryFilter.java deleted file mode 100644 index 5967f783934..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/query/QueryFilter.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.query; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlSchemaType; -import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import org.kie.internal.jaxb.StringKeyObjectValueMapXmlAdapter; - -public class QueryFilter extends QueryContext { - - private static final long serialVersionUID = 2830463093685095275L; - - @XmlElement - @XmlSchemaType(name="string") - private String language =""; - - @XmlElement - @XmlSchemaType(name="string") - private String filterParams = ""; - - @XmlElement - @XmlJavaTypeAdapter(StringKeyObjectValueMapXmlAdapter.class) - private Map params = new HashMap<>(); - - public QueryFilter() { - // default constructor for JAXB - } - - public QueryFilter(QueryFilter orig) { - super(orig); - this.language = orig.language; - this.filterParams = orig.filterParams; - params.putAll(params); - } - - public QueryFilter(int offset, int count) { - super(offset, count); - } - - public QueryFilter(int offset, int count, String orderBy, boolean ascending) { - super(offset, count, orderBy, ascending); - } - - public QueryFilter(int offset, int count, String filterParams, String language, String orderBy) { - super(offset, count); - this.filterParams = filterParams; - this.language = language; - this.orderBy = orderBy; - } - - public QueryFilter( String filterParams, Map params, String orderBy, boolean isAscending) { - this.filterParams = filterParams; - this.params = params; - this.orderBy = orderBy; - this.ascending = isAscending; - } - - public QueryFilter( String filterParams, Map params, String orderBy, int offset, int count ) { - super(offset, count); - this.filterParams = filterParams; - this.params = params; - this.orderBy = orderBy; - } - - public String getLanguage() { - return language; - } - - public void setLanguage( String language ) { - this.language = language; - } - - public String getFilterParams() { - return filterParams; - } - - public void setFilterParams( String filterParams ) { - this.filterParams = filterParams; - } - - public Map getParams() { - return params; - } - - public void setParams( Map params ) { - this.params = params; - } - -} diff --git a/kie-internal/src/main/java/org/kie/internal/query/QueryParameterIdentifiers.java b/kie-internal/src/main/java/org/kie/internal/query/QueryParameterIdentifiers.java deleted file mode 100644 index 538d4bc1183..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/query/QueryParameterIdentifiers.java +++ /dev/null @@ -1,154 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.query; - -import java.util.concurrent.atomic.AtomicInteger; - -public interface QueryParameterIdentifiers { - - // meta identifiers - - public final static String FIRST_RESULT = "firstResult"; - public final static String MAX_RESULTS = "maxResults"; - public final static String FLUSH_MODE = "flushMode"; - - public static final String PAGE_NUMBER = "page number"; - public static final String PAGE_SIZE = "page size"; - - public static final String FILTER = "filter"; - public static final String ORDER_BY = "orderby"; - public static final String ORDER_TYPE = "orderType"; - public static final String ASCENDING_VALUE = "ASC"; - public static final String DESCENDING_VALUE = "DESC"; - - /** - * *All* Query parameter identifiers MUST have the following format: - * - * - If a query can be executed on multiple values of the parameter ( for example, process instance id), - * => Then the constant name should end with "_LIST". - * - * - If a query can only contain one value of the parameter (for example, language for task queries), - * => Then the constant name should only be the parameter name. - */ - - // general identifiers - - static AtomicInteger idGen = new AtomicInteger(1); - - // general (multiple entities) - public static final String PROCESS_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String PROCESS_INSTANCE_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String PROCESS_SESSION_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String WORK_ITEM_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String DEPLOYMENT_ID_LIST = String.valueOf(idGen.getAndIncrement()); - - public static final String START_DATE_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String END_DATE_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String DATE_LIST = String.valueOf(idGen.getAndIncrement()); - - public static final String ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String TYPE_LIST = String.valueOf(idGen.getAndIncrement()); - - // audit identifiers - - // - (process instance log) - public static final String DURATION_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String IDENTITY_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String PROCESS_NAME_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String PROCESS_VERSION_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String PROCESS_INSTANCE_STATUS_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String OUTCOME_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String CORRELATION_KEY_LIST = String.valueOf(idGen.getAndIncrement()); - - // - (node instance log) - public static final String NODE_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String NODE_INSTANCE_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String NODE_NAME_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String PROCESS_INSTANCE_PARENT_ID_LIST = String.valueOf(idGen.getAndIncrement()); - - // - (variable instance log) - public static final String VARIABLE_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String VARIABLE_INSTANCE_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String VAR_VALUE_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String VALUE_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String OLD_VALUE_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String EXTERNAL_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String LAST_VARIABLE_LIST = String.valueOf(idGen.getAndIncrement()); - - public static final String VAR_VAL_SEPARATOR = ":"; - - // task identifiers - public static final String TASK_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String BUSINESS_ADMIN_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String POTENTIAL_OWNER_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String STAKEHOLDER_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String ACTUAL_OWNER_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String EXCLUDED_OWNER_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String CREATED_BY_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String TASK_STATUS_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String LANGUAGE = String.valueOf(idGen.getAndIncrement()); - public static final String CREATED_ON_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String TASK_NAME_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String TASK_PARENT_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String TASK_ACTIVATION_TIME_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String TASK_DESCRIPTION_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String TASK_PRIORITY_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String TASK_PROCESS_SESSION_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String TASK_DUE_DATE_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String ARCHIVED = String.valueOf(idGen.getAndIncrement()); - public static final String EXPIRATION_TIME_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String TASK_FORM_NAME_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String SKIPPABLE = String.valueOf(idGen.getAndIncrement()); - public static final String TASK_SUBJECT_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String SUB_TASKS_STRATEGY = String.valueOf(idGen.getAndIncrement()); - - public static final String TASK_USER_ROLES_LIMIT_LIST = String.valueOf(idGen.getAndIncrement()); - - // task audit - public static final String TASK_EVENT_DATE_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String USER_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String TASK_EVENT_MESSAGE_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String TASK_EVENT_LOG_TIME_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String MESSAGE_LIST = String.valueOf(idGen.getAndIncrement()); - - // executor identifiers - public static final String EXECUTOR_STATUS_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String EXECUTOR_TIME_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String STACK_TRACE_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String COMMAND_NAME_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String EXECUTOR_EXECUTIONS_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String EXECUTOR_KEY_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String EXECUTOR_OWNER_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String EXECUTOR_RETRIES_LIST = String.valueOf(idGen.getAndIncrement()); - - // task variable - public static final String TASK_VARIABLE_NAME_ID_LIST = String.valueOf(idGen.getAndIncrement()); - public static final String TASK_VARIABLE_VALUE_ID_LIST = String.valueOf(idGen.getAndIncrement()); - // this is a weird one, becaues it's not used in the query builder API, but internally for a - // pseudo-normal (but technically group) criteria - public static final String TASK_VARIABLE_COMBINED_ID = "-" + String.valueOf(idGen.getAndIncrement()); - public static final String TASK_VARIABLE_DATE_ID_LIST = String.valueOf(idGen.getAndIncrement()); - - public static final String CASE_FILE_DATA_LOG_LASTMODIFIED = String.valueOf(idGen.getAndIncrement()); - - public static final String SUBQUERY_STATUS = String.valueOf(idGen.getAndIncrement()); - public static final String SUBQUERY_DEPLOYMENT = String.valueOf(idGen.getAndIncrement()); - public static final String SUBQUERY_CASE = String.valueOf(idGen.getAndIncrement()); - -} \ No newline at end of file diff --git a/kie-internal/src/main/java/org/kie/internal/query/data/QueryData.java b/kie-internal/src/main/java/org/kie/internal/query/data/QueryData.java deleted file mode 100644 index 6460e835435..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/query/data/QueryData.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.query.data; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlType; - -import org.kie.internal.query.QueryContext; - -@XmlType -@XmlAccessorType(XmlAccessType.FIELD) -public class QueryData extends QueryParameters { - - @XmlElement - private QueryContext queryContext = new QueryContext(); - - public QueryData() { - // JAXB constructor - } - - public QueryData(QueryData queryData) { - super(queryData); - this.queryContext = new QueryContext(queryData.getQueryContext()); - } - - public QueryContext getQueryContext() { - return queryContext; - } - - public void setQueryContext( QueryContext queryContext ) { - this.queryContext = queryContext; - } - - public void clear() { - super.clear(); - this.queryContext.clear(); - } - -} diff --git a/kie-internal/src/main/java/org/kie/internal/query/data/QueryParameters.java b/kie-internal/src/main/java/org/kie/internal/query/data/QueryParameters.java deleted file mode 100644 index b6d2272d679..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/query/data/QueryParameters.java +++ /dev/null @@ -1,298 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.query.data; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; -import jakarta.xml.bind.annotation.XmlTransient; -import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import org.kie.internal.jaxb.StringKeyObjectValueMapXmlAdapter; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -@Deprecated // see org.jbpm.query.jpa.data.QueryWhere and org.jbpm.query.jpa.data.QueryCriteria -public class QueryParameters { - - @XmlTransient - private boolean union = true; - - @XmlTransient - private boolean like = false; - - @XmlTransient - private boolean range = false; - - @XmlElement - @XmlJavaTypeAdapter(StringKeyObjectValueMapXmlAdapter.class) - private Map> unionParameters = null; - - @XmlElement - @XmlJavaTypeAdapter(StringKeyObjectValueMapXmlAdapter.class) - private Map> intersectParameters = null; - - @XmlElement - @XmlJavaTypeAdapter(StringKeyObjectValueMapXmlAdapter.class) - private Map> unionRegexParameters = null; - - @XmlElement - @XmlJavaTypeAdapter(StringKeyObjectValueMapXmlAdapter.class) - private Map> intersectRegexParameters = null; - - @XmlElement - @XmlJavaTypeAdapter(StringKeyObjectValueMapXmlAdapter.class) - private Map> unionRangeParameters = null; - - @XmlElement - @XmlJavaTypeAdapter(StringKeyObjectValueMapXmlAdapter.class) - private Map> intersectRangeParameters = null; - - public QueryParameters() { - // JAXB constructor - } - - // getters - - public Map> getUnionParameters() { - if( unionParameters == null ) { - unionParameters = new HashMap<>(); - } - return unionParameters; - } - - public boolean unionParametersAreEmpty() { - return unionParameters == null ? true : unionParameters.isEmpty(); - - } - - public Map> getIntersectParameters() { - if( intersectParameters == null ) { - intersectParameters = new HashMap<>(); - } - return intersectParameters; - } - - public boolean intersectParametersAreEmpty() { - return intersectParameters == null ? true : intersectParameters.isEmpty(); - } - - public Map> getUnionRegexParameters() { - if( unionRegexParameters == null ) { - unionRegexParameters = new HashMap<>(); - } - return unionRegexParameters; - } - - public boolean unionRegexParametersAreEmpty() { - return unionRegexParameters == null ? true : unionRegexParameters.isEmpty(); - } - - public Map> getIntersectRegexParameters() { - if( intersectRegexParameters == null ) { - intersectRegexParameters = new HashMap<>(); - } - return intersectRegexParameters; - } - - public boolean intersectRegexParametersAreEmpty() { - return intersectRegexParameters == null ? true : intersectRegexParameters.isEmpty(); - } - - public Map> getUnionRangeParameters() { - if( unionRangeParameters == null ) { - unionRangeParameters = new HashMap<>(); - } - return unionRangeParameters; - } - - public boolean unionRangeParametersAreEmpty() { - return unionRangeParameters == null ? true : unionRangeParameters.isEmpty(); - } - - public Map> getIntersectRangeParameters() { - if( intersectRangeParameters == null ) { - intersectRangeParameters = new HashMap<>(); - } - return intersectRangeParameters; - } - - public boolean intersectRangeParametersAreEmpty() { - return intersectRangeParameters == null ? true : intersectRangeParameters.isEmpty(); - } - - // other logic - - public void addAppropriateParam( String listId, T... param ) { - if( param.length == 0 ) { - return; - } - List listParams = getAppropriateParamList(listId, param[0], param.length); - listParams.addAll(Arrays.asList(param)); - } - - public void addRangeParameter( String listId, T param, boolean start ) { - this.range = true; - List listParams = getAppropriateParamList(listId, param, 2); - int index = start ? 0 : 1; - listParams.set(index, param); - this.range = false; - } - - @SuppressWarnings("unchecked") - public List getAppropriateParamList(String listId, T param, int size) { - List listParams = null; - if( like ) { - if( ! (param instanceof String) ) { - throw new IllegalArgumentException("Only String parameters may be used in regular expressions."); - } - List stringListParams = null; - if( union ) { - listParams = (List) getUnionRegexParameters().get(listId); - if( listParams == null ) { - stringListParams = new ArrayList<>(size); - getUnionRegexParameters().put(listId, stringListParams); - } - } else { - listParams = (List) getIntersectParameters().get(listId); - if( listParams == null ) { - stringListParams = new ArrayList<>(size); - getIntersectRegexParameters().put(listId, stringListParams); - } - } - if( listParams == null ) { - return (List) stringListParams; - } else { - return listParams; - } - } else if( range ) { - if( union ) { - listParams = (List) getUnionRangeParameters().get(listId); - if( listParams == null ) { - listParams = Arrays.asList(null, null); - getUnionRangeParameters().put(listId, listParams); - } - } else { - listParams = (List) getIntersectRangeParameters().get(listId); - if( listParams == null ) { - listParams = Arrays.asList(null, null); - getIntersectRangeParameters().put(listId, listParams); - } - } - } else { - if( union ) { - listParams = (List) getUnionParameters().get(listId); - if( listParams == null ) { - listParams = new ArrayList<>(size); - getUnionParameters().put(listId, listParams); - } - } else { - listParams = (List) getIntersectParameters().get(listId); - if( listParams == null ) { - listParams = new ArrayList<>(size); - getIntersectParameters().put(listId, listParams); - } - } - } - return listParams; - } - - public void setToUnion() { - this.union = true; - } - - public void setToIntersection() { - this.union = false; - } - - public boolean isUnion() { - return this.union; - } - - public void setToLike() { - this.like = true; - } - - public boolean isLike() { - return this.like; - } - - public void setToEquals() { - this.like = false; - } - - public void setToRange() { - this.range = true; - } - - public void setToPrecise() { - this.range = false; - } - - public boolean isRange() { - return this.range; - } - - public void clear() { - union = true; - like = false; - range = false; - - Map [] maps = { - unionParameters, - intersectParameters, - unionRegexParameters, - intersectRegexParameters, - unionRangeParameters, - intersectRangeParameters - }; - for( Map paramMap : maps ) { - if( paramMap != null ) { - paramMap.clear(); - } - } - } - - public QueryParameters(QueryParameters queryParameters) { - this.union = queryParameters.union; - this.like = queryParameters.like; - this.range = queryParameters.range; - this.intersectParameters = queryParameters.intersectParameters == null ? null : - new HashMap<>(queryParameters.intersectParameters); - this.unionParameters = queryParameters.unionParameters == null ? null : - new HashMap<>(queryParameters.unionParameters); - this.intersectRangeParameters = queryParameters.intersectRangeParameters == null ? null : - new HashMap<>(queryParameters.intersectRangeParameters); - this.unionRangeParameters = queryParameters.unionRangeParameters == null ? null : - new HashMap<>(queryParameters.unionRangeParameters); - this.intersectRegexParameters = queryParameters.intersectRegexParameters == null ? null : - new HashMap<>(queryParameters.intersectRegexParameters); - this.unionRegexParameters = queryParameters.unionRegexParameters == null ? null : - new HashMap<>(queryParameters.unionRegexParameters); - } - - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionError.java b/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionError.java deleted file mode 100644 index b2367838a4c..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionError.java +++ /dev/null @@ -1,302 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.error; - -import java.io.Serializable; -import java.util.Date; -import java.util.UUID; - -public class ExecutionError implements Serializable { - - private static final long serialVersionUID = 740619427108653407L; - - protected String errorId; - - protected String type; - protected String deploymentId; - protected String processInstanceId; - protected String processId; - protected Long activityId; - protected String activityName; - protected Long jobId; - - protected String errorMessage; - protected String error; - - protected Short acknowledged = 0; - protected String acknowledgedBy; - protected Date acknowledgedAt; - - protected Date errorDate; - - protected Long initActivityId; - - public ExecutionError() { - errorId = UUID.randomUUID().toString(); - } - - public ExecutionError(String errorId, String type, String deploymentId, String processInstanceId, String processId, Long activityId, String activityName, Long jobId, String errorMessage, - short acknowledged, String acknowledgedBy, Date acknowledgedAt, - Date errorDate) { - this(errorId, type, deploymentId, processInstanceId, processId, activityId, activityName, jobId, errorMessage, null, acknowledged, acknowledgedBy, acknowledgedAt, errorDate); - } - - public ExecutionError(String errorId, String type, String deploymentId, String processInstanceId, String processId, Long activityId, String activityName, Long jobId, String errorMessage, String error, - short acknowledged, String acknowledgedBy, Date acknowledgedAt, - Date errorDate) { - this.errorId = errorId; - this.type = type; - this.deploymentId = deploymentId; - this.processInstanceId = processInstanceId; - this.processId = processId; - this.activityId = activityId; - this.activityName = activityName; - this.jobId = jobId; - this.errorMessage = errorMessage; - this.error = error; - this.acknowledged = acknowledged; - this.acknowledgedBy = acknowledgedBy; - this.acknowledgedAt = acknowledgedAt; - this.errorDate = errorDate; - } - - public String getErrorId() { - return errorId; - } - - public void setErrorId(String errorId) { - this.errorId = errorId; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getDeploymentId() { - return deploymentId; - } - - public void setDeploymentId(String deploymentId) { - this.deploymentId = deploymentId; - } - - public String getProcessInstanceId() { - return processInstanceId; - } - - public void setProcessInstanceId(String processInstanceId) { - this.processInstanceId = processInstanceId; - } - - public Long getActivityId() { - return activityId; - } - - public void setActivityId(Long activityId) { - this.activityId = activityId; - } - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public String getError() { - return error; - } - - public void setError(String error) { - this.error = error; - } - - protected Short getAcknowledged() { - return acknowledged; - } - - protected void setAcknowledged(Short acknowledged) { - this.acknowledged = acknowledged; - } - - public boolean isAcknowledged() { - if (acknowledged == null) { - return false; - } - return (acknowledged == 1) ? Boolean.TRUE : Boolean.FALSE; - } - - public void setAcknowledged(boolean acknowledged) { - setAcknowledged(acknowledged ? Short.valueOf("1") : Short.valueOf("0")); - } - - public String getAcknowledgedBy() { - return acknowledgedBy; - } - - public void setAcknowledgedBy(String acknowledgedBy) { - this.acknowledgedBy = acknowledgedBy; - } - - public Date getAcknowledgedAt() { - return acknowledgedAt; - } - - public void setAcknowledgedAt(Date acknowledgedAt) { - this.acknowledgedAt = acknowledgedAt; - } - - public String getProcessId() { - return processId; - } - - public void setProcessId(String processId) { - this.processId = processId; - } - - public String getActivityName() { - return activityName; - } - - public void setActivityName(String activityName) { - this.activityName = activityName; - } - - public static Builder builder() { - return new Builder(); - } - - public Date getErrorDate() { - return errorDate; - } - - public void setErrorDate(Date errorDate) { - this.errorDate = errorDate; - } - - public Long getJobId() { - return jobId; - } - - public void setJobId(Long jobId) { - this.jobId = jobId; - } - - public Long getInitActivityId() { - return initActivityId; - } - - - public void setInitActivityId(Long initActivityId) { - this.initActivityId = initActivityId; - } - - @Override - public String toString() { - return "ExecutionError [type=" + type + ", deploymentId=" + deploymentId + ", processInstanceId=" + processInstanceId + - ", processId=" + processId + ", activityId=" + activityId + ", activityName=" + activityName + - ", errorMessage=" + errorMessage + ", acknowledged=" + acknowledged + ", acknowledgedBy=" + acknowledgedBy + - ", acknowledgedAt=" + acknowledgedAt + "]"; - } - - - public static class Builder { - private ExecutionError error = new ExecutionError(); - - public ExecutionError build() { - return error; - } - - public Builder type(String type) { - error.setType(type); - return this; - } - - public Builder deploymentId(String deploymentId) { - error.setDeploymentId(deploymentId); - return this; - } - - public Builder message(String message) { - error.setErrorMessage(message); - return this; - } - - public Builder error(String errorStr) { - error.setError(errorStr); - return this; - } - - public Builder acknowledgedBy(String user) { - error.setAcknowledgedBy(user); - return this; - } - - public Builder processInstanceId(String piId) { - error.setProcessInstanceId(piId); - return this; - } - - public Builder activityId(Long activityId) { - error.setActivityId(activityId); - return this; - } - - public Builder acknowledged(boolean acknowledged) { - error.setAcknowledged(acknowledged ? Short.valueOf("1") : Short.valueOf("0")); - return this; - } - - public Builder acknowledgedAt(Date acknowledgedAt) { - error.setAcknowledgedAt(acknowledgedAt); - return this; - } - - public Builder processId(String processId) { - error.setProcessId(processId); - return this; - } - - public Builder activityName(String activityName) { - error.setActivityName(activityName); - return this; - } - - public Builder errorDate(Date errorDate) { - error.setErrorDate(errorDate); - return this; - } - - public Builder jobId(Long jobId) { - error.setJobId(jobId); - return this; - } - - public Builder initActivityId(Long initActivityId) { - error.setInitActivityId(initActivityId); - return this; - } - - } -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorContext.java b/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorContext.java deleted file mode 100644 index ef1ecc7a5ec..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorContext.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.error; - -import org.kie.api.runtime.process.NodeInstance; -import org.kie.api.task.model.Task; - -public class ExecutionErrorContext { - - private Throwable cause; - - private NodeInstance firstExecutedNode; - - private NodeInstance lastExecutedNode; - - private Task lastExecutedTask; - - public ExecutionErrorContext(Throwable cause, NodeInstance lastExecutedNode, Task lastExecutedTask, NodeInstance firstExecutedNode) { - super(); - this.cause = cause; - this.lastExecutedNode = lastExecutedNode; - this.lastExecutedTask = lastExecutedTask; - this.firstExecutedNode = firstExecutedNode; - } - - public Throwable getCause() { - return cause; - } - - public NodeInstance getLastExecutedNode() { - return lastExecutedNode; - } - - public Task getLastExecutedTask() { - return lastExecutedTask; - } - - public NodeInstance getFirstExecutedNode() { - return firstExecutedNode; - } - - @Override - public String toString() { - return "ExecutionErrorContext [cause=" + cause + ", firstExecutedNode=" + firstExecutedNode + - ", lastExecutedNode=" + lastExecutedNode + ", lastExecutedTask=" + lastExecutedTask + "]"; - } - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorFilter.java b/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorFilter.java deleted file mode 100644 index 76d240ac382..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorFilter.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.error; - -import java.util.stream.Stream; - -/** - * Responsible for implementing filter capability to decide how to deal with given error. - * Up to concrete implementations to decide on logic how to read details from the cause. - * It might simply check on the top level exception or it can drill down into bottom - * of the cause. - */ -public interface ExecutionErrorFilter { - - boolean accept(ExecutionErrorContext errorContext); - - /** - * Based on the cause filters the actual error and produces ExecutionError instance - * if applicable for given filter. In case filter is not finding anything relevant it shall return - * null instead of execution error instance to allow others to process it. - * @param cause the root cause of the error - * @return ExecutionError instance populated with details extracted from the cause, or null of not applicable to this filter - */ - ExecutionError filter(ExecutionErrorContext errorContext); - - /** - * Returns expected priority in regards to other filters. The lower value returned the higher priority it has. - * @return priority for processing - */ - Integer getPriority(); - - default boolean isCausedBy(Throwable throwable, Class... types) { - - while (throwable != null) { - final Class throwableClass = throwable.getClass(); - boolean matched = Stream.of(types) - .filter(clazz -> clazz != null) - .anyMatch(clazz -> clazz.isAssignableFrom(throwableClass)); - if (matched) { - - return true; - } else { - throwable = throwable.getCause(); - } - } - - return false; - } - - @SuppressWarnings("unchecked") - default T extract(Throwable throwable, Class type) { - - while (throwable != null) { - if (type.isAssignableFrom(throwable.getClass())) { - - return (T) throwable; - } else { - throwable = throwable.getCause(); - } - } - - return null; - } -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorHandler.java b/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorHandler.java deleted file mode 100644 index ebffb3790ad..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.error; - -import org.kie.api.runtime.process.NodeInstance; -import org.kie.api.task.model.Task; - -public interface ExecutionErrorHandler { - - - void processing(NodeInstance nodeInstance); - - void processing(Task task); - - void processed(NodeInstance nodeInstance); - - void processed(Task task); - - void handle(Throwable cause); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorListener.java b/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorListener.java deleted file mode 100644 index 8752643fc82..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.error; - -public interface ExecutionErrorListener { - - void onExecutionError(ExecutionError error); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorManager.java b/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorManager.java deleted file mode 100644 index 518dbf59ecc..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorManager.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.error; - - -public interface ExecutionErrorManager { - - ExecutionErrorHandler getHandler(); - - ExecutionErrorStorage getStorage(); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorStorage.java b/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorStorage.java deleted file mode 100644 index 0011ce4a078..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/error/ExecutionErrorStorage.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.error; - -import java.util.List; - -public interface ExecutionErrorStorage { - - ExecutionError store(ExecutionError error); - - ExecutionError get(String errorId); - - void acknowledge(String user, String... errorId); - - List list(Integer page, Integer pageSize); - - List listByProcessInstance(String processInstanceId, Integer page, Integer pageSize); - - List listByActivity(String activityName, Integer page, Integer pageSize); - - List listByDeployment(String deploymentId, Integer page, Integer pageSize); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/CacheManager.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/CacheManager.java deleted file mode 100644 index 847f50a4fe3..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/CacheManager.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager; - -import org.kie.internal.runtime.Cacheable; - -/** - * Maintains a cache of various items that are long lived or expensive to be created - * frequently so they can benefit from being cached. - * - */ -public interface CacheManager { - - /** - * Adds a given value into the cache under given key - * @param key unique key for the item to be stored - * @param value actual value to be cached - */ - void add(String key, Object value); - - /** - * Retrieves item from a cache if exists - * @param key key for the item in the cache - * @return actual value if found otherwise null - */ - Object get(String key); - - /** - * Removes the item from cache if exists - * @param key key for the item in the cache - * @return actual value if found otherwise null - */ - Object remove(String key); - - /** - * Disposes cache and cleans up/closes its stored resources of applicable - * @see Cacheable for details - */ - void dispose(); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/Disposable.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/Disposable.java deleted file mode 100644 index 2806619fa87..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/Disposable.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager; - -/** - * Marker interface that indicates that given class is disposable - meaning shall be - * manually or automatically disposed on close events. - * - */ -public interface Disposable { - - /** - * Actual logic that shall be executed on dispose. - */ - void dispose(); - - /** - * Allows to register listeners to be notified whenever instance is disposed so dependent - * instances can take proper action on that occasion. - * @param listener callback listener instance - */ - void addDisposeListener(DisposeListener listener); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/DisposeListener.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/DisposeListener.java deleted file mode 100644 index 35cd37f2939..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/DisposeListener.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager; - -import org.kie.api.runtime.manager.RuntimeEngine; - -/** - * Callback listener interface to receive notification when Disposable - * instances are actually disposed. - * - */ -public interface DisposeListener { - - /** - * Invoked by instances that are going to be disposed. - * @param runtime RuntimeEngine instance that is going to be disposed. - */ - void onDispose(RuntimeEngine runtime); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/EventListenerProducer.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/EventListenerProducer.java deleted file mode 100644 index d3792fedfe5..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/EventListenerProducer.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager; - -import java.util.List; -import java.util.Map; - -/** - * Allows do define custom producers for know EventListeners. Intention of this is that there might be several - * implementations that might provide different listener instance based on the context they are executed in. - *
- * It will be invoked by RegisterableItemsFactory implementation (especially InjectableRegisterableItemsFactory - * in CDI world) for every KieSession. Recommendation is to always produce new instances to avoid unexpected - * results. - * - * @param type of the event listener - ProcessEventListener, AgendaEventListener, WorkingMemoryEventListener - */ -public interface EventListenerProducer { - - /** - * Returns list of instances for given (T) type of listeners - *
- * Parameters that might be given are as follows: - *
    - *
  • ksession
  • - *
  • taskService
  • - *
  • runtimeManager
  • - *
- * @param identifier - identifier of the owner - usually RuntimeManager that allows the producer to filter out - * and provide valid instances for given owner - * @param params - owner might provide some parameters, usually KieSession, TaskService, RuntimeManager instances - * @return list of listener instances (recommendation is to always return new instances when this method is invoked) - */ - List getEventListeners(String identifier, Map params); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/GlobalProducer.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/GlobalProducer.java deleted file mode 100644 index 6ccca921514..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/GlobalProducer.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager; - -import java.util.Map; - -/** - * Allows to provide global instances for KieSession to be registered on time when RuntimeEngine - * is created. - *
- * It will be invoked by RegisterableItemsFactory implementation (especially InjectableRegisterableItemsFactory - * in CDI world) for every KieSession. - * - */ -public interface GlobalProducer { - - /** - * Returns map of (key = global name, value global instance) of globals - * to be registered on KieSession - *
- * Parameters that might be given are as follows: - *
    - *
  • ksession
  • - *
  • taskService
  • - *
  • runtimeManager
  • - *
- * - * @param identifier - identifier of the owner - usually RuntimeManager that allows the producer to filter out - * and provide valid instances for given owner - * @param params - owner might provide some parameters, usually KieSession, TaskService, RuntimeManager instances - * @return map of work item handler instances (recommendation is to always return new instances when this method is invoked) - */ - Map getGlobals(String identifier, Map params); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/InternalRuntimeEngine.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/InternalRuntimeEngine.java deleted file mode 100644 index 6e9d81b6cd5..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/InternalRuntimeEngine.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager; - -import org.kie.api.runtime.KieSession; -import org.kie.api.runtime.manager.RuntimeEngine; - -/** - * Extension to stable API of RuntimeEngine that provides additional capabilities. - * - */ -public interface InternalRuntimeEngine extends RuntimeEngine { - - /** - * Returns internal kie session. - * @return kie session already created - */ - KieSession internalGetKieSession(); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/Mapper.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/Mapper.java deleted file mode 100644 index 81dcdc4f8c1..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/Mapper.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager; - -import org.kie.api.runtime.manager.Context; - -/** - * Mapper responsibility is to provide correlation between context - * identifier and ksession identifier to effectively keep track of what context - * has been mapped to given ksession.
- * Mapper covers entire life cycle of the mapping which consists of: - *
    - *
  • storing the mapping
  • - *
  • retrieving the mapping
  • - *
  • removing the mapping
  • - *
- * - */ -public interface Mapper { - - /** - * Stores context to ksession id mapping - * @param context instance of the context to be stored - * @param ksessionId actual identifier of ksession - */ - void saveMapping(Context context, Long ksessionId, String ownerId); - - /** - * Finds ksession for given context - * @param context instance of the context - * @return ksession identifier when found otherwise null - */ - Long findMapping(Context context, String ownerId); - - /** - * Finds context by ksession identifier - * @param ksessionId identifier of ksession - * @return context instance when wound otherwise null - */ - Object findContextId(Long ksessionId, String ownerId); - - /** - * Remove permanently context to ksession id mapping - * @param context context instance that mapping shall be removed for - */ - void removeMapping(Context context, String ownerId); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeEnvironment.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeEnvironment.java deleted file mode 100644 index 8084603c24f..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeEnvironment.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager; - - -/** - * Extension of org.kie.api.runtime.manager.RuntimeEnvironment that contains internal methods - */ -public interface RuntimeEnvironment extends org.kie.api.runtime.manager.RuntimeEnvironment { - - /** - * Delivers concrete implementation of Mapper that provides access to mapping between contexts and - * ksession identifiers for tracking purposes. - * @return - */ - Mapper getMapper(); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeManagerFactory.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeManagerFactory.java deleted file mode 100644 index 596e1b5717c..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeManagerFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @deprecated - * Use org.kie.api.runtime.manager.RuntimeManagerFactory - */ -public interface RuntimeManagerFactory extends org.kie.api.runtime.manager.RuntimeManagerFactory { - - - /** - * @deprecated - * Use org.kie.api.runtime.manager.RuntimeManagerFactory - */ - public static class Factory { - private static RuntimeManagerFactory INSTANCE; - private static Logger logger = LoggerFactory.getLogger(Factory.class); - - static { - try { - final Object delegate = - Class.forName( System.getProperty("org.jbpm.runtime.manager.class", - "org.jbpm.runtime.manager.impl.RuntimeManagerFactoryImpl") ).newInstance(); - INSTANCE = (RuntimeManagerFactory) Proxy.newProxyInstance(RuntimeManagerFactory.class.getClassLoader(), - new Class[]{RuntimeManagerFactory.class}, new InvocationHandler() { - - @Override - public Object invoke(Object proxy, Method method, Object[] arguments) throws Throwable { - - return method.invoke(delegate, arguments); - } - }); - } catch (Exception e) { - logger.error("Unable to instance RuntimeManagerFactory due to " + e.getMessage()); - } - } - - /** - * Returns a reference to the RuntimeManagerFactory singleton - */ - public static RuntimeManagerFactory get() { - if (INSTANCE == null) { - throw new RuntimeException("RuntimeManagerFactory was not initialized, see previous errors"); - } - return INSTANCE; - } - } -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeManagerIdFilter.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeManagerIdFilter.java deleted file mode 100644 index 515a41ce244..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeManagerIdFilter.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager; - -import java.util.Collection; - -/** - * Allows to apply filtering on runtime manager identifiers to find only those matching - * - */ -public interface RuntimeManagerIdFilter { - - /** - * Filters given identifiers based on given pattern and return only those matching. - * @param pattern pattern used to filter identifiers - * @param identifiers all available identifiers - * @return returns only matched identifiers or empty list in case of no match found - */ - Collection filter(String pattern, Collection identifiers); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeManagerRegistry.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeManagerRegistry.java deleted file mode 100644 index 6363d5a8360..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/RuntimeManagerRegistry.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager; - -import java.util.Collection; -import java.util.Collections; -import java.util.concurrent.ConcurrentHashMap; - -import org.kie.api.runtime.manager.RuntimeManager; - -public class RuntimeManagerRegistry { - - private static RuntimeManagerRegistry INSTANCE = new RuntimeManagerRegistry(); - - protected volatile ConcurrentHashMap registeredManager = new ConcurrentHashMap<>(); - - private RuntimeManagerRegistry() { - - } - - public static RuntimeManagerRegistry get() { - return INSTANCE; - } - - public synchronized void register(RuntimeManager manager) { - if (registeredManager.containsKey(manager.getIdentifier())) { - throw new IllegalStateException("RuntimeManager is already registered with id " + manager.getIdentifier()); - } - this.registeredManager.put(manager.getIdentifier(), manager); - } - - public synchronized void remove(RuntimeManager manager) { - - this.registeredManager.remove(manager.getIdentifier()); - } - - public synchronized void remove(String identifier) { - - this.registeredManager.remove(identifier); - } - - public RuntimeManager getManager(String id) { - return this.registeredManager.get(id); - } - - public boolean isRegistered(String id) { - return this.registeredManager.containsKey(id); - } - - public Collection getRegisteredIdentifiers() { - // Using "registeredManager.keySet()" directly would result in issues when compiling with JDK 8+. The "keySet()" - // method returns type ConcurrentHashMap$KeySetView which is only available in Java 8+. That means - // the bytecode would contain reference to that type, which does not exist in Java 6 and Java 7 and thus - // clients would get NoSuchMethodError at runtime. The "keys()" method is fully backwards compatible, but it - // requires wrapping inside additional collection as "unmodifiableCollection()" does not accept Enumerations. - return Collections.unmodifiableCollection(Collections.list(this.registeredManager.keys())); - } - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/SessionFactory.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/SessionFactory.java deleted file mode 100644 index b1eb034f6e5..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/SessionFactory.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager; - -import org.kie.api.runtime.KieSession; - -/** - * Factory that produces KieSession instances. - * - */ -public interface SessionFactory { - - /** - * Produces new instance of KieSession - * @return new instance of KieSession - */ - KieSession newKieSession(); - - /** - * Loads KieSession form data store (such as db) based on given id. - * @param sessionId identifier of ksession - * @return loaded instance of KieSession - * @throws RuntimeException in case session cannot be loaded - */ - KieSession findKieSessionById(Long sessionId); - - /** - * Closes the factory and releases all resources - */ - void close(); - - /** - * Invoked when runtime engine is about to be disposed - * @param sessionId ksession id that is disposed. - */ - void onDispose(Long sessionId); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/TaskServiceFactory.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/TaskServiceFactory.java deleted file mode 100644 index 136b8569e52..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/TaskServiceFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager; - -import org.kie.api.task.TaskService; - -/** - * Factory that produces TaskService instances. - * - */ -public interface TaskServiceFactory { - - /** - * Produces new instance of TaskService - * @return new instance of TaskService - */ - TaskService newTaskService(); - - /** - * Closes this factory and releases all resources - */ - void close(); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/WorkItemHandlerProducer.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/WorkItemHandlerProducer.java deleted file mode 100644 index 7ba623e3850..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/WorkItemHandlerProducer.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager; - -import java.util.Map; - -import org.kie.api.runtime.process.WorkItemHandler; - -/** - * Allows to provide custom implementations to deliver WorkItem name and WorkItemHandler instance pairs - * for the runtime. - *
- * It will be invoked by RegisterableItemsFactory implementation (especially InjectableRegisterableItemsFactory - * in CDI world) for every KieSession. Recommendation is to always produce new instances to avoid unexpected - * results. - * - */ -public interface WorkItemHandlerProducer { - - /** - * Returns map of (key = work item name, value work item handler instance) of work items - * to be registered on KieSession - *
- * Parameters that might be given are as follows: - *
    - *
  • ksession
  • - *
  • taskService
  • - *
  • runtimeManager
  • - *
- * - * @param identifier - identifier of the owner - usually RuntimeManager that allows the producer to filter out - * and provide valid instances for given owner - * @param params - owner might provide some parameters, usually KieSession, TaskService, RuntimeManager instances - * @return map of work item handler instances (recommendation is to always return new instances when this method is invoked) - */ - Map getWorkItemHandlers(String identifier, Map params); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/AuditDateDeleteBuilder.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/AuditDateDeleteBuilder.java deleted file mode 100644 index 8d648b7375c..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/AuditDateDeleteBuilder.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.audit.query; - -import java.util.Date; - -/** - * This interface defines methods that are used by all of the Audit delete query builder implementations. - * @param - * - */ -public interface AuditDateDeleteBuilder extends AuditDeleteBuilder { - - /** - * Specify one or more dates as criteria in the query - * @param date one or more dates - * @return The current query builder instance - */ - T date(Date... date); - - /** - * Specify the begin of a date range to be used as a criteria on the date field. - * The date range includes the date specified. - * @param rangeStart the start (early end) of the date range - * @return The current query builder instance - */ - T dateRangeStart(Date rangeStart); - - /** - * Specify the end of a date range to be used as a criteria on the date field. - * The date range includes this date. - * @param rangeEnd the end (later end) of the date range - * @return The current query builder instance - */ - T dateRangeEnd(Date rangeEnd); -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/AuditDeleteBuilder.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/AuditDeleteBuilder.java deleted file mode 100644 index 1307953f405..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/AuditDeleteBuilder.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.audit.query; - -import org.kie.internal.query.ParametrizedQueryBuilder; -import org.kie.internal.query.ParametrizedUpdate; - -/** - * This interface defines methods that are used by all of the Audit delete query builder implementations. - * @param - * - */ -public interface AuditDeleteBuilder extends ParametrizedQueryBuilder { - - /** - * Specify one or more process instance ids as criteria in the query - * @param processInstanceId one or more a process instance ids - * @return The current query builder instance - */ - public T processInstanceId(long... processInstanceId); - - /** - * Specify one or more process (definition) id's as criteria in the query - * @param processId one or more process ids - * @return The current query builder instance - */ - public T processId(String... processId); - - /** - * Specify one or more status that process instance should be in as criteria in the query. - * It might be supported or not - * @param statuses @see org.kie.api.runtime.process.ProcessInstance - * @return The current query builder instance - */ - T logBelongsToProcessInStatus(Integer... statuses); - - /** - * Specify deployment id that process instance should be in as criteria in the query. - * It might me supported or not - * @param the deployment id - * @return The current query builder instance - */ - T logBelongsToProcessInDeployment(String deploymentId); - - /** - * Specify the number of records to be included per transaction. - * @param numRecords number of records (0 means all records will be processed into one single transaction) - * @return The current query builder instance - */ - T recordsPerTransaction(int numRecords); - - /** - * Create the {@link ParametrizedUpdate} instance that can be used - * to execute an update or delete of the entities that this builder is for. - *

- * Further modifications to this builder instance - * will not affect the query criteria used in the {@link ParametrizedUpdate} - * produced by this method. - * - * @return a {@link ParametrizedUpdate} instance that can be executed. - */ - public ParametrizedUpdate build(); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/AuditLogQueryBuilder.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/AuditLogQueryBuilder.java deleted file mode 100644 index 3075c277e60..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/AuditLogQueryBuilder.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.audit.query; - -import org.kie.internal.query.ParametrizedQueryBuilder; - -/** - * This interface defines methods that are used by all of the Audit - * {@link ParametrizedQueryBuilder} implementations. - * - * @param The {@link ParametrizedQueryBuilder} implementation type - * @param The entity type on which is being queried - */ -public interface AuditLogQueryBuilder extends ProcessIdQueryBuilder { - - /** - * Specify which field to use when ordering the results, in ascending order. - *

- * If this method is not used, the results will be ordered in ascending order - * by the id field. - * @param field the field by which the query results should be ordered - * @return The current instance of this query builder - */ - public T ascending( OrderBy field ); - - /** - * Specify which field to use when ordering the results, in descending order. - *

- * If this method is not used, the results will be ordered in ascending order - * by the id field. - * @param field the field by which the query results should be ordered - * @return The current instance of this query builder - */ - public T descending( OrderBy field ); - - public static enum OrderBy { - // order by process instance id - processInstanceId, - // order by process id - processId, - } - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ErrorInfoDeleteBuilder.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ErrorInfoDeleteBuilder.java deleted file mode 100644 index 04fd6ae8d96..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ErrorInfoDeleteBuilder.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.audit.query; - - -public interface ErrorInfoDeleteBuilder extends AuditDateDeleteBuilder { - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/NodeInstanceLogDeleteBuilder.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/NodeInstanceLogDeleteBuilder.java deleted file mode 100644 index 5a86613e488..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/NodeInstanceLogDeleteBuilder.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.audit.query; - - -public interface NodeInstanceLogDeleteBuilder extends AuditDateDeleteBuilder { - - /** - * Specify one or more work item ids associated with a node to use as a criteria. - * @param workItemId one or more long work item ids - * @return The current query builder instance - */ - public NodeInstanceLogDeleteBuilder workItemId(long... workItemId); - - /** - * Specify one or more node instance ids to use as a criteria. - * @param nodeInstanceId one or more string node instance ids - * @return The current query builder instance - */ - public NodeInstanceLogDeleteBuilder nodeInstanceId(String... nodeInstanceId); - - /** - * Specify one or more node ids to use as a criteria. - * @param nodeId one or more string node ids - * @return The current query builder instance - */ - public NodeInstanceLogDeleteBuilder nodeId(String... nodeId); - - /** - * Specify one or more node names to use as a criteria. - * @param name one or more string node names - * @return The current query builder instance - */ - public NodeInstanceLogDeleteBuilder nodeName(String... name); - - /** - * Specify externalId to be used as criteria on the externalId field. - * @param externalId identifier that defines custom id - * @return The current query builder instance - */ - public NodeInstanceLogDeleteBuilder externalId(String... externalId); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/NodeInstanceLogQueryBuilder.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/NodeInstanceLogQueryBuilder.java deleted file mode 100644 index dafd6e16e58..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/NodeInstanceLogQueryBuilder.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.audit.query; - -import java.util.Date; - -import org.kie.api.runtime.manager.audit.NodeInstanceLog; - -public interface NodeInstanceLogQueryBuilder extends AuditLogQueryBuilder { - - /** - * Specify one or more dates as criteria in the query. - * @param date one or more dates - * @return The current query builder instance - */ - public NodeInstanceLogQueryBuilder date(Date... date); - - /** - * Specify the begin of a date range to be used as a criteria on the date field. - * The date range includes the date specified. - * @param rangeStart the start (early end) of the date range - * @return The current query builder instance - */ - public NodeInstanceLogQueryBuilder dateRangeStart(Date rangeStart); - - /** - * Specify the end of a date range to be used as a criteria on the date field. - * The date range includes this date. - * @param rangeEnd the end (later end) of the date range - * @return The current query builder instance - */ - public NodeInstanceLogQueryBuilder dateRangeEnd(Date rangeEnd); - - /** - * Specify one or more node instance ids to use as a criteria. - * @param nodeInstanceId one or more string node instance ids - * @return The current query builder instance - */ - public NodeInstanceLogQueryBuilder nodeInstanceId(String... nodeInstanceId); - - /** - * Specify one or more node ids to use as a criteria. - * @param nodeId one or more string node ids - * @return The current query builder instance - */ - public NodeInstanceLogQueryBuilder nodeId(String... nodeId); - - /** - * Specify one or more node names to use as a criteria. - * @param name one or more string node names - * @return The current query builder instance - */ - public NodeInstanceLogQueryBuilder nodeName(String... name); - - /** - * Specify one or more node types to use as a criteria. - * @param type one or more string node types - * @return The current query builder instance - */ - public NodeInstanceLogQueryBuilder nodeType(String... type); - - /** - * Specify one or more work item ids associated with a node to use as a criteria. - * @param workItemId one or more long work item ids - * @return The current query builder instance - */ - public NodeInstanceLogQueryBuilder workItemId(long... workItemId); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ProcessIdQueryBuilder.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ProcessIdQueryBuilder.java deleted file mode 100644 index 70e0be89896..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ProcessIdQueryBuilder.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.audit.query; - -import org.kie.internal.query.ParametrizedQueryBuilder; -import org.kie.internal.query.ProcessInstanceIdQueryBuilder; - -/** - * This interface defines methods that are used by all of the Audit - * {@link ParametrizedQueryBuilder} implementations. - * - * @param The {@link ParametrizedQueryBuilder} implementation type - * @param The entity type on which is being queried - */ -public interface ProcessIdQueryBuilder extends ProcessInstanceIdQueryBuilder { - - /** - * Specify one or more process (definition) id's as criteria in the query - * @param processId one or more process ids - * @return The current query builder instance - */ - public T processId(String... processId); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ProcessInstanceLogDeleteBuilder.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ProcessInstanceLogDeleteBuilder.java deleted file mode 100644 index 80bc3580371..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ProcessInstanceLogDeleteBuilder.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.audit.query; - -import java.util.Date; - -public interface ProcessInstanceLogDeleteBuilder extends AuditDeleteBuilder { - - /** - * Specify one more statuses (in the form of an int) as criteria. - * @param status one or more int statuses - * @return The current instance of this query builder - */ - public ProcessInstanceLogDeleteBuilder status(int... status); - - /** - * Specify one or more (process instance) outcomes as a criteria. - * @param outcome one or more string outcomes - * @return The current instance of this query builder - */ - public ProcessInstanceLogDeleteBuilder outcome(String... outcome); - - - /** - * Specify one or more identiies (who started the process instance) as a criteria - * @param identity one or more string identities - * @return The current instance of this query builder - */ - public ProcessInstanceLogDeleteBuilder identity(String... identity); - - /** - * Specify one or more process versions as a criteria - * @param version one or more string process versions - * @return The current instance of this query builder - */ - public ProcessInstanceLogDeleteBuilder processVersion(String... version); - - /** - * Specify one or more process names as a criteria - * @param processName one or more string process names - * @return The current instance of this query builder - */ - public ProcessInstanceLogDeleteBuilder processName(String... processName); - - /** - * Specify one or more (process instance) start dates as a criteria - * @param date one or more {@link Date} start dates - * @return The current instance of this query builder - */ - public ProcessInstanceLogDeleteBuilder startDate(Date... date); - - /** - * Specify the begin of a date range to be used as a criteria on the start date field. - * The date range includes the date specified. - * @param rangeStart the start (early end) of the date range - * @return The current query builder instance - */ - public ProcessInstanceLogDeleteBuilder startDateRangeStart(Date rangeStart); - - /** - * Specify the end of a date range to be used as a criteria on the start date field. - * The date range includes this date. - * @param rangeEnd the end (later end) of the date range - * @return The current query builder instance - */ - public ProcessInstanceLogDeleteBuilder startDateRangeEnd(Date rangeEnd); - - /** - * Specify one or more (process instance) end dates as a criteria - * @param date one or more {@link Date} end dates - * @return The current instance of this query builder - */ - public ProcessInstanceLogDeleteBuilder endDate(Date... date); - - /** - * Specify the begin of a date range to be used as a criteria on the end date field. - * The date range includes this date. - * @param date the begin (later end) of the date range - * @return The current query builder instance - */ - public ProcessInstanceLogDeleteBuilder endDateRangeStart(Date rangeStart); - - /** - * Specify the end of a date range to be used as a criteria on the end date field. - * The date range includes this date. - * @param date the end (later end) of the date range - * @return The current query builder instance - */ - public ProcessInstanceLogDeleteBuilder endDateRangeEnd(Date rangeEnd); - - /** - * Specify externalId to be used as criteria on the externalId field. - * @param externalId identifier that defines custom id - * @return The current query builder instance - */ - public ProcessInstanceLogDeleteBuilder externalId(String... externalId); - - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ProcessInstanceLogQueryBuilder.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ProcessInstanceLogQueryBuilder.java deleted file mode 100644 index 0812e3d9492..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/ProcessInstanceLogQueryBuilder.java +++ /dev/null @@ -1,141 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.audit.query; - -import java.util.Date; - -import org.kie.api.runtime.manager.audit.ProcessInstanceLog; -import org.kie.internal.process.CorrelationKey; - -public interface ProcessInstanceLogQueryBuilder extends AuditLogQueryBuilder { - - /** - * Specify one more statuses (in the form of an int) as criteria. - * @param status one or more int statuses - * @return The current instance of this query builder - */ - public ProcessInstanceLogQueryBuilder status(int... status); - - /** - * Specify one or more (process instance) outcomes as a criteria. - * @param outcome one or more string outcomes - * @return The current instance of this query builder - */ - public ProcessInstanceLogQueryBuilder outcome(String... outcome); - - /** - * Specify one or more (process instance) durations as a criteria. - *

- * This duration is in milliseconds. - * @param duration one or more long durations - * @return The current instance of this query builder - */ - public ProcessInstanceLogQueryBuilder duration(long... duration); - - /** - * Specify the begin (minimum) of a range to be used as a criteria on the - * (process instance) duration field - * @param durationMin the begin (minimum) of the long range - * @return The current instance of this query builder - */ - public ProcessInstanceLogQueryBuilder durationMin(long durationMin); - - /** - * Specify the end (maximum) of a range to be used as a criteria on the - * (process instance) duration field - * @param durationMax the end (maximum) of the long range - * @return The current instance of this query builder - */ - public ProcessInstanceLogQueryBuilder durationMax(long durationMax); - - /** - * Specify one or more identiies (who started the process instance) as a criteria - * @param identity one or more string identities - * @return The current instance of this query builder - */ - public ProcessInstanceLogQueryBuilder identity(String... identity); - - /** - * Specify one or more process versions as a criteria - * @param version one or more string process versions - * @return The current instance of this query builder - */ - public ProcessInstanceLogQueryBuilder processVersion(String... version); - - /** - * Specify one or more process names as a criteria - * @param processName one or more string process names - * @return The current instance of this query builder - */ - public ProcessInstanceLogQueryBuilder processName(String... processName); - - /** - * Specify one or more (process instance) start dates as a criteria - * @param date one or more {@link Date} start dates - * @return The current instance of this query builder - */ - public ProcessInstanceLogQueryBuilder startDate(Date... date); - - /** - * Specify the begin of a date range to be used as a criteria on the start date field. - * The date range includes the date specified. - * @param rangeStart the start (early end) of the date range - * @return The current query builder instance - */ - public ProcessInstanceLogQueryBuilder startDateRangeStart(Date rangeStart); - - /** - * Specify the end of a date range to be used as a criteria on the start date field. - * The date range includes this date. - * @param rangeEnd the end (later end) of the date range - * @return The current query builder instance - */ - public ProcessInstanceLogQueryBuilder startDateRangeEnd(Date rangeEnd); - - /** - * Specify one or more (process instance) end dates as a criteria - * @param date one or more {@link Date} end dates - * @return The current instance of this query builder - */ - public ProcessInstanceLogQueryBuilder endDate(Date... date); - - /** - * Specify the begin of a date range to be used as a criteria on the end date field. - * The date range includes this date. - * @param rangeStart the begin (later end) of the date range - * @return The current query builder instance - */ - public ProcessInstanceLogQueryBuilder endDateRangeStart(Date rangeStart); - - /** - * Specify the end of a date range to be used as a criteria on the end date field. - * The date range includes this date. - * @param rangeEnd the end (later end) of the date range - * @return The current query builder instance - */ - public ProcessInstanceLogQueryBuilder endDateRangeEnd(Date rangeEnd); - - /** - * Specify one or more process correlation keys as a criteria - * @param correlationKeys one or more correlation keys - * @return The current instance of this query builder - */ - public ProcessInstanceLogQueryBuilder correlationKey(CorrelationKey... correlationKeys); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/VariableInstanceLogDeleteBuilder.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/VariableInstanceLogDeleteBuilder.java deleted file mode 100644 index 29e6cb4d711..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/VariableInstanceLogDeleteBuilder.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.audit.query; - - -public interface VariableInstanceLogDeleteBuilder extends AuditDateDeleteBuilder{ - - /** - * Specify one or more external ids to use as a criteria. In some cases, - * the external id is the deployment unit id or runtime manager id. - * @param externalId one or more string external ids - * @return The current query builder instance - */ - public VariableInstanceLogDeleteBuilder externalId(String... externalId); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/VariableInstanceLogQueryBuilder.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/VariableInstanceLogQueryBuilder.java deleted file mode 100644 index 877f354ad9d..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/audit/query/VariableInstanceLogQueryBuilder.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.audit.query; - -import java.util.Date; - -import org.kie.api.runtime.manager.audit.VariableInstanceLog; - -public interface VariableInstanceLogQueryBuilder extends AuditLogQueryBuilder { - - /** - * Specify one or more dates as criteria in the query. - * @param date one or more dates - * @return The current query builder instance - */ - public VariableInstanceLogQueryBuilder date(Date... date); - - /** - * Specify the begin of a date range to be used as a criteria on the date field. - * The date range includes the date specified. - * @param rangeStart the start (early end) of the date range - * @return The current query builder instance - */ - public VariableInstanceLogQueryBuilder dateRangeStart(Date rangeStart); - - /** - * Specify the end of a date range to be used as a criteria on the date field. - * The date range includes this date. - * @param rangeEnd the end (later end) of the date range - * @return The current query builder instance - */ - public VariableInstanceLogQueryBuilder dateRangeEnd(Date rangeEnd); - - /** - * Specify one or more variable instance ids to use as a criteria. - * @param variableInstanceId one or more string variable instance ids - * @return The current query builder instance - */ - public VariableInstanceLogQueryBuilder variableInstanceId(String... variableInstanceId); - - /** - * Specify one or more variable ids to use as a criteria. - * @param variableId one or more string variable ids - * @return The current query builder instance - */ - public VariableInstanceLogQueryBuilder variableId(String... variableId); - - /** - * Specify one or more variable values to use as a criteria. - * @param value one or more string values - * @return The current query builder instance - */ - public VariableInstanceLogQueryBuilder value(String... value); - - /** - * Specify one or more old (previous) variable values to use as a criteria. - * @param oldVvalue one or more string old values - * @return The current query builder instance - */ - public VariableInstanceLogQueryBuilder oldValue(String... oldVvalue); - - /** - * Specify the value that variable instance logs should have - * @param variableId the String variable id - * @param value the String value of the variable - * @return The current query builder instance - */ - public VariableInstanceLogQueryBuilder variableValue(String variableId, String value); - - /** - * Specify one or more external ids to use as a criteria. In some cases, - * the external id is the deployment unit id or runtime manager id. - * @param externalId one or more string external ids - * @return The current query builder instance - */ - public VariableInstanceLogQueryBuilder externalId(String... externalId); - - /** - * Only retrieve the most recent ("last") variable instance logs per variable - *

- * When using this, please make sure that this criteria intersects other criteria. - *

- * Otherwise, this criteria will have no effect at all. - * @return The current query builder instance - */ - public VariableInstanceLogQueryBuilder last(); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/context/CaseContext.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/context/CaseContext.java deleted file mode 100644 index f8e404050e3..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/context/CaseContext.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.context; - -import org.kie.api.runtime.manager.Context; - -/** - * Context implementation to deliver capabilities to find proper RuntimeEngine - * instances based on case identifier. Use by strategy: - *
    - *
  • PerCase
  • - *
- * To obtain instances of this context use one of the following static methods: - *
    - *
  • get(String) to get context for case
  • - *
- * - */ -public class CaseContext implements Context { - - private String caseIdentifier; - - public CaseContext(String caseIdentifier) { - this.caseIdentifier = caseIdentifier; - } - - @Override - public String getContextId() { - - return caseIdentifier; - } - - /** - * Returns new instance of CaseContext with case identifier - * @param caseIdentifier unique case identifier - * @return - */ - public static CaseContext get(String caseIdentifier) { - return new CaseContext(caseIdentifier); - } -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/context/CorrelationKeyContext.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/context/CorrelationKeyContext.java deleted file mode 100644 index 469c6f120c8..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/context/CorrelationKeyContext.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.context; - -import org.kie.api.runtime.manager.Context; -import org.kie.internal.process.CorrelationKey; - -/** - * Context implementation to deliver capabilities to find proper RuntimeEngine - * instances based on correlation key instead of process instance id. Use by strategy: - *
    - *
  • PerProcessInstance
  • - *
- * To obtain instances of this context use one of the following static methods: - *
    - *
  • get() to get empty context when starting process instances
  • - *
  • get(CorrelationKey) to get context for specific process instance
  • - *
- * - */ -public class CorrelationKeyContext implements Context { - - private CorrelationKey correlationKey; - - public CorrelationKeyContext(CorrelationKey key) { - this.correlationKey = key; - } - - @Override - public CorrelationKey getContextId() { - - return correlationKey; - } - - /** - * Returns new instance of CorrelationKeyContext without correlation key. - * Used for starting new instances of the process. - * @return - */ - public static CorrelationKeyContext get() { - return new CorrelationKeyContext(null); - } - - /** - * Returns new instance of CorrelationKeyContext with correlation key of already existing process instance - * @param key actual correlation key of process instance - * @return - */ - public static CorrelationKeyContext get(CorrelationKey key) { - return new CorrelationKeyContext(key); - } -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/context/EmptyContext.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/context/EmptyContext.java deleted file mode 100644 index 7c2425143e9..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/context/EmptyContext.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.context; - -import org.kie.api.runtime.manager.Context; - -/** - * Default implementation of Context interface that does not bring any specifics - * to the RuntimeManager and is usually used for instances of manager that does not deal with - * contextual information: - *
    - *
  • Singleton
  • - *
  • PerRequest
  • - *
- * To obtain instances of this context use static get() method. - */ -public class EmptyContext implements Context { - - protected static final String CONTEXT_ID = "EmptyContext"; - - protected static final Context INSTANCE = new EmptyContext(); - - protected EmptyContext() { - - } - @Override - public String getContextId() { - - return CONTEXT_ID; - } - - /** - * Returns instances of the empty context. - * @return - */ - public static Context get() { - return INSTANCE; - } -} diff --git a/kie-internal/src/main/java/org/kie/internal/runtime/manager/context/ProcessInstanceIdContext.java b/kie-internal/src/main/java/org/kie/internal/runtime/manager/context/ProcessInstanceIdContext.java deleted file mode 100644 index d9e1ca22e5b..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/runtime/manager/context/ProcessInstanceIdContext.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.runtime.manager.context; - -import org.kie.api.runtime.manager.Context; - -/** - * Process instance id aware implementation of the Context interface. - * It's main responsibility is to be the data holder between caller and runtime manager - * to obtain proper instances of RuntimeEngine.
- * Used by strategy: - *
    - *
  • PerProcessInstance
  • - *
- * To obtain instances of this context use one of the following static methods: - *
    - *
  • get() to get empty context when starting process instances
  • - *
  • get(Long) to get context for specific process instance
  • - *
- */ -public class ProcessInstanceIdContext implements Context { - - private String processInstanceId; - - public ProcessInstanceIdContext(String processInstanceId) { - this.processInstanceId = processInstanceId; - } - - @Override - public String getContextId() { - return processInstanceId; - } - - public void setContextId(String id) { - this.processInstanceId = id; - } - - /** - * Returns new instance of ProcessInstanceIdContext without process instance id. - * Used for starting new instances of the process. - * @return - */ - public static ProcessInstanceIdContext get() { - return new ProcessInstanceIdContext(null); - } - - /** - * Returns new instance of ProcessInstanceIdContext with id of already existing process instance - * @param processInstanceId actual identifier of process instance - * @return - */ - public static ProcessInstanceIdContext get(String processInstanceId) { - return new ProcessInstanceIdContext(processInstanceId); - } - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/AuditTask.java b/kie-internal/src/main/java/org/kie/internal/task/api/AuditTask.java deleted file mode 100644 index f1dd9ecad50..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/AuditTask.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.Date; - -public interface AuditTask { - long getTaskId(); - - void setTaskId(long taskId); - - String getStatus(); - - void setStatus(String status); - - Date getActivationTime(); - - void setActivationTime(Date activationTime); - - String getName(); - - void setName(String name); - - String getDescription(); - - void setDescription(String description); - - int getPriority(); - - void setPriority(int priority); - - String getCreatedBy(); - - void setCreatedBy(String createdBy); - - Date getCreatedOn(); - - void setCreatedOn(Date createdOn); - - Date getDueDate(); - - void setDueDate(Date dueDate); - - long getProcessInstanceId(); - - void setProcessInstanceId(String processInstanceId); - - String getProcessId(); - - void setProcessId(String processId); - - long getProcessSessionId(); - - void setProcessSessionId(long processSessionId); - - long getParentId(); - - void setParentId(long parentId); - - String getActualOwner(); - - void setActualOwner(String actualOwner); - - String getDeploymentId(); - - void setDeploymentId(String deploymentId); - - long getWorkItemId(); - - void setWorkItemId(long workItemId); - - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/ContentMarshallerContext.java b/kie-internal/src/main/java/org/kie/internal/task/api/ContentMarshallerContext.java deleted file mode 100644 index c8d03816faf..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/ContentMarshallerContext.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import org.kie.api.runtime.Environment; - -public class ContentMarshallerContext { - - private Environment environment; - private ClassLoader classloader; - - public ContentMarshallerContext() { - - } - - public ContentMarshallerContext(Environment environment, ClassLoader classloader) { - this.environment = environment; - this.classloader = classloader; - } - - public Environment getEnvironment() { - return environment; - } - public void setEnvironment(Environment environment) { - this.environment = environment; - } - public ClassLoader getClassloader() { - return classloader; - } - public void setClassloader(ClassLoader classloader) { - this.classloader = classloader; - } - - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/EventService.java b/kie-internal/src/main/java/org/kie/internal/task/api/EventService.java deleted file mode 100644 index c865736248c..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/EventService.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.List; - -public interface EventService { - - void registerTaskEventListener(T listener); - - List getTaskEventListeners(); - - void clearTaskEventListeners(); - - void removeTaskEventListener(T listener); -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/InternalTaskService.java b/kie-internal/src/main/java/org/kie/internal/task/api/InternalTaskService.java deleted file mode 100644 index c56dbe8442d..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/InternalTaskService.java +++ /dev/null @@ -1,218 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.kie.api.task.TaskService; -import org.kie.api.task.model.Attachment; -import org.kie.api.task.model.Content; -import org.kie.api.task.model.Group; -import org.kie.api.task.model.I18NText; -import org.kie.api.task.model.OrganizationalEntity; -import org.kie.api.task.model.Status; -import org.kie.api.task.model.Task; -import org.kie.api.task.model.TaskSummary; -import org.kie.api.task.model.User; -import org.kie.internal.query.QueryFilter; -import org.kie.internal.task.api.model.ContentData; -import org.kie.internal.task.api.model.FaultData; -import org.kie.internal.task.api.model.SubTasksStrategy; -import org.kie.internal.task.api.model.TaskDef; -import org.kie.internal.task.api.model.TaskEvent; -import org.kie.internal.task.query.TaskSummaryQueryBuilder; - -/** - * The Task Service Entry Point serves as - * facade of all the other services, providing a single entry point - * to access to all the services - */ -public interface InternalTaskService extends TaskService { - - List getTasksOwned(String userId, List status, QueryFilter filter); - - List getTasksAssignedAsPotentialOwner(String userId, List groupIds, List status, QueryFilter filter); - - void addGroup(Group group); - - void addUser(User user); - - int archiveTasks(List tasks); - - void deleteFault(long taskId, String userId); - - void deleteOutput(long taskId, String userId); - - void deployTaskDef(TaskDef def); - - List getActiveTasks(); - - List getActiveTasks(Date since); - - List getAllTaskDef(String filter); - - List getArchivedTasks(); - - List getCompletedTasks(); - - List getCompletedTasks(Date since); - - List getCompletedTasksByProcessId(Long processId); - - Group getGroupById(String groupId); - - List getGroups(); - - List getSubTasksAssignedAsPotentialOwner(long parentId, String userId); - - List getSubTasksByParent(long parentId); - - int getPendingSubTasksByParent(long parentId); - - TaskDef getTaskDefById(String id); - - List getTasksAssignedAsPotentialOwnerByExpirationDate(String userId, List statuses, Date expirationDate); - - List getTasksAssignedAsPotentialOwnerByExpirationDateOptional(String userId, List statuses, Date expirationDate); - - List getTasksOwnedByExpirationDate(String userId, List statuses, Date expirationDate); - - List getTasksOwnedByExpirationDateOptional(String userId, List statuses, Date expirationDate); - - List getTasksAssignedAsExcludedOwner(String userId); - - List getTasksAssignedAsPotentialOwner(String userId, List groupIds); - - List getTasksAssignedAsPotentialOwnerByStatusByGroup(String userId, List groupIds, List status); - - List getTasksAssignedAsRecipient(String userId); - - List getTasksAssignedAsTaskInitiator(String userId); - - List getTasksAssignedAsTaskStakeholder(String userId); - - List getTasksOwnedByExpirationDateBeforeSpecifiedDate(String userId, List status, Date date); - - List getTasksByStatusByProcessInstanceIdByTaskName(String processInstanceId, List status, String taskName); - - Map> getPotentialOwnersForTaskIds(List taskIds); - - User getUserById(String userId); - - List getUsers(); - - long addTask(Task task, ContentData data); - - void remove(long taskId, String userId); - - void removeGroup(String groupId); - - int removeTasks(List tasks); - - void removeUser(String userId); - - void setFault(long taskId, String userId, FaultData fault); - - void setOutput(long taskId, String userId, Object outputContentData); - - void setPriority(long taskId, int priority); - - void setTaskNames(long taskId, List taskNames); - - void undeployTaskDef(String id); - - List getTaskEventsById(long taskId); - - UserInfo getUserInfo(); - - void setUserInfo(UserInfo userInfo); - - void addUsersAndGroups(Map users, Map groups); - - int removeAllTasks(); - - long addContent(long taskId, Content content); - - long setDocumentContentFromUser(long taskId, String userId, byte [] byteContent); - - long addContent(long taskId, Map params); - - long addOutputContentFromUser(long taskId, String userId, Map params); - - Content getContentByIdForUser(long contentId, String userId ); - - Map getOutputContentMapForUser(long taskId, String userId); - - void deleteContent(long taskId, long contentId); - - List getAllContentByTaskId(long taskId); - - long addAttachment(long taskId, Attachment attachment, Content content); - - void deleteAttachment(long taskId, long attachmentId); - - List getAllAttachmentsByTaskId(long taskId); - - void removeTaskEventsById(long taskId); - - OrganizationalEntity getOrganizationalEntityById(String entityId); - - void setDescriptions(long taskId, List descriptions); - - void setSkipable(long taskId, boolean skipable); - - void setSubTaskStrategy(long taskId, SubTasksStrategy strategy); - - int getPriority(long taskId); - - Date getExpirationDate(long taskId); - - List getDescriptions(long taskId); - - boolean isSkipable(long taskId); - - SubTasksStrategy getSubTaskStrategy(long taskId); - - Task getTaskInstanceById(long taskId); - - int getCompletedTaskByUserId(String userId); - - int getPendingTaskByUserId(String userId); - - List getTasksAssignedByGroup(String groupId); - - List getTasksAssignedByGroups(List groupIds); - - void addMarshallerContext(String ownerId, ContentMarshallerContext context); - - void removeMarshallerContext(String ownerId); - - ContentMarshallerContext getMarshallerContext(Task task); - - TaskSummaryQueryBuilder taskSummaryQuery(String userId); - - List getTasksAssignedAsBusinessAdministratorByStatus(String userId, String language ,List statuses); - - void executeReminderForTask(long taskId,String fromUser); - - long addContentFromUser(long taskId, String userId, Map params); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskAdminService.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskAdminService.java deleted file mode 100644 index 1b1fc0b44e9..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskAdminService.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.Date; -import java.util.List; - -import org.kie.api.task.model.TaskSummary; - - -/** - * The Task Admintration Service is intended to provide - * administrative functions such as: - * - Remove and Archive Tasks - - */ -public interface TaskAdminService { - - public List getActiveTasks(); - - public List getActiveTasks(Date since); - - public List getCompletedTasks(); - - public List getCompletedTasks(Date since); - - public List getCompletedTasksByProcessId(Long processId); - - public int archiveTasks(List tasks); - - public List getArchivedTasks(); - - public int removeTasks(List tasks); - - public int removeAllTasks(); -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskAttachmentService.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskAttachmentService.java deleted file mode 100644 index d30721014fe..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskAttachmentService.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.List; - -import org.kie.api.task.model.Attachment; -import org.kie.api.task.model.Content; - -/** - * The Task Attachment Service will deal with all the - * functionality related with Task Attachments. Different - * implementations can be provided to handle the Task Attachments. - */ - -public interface TaskAttachmentService { - - long addAttachment(long taskId, Attachment attachment, Content content); - - void deleteAttachment(long taskId, long attachmentId); - - List getAllAttachmentsByTaskId(long taskId); - - Attachment getAttachmentById(long attachId); -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskCommentService.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskCommentService.java deleted file mode 100644 index 5b46b7444be..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskCommentService.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.List; - -import org.kie.api.task.model.Comment; - -/** - * The Task Comment Service will handle all the - * operations related with the Comments associated with - * a Task - */ -public interface TaskCommentService { - - long addComment(long taskId, Comment comment); - - void deleteComment(long taskId, long commentId); - - List getAllCommentsByTaskId(long taskId); - - Comment getCommentById(long commentId); -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskContentService.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskContentService.java deleted file mode 100644 index 7e4840dd77a..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskContentService.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.List; -import java.util.Map; - -import org.kie.api.task.model.Content; -import org.kie.api.task.model.Task; - -/** - * The Task Content Service is intended to handle - * the information which is stored inside a Task. - * The information inside the Task Content represents - * the information required for the Task to be completed. - * This information can be divided into: - * - Task Input: The data used by the Human Actor - * as a context to do the job - * - Task Output: The data entered by the Human Actor - * as the result of the work that is being done. - */ - -public interface TaskContentService { - - long setDocumentContent(long taskId, Content content); - - long addOutputContent(long taskId, Map params); - - void deleteDocumentContent(long taskId, long contentId); - - List getAllContentByTaskId(long taskId); - - Content getContentById(long contentId); - - void addMarshallerContext(String ownerId, ContentMarshallerContext context); - - void removeMarshallerContext(String ownerId); - - ContentMarshallerContext getMarshallerContext(Task task); - - Task loadTaskVariables(Task task); -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskContext.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskContext.java deleted file mode 100644 index f8ad954910a..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskContext.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import org.kie.api.runtime.Context; -import org.kie.api.task.UserGroupCallback; - -public interface TaskContext extends Context, org.kie.api.task.TaskContext { - - TaskPersistenceContext getPersistenceContext(); - - void setPersistenceContext(TaskPersistenceContext context); - - UserGroupCallback getUserGroupCallback(); - - void setUserId(String userId); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskDeadlinesService.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskDeadlinesService.java deleted file mode 100644 index 5582791f04f..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskDeadlinesService.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.Arrays; -import java.util.List; - -import org.kie.api.task.model.Status; -import org.kie.internal.task.api.model.Deadline; - -/** - * The Task Deadlines Service is intended to handle - * all the Deadlines associated with a Task - */ -public interface TaskDeadlinesService { - - public enum DeadlineType { - START(Status.Created, Status.Ready, Status.Reserved), - END(Status.Created, Status.Ready, Status.Reserved, Status.InProgress, Status.Suspended); - private List validStatuses; - - private DeadlineType(Status... statuses) { - this.validStatuses = Arrays.asList(statuses); - } - - public boolean isValidStatus(Status status) { - return this.validStatuses.contains(status); - } - - } - - public void schedule(long taskId, long deadlineId, long delay, DeadlineType type); - - public void unschedule(long taskId, DeadlineType type); - - void unschedule(long taskId, Deadline deadline, DeadlineType type); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskDefService.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskDefService.java deleted file mode 100644 index c8182437945..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskDefService.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.List; - -import org.kie.internal.task.api.model.TaskDef; - -/** - * Experimental: - * The Task Definition Service is intended to keep - * meta information about a Task. This meta information - * can be used as a Task Template, to reuse the same - * template in different places without redefining the - * Task Structure - */ -public interface TaskDefService { - - public void deployTaskDef(TaskDef def); - - public List getAllTaskDef(String filter); - - public TaskDef getTaskDefById(String id); - - public void undeployTaskDef(String id); -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskEvent.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskEvent.java deleted file mode 100644 index e7bf0130a64..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - - -public interface TaskEvent extends org.kie.api.task.TaskEvent { - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskEventsService.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskEventsService.java deleted file mode 100644 index 707736bf9b7..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskEventsService.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.List; - -import org.kie.internal.task.api.model.TaskEvent; - - -/** - * The Task Events Service is intended to - * provide all the functionality required to handle - * the events that are being emitted by the module - */ -public interface TaskEventsService { - - List getTaskEventsById(long taskId); - - void removeTaskEventsById(long taskId); - - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskIdentityService.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskIdentityService.java deleted file mode 100644 index 25692a96659..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskIdentityService.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.List; - -import org.kie.api.task.model.Group; -import org.kie.api.task.model.OrganizationalEntity; -import org.kie.api.task.model.User; - -/** - * The Task Identity Service provides all the - * functionality related with the Organizational Entities - * that will be handled internally by jBPM. This methods - * will allow us to create the Mappings against external - * identity directories to the internal inforamtion required - * by jBPM. - */ -public interface TaskIdentityService { - - public void addUser(User user); - - public void addGroup(Group group); - - public void removeGroup(String groupId); - - public void removeUser(String userId); - - public List getUsers(); - - public List getGroups(); - - public User getUserById(String userId); - - public Group getGroupById(String groupId); - - public OrganizationalEntity getOrganizationalEntityById(String entityId); - - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskInstanceService.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskInstanceService.java deleted file mode 100644 index c880255e827..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskInstanceService.java +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.kie.api.runtime.CommandExecutor; -import org.kie.api.task.model.Content; -import org.kie.api.task.model.I18NText; -import org.kie.api.task.model.OrganizationalEntity; -import org.kie.api.task.model.Task; -import org.kie.internal.task.api.model.ContentData; -import org.kie.internal.task.api.model.FaultData; -import org.kie.internal.task.api.model.Operation; -import org.kie.internal.task.api.model.SubTasksStrategy; - -/** - * The Task Instance Service is in charge of - * handling all the actions required to interact with a - * Task Instance. All the operations described in the WS-HT specification - * related with the Task Lifecycle are implemented here. - */ -public interface TaskInstanceService extends CommandExecutor { - - /* - * LIFECYCLE METHODS - */ - - default void fireEvent(Operation operation, long taskId) {} - - default void fireEvent(Operation operation, Task task) {} - - long addTask(Task task, Map params); - - long addTask(Task task, ContentData data); - - void activate(long taskId, String userId); - - void claim(long taskId, String userId); - - void claim(long taskId, String userId, List groupIds); - - void claimNextAvailable(String userId); - - void claimNextAvailable(String userId, List groupIds); - - void complete(long taskId, String userId, Map data); - - void delegate(long taskId, String userId, String targetUserId); - - void exit(long taskId, String userId); - - void fail(long taskId, String userId, Map faultData); - - void forward(long taskId, String userId, String targetEntityId); - - void release(long taskId, String userId); - - void remove(long taskId, String userId); - - void resume(long taskId, String userId); - - void skip(long taskId, String userId); - - void start(long taskId, String userId); - - void stop(long taskId, String userId); - - void suspend(long taskId, String userId); - - void nominate(long taskId, String userId, List potentialOwners); - - void setFault(long taskId, String userId, FaultData fault); - - void setOutput(long taskId, String userId, Object outputContentData); - - void deleteFault(long taskId, String userId); - - void deleteOutput(long taskId, String userId); - - void setPriority(long taskId, int priority); - - void setTaskNames(long taskId, List taskNames); - - void setExpirationDate(long taskId, Date date); - - public void setDescriptions(long taskId, List descriptions); - - public void setSkipable(long taskId, boolean skipable); - - void setSubTaskStrategy(long taskId, SubTasksStrategy strategy); - - int getPriority(long taskId); - - Date getExpirationDate(long taskId); - - List getDescriptions(long taskId); - - boolean isSkipable(long taskId); - - SubTasksStrategy getSubTaskStrategy(long taskId); - - void setName(long taskId, String name); - - void setDescription(long taskId, String description); - - void setSubject(long taskId, String subject); - - long addOutputContentFromUser(long taskId, String userId, Map params); - - Content getContentByIdForUser( long contentId, String userId ); - - Map getContentMapForUser( Long taskId, String userId ); - - - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskModelFactory.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskModelFactory.java deleted file mode 100644 index f0536b70af3..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskModelFactory.java +++ /dev/null @@ -1,107 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import org.kie.api.task.model.Attachment; -import org.kie.api.task.model.Comment; -import org.kie.api.task.model.Content; -import org.kie.api.task.model.Email; -import org.kie.api.task.model.Group; -import org.kie.api.task.model.I18NText; -import org.kie.api.task.model.OrganizationalEntity; -import org.kie.api.task.model.PeopleAssignments; -import org.kie.api.task.model.Task; -import org.kie.api.task.model.TaskData; -import org.kie.api.task.model.TaskSummary; -import org.kie.api.task.model.User; -import org.kie.internal.task.api.model.BooleanExpression; -import org.kie.internal.task.api.model.ContentData; -import org.kie.internal.task.api.model.Deadline; -import org.kie.internal.task.api.model.DeadlineSummary; -import org.kie.internal.task.api.model.Deadlines; -import org.kie.internal.task.api.model.Delegation; -import org.kie.internal.task.api.model.EmailNotification; -import org.kie.internal.task.api.model.EmailNotificationHeader; -import org.kie.internal.task.api.model.Escalation; -import org.kie.internal.task.api.model.FaultData; -import org.kie.internal.task.api.model.Language; -import org.kie.internal.task.api.model.Notification; -import org.kie.internal.task.api.model.Reassignment; -import org.kie.internal.task.api.model.TaskDef; - -public interface TaskModelFactory { - - Attachment newAttachment(); - - BooleanExpression newBooleanExpression(); - - Comment newComment(); - - ContentData newContentData(); - - Content newContent(); - - Deadline newDeadline(); - - DeadlineSummary newDeadlineSummary(); - - Deadlines newDeadlines(); - - Delegation newDelegation(); - - EmailNotificationHeader newEmailNotificationHeader(); - - EmailNotification newEmialNotification(); - - Escalation newEscalation(); - - FaultData newFaultData(); - - Group newGroup(); - - Group newGroup(String id); - - I18NText newI18NText(); - - Language newLanguage(); - - Notification newNotification(); - - OrganizationalEntity newOrgEntity(); - - PeopleAssignments newPeopleAssignments(); - - Reassignment newReassignment(); - - TaskData newTaskData(); - - TaskDef newTaskDef(); - - Task newTask(); - - TaskSummary newTaskSummary(); - - User newUser(); - - User newUser(String id); - - Email newEmail(); - - Email newEmail(String id); -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskModelProvider.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskModelProvider.java deleted file mode 100644 index 84086dbbad8..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskModelProvider.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import org.kie.api.internal.utils.KieService; - -public class TaskModelProvider { - - private static class LazyHolder { - private static final TaskModelProviderService provider = KieService.load(TaskModelProviderService.class); - } - - public static TaskModelFactory getFactory() { - return getTaskModelProviderService().getTaskModelFactory(); - } - - public static TaskModelProviderService getTaskModelProviderService() { - return LazyHolder.provider; - } - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskModelProviderService.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskModelProviderService.java deleted file mode 100644 index d8ae06a7105..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskModelProviderService.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import org.kie.api.internal.utils.KieService; - -public interface TaskModelProviderService extends KieService { - - TaskModelFactory getTaskModelFactory(); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskPersistenceContext.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskPersistenceContext.java deleted file mode 100644 index bd01b941ca0..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskPersistenceContext.java +++ /dev/null @@ -1,183 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.kie.api.task.UserGroupCallback; -import org.kie.api.task.model.Attachment; -import org.kie.api.task.model.Comment; -import org.kie.api.task.model.Content; -import org.kie.api.task.model.Email; -import org.kie.api.task.model.Group; -import org.kie.api.task.model.OrganizationalEntity; -import org.kie.api.task.model.Task; -import org.kie.api.task.model.TaskSummary; -import org.kie.api.task.model.User; -import org.kie.internal.task.api.model.ContentData; -import org.kie.internal.task.api.model.Deadline; -import org.kie.internal.task.api.model.FaultData; - -public interface TaskPersistenceContext { - - Task findTask(Long taskId); - - Task persistTask(Task task); - - Task updateTask(Task task); - - Task removeTask(Task task); - - Group findGroup(String groupId); - - Group persistGroup(Group group); - - Group updateGroup(Group group); - - Group removeGroup(Group group); - - User findUser(String userId); - - User persistUser(User user); - - User updateUser(User user); - - User removeUser(User user); - - OrganizationalEntity findOrgEntity(String orgEntityId); - - OrganizationalEntity persistOrgEntity(OrganizationalEntity orgEntity); - - OrganizationalEntity updateOrgEntity(OrganizationalEntity orgEntity); - - OrganizationalEntity removeOrgEntity(OrganizationalEntity orgEntity); - - Content findContent(Long contentId); - - Content persistContent(Content content); - - Content updateContent(Content content); - - Content removeContent(Content content); - - Long findTaskIdByContentId(Long contentId); - - Attachment findAttachment(Long attachmentId); - - Attachment persistAttachment(Attachment attachment); - - Attachment updateAttachment(Attachment attachment); - - Attachment removeAttachment(Attachment attachment); - - Attachment removeAttachmentFromTask(Task task, long attachmentId); - - Attachment addAttachmentToTask(Attachment attachment, Task task); - - Comment findComment(Long commentId); - - Comment persistComment(Comment comment); - - Comment updateComment(Comment comment); - - Comment removeComment(Comment comment); - - Comment removeCommentFromTask(Comment comment, Task task); - - Comment addCommentToTask(Comment comment, Task task); - - Deadline findDeadline(Long deadlineId); - - Deadline persistDeadline(Deadline deadline); - - Deadline updateDeadline(Deadline deadline); - - Deadline removeDeadline(Deadline deadline); - - Task setDocumentToTask(Content content, ContentData contentData, Task task); - - Task setFaultToTask(Content content, FaultData faultData, Task task); - - Task setOutputToTask(Content content, ContentData contentData, Task task); - - - /* - * Query related methods - */ - - T queryWithParametersInTransaction(String queryName, Map params, Class clazz); - - T queryWithParametersInTransaction(String queryName, boolean singleResult, Map params, Class clazz); - - T queryAndLockWithParametersInTransaction(String queryName, Map params, boolean singleResult, Class clazz); - - T queryInTransaction(String queryName, Class clazz); - - T queryStringInTransaction(String queryString, Class clazz ); - - T queryStringWithParametersInTransaction(String queryString, boolean singleResult, Map params, Class clazz ); - - T queryStringWithParametersInTransaction(String queryString, Map params, Class clazz ); - - T queryAndLockStringWithParametersInTransaction(String queryName, Map params, boolean singleResult, Class clazz); - - int executeUpdateString(String updateString); - - int executeUpdate(String queryName, Map params); - - HashMap addParametersToMap(Object ... parameterValues); - - /* - * Following are optional methods that are more like extension to - * default data model to allow flexible add-ons - */ - T persist(T object); - - T find(Class entityClass, Object primaryKey); - - T remove(T entity); - - T merge(T entity); - - /* - * life cycle methods - */ - boolean isOpen(); - - void joinTransaction(); - - void close(); - - /* - * JPA Query methods - */ - - List doTaskSummaryCriteriaQuery(String userId, UserGroupCallback userGroupCallback, Object queryWhere); - - Email findEmail(String emailId); - - Email persistEmail(Email email); - - Email updateEmail(Email email); - - Email removeEmail(Email email); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskQueryService.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskQueryService.java deleted file mode 100644 index af12921562b..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskQueryService.java +++ /dev/null @@ -1,118 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.kie.api.task.model.OrganizationalEntity; -import org.kie.api.task.model.Status; -import org.kie.api.task.model.Task; -import org.kie.api.task.model.TaskSummary; -import org.kie.internal.query.QueryFilter; - - -/** - * The Task Query Service will contain all the methods - * to get information about the current Task Instances. - * Most of the times these methods will be used to build - * User Interfaces, and we should not include any method - * related with Task Statistics here. - */ -public interface TaskQueryService { - - List getTasksAssignedAsPotentialOwner(String userId, List groupIds, List status, QueryFilter filter); - - List getTasksOwned(String userId, List status, QueryFilter filter); - - List getTasksAssignedAsPotentialOwner(String userId, List groupIds); - - List getTasksAssignedAsBusinessAdministrator(String userId, List groupIds); - - List getTasksAssignedAsBusinessAdministratorByStatus(String userId, List groupIds, List status); - - List getTasksAssignedAsExcludedOwner(String userId); - - List getTasksAssignedAsPotentialOwnerByExpirationDate(String userId, List groupIds, List status, Date expirationDate); - - List getTasksAssignedAsPotentialOwnerByExpirationDateOptional(String userId, List groupIds, List status, Date expirationDate); - - List getTasksAssignedAsPotentialOwnerByExpirationDate(String userId, List status, Date expirationDate); - - List getTasksAssignedAsPotentialOwnerByExpirationDateOptional(String userId, List status, Date expirationDate); - - List getTasksAssignedAsPotentialOwner(String userId, List groupIds, int firstResult, int maxResults); - - List getTasksAssignedAsPotentialOwnerByStatus(String userId, List status); - - List getTasksAssignedAsPotentialOwnerByStatusByGroup(String userId, List groupIds, List status); - - List getTasksAssignedAsRecipient(String userId); - - List getTasksAssignedAsTaskInitiator(String userId); - - List getTasksAssignedAsTaskStakeholder(String userId); - - List getTasksAssignedByGroup(String groupId); - - List getTasksAssignedByGroups(List groupsId); - - List getTasksAssignedByGroupsByExpirationDate(List groupIds, Date expirationDate); - - List getTasksAssignedByGroupsByExpirationDateOptional(List groupIds, Date expirationDate); - - List getTasksOwned(String userId); - - List getTasksOwnedByStatus(String userId, List status); - - List getTasksOwnedByExpirationDate(String userId, List status, Date expirationDate); - - List getTasksOwnedByExpirationDateOptional(String userId, List status, Date expirationDate); - - List getTasksOwnedByExpirationDateBeforeSpecifiedDate(String userId, List status, Date date); - - List getSubTasksAssignedAsPotentialOwner(long parentId, String userId); - - List getSubTasksByParent(long parentId); - - List getTasksByStatusByProcessInstanceId(String processInstanceId, List status); - - List getTasksByStatusByProcessInstanceIdByTaskName(String processInstanceId, List status, String taskName); - - int getPendingSubTasksByParent(long parentId); - - Task getTaskByWorkItemId(long workItemId); - - Task getTaskInstanceById(long taskId); - - List getTasksByProcessInstanceId(String processInstanceId); - - Map> getPotentialOwnersForTaskIds(List taskIds); - - int getCompletedTaskByUserId(String userId); - int getPendingTaskByUserId(String userId); - - /** - * - * @param queryWhere - * @return - */ - List query( String userId, Object queryWhere ); -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskStatisticsService.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskStatisticsService.java deleted file mode 100644 index ba95d5b8b92..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskStatisticsService.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -/** - * The Task Statistics Service provides all - * the methods for gathering Task Instance Statistics. - * The Task Statistics methods are provided separately from the - * Task Query Services, because they can include more complex operations than - * simple queries, like aggregations, averages, sums, etc. - */ -public interface TaskStatisticsService { - public int getCompletedTaskByUserId(String userId); - public int getPendingTaskByUserId(String userId); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskVariable.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskVariable.java deleted file mode 100644 index 2f530099727..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskVariable.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.Date; - -/** - * Represents single Task variable entity - * - */ -public interface TaskVariable { - - public enum VariableType { - INPUT, - OUTPUT; - } - - /** - * Returns task id that this variable belongs to - * @return - */ - Long getTaskId(); - - /** - * Returns process instance id that the task this variable belongs to is owned by - * This might be null in case ad hoc tasks - * @return - */ - Long getProcessInstanceId(); - - /** - * Returns process id that the task this variable belongs to is owned by - * This might be null in case ad hoc tasks - * @return - */ - String getProcessId(); - - /** - * Returns name of the variable - * @return - */ - String getName(); - - /** - * Returns value of this variable - its string representation that can be queried - * @return - */ - String getValue(); - - /** - * Return type of the variable - either input or output - * @return - */ - VariableType getType(); - - /** - * Returns last time this variable was modified - * @return - */ - Date getModificationDate(); - - void setTaskId(Long taskId); - - void setProcessInstanceId(String processInstanceId); - - void setProcessId(String processId); - - void setName(String name); - - void setValue(String value); - - void setType(VariableType type); - - void setModificationDate(Date modificationDate); -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/TaskVariableIndexer.java b/kie-internal/src/main/java/org/kie/internal/task/api/TaskVariableIndexer.java deleted file mode 100644 index 412ff9fe62c..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/TaskVariableIndexer.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import org.kie.internal.utils.VariableIndexer; - -/** - * Dedicated type for custom implementations of VariableIndexer for tasks - user tasks - * - */ -public interface TaskVariableIndexer extends VariableIndexer { - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/UserGroupCallback.java b/kie-internal/src/main/java/org/kie/internal/task/api/UserGroupCallback.java deleted file mode 100644 index dc7257d154e..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/UserGroupCallback.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -public interface UserGroupCallback extends org.kie.api.task.UserGroupCallback { - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/UserInfo.java b/kie-internal/src/main/java/org/kie/internal/task/api/UserInfo.java deleted file mode 100644 index fccb74bce53..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/UserInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api; - -import java.util.Iterator; - -import org.kie.api.task.model.Group; -import org.kie.api.task.model.OrganizationalEntity; - -public interface UserInfo extends org.kie.api.task.UserInfo { - - String getDisplayName(OrganizationalEntity entity); - - Iterator getMembersForGroup(Group group); - - boolean hasEmail(Group group); - - String getEmailForEntity(OrganizationalEntity entity); - - String getLanguageForEntity(OrganizationalEntity entity); - - String getEntityForEmail(String email); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/assignment/Assignment.java b/kie-internal/src/main/java/org/kie/internal/task/api/assignment/Assignment.java deleted file mode 100644 index 82255b03202..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/assignment/Assignment.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.assignment; - -import java.io.Serializable; - -public class Assignment implements Serializable, Comparable{ - - private static final long serialVersionUID = -6569072011166557126L; - - private String user; - - public Assignment(String user) { - super(); - this.user = user; - } - - public String getUser(){ - return this.user; - } - - @Override - public String toString() { - return "Assignment [user=" + user + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((user == null) ? 0 : user.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - Assignment other = (Assignment) obj; - if (user == null) { - if (other.user != null) { - return false; - } - } else if (!user.equals(other.user)) { - return false; - } - return true; - } - - @Override - public int compareTo(Assignment o) { - if (this.user == null) { - return -1; - } - return this.user.compareTo(o.getUser()); - } -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/assignment/AssignmentStrategy.java b/kie-internal/src/main/java/org/kie/internal/task/api/assignment/AssignmentStrategy.java deleted file mode 100644 index 12ee03c7403..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/assignment/AssignmentStrategy.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.assignment; - -import org.kie.api.task.TaskContext; -import org.kie.api.task.model.Task; - -/** - * Task assignment strategy that defines how to select actual owner based on task properties - * such as potential owners, task data etc. Depending on the strategy implementation - * additional source of information might be needed e.g. people availability etc. - * - * Each strategy must uniquely identify itself as it's placed in the registry for further use. - */ -public interface AssignmentStrategy { - - /** - * Returns unique identifier of the strategy - * @return identifier to be used for further look ups - */ - String getIdentifier(); - - /** - * Applies the strategy on given task based on concrete implementation details. - * @param task task that should be assigned - * @param context task context to be able to use various services including PersistenceContext - * @param excludedUser user that should be excluded from the assignment as it's the one who performed operation - * e.g. use who has been assigned to the task and released should not be reassign to it again - * @return returns single Assignment selected for this task or null if none was found - */ - Assignment apply(Task task, TaskContext context, String excludedUser); - - /** - * Optional method that notifies the strategy about task being done (completed, exited, etc). - * Mainly for strategies that do maintain state so tasks that are done are removed from - * assignees' queues - * @param task task that has been done - * @param context task context to be able to use various services including PersistenceContext - */ - default void taskDone(Task task, TaskContext context) { - - }; -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/AccessType.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/AccessType.java deleted file mode 100644 index 3caaedb1650..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/AccessType.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/** - * - */ -package org.kie.internal.task.api.model; - -import jakarta.xml.bind.annotation.XmlType; - -@XmlType -public enum AccessType { - Inline, Url, Unknown -} \ No newline at end of file diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/AllowedToDelegate.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/AllowedToDelegate.java deleted file mode 100644 index df54e9504c6..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/AllowedToDelegate.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/** - * - */ -package org.kie.internal.task.api.model; - -public enum AllowedToDelegate { - Anybody, Nobody, PotentialOwners, Other -} \ No newline at end of file diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/BooleanExpression.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/BooleanExpression.java deleted file mode 100644 index 9eb487b544d..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/BooleanExpression.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.io.Externalizable; - - -public interface BooleanExpression extends Externalizable { - - Long getId(); - - void setId(long id); - - String getType(); - - void setType(String type); - - String getExpression(); - - void setExpression(String expression); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/CommandName.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/CommandName.java deleted file mode 100644 index b80716a8484..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/CommandName.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - - -public enum CommandName { - OperationRequest, - OperationResponse, - - ClaimRequest, - ClaimResponse, - - ClaimNextAvailableRequest, - - StartRequest, - StartResponse, - - StopRequest, - StopResponse, - - ReleaseRequest, - ReleaseResponse, - - SuspendRequest, - SuspendResponse, - - ResumeRequest, - ResumeResponse, - - SkipRequest, - SkipResponse, - - DelegateRequest, - DelegateResponse, - - ForwardRequest, - ForwardResponse, - - CompleteRequest, - CompleteResponse, - - FailRequest, - FailResponse, - - GetTaskRequest, - GetTaskResponse, - - AddTaskRequest, - AddTaskResponse, - - AddAttachmentRequest, - AddAttachmentResponse, - DeleteAttachmentRequest, - DeleteAttachmentResponse, - - SetDocumentContentRequest, - SetDocumentContentResponse, - GetContentRequest, - GetContentResponse, - - AddCommentRequest, - AddCommentResponse, - DeleteCommentRequest, - DeleteCommentResponse, - - QueryTasksOwned, - QueryTasksOwnedWithParticularStatus, - QueryTasksAssignedAsBusinessAdministrator, - QueryTasksAssignedAsExcludedOwner, - QueryTasksAssignedAsPotentialOwner, - QueryTasksAssignedAsPotentialOwnerWithGroup, - QueryTasksAssignedAsPotentialOwnerByGroup, - QueryTasksAssignedAsPotentialOwnerByStatus, - QueryTasksAssignedAsPotentialOwnerByStatusByGroup, - QuerySubTasksAssignedAsPotentialOwner, - QueryGetSubTasksByParentTaskId, - QueryTasksAssignedAsRecipient, - QueryTasksAssignedAsTaskInitiator, - QueryTasksAssignedAsTaskStakeholder, - QueryTaskSummaryResponse, - - QueryTaskByWorkItemId, - QueryTaskByWorkItemIdResponse, - - RegisterForEventRequest, - UnRegisterForEventRequest, - EventTriggerResponse, - - RegisterClient, - - QueryGenericRequest, - QueryGenericResponse, - - NominateTaskRequest, - SetOutputRequest, - SetFaultRequest, - SetPriorityRequest, - DeleteOutputRequest, - DeleteFaultRequest - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/ContentData.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/ContentData.java deleted file mode 100644 index d96635409a2..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/ContentData.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.io.Externalizable; - -public interface ContentData extends Externalizable { - - AccessType getAccessType(); - - void setAccessType(AccessType accessType); - - String getType(); - - void setType(String type); - - byte[] getContent(); - - void setContent(byte[] content); - - Object getContentObject(); - - void setContentObject(Object object); -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/Deadline.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/Deadline.java deleted file mode 100644 index 8478b13a467..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/Deadline.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.io.Externalizable; -import java.util.Date; -import java.util.List; - -import org.kie.api.task.model.I18NText; - - -public interface Deadline extends Externalizable { - - Boolean isEscalated(); - - void setEscalated(Boolean escalated); - - long getId(); - - void setId(long id); - - List getDocumentation(); - - void setDocumentation(List documentation); - - Date getDate(); - - void setDate(Date date); - - List getEscalations(); - - void setEscalations(List escalations); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/DeadlineSummary.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/DeadlineSummary.java deleted file mode 100644 index d3ddcce5dee..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/DeadlineSummary.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.util.Date; - -public interface DeadlineSummary { - - long getTaskId(); - - void setTaskId(long taskId); - - long getDeadlineId(); - - void setDeadlineId(long deadlineId); - - Date getDate(); - - void setDate(Date date); -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/Deadlines.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/Deadlines.java deleted file mode 100644 index d9ee816b6aa..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/Deadlines.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.io.Externalizable; -import java.util.List; - - -public interface Deadlines extends Externalizable { - - List getStartDeadlines(); - - void setStartDeadlines(List startDeadlines); - - List getEndDeadlines(); - - void setEndDeadlines(List endDeadlines); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/Delegation.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/Delegation.java deleted file mode 100644 index 9fb38b17d55..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/Delegation.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.io.Externalizable; -import java.util.List; - -import org.kie.api.task.model.OrganizationalEntity; - - -public interface Delegation extends Externalizable { - - AllowedToDelegate getAllowed(); - - void setAllowed(AllowedToDelegate allowedToDelegate); - - List getDelegates(); - - void setDelegates(List delegates); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/EmailNotification.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/EmailNotification.java deleted file mode 100644 index df72cf22d5f..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/EmailNotification.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.util.Map; - - - -public interface EmailNotification extends Notification { - - - Map getEmailHeaders(); - - void setEmailHeaders(Map emailHeaders); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/EmailNotificationHeader.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/EmailNotificationHeader.java deleted file mode 100644 index c3741a2e8cb..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/EmailNotificationHeader.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/** - * - */ -package org.kie.internal.task.api.model; - -import java.io.Externalizable; - -public interface EmailNotificationHeader extends Externalizable { - - long getId(); - - void setId(long id); - - String getLanguage(); - - void setLanguage(String language); - - String getSubject(); - - void setSubject(String subject); - - String getBody(); - - void setBody(String body); - - String getReplyTo(); - - void setReplyTo(String replyTo); - - String getFrom(); - - void setFrom(String from); - -} \ No newline at end of file diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/Escalation.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/Escalation.java deleted file mode 100644 index 593db31c8f9..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/Escalation.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.io.Externalizable; -import java.util.List; - - -public interface Escalation extends Externalizable { - - long getId(); - - void setId(long id); - - String getName(); - - void setName(String name); - - List getConstraints(); - - void setConstraints(List constraints); - - List getNotifications(); - - void setNotifications(List notifications); - - List getReassignments(); - - void setReassignments(List reassignments); -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/FaultData.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/FaultData.java deleted file mode 100644 index 356eaf1073a..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/FaultData.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - - -public interface FaultData extends ContentData { - - String getFaultName(); - - void setFaultName(String faultName); - - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalAttachment.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalAttachment.java deleted file mode 100644 index 27727644ed2..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalAttachment.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.util.Date; - -import org.kie.api.task.model.Attachment; -import org.kie.api.task.model.Content; -import org.kie.api.task.model.User; - -public interface InternalAttachment extends Attachment { - - void setId(long id); - - void setName(String name); - - AccessType getAccessType(); - - void setAccessType(AccessType accessType); - - void setContentType(String contentType); - - void setAttachedAt(Date attachedAt); - - void setAttachedBy(User attachedBy); - - void setContent(Content content); - - void setSize(int size); - - void setAttachmentContentId(long contentId); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalComment.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalComment.java deleted file mode 100644 index 3354b8fb500..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalComment.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.util.Date; - -import org.kie.api.task.model.Comment; -import org.kie.api.task.model.User; - - -public interface InternalComment extends Comment { - - void setId(long id); - - void setText(String text); - - void setAddedAt(Date addedDate); - - void setAddedBy(User addedBy); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalContent.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalContent.java deleted file mode 100644 index ab36784091c..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalContent.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import org.kie.api.task.model.Content; - -public interface InternalContent extends Content { - - void setId(long id); - - void setContent(byte[] content); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalI18NText.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalI18NText.java deleted file mode 100644 index 2c6cb184783..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalI18NText.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import org.kie.api.task.model.I18NText; - -public interface InternalI18NText extends I18NText { - - void setId(Long id); - - void setLanguage(String language); - - void setText(String text); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalOrganizationalEntity.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalOrganizationalEntity.java deleted file mode 100644 index 3b8f6e716a4..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalOrganizationalEntity.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import org.kie.api.task.model.OrganizationalEntity; - -public interface InternalOrganizationalEntity extends OrganizationalEntity { - - void setId(String id); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalPeopleAssignments.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalPeopleAssignments.java deleted file mode 100644 index 629227cc6ad..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalPeopleAssignments.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.util.List; - -import org.kie.api.task.model.OrganizationalEntity; -import org.kie.api.task.model.PeopleAssignments; -import org.kie.api.task.model.User; - - -public interface InternalPeopleAssignments extends PeopleAssignments { - - void setTaskInitiator(User taskInitiator); - - void setPotentialOwners(List potentialOwners); - - List getExcludedOwners(); - - void setExcludedOwners(List excludedOwners); - - List getTaskStakeholders(); - - void setTaskStakeholders(List taskStakeholders); - - void setBusinessAdministrators(List businessAdministrators); - - List getRecipients(); - - void setRecipients(List recipients); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalTask.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalTask.java deleted file mode 100644 index 60df657f352..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalTask.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.util.List; - -import org.kie.api.task.model.I18NText; -import org.kie.api.task.model.PeopleAssignments; -import org.kie.api.task.model.Task; -import org.kie.api.task.model.TaskData; - -public interface InternalTask extends Task { - - void setId(Long id); - - void setArchived(Boolean archived); - - void setPriority(Integer priority); - - void setNames(List names); - - void setFormName(String formName); - - void setSubjects(List subjects); - - void setDescriptions(List descriptions); - - void setPeopleAssignments(PeopleAssignments peopleAssignments); - - Delegation getDelegation(); - - void setDelegation(Delegation delegation); - - void setTaskData(TaskData taskData); - - Deadlines getDeadlines(); - - void setDeadlines(Deadlines deadlines); - - void setTaskType(String taskType); - - SubTasksStrategy getSubTaskStrategy(); - - void setSubTaskStrategy(SubTasksStrategy subTaskStrategy); - - void setName(String name); - - void setSubject(String subject); - - void setDescription(String description); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalTaskData.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalTaskData.java deleted file mode 100644 index f3372600d1f..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalTaskData.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.kie.api.task.model.Attachment; -import org.kie.api.task.model.Comment; -import org.kie.api.task.model.Status; -import org.kie.api.task.model.TaskData; -import org.kie.api.task.model.User; - -public interface InternalTaskData extends TaskData { - - /** - * Initializes the state of the TaskData, i.e. sets the createdOn, activationTime - * and sets the state to Status.Created. - * - * @return returns the current state of the TaskData - */ - Status initialize(); - - void setStatus(Status status); - - void setPreviousStatus(Status previousStatus); - - void setActualOwner(User actualOwner); - - void setCreatedBy(User createdBy); - - void setCreatedOn(Date createdOn); - - void setActivationTime(Date activationTime); - - void setExpirationTime(Date expirationTime); - - void setSkipable(boolean isSkipable); - - void setWorkItemId(long workItemId); - - void setProcessInstanceId(String processInstanceId); - - void setProcessId(String processId); - - void setDeploymentId(String deploymentId); - - void setProcessSessionId(long processSessionId); - - /** - * Sets the document content data for this task data. It will set the documentContentId from the specified - * documentID, documentAccessType, documentType from the specified - * documentConentData. - * @param documentID id of document content - * @param documentConentData ContentData - */ - void setDocument(long documentID, ContentData documentConentData); - - AccessType getDocumentAccessType(); - - void setDocumentAccessType(AccessType accessType); - - void setDocumentContentId(long documentContentId); - - void setDocumentType(String documentType); - - /** - * Sets the content data for this task data. It will set the outputContentId from the specified - * outputContentId, outputAccessType, outputType from the specified - * outputContentData. - * @param outputContentId id of output content - * @param outputContentData contentData - */ - void setOutput(long outputContentId, ContentData outputContentData); - - AccessType getOutputAccessType(); - - void setOutputAccessType(AccessType outputAccessType); - - void setOutputType(String outputType); - - void setOutputContentId(long outputContentId); - - /** - * Sets the fault data for this task data. It will set the faultContentId from the specified - * faultContentId, faultAccessType, faultType, faultName from the - * specified faultData. - * @param faultContentId id of fault content - * @param faultData FaultData - */ - void setFault(long faultContentId, FaultData faultData); - - void setFaultName(String faultName); - - AccessType getFaultAccessType(); - - void setFaultAccessType(AccessType faultAccessType); - - void setFaultType(String faultType); - - void setFaultContentId(long faultContentId); - - /** - * Adds the specified comment to our list of comments. - * - * @param comment comment to add - */ - void addComment(Comment comment); - - /** - * Removes the Comment specified by the commentId. - * - * @param commentId id of Comment to remove - * @return removed Comment or null if one was not found with the id - */ - Comment removeComment(final long commentId); - - void setComments(List comments); - - /** - * Adds the specified attachment to our list of Attachments. - * - * @param attachment attachment to add - */ - void addAttachment(Attachment attachment); - - /** - * Removes the Attachment specified by the attachmentId. - * - * @param attachmentId id of attachment to remove - * @return removed Attachment or null if one was not found with the id - */ - Attachment removeAttachment(final long attachmentId); - - void setAttachments(List attachments); - - long getParentId(); - - void setParentId(long parentId); - - void setTaskInputVariables(Map taskInputVariables); - - void setTaskOutputVariables(Map taskOutputVariables); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalTaskSummary.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalTaskSummary.java deleted file mode 100644 index d22b14a946d..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/InternalTaskSummary.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.util.Date; -import java.util.List; - -import org.kie.api.task.model.Status; -import org.kie.api.task.model.TaskSummary; -import org.kie.api.task.model.User; - -public interface InternalTaskSummary extends TaskSummary { - - void setId(long id); - - void setProcessInstanceId(String processInstanceId); - - void setName(String name); - - void setSubject(String subject); - - void setDescription(String description); - - void setStatus(Status status); - - void setPriority(int priority); - - void setSkipable(boolean skipable); - - void setActualOwner(User actualOwner); - - void setCreatedBy(User createdBy); - - void setCreatedOn(Date createdOn); - - void setActivationTime(Date activationTime); - - void setExpirationTime(Date expirationTime); - - void setProcessId(String processId); - - void setProcessSessionId(long processSessionId); - - SubTasksStrategy getSubTaskStrategy(); - - void setSubTaskStrategy(SubTasksStrategy subTaskStrategy); - - Long getParentId(); - - void setParentId(long parentId); - - @Deprecated // remove in 7.0 since this field is never filled - void setPotentialOwners(List potentialOwners); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/Language.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/Language.java deleted file mode 100644 index e0b1b84091d..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/Language.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - - -public interface Language { - - String getMapkey(); - - void setMapkey(String language); - - - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/Notification.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/Notification.java deleted file mode 100644 index ab3ac9110d5..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/Notification.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.io.Externalizable; -import java.util.List; - -import org.kie.api.task.model.I18NText; -import org.kie.api.task.model.OrganizationalEntity; - -public interface Notification extends Externalizable { - - Long getId(); - - void setId(long id); - - NotificationType getNotificationType(); - - List getDocumentation(); - - void setDocumentation(List documentation); - - int getPriority(); - - void setPriority(int priority); - - List getRecipients(); - - void setRecipients(List recipients); - - List getBusinessAdministrators(); - - void setBusinessAdministrators(List businessAdministrators); - - List getNames(); - - void setNames(List names); - - List getSubjects(); - - void setSubjects(List subjects); - - List getDescriptions(); - - void setDescriptions(List descriptions); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/NotificationEvent.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/NotificationEvent.java deleted file mode 100644 index d4335dc9e8a..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/NotificationEvent.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.io.Serializable; -import java.util.Map; - -import org.kie.api.task.model.Task; - - -/** - * - */ -public class NotificationEvent implements Serializable{ - private Notification notification; - private Task task; - private Map variables; - - public NotificationEvent(Notification notification, Task task, Map variables) { - this.notification = notification; - this.task = task; - this.variables = variables; - } - - public Notification getNotification() { - return notification; - } - - public void setNotification(Notification notification) { - this.notification = notification; - } - - public Task getTask() { - return task; - } - - public void setTask(Task task) { - this.task = task; - } - - public Map getContent() { - return variables; - } - - public void setContent(Map variables) { - this.variables = variables; - } - - - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/NotificationType.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/NotificationType.java deleted file mode 100644 index 187ea87a4e6..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/NotificationType.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -public enum NotificationType { - Default, Email -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/Operation.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/Operation.java deleted file mode 100644 index c6be1a14fca..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/Operation.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -public enum Operation { - Claim, - Start, - Stop, - Release, - Suspend, - Resume, - Skip, - Delegate, - Forward, - Complete, - Fail, - Register, - Remove, - Activate, - Exit, - Nominate, - Modify, - View; -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/Reassignment.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/Reassignment.java deleted file mode 100644 index fd213ec7beb..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/Reassignment.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.io.Externalizable; -import java.util.List; - -import org.kie.api.task.model.I18NText; -import org.kie.api.task.model.OrganizationalEntity; - -public interface Reassignment extends Externalizable { - - Long getId(); - - void setId(long id); - - List getDocumentation(); - - void setDocumentation(List documentation); - - List getPotentialOwners(); - - void setPotentialOwners(List potentialOwners); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/SubTasksStrategy.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/SubTasksStrategy.java deleted file mode 100644 index 209a283f4f1..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/SubTasksStrategy.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import jakarta.xml.bind.annotation.XmlType; - -@XmlType -public enum SubTasksStrategy{ - NoAction, EndParentOnAllSubTasksEnd, SkipAllSubTasksOnParentSkip -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/TaskDef.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/TaskDef.java deleted file mode 100644 index 39b8dc955f7..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/TaskDef.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.io.Externalizable; - - -public interface TaskDef extends Externalizable { - - long getId(); - - void setId(long id); - - String getName(); - - void setName(String name); - - int getPriority(); - - void setPriority(int priority); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/model/TaskEvent.java b/kie-internal/src/main/java/org/kie/internal/task/api/model/TaskEvent.java deleted file mode 100644 index 22d4fc293a7..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/model/TaskEvent.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.model; - -import java.util.Date; - -public interface TaskEvent { - - public enum TaskEventType{ADDED, UPDATED, STARTED, ACTIVATED, COMPLETED, - STOPPED, EXITED, FAILED, - CLAIMED, SKIPPED, SUSPENDED, CREATED, - FORWARDED, RELEASED, RESUMED, DELEGATED, NOMINATED}; - - long getId(); - - long getTaskId(); - - TaskEventType getType(); - - String getUserId(); - - Date getLogTime(); - - Long getProcessInstanceId(); - - Long getWorkItemId(); - - String getMessage(); - - String getCorrelationKey(); - - Integer getProcessType(); - - void setCorrelationKey(String correlationKey); - - void setProcessType(Integer processType); -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/prediction/PredictionOutcome.java b/kie-internal/src/main/java/org/kie/internal/task/api/prediction/PredictionOutcome.java deleted file mode 100644 index b5c37d887ed..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/prediction/PredictionOutcome.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/** - * A class to encapsulate prediction results from a {@link org.kie.internal.task.api.prediction.PredictionService} - * implementation. - */ -package org.kie.internal.task.api.prediction; - -import java.util.Map; - -/** - * Encapsulates results from a {@link PredictionService}. - */ -public class PredictionOutcome { - - private boolean present; - - private double confidenceLevel = 0.0; - - private double confidenceThreshold = 0.0; - - private Map data; - - /** - * Creates an empty prediction. - */ - public PredictionOutcome() { - this.present = false; - } - - /** - * - * Returns a prediction for a prediction service with the specified confidence level, confidence threshold and - * outcome. - * - * @param confidenceLevel Numerical value to quantify confidence level for this prediction - * @param confidenceThreshold The threshold above which a prediction should be automatically accepted - * @param data A map containing the outcome names and values (respectively as map keys and values) - */ - public PredictionOutcome(double confidenceLevel, double confidenceThreshold, Map data) { - this.present = data != null; - this.confidenceLevel = confidenceLevel; - this.confidenceThreshold = confidenceThreshold; - this.data = data; - } - - public boolean isPresent() { - return this.present; - } - - /** - * Returns true if a prediction has a confidence level above the specified threshold otherwise false - */ - public boolean isCertain() { - return this.present && confidenceLevel > confidenceThreshold; - } - - public double getConfidenceLevel() { - return confidenceLevel; - } - - public double getConfidenceThreshold() { - return confidenceThreshold; - } - - public Map getData() { - return data; - } -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/api/prediction/PredictionService.java b/kie-internal/src/main/java/org/kie/internal/task/api/prediction/PredictionService.java deleted file mode 100644 index dd10bd197ec..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/api/prediction/PredictionService.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.api.prediction; - -import java.util.Map; - -import org.kie.api.task.model.Task; - -/** - * Interface which allows a prediction or recommendation service implementation to be trained with task data - * and return outcome predictions based on task input. - *

- * This interface is still considered subject to change. - */ -public interface PredictionService { - - String getIdentifier(); - - /** - * Return an outcome prediction for a set of input attributes. - * @param task Task information to be optionally used by the predictive model - * @param inputData A map of input attributes with the attribute name as key and the attribute value as value. - * @return PredictionOutcome object which encapsulates the results from a prediction - */ - PredictionOutcome predict(Task task, Map inputData); - - /** - * Train a predictive model using task data and a set of input and outcome attributes. - * @param task Task information to be optionally used by the predictive model - * @param inputData A map of input attributes with the attribute name as key and the attribute value as value. - * @param outputData A map of output attributes (outcomes) with the attribute name as key and the attribute value as value. - */ - void train(Task task, Map inputData, Map outputData); -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/query/AuditTaskDeleteBuilder.java b/kie-internal/src/main/java/org/kie/internal/task/query/AuditTaskDeleteBuilder.java deleted file mode 100644 index b26327337c7..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/query/AuditTaskDeleteBuilder.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.query; - -import org.kie.internal.runtime.manager.audit.query.AuditDateDeleteBuilder; - - -public interface AuditTaskDeleteBuilder extends AuditDateDeleteBuilder { - - /** - * Specify one or more deployment ids to use as a criteria. - * @param deploymentId one or more string deployment ids - * @return The current query builder instance - */ - public AuditTaskDeleteBuilder deploymentId(String... deploymentId); - - - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/query/AuditTaskQueryBuilder.java b/kie-internal/src/main/java/org/kie/internal/task/query/AuditTaskQueryBuilder.java deleted file mode 100644 index 18c024336ab..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/query/AuditTaskQueryBuilder.java +++ /dev/null @@ -1,201 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.query; - -import java.util.Date; - -import org.kie.api.task.model.Status; -import org.kie.internal.task.api.AuditTask; - -public interface AuditTaskQueryBuilder extends TaskAuditQueryBuilder { - - /** - * Specify one or more process (definition) id's as criteria in the query - * @param processId one or more process ids - * @return The current query builder instance - */ - public AuditTaskQueryBuilder processId(String... processId); - - /** - * Specify one or more task statuses to use as a criteria. - * @param status one or more task statuses - * @return The current query builder instance - */ - public AuditTaskQueryBuilder taskStatus(Status... status); - - /** - * Specify one or more user ids to use as a criteria - * for the actual owner of the task as logged in the task event - * @param actualOwnerUserId one or more (string) user ids - * @return The current query builder instance - */ - public AuditTaskQueryBuilder actualOwner(String... actualOwnerUserId); - - /** - * Specify one or more deployment ids to use as a criteria - * @param deploymentId one or more (string) deployment ids - * @return The current query builder instance - */ - public AuditTaskQueryBuilder deploymentId(String... deploymentId); - - /** - * Specify one or more dates to use as a criteria - * for the created-on date of a task as logged in the task event - * @param createdOn one or more dates - * @return The current query builder instance - */ - public AuditTaskQueryBuilder createdOn(Date... createdOn); - - /** - * Specify an inclusive range of created-on dates to use as a criteria - *

- * If the lower or upper end of the range is given as null, - * then an open-ended range using the non-null range end is used - * as the criteria - * @param createdOnMin the minimal (lower) date to use in the range - * @param createdOnMax the max (upper) date to use in the range - * @return The current query builder instance - */ - public AuditTaskQueryBuilder createdOnRange(Date createdOnMin, Date createdOnMax); - - /** - * Specify one or more (task) parent ids to use as a criteria - * @param parentId one or more longs - * @return The current query builder instance - */ - public AuditTaskQueryBuilder taskParentId(long... parentId); - - /** - * Specify one or more user ids to use as a criteria - * for the creator of the task as logged in the task event - * @param createdByUserId one or more (string) user ids - * @return The current query builder instance - */ - public AuditTaskQueryBuilder createdBy(String... createdByUserId); - - - /** - * Specify one or more dates to use as a criteria - * for the activation time of the task as logged in the task event - * @param activationTime one or more dates - * @return The current query builder instance - */ - public AuditTaskQueryBuilder activationTime(Date... activationTime); - - /** - * Specify an inclusive range of (task) activation-time dates to use as a criteria - *

- * If the lower or upper end of the range is given as null, - * then an open-ended range using the non-null range end is used - * as the criteria - * @param activationTimeMin the minimal (lower) date to use in the range - * @param activationTimeMax the max (upper) date to use in the range - * @return The current query builder instance - */ - public AuditTaskQueryBuilder activationTimeRange(Date activationTimeMin, Date activationTimeMax); - - /** - * Specify one or more task description to use as a criteria. - * @param description one or more description string - * @return The current query builder instance - */ - public AuditTaskQueryBuilder description(String... description); - - /** - * Specify one or more (task) priorities to use as a criteria. - * @param priority one or more ints - * @return The current query builder instance - */ - public AuditTaskQueryBuilder priority(int... priority); - - /** - * Specify one or more task names to use as a criteria. - * @param name one or more string - * @return The current query builder instance - */ - public AuditTaskQueryBuilder taskName(String... name); - - /** - * Specify one or more process session ids associated with a task - * to use as a criteria - * @param processSessionId one or more process session ids - * @return The current query builder instance - */ - public AuditTaskQueryBuilder processSessionId(long... processSessionId); - - /** - * Specify one or more (task) due dates to use as a criteria - * for the activation time of the task as logged in the task event - * @param dueDate one or more dates - * @return The current query builder instance - */ - public AuditTaskQueryBuilder dueDate(Date... dueDate); - - /** - * Specify an inclusive range of (task) due dates to use as a criteria - *

- * If the lower or upper end of the range is given as null, - * then an open-ended range using the non-null range end is used - * as the criteria - * @param dueDateMin the minimal (lower) date to use in the range - * @param dueDateMax the max (upper) date to use in the range - * @return The current query builder instance - */ - public AuditTaskQueryBuilder dueDateRange(Date dueDateMin, Date dueDateMax); - - /** - * Specify one or more (task-related) work item ids to use as a criteria. - * @param workItemId one or more long work item ids - * @return The current query builder instance - */ - public AuditTaskQueryBuilder workItemId(long... workItemId); - - /** - * Specify which field to use when ordering the results, in ascending order. - *

- * If this method is not used, the results will be ordered in ascending order - * by the id field. - * @param field the field by which the query results should be ordered - * @return The current instance of this query builder - */ - public AuditTaskQueryBuilder ascending( OrderBy field ); - - /** - * Specify which field to use when ordering the results, in descending order. - *

- * If this method is not used, the results will be ordered in ascending order - * by the id field. - * @param field the field by which the query results should be ordered - * @return The current instance of this query builder - */ - public AuditTaskQueryBuilder descending( OrderBy field ); - - public static enum OrderBy { - // order by task id - taskId, - // order by task created-on date - createdOn, - // order by task activation time - activationTime, - // order by process id - processId, - // order by process instance id - processInstanceId, - } -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/query/TaskAuditQueryBuilder.java b/kie-internal/src/main/java/org/kie/internal/task/query/TaskAuditQueryBuilder.java deleted file mode 100644 index e24247b11a3..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/query/TaskAuditQueryBuilder.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.query; - -import org.kie.internal.query.ProcessInstanceIdQueryBuilder; - - -public interface TaskAuditQueryBuilder extends ProcessInstanceIdQueryBuilder { - - /** - * Specify one or more task instance ids to use as a criteria. - * @param taskId one or more task ids - * @return The current query builder instance - */ - public T taskId(long... taskId); - - /** - * Specify an inclusive range of task ids to use as a criteria - *

- * If the lower or upper end of the range is given as null, - * then an open-ended range using the non-null range end is used - * as the criteria - * @param taskIdMin the minimal (lower) taskId to use in the range - * @param taskIdMax the max (upper) taskId to use in the range - * @return The current query builder instance - */ - public T taskIdRange(Long taskIdMin, Long taskIdMax); - - /** - * Specify one or more task event ids to use as a criteria - * @param id one or more task event entity ids - * @return The current query builder instance - */ - public T id(long... id); - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/query/TaskEventDeleteBuilder.java b/kie-internal/src/main/java/org/kie/internal/task/query/TaskEventDeleteBuilder.java deleted file mode 100644 index 4d58ab6baba..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/query/TaskEventDeleteBuilder.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.query; - -import org.kie.internal.runtime.manager.audit.query.AuditDateDeleteBuilder; - - -public interface TaskEventDeleteBuilder extends AuditDateDeleteBuilder{ - - - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/query/TaskEventQueryBuilder.java b/kie-internal/src/main/java/org/kie/internal/task/query/TaskEventQueryBuilder.java deleted file mode 100644 index f90d455ba9f..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/query/TaskEventQueryBuilder.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.query; - -import java.util.Date; - -import org.kie.internal.query.ProcessInstanceIdQueryBuilder; -import org.kie.internal.task.api.model.TaskEvent; -import org.kie.internal.task.api.model.TaskEvent.TaskEventType; - -public interface TaskEventQueryBuilder extends ProcessInstanceIdQueryBuilder { - - /** - * Specify one or more messages to use as a criteria. - * @param message one or more strings - * @return The current query builder instance - */ - public TaskEventQueryBuilder message(String... message); - - /** - * Specify one or more task instance ids to use as a criteria. - * @param taskId one or more task ids - * @return The current query builder instance - */ - public TaskEventQueryBuilder taskId(long... taskId); - - /** - * Specify an inclusive range of task ids to use as a criteria - *

- * If the lower or upper end of the range is given as null, - * then an open-ended range using the non-null range end is used - * as the criteria - * @param taskIdMin the minimal (lower) taskId to use in the range - * @param taskIdMax the max (upper) taskId to use in the range - * @return The current query builder instance - */ - public TaskEventQueryBuilder taskIdRange(Long taskIdMin, Long taskIdMax); - - /** - * Specify one or more task event ids to use as a criteria - * @param id one or more task event entity ids - * @return The current query builder instance - */ - public TaskEventQueryBuilder id(long... id); - - /** - * Specify one or more dates to use as a criteria - * for the log (creation) date of the task event - * @param logTime one or more dates - * @return The current query builder instance - */ - public TaskEventQueryBuilder logTime(Date... logTime); - - /** - * Specify an inclusive range of log dates to use as a criteria - *

- * If the lower or upper end of the range is given as null, - * then an open-ended range using the non-null range end is used - * as the criteria - * @param logTimeMin the minimal (lower) date to use in the range - * @param logTimeMax the max (upper) date to use in the range - * @return The current query builder instance - */ - public TaskEventQueryBuilder logTimeRange(Date logTimeMin, Date logTimeMax); - - /** - * Specify one or more user ids to use as a criteria - * @param userId one or more (string) user ids - * @return The current query builder instance - */ - public TaskEventQueryBuilder userId(String... userId); - - /** - * Specify one or more task event types to use as a criteria - * @param taskEventType one or more {@link TaskEventType}s - * @return The current query builder instance - */ - public TaskEventQueryBuilder type(TaskEventType... taskEventType); - - /** - * Specify one or more (task-related) work item ids to use as a criteria. - * @param workItemId one or more long work item ids - * @return The current query builder instance - */ - public TaskEventQueryBuilder workItemId(long... workItemId); - - /** - * Specify which field to use when ordering the results, in ascending order. - *

- * If this method is not used, the results will be ordered in ascending order - * by the id field. - * @param field the field by which the query results should be ordered - * @return The current instance of this query builder - */ - public TaskEventQueryBuilder ascending( OrderBy field ); - - /** - * Specify which field to use when ordering the results, in descending order. - *

- * If this method is not used, the results will be ordered in ascending order - * by the id field. - * @param field the field by which the query results should be ordered - * @return The current instance of this query builder - */ - public TaskEventQueryBuilder descending( OrderBy field ); - - public static enum OrderBy { - // order by task id - taskId, - // order by task event date - logTime, - // order by process instance id - processInstanceId, - } - -} \ No newline at end of file diff --git a/kie-internal/src/main/java/org/kie/internal/task/query/TaskSummaryQueryBuilder.java b/kie-internal/src/main/java/org/kie/internal/task/query/TaskSummaryQueryBuilder.java deleted file mode 100644 index 14913963b07..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/query/TaskSummaryQueryBuilder.java +++ /dev/null @@ -1,296 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.query; - -import java.util.Date; - -import org.kie.api.task.model.Status; -import org.kie.api.task.model.TaskSummary; -import org.kie.internal.runtime.manager.audit.query.ProcessIdQueryBuilder; -import org.kie.internal.task.api.TaskVariable; -import org.kie.internal.task.api.model.SubTasksStrategy; - -/** - * An instance of this class is used to dynamically - * create a query to retrieve {@link TaskSummary} instances. - *

- * One of the main motivations behind this class is that - * adding new methods to this method provides a (factorial) - * increase in ways to query for {@link TaskSummary} instances - * without unnecessarily cluttering up the interface, unlike - * the deprecated "get*" method signatures, - */ -public interface TaskSummaryQueryBuilder extends ProcessIdQueryBuilder { - - /** - * Add one or more activation times as a criteria to the query - * @param activationTime one or more {@link Date} values - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder activationTime(Date... activationTime); - - /** - * Specify an inclusive range of (task) activation-time dates to use as a criteria - *

- * If the lower or upper end of the range is given as null, - * then an open-ended range using the non-null range end is used - * as the criteria - * @param activationTimeMin the minimal (lower) date to use in the range - * @param activationTimeMax the max (upper) date to use in the range - * @return The current query builder instance - */ - public TaskSummaryQueryBuilder activationTimeRange(Date activationTimeMin, Date activationTimeMax); - - /** - * Add one or more (actual) task owner ids as a criteria to the query - * @param actualOwnerUserId - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder actualOwner(String... actualOwnerUserId); - - /** - * Add whether or not the task is archived as a criteria to the query - * @param archived a boolean - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder archived(boolean archived); - - /** - * Add one or more initiator user ids as a criteria to the query - *

- * The initiator is also the user who created the task. - * @param createdById - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder createdBy(String... createdById); - - /** - * Add one or more creation dates as a criteria to the query - * @param createdOnDate one or more {@link Date} values - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder createdOn(Date... createdOnDate); - - /** - * Specify an inclusive range of (task) creation dates to use as a criteria - *

- * If the lower or upper end of the range is given as null, - * then an open-ended range using the non-null range end is used - * as the criteria - * @param createdOnMin the minimal (lower) date to use in the range - * @param createdOnMax the max (upper) date to use in the range - * @return The current query builder instance - */ - public TaskSummaryQueryBuilder createdOnRange(Date createdOnMin, Date createdOnMax); - - /** - * Add one or more deployment ids as a criteria to the query - * @param deploymentId - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder deploymentId(String... deploymentId); - - /** - * Add one or more descriptions as a criteria to the query - * @param description one or more strings - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder description(String... description); - - /** - * Add one or more expiration times as a criteria to the query - * @param expirationTime one or more {@link Date} values - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder expirationTime(Date... expirationTime); - - /** - * Specify an inclusive range of (task) expiration-time dates to use as a criteria - *

- * If the lower or upper end of the range is given as null, - * then an open-ended range using the non-null range end is used - * as the criteria - * @param expirationTimeMin the minimal (lower) date to use in the range - * @param expirationTimeMax the max (upper) date to use in the range - * @return The current query builder instance - */ - public TaskSummaryQueryBuilder expirationTimeRange(Date expirationTimeMin, Date expirationTimeMax); - - /** - * Add one or more (task) form names as a criteria to the query - * @param formName one or more strings - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder formName(String... formName); - - /** - * Add one or more (task) names as a criteria to the query - * @param name one or more strings - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder name(String... name); - - /** - * Add one or more work item ids as a criteria to the query - * @param processSessionId one or more longs - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder processSessionId(long... processSessionId); - - /** - * Add whether or not the task is skippable as a criteria to the query - * @param skippable a boolean - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder skippable(boolean skippable); - - /** - * Add one or more statuses as a criteria to the query - * @param status - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder status(Status... status); - - /** - * Add one or more subjects as a criteria to the query - * @param subject one or more strings - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder subject(String... subject); - - /** - * Add one or more (task) sub-task-strategies as a criteria to the query - * @param subTasksStrategy one or more {@link SubTasksStrategy} values - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder subTaskStrategy(SubTasksStrategy... subTasksStrategy); - - /** - * Add one or more task ids as a criteria to the query - * @param taskId - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder taskId(long... taskId); - - /** - * Specify an inclusive range of (task) ids to use as a criteria - *

- * If the lower or upper end of the range is given as null, - * then an open-ended range using the non-null range end is used - * as the criteria - * @param taskIdMin the minimal (lower) date to use in the range - * @param taskIdMax the max (upper) date to use in the range - * @return The current query builder instance - */ - public TaskSummaryQueryBuilder taskIdRange(Long taskIdMin, Long taskIdMax); - - /** - * Add one or more (task) parent ids as a criteria to the query - * @param taskParentId one or more longs - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder taskParentId(long... taskParentId); - - /** - * Add one or more (task) types as a criteria to the query - * @param taskType one or more strings - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder taskType(String... taskType); - - /** - * Add one or more work item ids as a criteria to the query - * @param workItemId one or more longs - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder workItemId(long... workItemId); - - /** - * Add one or more priorities as a criteria to the query - * @param priority one or more ints - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder priority(int... priority); - - /** - * Add one or more business administrator (user) ids as a criteria to the query - * @param businessAdminId one or more strings - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder businessAdmin(String... businessAdminId); - - /** - * Add one or more potential owner ids as a criteria to the query - * @param potentialOwnerId - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder potentialOwner(String... potentialOwnerId); - - /** - * Add one or more stake holder (user) ids as a criteria to the query - * @param stakeHolderId one or more strings - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder stakeHolder(String... stakeHolderId); - - /** - * Add one or more {@link TaskVariable} names as a criteria to the query - * @param varName one or more strings - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder variableName(String... varName); - - /** - * Add one or more {@link TaskVariable} values as a criteria to the query - * @param varValue one or more strings - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder variableValue(String... varValue); - - /** - * Order the results in ascending order by the given parameter - *

- * results are ordered by default by task id. - * @param orderBy - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder ascending(OrderBy orderBy); - - /** - * Order the results in descending order by the given parameter - *

- * results are ordered by default by task id. - * @param orderBy - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskSummaryQueryBuilder descending(OrderBy orderBy); - - /** - /** - * An enum used to specify the criteria for ordering the results of the query - */ - public static enum OrderBy { - taskId, - processInstanceId, - taskName, - taskStatus, - createdOn, - createdBy; - } -} \ No newline at end of file diff --git a/kie-internal/src/main/java/org/kie/internal/task/query/TaskVariableDeleteBuilder.java b/kie-internal/src/main/java/org/kie/internal/task/query/TaskVariableDeleteBuilder.java deleted file mode 100644 index 9363d8ef650..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/query/TaskVariableDeleteBuilder.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.query; - -import org.kie.internal.runtime.manager.audit.query.AuditDateDeleteBuilder; - - -public interface TaskVariableDeleteBuilder extends AuditDateDeleteBuilder{ - - - -} diff --git a/kie-internal/src/main/java/org/kie/internal/task/query/TaskVariableQueryBuilder.java b/kie-internal/src/main/java/org/kie/internal/task/query/TaskVariableQueryBuilder.java deleted file mode 100644 index 85e12a3fa68..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/task/query/TaskVariableQueryBuilder.java +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.task.query; - -import java.util.Date; - -import org.kie.internal.runtime.manager.audit.query.ProcessIdQueryBuilder; -import org.kie.internal.task.api.TaskVariable; -import org.kie.internal.task.api.TaskVariable.VariableType; - -public interface TaskVariableQueryBuilder extends ProcessIdQueryBuilder { - - /** - * Specify one or more task event ids to use as a criteria - * @param id one or more task event entity ids - * @return The current query builder instance - */ - public TaskVariableQueryBuilder id(long... id); - - /** - * Specify one or more task instance ids to use as a criteria. - * @param taskId one or more task ids - * @return The current query builder instance - */ - public TaskVariableQueryBuilder taskId(long... taskId); - - /** - * Specify an inclusive range of task ids to use as a criteria - *

- * If the lower or upper end of the range is given as null, - * then an open-ended range using the non-null range end is used - * as the criteria - * @param taskIdMin the minimal (lower) taskId to use in the range - * @param taskIdMax the max (upper) taskId to use in the range - * @return The current query builder instance - */ - public TaskVariableQueryBuilder taskIdRange(Long taskIdMin, Long taskIdMax); - - /** - * Specify one or more process (definition) id's as criteria in the query - * @param processId one or more process ids - * @return The current query builder instance - */ - public TaskVariableQueryBuilder processId(String... processId); - - /** - * Add one or more (task variable) names as a criteria to the query - * @param name one or more strings - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskVariableQueryBuilder name(String... name); - - /** - * Add one or more (task variable) values as a criteria to the query - * @param value one or more strings - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskVariableQueryBuilder value(String... value); - - /** - * Add one or more (task variable) types as a criteria to the query - * @param type one or more {@link VariableType} values - * @return the current {@link TaskSummaryQueryBuilder} instance - */ - public TaskVariableQueryBuilder type(VariableType... type); - - /** - * Specify one or more dates to use as a criteria - * for the modification date of the task variable - * @param logTime one or more dates - * @return The current query builder instance - */ - public TaskVariableQueryBuilder modificationDate(Date... logTime); - - /** - * Specify an inclusive range of modification dates to use as a criteria - *

- * If the lower or upper end of the range is given as null, - * then an open-ended range using the non-null range end is used - * as the criteria - * @param modDateMin the minimal (lower) date to use in the range - * @param modDateMax the max (upper) date to use in the range - * @return The current query builder instance - */ - public TaskVariableQueryBuilder modificationDateRange(Date modDateMin, Date modDateMax); - /** - * Specify which field to use when ordering the results, in ascending order. - *

- * If this method is not used, the results will be ordered in ascending order - * by the id field. - * @param field the field by which the query results should be ordered - * @return The current instance of this query builder - */ - public TaskVariableQueryBuilder ascending( OrderBy field ); - - /** - * Specify which field to use when ordering the results, in descending order. - *

- * If this method is not used, the results will be ordered in ascending order - * by the id field. - * @param field the field by which the query results should be ordered - * @return The current instance of this query builder - */ - public TaskVariableQueryBuilder descending( OrderBy field ); - - public static enum OrderBy { - // order by id - id, - // order by task id - taskId, - // order by process instance id - processInstanceId, - // order by modificationDate - modificationDate - } - -} \ No newline at end of file diff --git a/kie-internal/src/main/java/org/kie/internal/utils/NotificationPublisher.java b/kie-internal/src/main/java/org/kie/internal/utils/NotificationPublisher.java deleted file mode 100644 index 1288e0f122a..00000000000 --- a/kie-internal/src/main/java/org/kie/internal/utils/NotificationPublisher.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.internal.utils; - -import java.util.Map; -import java.util.Set; - -import org.kie.api.task.model.OrganizationalEntity; - -/** - * Responsible for providing various types of publishers of notifications - * e.g. email, sms, message, etc. - */ -public interface NotificationPublisher { - - /** - * Publishes given notification based on the actual implementation. - * This method should never thrown exceptions as they might be interfering with processing logic. - * - * @param sender identifier of the sender to be attached to the message produced from the notification - * @param subject subject to be used when publishing the notification - * @param recipients list of users or groups the notification should be send to - * @param body actual message body - */ - void publish(String sender, String subject, Set recipients, String body); - - /** - * Renders body based on given template and parameters and then publishes given notification based on the actual implementation. - * - * This method can throw IllegalArgumentException in case given template was not found. This allows to fall back - * to send notification with not rendered body - * - * @param sender identifier of the sender to be attached to the message produced from the notification - * @param subject subject to be used when publishing the notification - * @param recipients list of users or groups the notification should be send to - * @param template name of the template to be used to render body - * @param parameters map of parameters that can be used while rendering body from the template - * @throws IllegalArgumentException when template was not found - */ - void publish(String sender, String subject, Set recipients, String template, Map parameters); - - /** - * Indicates if given publisher is active and thus should be used to publish notifications - * @return true if active false otherwise - */ - boolean isActive(); -} From c431ecaad0bd673555f404b04d3f3af5640d4517 Mon Sep 17 00:00:00 2001 From: Gabriele Cardosi Date: Mon, 8 Apr 2024 10:51:06 +0200 Subject: [PATCH 05/12] [incubator-kie-issues#1065] Remove dmn test resource unpacking (#5828) * [incubator-kie-issues#1065] Remove dmn test resource unpacking * [incubator-kie-issues#1065] Fix ValidatorTest.validateAllValidSharedModels (attempt) * [incubator-kie-issues#1065] Fix ValidatorTest.validateAllValidSharedModels (attempt) --------- Co-authored-by: Gabriele-Cardosi --- kie-dmn/kie-dmn-validation/pom.xml | 32 --------- .../org/kie/dmn/validation/ValidatorTest.java | 65 ++++++++----------- 2 files changed, 27 insertions(+), 70 deletions(-) diff --git a/kie-dmn/kie-dmn-validation/pom.xml b/kie-dmn/kie-dmn-validation/pom.xml index 3dfc05eb19a..863a165af95 100644 --- a/kie-dmn/kie-dmn-validation/pom.xml +++ b/kie-dmn/kie-dmn-validation/pom.xml @@ -181,40 +181,8 @@ src/test/resources - - ${project.build.directory}/generated-test-resources - - - - org.apache.maven.plugins - maven-dependency-plugin - ${dependency-plugin.version} - - - unpack - generate-test-resources - - unpack - - - - - org.kie - kie-dmn-test-resources - ${project.version} - tests - jar - true - ${project.build.directory}/generated-test-resources - valid_models/**/*.dmn - - - - - - org.codehaus.mojo exec-maven-plugin diff --git a/kie-dmn/kie-dmn-validation/src/test/java/org/kie/dmn/validation/ValidatorTest.java b/kie-dmn/kie-dmn-validation/src/test/java/org/kie/dmn/validation/ValidatorTest.java index 9096a81755a..d3668ecca91 100644 --- a/kie-dmn/kie-dmn-validation/src/test/java/org/kie/dmn/validation/ValidatorTest.java +++ b/kie-dmn/kie-dmn-validation/src/test/java/org/kie/dmn/validation/ValidatorTest.java @@ -24,18 +24,13 @@ import java.io.Reader; import java.net.URISyntaxException; import java.net.URL; -import java.nio.file.DirectoryIteratorException; -import java.nio.file.DirectoryStream; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Objects; -import java.util.stream.Collectors; -import java.util.stream.StreamSupport; +import java.util.jar.JarFile; +import java.util.zip.ZipEntry; -import org.drools.io.FileSystemResource; +import org.drools.io.ClassPathResource; import org.junit.Ignore; import org.junit.Test; import org.kie.api.builder.Message.Level; @@ -533,40 +528,34 @@ public void testInformationItemMissingTypeRef_SMC() { } @Test - public void validateAllValidSharedModels() throws URISyntaxException, IOException { - String modelFilesPath = "valid_models"; - URL modelFilesUrl = - Collections.list(Thread.currentThread().getContextClassLoader().getResources(modelFilesPath)) + public void validateAllValidSharedModels() throws IOException { + String modelFilesPath = "valid_models/"; + URL modelFilesJarURL = Collections.list(Thread.currentThread().getContextClassLoader().getResources( + "valid_models/")) .stream() - .filter(url -> url.getProtocol().equals("file")) + .filter(url -> url.getProtocol().equals("jar")) .findFirst() - .orElseThrow(() -> new RuntimeException("Failed to retrieve " + modelFilesPath)); - Path modelsPath = Path.of(modelFilesUrl.toURI()); - testDirectory(modelsPath); - } - - private void testDirectory(Path modelsPath) { - try (DirectoryStream pathIterator = Files.newDirectoryStream(modelsPath)) { - Map> allFiles = StreamSupport.stream(pathIterator.spliterator(), false) - .collect(Collectors.groupingBy(path -> path.toFile().isDirectory())); - if (allFiles.containsKey(true)) { - allFiles.get(true).forEach(this::testDirectory); - } - if (allFiles.containsKey(false)) { - testFiles(allFiles.get(false)); - } - } catch (IOException | DirectoryIteratorException e) { - String messageToShow = e.getMessage() != null && !e.getMessage().isEmpty() ? e.getMessage() : String.format("Unable to navigate directory %s", modelsPath); - LOGGER.error(messageToShow); - LOGGER.debug(messageToShow, e); - fail(messageToShow); - } + .orElseThrow(() -> new RuntimeException("Failed to retrieve jar containing " + modelFilesPath)); + String modelFilesJarFile = modelFilesJarURL.getFile(); + String jarPath = modelFilesJarFile.substring(modelFilesJarFile.lastIndexOf(":") + 1, + modelFilesJarFile.lastIndexOf("!")); + final JarFile jarFile = new JarFile(new File(jarPath)); + testDirectoryInJar(jarFile, modelFilesPath); + } + + private void testDirectoryInJar(JarFile jarFile, String directory) { + List allFiles = Collections.list(jarFile.entries()) + .stream() + .filter(entry -> entry.getName().startsWith(directory) && !entry.isDirectory()) + .map(ZipEntry::getName) + .toList(); + testFiles(allFiles); } - private void testFiles(List modelPaths) { - Resource[] resources = modelPaths.stream() - .map(path -> new FileSystemResource(path.toFile())) - .toArray(value -> new Resource[modelPaths.size()]); + private void testFiles(List modelFiles) { + Resource[] resources = modelFiles.stream() + .map(ClassPathResource::new) + .toArray(value -> new Resource[modelFiles.size()]); List dmnMessages = validatorBuilder.theseModels(resources); assertNotNull(dmnMessages); dmnMessages.forEach(dmnMessage -> LOGGER.error(dmnMessage.toString())); From fa4a1825d5cc4858ca197fc1dfaa59ff474c6738 Mon Sep 17 00:00:00 2001 From: Toshiya Kobayashi Date: Mon, 8 Apr 2024 20:12:12 +0900 Subject: [PATCH 06/12] [incubator-kie-issues-803] Add an explanation of semicolon as OOPath delimiter in docs (#5829) --- .../pages/language-reference/_drl-rules.adoc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drools-docs/src/modules/ROOT/pages/language-reference/_drl-rules.adoc b/drools-docs/src/modules/ROOT/pages/language-reference/_drl-rules.adoc index 7c06016c2dd..e1dd56afc1b 100644 --- a/drools-docs/src/modules/ROOT/pages/language-reference/_drl-rules.adoc +++ b/drools-docs/src/modules/ROOT/pages/language-reference/_drl-rules.adoc @@ -1347,6 +1347,25 @@ You cannot embed a comma operator in a composite constraint expression, such as /persons[ ( age > 50 && weight > 80 ) || height > 2 ] ---- +[NOTE] +==== +When you write multiple OOPath lines +[source] +---- +when + /persons[ age == "10" ] + /addresses[ city == "London" ] +---- +Before {PRODUCT} 10, they were concatenated to one line `/persons[ age == "10" ]/addresses[ city == "London" ]`. To avoid that, you need to explicitly use a semicolon `;` to separate the OOPath lines. +[source] +---- +when + /persons[ age == "10" ]; + /addresses[ city == "London" ]; +---- +Since {PRODUCT} 10, {PRODUCT} considers the new line as a separator between OOPath lines. So the semicolon is not required. +==== + === Bound variables in patterns and constraints You can bind variables to OOPath expressions of patterns and constraints to refer to matched objects in other portions of a rule. Bound variables can help you define rules more efficiently or more consistently with how you annotate facts in your data model. From dc8417a70b3d13400d1505f314bd7874a8522d57 Mon Sep 17 00:00:00 2001 From: Gabriele Cardosi Date: Tue, 9 Apr 2024 07:29:46 +0200 Subject: [PATCH 07/12] [incubator-kie-issues#1066] Implement usage of namespace inside href for unnamed imports (#5830) * [incubator-kie-issues#1066] Soring both default and imported id for unnamed imports * [incubator-kie-issues#1066] Implementing tests with and without namespace in href --------- Co-authored-by: Gabriele-Cardosi --- .../org/kie/dmn/core/impl/DMNModelImpl.java | 29 ++++---- .../org/kie/dmn/core/impl/DMNRuntimeImpl.java | 5 +- .../org/kie/dmn/core/DMNCompilerTest.java | 55 ++++++++------ .../core/compiler/UnnamedImportUtilsTest.java | 62 +++++++++++----- .../DMNv1_5/Imported_Model_Unamed.dmn | 6 +- ...g_EmptyNamed_Model_With_Href_Namespace.dmn | 74 +++++++++++++++++++ ...ptyNamed_Model_Without_Href_Namespace.dmn} | 5 -- .../validation/v1_5/DMN15ValidationsTest.java | 25 +++++-- 8 files changed, 188 insertions(+), 73 deletions(-) create mode 100644 kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Importing_EmptyNamed_Model_With_Href_Namespace.dmn rename kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/{Importing_EmptyNamed_Model.dmn => Importing_EmptyNamed_Model_Without_Href_Namespace.dmn} (94%) diff --git a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNModelImpl.java b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNModelImpl.java index f7a45a44d36..d100cbbc85e 100644 --- a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNModelImpl.java +++ b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNModelImpl.java @@ -23,6 +23,7 @@ import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -167,16 +168,12 @@ public String nameInCurrentModel(DMNNode node) { return node.getName(); } else { Optional lookupAlias = getImportAliasFor(node.getModelNamespace(), node.getModelName()); - if (lookupAlias.isPresent()) { - return lookupAlias.get() + "." + node.getName(); - } else { - return null; - } + return lookupAlias.map(s -> s + "." + node.getName()).orElse(null); } } public void addInput(InputDataNode idn) { - inputs.put(computeDRGElementModelLocalId(idn), idn); + computeDRGElementModelLocalId(idn).forEach(id -> inputs.put(id, idn)); } @Override @@ -199,24 +196,24 @@ public InputDataNode getInputByName(String name) { @Override public Set getInputs() { - return this.inputs.values().stream().collect( Collectors.toCollection(LinkedHashSet::new) ); + return new LinkedHashSet<>(this.inputs.values()); } public void addDecision(DecisionNode dn) { - decisions.put(computeDRGElementModelLocalId(dn), dn); + computeDRGElementModelLocalId(dn).forEach(id -> decisions.put(id, dn)); } - private String computeDRGElementModelLocalId(DMNNode node) { + private List computeDRGElementModelLocalId(DMNNode node) { // incubator-kie-issues#852: The idea is to not treat the anonymous models as import, but to "merge" them with original opne, // Here, if the node comes from an unnamed imported model, then it is stored only with its id, to be looked for // as if defined in the model itself if (node.getModelNamespace().equals(definitions.getNamespace())) { - return node.getId(); + return Collections.singletonList(node.getId()); } else if (isInUnnamedImport(node, this)) { // the node is an unnamed import - return node.getId(); + return Arrays.asList(node.getId(), node.getModelNamespace() + "#" + node.getId()); } else { - return node.getModelNamespace() + "#" + node.getId(); + return Collections.singletonList(node.getModelNamespace() + "#" + node.getId()); } } @@ -241,7 +238,7 @@ public DecisionNode getDecisionByName(String name) { @Override public Set getDecisions() { - return this.decisions.values().stream().collect(Collectors.toCollection(LinkedHashSet::new)); + return new LinkedHashSet<>(this.decisions.values()); } @Override @@ -265,7 +262,7 @@ public Set getRequiredInputsForDecisionId(String decisionId) { } public void addDecisionService(DecisionServiceNode dsn) { - decisionServices.put(computeDRGElementModelLocalId(dsn), dsn); + computeDRGElementModelLocalId(dsn).forEach(id -> decisionServices.put(id, dsn)); } public DecisionServiceNode getDecisionServiceById(String id) { @@ -286,11 +283,11 @@ public DecisionServiceNode getDecisionServiceByName(String name) { @Override public Collection getDecisionServices() { - return this.decisionServices.values().stream().collect(Collectors.toCollection(LinkedHashSet::new)); + return new LinkedHashSet<>(this.decisionServices.values()); } public void addBusinessKnowledgeModel(BusinessKnowledgeModelNode bkm) { - bkms.put(computeDRGElementModelLocalId(bkm), bkm); + computeDRGElementModelLocalId(bkm).forEach(id -> bkms.put(id, bkm)); } @Override diff --git a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNRuntimeImpl.java b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNRuntimeImpl.java index 85ccf42b784..12a3eebea54 100644 --- a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNRuntimeImpl.java +++ b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNRuntimeImpl.java @@ -461,7 +461,10 @@ public static Object coerceUsingType(Object value, DMNType type, boolean typeChe private boolean isNodeValueDefined(DMNResultImpl result, DMNNode callerNode, DMNNode node) { if (node.getModelNamespace().equals(result.getContext().scopeNamespace().orElse(result.getModel().getNamespace()))) { return result.getContext().isDefined(node.getName()); - } else { + } else if (isInUnnamedImport(node, (DMNModelImpl) result.getModel())) { + // the node is an unnamed import + return result.getContext().isDefined(node.getName()); + } else { Optional importAlias = callerNode.getModelImportAliasFor(node.getModelNamespace(), node.getModelName()); if (importAlias.isPresent()) { Object aliasContext = result.getContext().get(importAlias.get()); diff --git a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNCompilerTest.java b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNCompilerTest.java index c52ba8da6d5..55ef34f927e 100644 --- a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNCompilerTest.java +++ b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNCompilerTest.java @@ -273,8 +273,18 @@ public void testImport() { } @Test - public void testEmptyNamedModelImport() { - final DMNRuntime runtime = createRuntimeWithAdditionalResources("valid_models/DMNv1_5/Importing_EmptyNamed_Model.dmn", + public void testEmptyNamedModelImportWithHrefNamespace() { + commonValidateUnnamedImport("valid_models/DMNv1_5/Importing_EmptyNamed_Model_With_Href_Namespace.dmn", "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"); + } + + @Test + public void testEmptyNamedModelImportWithoutHrefNamespace() { + commonValidateUnnamedImport("valid_models/DMNv1_5/Importing_EmptyNamed_Model_Without_Href_Namespace.dmn", "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"); + } + + @Test + public void testOverridingEmptyNamedModelImport() { + final DMNRuntime runtime = createRuntimeWithAdditionalResources("valid_models/DMNv1_5/Importing_OverridingEmptyNamed_Model.dmn", this.getClass(), "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"); @@ -286,7 +296,7 @@ public void testEmptyNamedModelImport() { } final DMNModel importingModel = runtime.getModel("http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc", - "Importing empty-named Model"); + "Importing empty-named Model"); assertThat(importingModel).isNotNull(); for (final DMNMessage message : importingModel.getMessages()) { LOG.debug("{}", message); @@ -319,10 +329,26 @@ public void testEmptyNamedModelImport() { } @Test - public void testOverridingEmptyNamedModelImport() { - final DMNRuntime runtime = createRuntimeWithAdditionalResources("valid_models/DMNv1_5/Importing_OverridingEmptyNamed_Model.dmn", + public void testWrongComparisonOps() { + final DMNRuntime runtime = createRuntime("WrongComparisonOps.dmn", this.getClass()); + final DMNModel dmnModel = runtime.getModel("http://www.trisotech.com/definitions/_a937d093-86d3-4306-8db8-1e7a33588b68", "Drawing 1"); + assertThat(dmnModel).isNotNull(); + assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse(); + assertThat(dmnModel.getMessages()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).hasSize(4); + assertThat(dmnModel.getMessages(DMNMessage.Severity.WARN)).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).hasSize(4); + assertThat(dmnModel.getMessages(DMNMessage.Severity.WARN) + .stream() + .filter(m -> m.getSourceId().equals("_d72d6fab-1e67-4fe7-9c12-54800d6fe294") || + m.getSourceId().equals("_2390dd99-094d-4f97-aecc-9cccb697ce05") || + m.getSourceId().equals("_0c292d34-498e-4b08-ae99-3c694197b69f") || + m.getSourceId().equals("_21c7d800-b806-4b2e-9a10-00828de7f2d2")) + .count()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isEqualTo(4L); + } + + private void commonValidateUnnamedImport(String importingModelRef, String importedModelRef) { + final DMNRuntime runtime = createRuntimeWithAdditionalResources(importingModelRef, this.getClass(), - "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"); + importedModelRef); final DMNModel importedModel = runtime.getModel("http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df44", "Imported Model"); @@ -363,21 +389,4 @@ public void testOverridingEmptyNamedModelImport() { assertThat(allProperties).containsEntry("Imported Greeting", "Hello John!"); } } - - @Test - public void testWrongComparisonOps() { - final DMNRuntime runtime = createRuntime("WrongComparisonOps.dmn", this.getClass()); - final DMNModel dmnModel = runtime.getModel("http://www.trisotech.com/definitions/_a937d093-86d3-4306-8db8-1e7a33588b68", "Drawing 1"); - assertThat(dmnModel).isNotNull(); - assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse(); - assertThat(dmnModel.getMessages()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).hasSize(4); - assertThat(dmnModel.getMessages(DMNMessage.Severity.WARN)).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).hasSize(4); - assertThat(dmnModel.getMessages(DMNMessage.Severity.WARN) - .stream() - .filter(m -> m.getSourceId().equals("_d72d6fab-1e67-4fe7-9c12-54800d6fe294") || - m.getSourceId().equals("_2390dd99-094d-4f97-aecc-9cccb697ce05") || - m.getSourceId().equals("_0c292d34-498e-4b08-ae99-3c694197b69f") || - m.getSourceId().equals("_21c7d800-b806-4b2e-9a10-00828de7f2d2")) - .count()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isEqualTo(4L); - } } diff --git a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/UnnamedImportUtilsTest.java b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/UnnamedImportUtilsTest.java index e4e9309a970..2f317557a5b 100644 --- a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/UnnamedImportUtilsTest.java +++ b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/UnnamedImportUtilsTest.java @@ -26,23 +26,15 @@ public class UnnamedImportUtilsTest { @Test - public void isInUnnamedImportTrue() { - final DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources("valid_models/DMNv1_5/Importing_EmptyNamed_Model" + - ".dmn", - this.getClass(), - "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"); + public void isInUnnamedImportTrueWithHrefNamespace() { + commonIsInUnnamedImportTrue("valid_models/DMNv1_5/Importing_EmptyNamed_Model_With_Href_Namespace.dmn", + "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"); + } - final DMNModel importedModel = runtime.getModel("http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df44", - "Imported Model"); - assertThat(importedModel).isNotNull(); - final DMNModelImpl importingModel = (DMNModelImpl)runtime.getModel("http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc", - "Importing empty-named Model"); - assertThat(importingModel).isNotNull(); - importedModel.getDecisions().forEach(node -> assertTrue(isInUnnamedImport(node, importingModel))); - importedModel.getBusinessKnowledgeModels().forEach(node -> assertTrue(isInUnnamedImport(node, importingModel))); - importedModel.getDecisionServices().forEach(node -> assertTrue(isInUnnamedImport(node, importingModel))); - importedModel.getInputs().forEach(node -> assertTrue(isInUnnamedImport(node, importingModel))); - importedModel.getItemDefinitions().forEach(node -> assertTrue(isInUnnamedImport(node, importingModel))); + @Test + public void isInUnnamedImportTrueWithoutHrefNamespace() { + commonIsInUnnamedImportTrue("valid_models/DMNv1_5/Importing_EmptyNamed_Model_Without_Href_Namespace.dmn", + "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"); } @Test @@ -81,10 +73,42 @@ public void addIfNotPresentTrue() throws IOException { } @Test - public void addIfNotPresentFalse() throws IOException { - final DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources("valid_models/DMNv1_5/Importing_EmptyNamed_Model.dmn", + public void addIfNotPresentFalseWithHrefNamespace() throws IOException { + commonAddIfNotPresentFalse("valid_models/DMNv1_5/Importing_EmptyNamed_Model_With_Href_Namespace.dmn", + "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"); + } + + @Test + public void addIfNotPresentFalseWithoutHrefNamespace() throws IOException { + commonAddIfNotPresentFalse("valid_models/DMNv1_5/Importing_EmptyNamed_Model_Without_Href_Namespace.dmn", + "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"); + } + + private void commonIsInUnnamedImportTrue(String importingModelRef, String importedModelRef) { + final DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources(importingModelRef, this.getClass(), - "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"); + importedModelRef); + + final DMNModel importedModel = runtime.getModel("http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f" + + "-9848-11ba35e0df44", + "Imported Model"); + assertThat(importedModel).isNotNull(); + final DMNModelImpl importingModel = (DMNModelImpl) runtime.getModel("http://www.trisotech" + + ".com/dmn/definitions/_f79aa7a4" + + "-f9a3-410a-ac95-bea496edabgc", + "Importing empty-named Model"); + assertThat(importingModel).isNotNull(); + importedModel.getDecisions().forEach(node -> assertTrue(isInUnnamedImport(node, importingModel))); + importedModel.getBusinessKnowledgeModels().forEach(node -> assertTrue(isInUnnamedImport(node, importingModel))); + importedModel.getDecisionServices().forEach(node -> assertTrue(isInUnnamedImport(node, importingModel))); + importedModel.getInputs().forEach(node -> assertTrue(isInUnnamedImport(node, importingModel))); + importedModel.getItemDefinitions().forEach(node -> assertTrue(isInUnnamedImport(node, importingModel))); + } + + private void commonAddIfNotPresentFalse(String importingModelRef, String importedModelRef) throws IOException { + final DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources(importingModelRef, + this.getClass(), + importedModelRef); final DMNModelImpl importingModel = (DMNModelImpl)runtime.getModel("http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc", "Importing empty-named Model"); assertThat(importingModel).isNotNull(); diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Imported_Model_Unamed.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Imported_Model_Unamed.dmn index 2c900040e20..e8a79c6e53b 100644 --- a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Imported_Model_Unamed.dmn +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Imported_Model_Unamed.dmn @@ -23,7 +23,11 @@ number
- + + + + + + + + + + + + + + + + + Local Hello( A Person ) + + + + + + + + + + + + + Say Hello( A Person ) + + + + + + + + + "Local Hello " + Person.name + "!" + + + + + diff --git a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Importing_EmptyNamed_Model.dmn b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Importing_EmptyNamed_Model_Without_Href_Namespace.dmn similarity index 94% rename from kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Importing_EmptyNamed_Model.dmn rename to kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Importing_EmptyNamed_Model_Without_Href_Namespace.dmn index 6bcd6e18387..eb567f30bb3 100644 --- a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Importing_EmptyNamed_Model.dmn +++ b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/Importing_EmptyNamed_Model_Without_Href_Namespace.dmn @@ -23,11 +23,6 @@ drools:modelName="Imported Model" triso:fileId="eyJmIjp7InNrdSI6IjEwMmM0MDQ3LTg5NjctNGI3ZS1hODgxLTBhY2ZkNWJjOTAwMiIsIm5hbWUiOiJJbXBvcnRlZCBNb2RlbCJ9fQ==" triso:fileName="Edson Tirelli/Imported Model"/> - - - inputData = Map.of("A Person", prototype(entry("name", "Hugh"), entry("age", 32))); - evaluate(modelNamespace, modelName, importingModelFileName, inputData, importedModelFileName); + public void unnamedImportValidationWithHrefNamespace() { + commonUnnamedImportValidation("valid_models/DMNv1_5/Importing_EmptyNamed_Model_With_Href_Namespace.dmn", + "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"); + } + + @Test + public void unnamedImportValidationWithoutHrefNamespace() { + commonUnnamedImportValidation("valid_models/DMNv1_5/Importing_EmptyNamed_Model_Without_Href_Namespace.dmn", + "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"); } @Test @@ -131,6 +132,14 @@ public void typeConstraintsChecksValidation() { evaluate(modelNamespace, modelName, modelFileName, inputData); } + private void commonUnnamedImportValidation(String importingModelRef, String importedModelRef) { + String modelName = "Importing empty-named Model"; + String modelNamespace = "http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc"; + validate(importingModelRef, importedModelRef); + Map inputData = Map.of("A Person", prototype(entry("name", "Hugh"), entry("age", 32))); + evaluate(modelNamespace, modelName, importingModelRef, inputData, importedModelRef); + } + private void validate(String modelFileName, String... otherFileNames) { List allModelsFileNames = new ArrayList<>(); allModelsFileNames.add(modelFileName); From 0c7588f7298d19ff33d3d21a7abc93c93e778c72 Mon Sep 17 00:00:00 2001 From: Roberto Oliveira Date: Tue, 16 Apr 2024 08:20:29 +0200 Subject: [PATCH 08/12] Updating Maven to 3.9.6 in GH Actions (#5835) --- .github/workflows/pr-downstream-full.yml | 2 +- .github/workflows/pr-downstream.yml | 2 +- .github/workflows/pr-drools-ansible.yml | 2 +- .github/workflows/pr-drools-docs.yml | 2 +- .github/workflows/pr-drools.yml | 2 +- .../drools-quarkus-quickstart-test/guide.adoc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-downstream-full.yml b/.github/workflows/pr-downstream-full.yml index e3f02055d22..a1f5a071631 100644 --- a/.github/workflows/pr-downstream-full.yml +++ b/.github/workflows/pr-downstream-full.yml @@ -24,7 +24,7 @@ jobs: matrix: os: [ubuntu-latest] java-version: [17] - maven-version: ['3.9.3'] + maven-version: ['3.9.6'] fail-fast: false runs-on: ${{ matrix.os }} name: Build Chain (${{ matrix.os }} / Java-${{ matrix.java-version }} / Maven-${{ matrix.maven-version }}) diff --git a/.github/workflows/pr-downstream.yml b/.github/workflows/pr-downstream.yml index eddb400fdbe..b82393a748f 100644 --- a/.github/workflows/pr-downstream.yml +++ b/.github/workflows/pr-downstream.yml @@ -23,7 +23,7 @@ jobs: job_name: [ kogito-runtimes, kogito-apps, kogito-quarkus-examples, kogito-springboot-examples, serverless-workflow-examples ] os: [ubuntu-latest] java-version: [17] - maven-version: ['3.9.3'] + maven-version: ['3.9.6'] include: - job_name: kogito-runtimes repository: kogito-runtimes diff --git a/.github/workflows/pr-drools-ansible.yml b/.github/workflows/pr-drools-ansible.yml index e59633d3923..253b577bb45 100644 --- a/.github/workflows/pr-drools-ansible.yml +++ b/.github/workflows/pr-drools-ansible.yml @@ -22,7 +22,7 @@ jobs: matrix: os: [ubuntu-latest] java-version: [17] - maven-version: ['3.9.3'] + maven-version: ['3.9.6'] fail-fast: false runs-on: ${{ matrix.os }} name: Ansible Integration / ${{ matrix.os }} / Java-${{ matrix.java-version }} / Maven-${{ matrix.maven-version }} diff --git a/.github/workflows/pr-drools-docs.yml b/.github/workflows/pr-drools-docs.yml index babb27e59c2..02f5abc04a3 100644 --- a/.github/workflows/pr-drools-docs.yml +++ b/.github/workflows/pr-drools-docs.yml @@ -16,7 +16,7 @@ jobs: matrix: os: [ubuntu-latest] java-version: [17] - maven-version: ['3.9.3'] + maven-version: ['3.9.6'] fail-fast: false runs-on: ${{ matrix.os }} name: ${{ matrix.os }} / Java-${{ matrix.java-version }} / Maven-${{ matrix.maven-version }} diff --git a/.github/workflows/pr-drools.yml b/.github/workflows/pr-drools.yml index a70d116a641..01c32b6f9a2 100644 --- a/.github/workflows/pr-drools.yml +++ b/.github/workflows/pr-drools.yml @@ -22,7 +22,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest] java-version: [17] - maven-version: ['3.9.3'] + maven-version: ['3.9.6'] fail-fast: false runs-on: ${{ matrix.os }} name: ${{ matrix.os }} / Java-${{ matrix.java-version }} / Maven-${{ matrix.maven-version }} diff --git a/drools-quarkus-extension/drools-quarkus-quickstart-test/guide.adoc b/drools-quarkus-extension/drools-quarkus-quickstart-test/guide.adoc index bb74e51dc27..44ed4439356 100644 --- a/drools-quarkus-extension/drools-quarkus-quickstart-test/guide.adoc +++ b/drools-quarkus-extension/drools-quarkus-quickstart-test/guide.adoc @@ -18,7 +18,7 @@ To complete this guide, you need: * less than 15 minutes * an IDE * JDK 17+ installed with `JAVA_HOME` configured appropriately -* Apache Maven 3.9.3+ +* Apache Maven 3.9.6+ * Docker * link:{quarkus-guides-url}/building-native-image[GraalVM installed if you want to run in native mode] From 54e1e48b8a6d583f18dd355c7ea8391ad45de8b4 Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Wed, 10 Apr 2024 15:26:49 +0200 Subject: [PATCH 09/12] [KIE-1064] simplify session serialization by adding dormant activations to rule executor (#5821) * [KIE-1064] simplify session serialization by adding dormant activations to rule executor * wip * wip * wip * wip * wip * final rework --- .../core/common/ActivationsManager.java | 2 +- .../core/common/AgendaGroupsManager.java | 8 +- .../core/phreak/EagerPhreakBuilder.java | 5 +- .../drools/core/phreak/LazyPhreakBuilder.java | 5 +- .../core/phreak/PhreakAccumulateNode.java | 5 +- .../drools/core/phreak/PhreakBranchNode.java | 32 ++- .../core/phreak/PhreakRuleTerminalNode.java | 83 ++++---- .../org/drools/core/phreak/RuleExecutor.java | 115 +++++++--- .../drools/core/reteoo/AlphaTerminalNode.java | 14 +- .../core/reteoo/ModifyPreviousTuples.java | 2 +- .../drools/core/reteoo/RuleTerminalNode.java | 4 +- .../reteoo/RuleTerminalNodeLeftTuple.java | 15 +- .../org/drools/core/reteoo/TupleFactory.java | 13 +- .../java/org/drools/core/util/LinkedList.java | 12 +- .../kiesession/agenda/DefaultAgenda.java | 2 +- .../mvel/MVELAccumulateBuilderTest.java | 19 +- .../iterators/PhreakActivationIterator.java | 198 ++---------------- .../protobuf/MarshallingTest.java | 67 ++++-- .../integrationtests/AbstractCepEspTest.java | 2 +- .../ExecutionFlowControlTest.java | 12 +- .../NamedConsequencesTest.java | 7 +- ...enanceSystemRuleTerminalNodeLeftTuple.java | 2 +- 22 files changed, 270 insertions(+), 354 deletions(-) diff --git a/drools-core/src/main/java/org/drools/core/common/ActivationsManager.java b/drools-core/src/main/java/org/drools/core/common/ActivationsManager.java index 5042d5fce56..2ad3ba7ae01 100644 --- a/drools-core/src/main/java/org/drools/core/common/ActivationsManager.java +++ b/drools-core/src/main/java/org/drools/core/common/ActivationsManager.java @@ -95,7 +95,7 @@ default void stageLeftTuple(RuleAgendaItem ruleAgendaItem, InternalMatch justifi if (!ruleAgendaItem.isQueued()) { ruleAgendaItem.getRuleExecutor().getPathMemory().queueRuleAgendaItem(this); } - ruleAgendaItem.getRuleExecutor().addLeftTuple( justified.getTuple() ); + ruleAgendaItem.getRuleExecutor().modifyActiveTuple((RuleTerminalNodeLeftTuple) justified.getTuple() ); } default ActivationsManager getPartitionedAgenda(int partitionNr) { diff --git a/drools-core/src/main/java/org/drools/core/common/AgendaGroupsManager.java b/drools-core/src/main/java/org/drools/core/common/AgendaGroupsManager.java index 84f5a354eb5..fe6ab7aeca7 100644 --- a/drools-core/src/main/java/org/drools/core/common/AgendaGroupsManager.java +++ b/drools-core/src/main/java/org/drools/core/common/AgendaGroupsManager.java @@ -218,8 +218,8 @@ public int sizeOfRuleFlowGroup(String name) { } int count = 0; for ( RuleAgendaItem item : mainAgendaGroup.getActivations() ) { - if (!(item.getRuleExecutor().getLeftTupleList().isEmpty())) { - count = count + item.getRuleExecutor().getLeftTupleList().size(); + if (!(item.getRuleExecutor().getActiveMatches().isEmpty())) { + count = count + item.getRuleExecutor().getActiveMatches().size(); } } return count; @@ -512,8 +512,8 @@ public int sizeOfRuleFlowGroup(String name) { int count = 0; for ( RuleAgendaItem item : group.getActivations() ) { - if (!item.getRuleExecutor().getLeftTupleList().isEmpty()) { - count = count + item.getRuleExecutor().getLeftTupleList().size(); + if (!item.getRuleExecutor().getActiveMatches().isEmpty()) { + count = count + item.getRuleExecutor().getActiveMatches().size(); } } return count; diff --git a/drools-core/src/main/java/org/drools/core/phreak/EagerPhreakBuilder.java b/drools-core/src/main/java/org/drools/core/phreak/EagerPhreakBuilder.java index a4d37f49d32..2c4e58d806f 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/EagerPhreakBuilder.java +++ b/drools-core/src/main/java/org/drools/core/phreak/EagerPhreakBuilder.java @@ -62,6 +62,7 @@ import org.drools.core.reteoo.QueryElementNode; import org.drools.core.reteoo.RightInputAdapterNode; import org.drools.core.reteoo.RightTuple; +import org.drools.core.reteoo.RuleTerminalNodeLeftTuple; import org.drools.core.reteoo.RuntimeComponentFactory; import org.drools.core.reteoo.SegmentMemory; import org.drools.core.reteoo.SegmentMemory.MemoryPrototype; @@ -1245,7 +1246,7 @@ private static TupleImpl insertPeerLeftTuple(TupleImpl lt, LeftTupleSinkNode nod TerminalNode rtn = ( TerminalNode ) node; InternalAgenda agenda = wm.getAgenda(); RuleAgendaItem agendaItem = AlphaTerminalNode.getRuleAgendaItem( wm, agenda, rtn, insert ); - PhreakRuleTerminalNode.doLeftTupleInsert( rtn, agendaItem.getRuleExecutor(), agenda, agendaItem, peer ); + PhreakRuleTerminalNode.doLeftTupleInsert( rtn, agendaItem.getRuleExecutor(), agenda, agendaItem, (RuleTerminalNodeLeftTuple) peer ); } return peer; } @@ -1274,7 +1275,7 @@ private static void iterateLeftTuple(TupleImpl lt, InternalWorkingMemory wm) { if (NodeTypeEnums.isTerminalNode(lt.getSink())) { PathMemory pmem = (PathMemory) wm.getNodeMemories().peekNodeMemory( lt.getSink()); if (pmem != null) { - PhreakRuleTerminalNode.doLeftDelete( pmem.getActualActivationsManager( wm ), pmem.getRuleAgendaItem().getRuleExecutor(), lt ); + PhreakRuleTerminalNode.doLeftDelete( pmem.getActualActivationsManager( wm ), pmem.getRuleAgendaItem().getRuleExecutor(), (RuleTerminalNodeLeftTuple) lt ); } } else { if (lt.getContextObject() instanceof AccumulateContext) { diff --git a/drools-core/src/main/java/org/drools/core/phreak/LazyPhreakBuilder.java b/drools-core/src/main/java/org/drools/core/phreak/LazyPhreakBuilder.java index 6402ba6ebaf..52e6b86fb83 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/LazyPhreakBuilder.java +++ b/drools-core/src/main/java/org/drools/core/phreak/LazyPhreakBuilder.java @@ -70,6 +70,7 @@ import org.drools.core.reteoo.RightInputAdapterNode; import org.drools.core.reteoo.RightInputAdapterNode.RiaPathMemory; import org.drools.core.reteoo.RightTuple; +import org.drools.core.reteoo.RuleTerminalNodeLeftTuple; import org.drools.core.reteoo.RuntimeComponentFactory; import org.drools.core.reteoo.SegmentMemory; import org.drools.core.reteoo.SegmentNodeMemory; @@ -978,7 +979,7 @@ private static TupleImpl insertPeerLeftTuple(TupleImpl lt, LeftTupleSinkNode nod TerminalNode rtn = ( TerminalNode ) node; InternalAgenda agenda = wm.getAgenda(); RuleAgendaItem agendaItem = AlphaTerminalNode.getRuleAgendaItem( wm, agenda, rtn, insert ); - PhreakRuleTerminalNode.doLeftTupleInsert( rtn, agendaItem.getRuleExecutor(), agenda, agendaItem, peer ); + PhreakRuleTerminalNode.doLeftTupleInsert( rtn, agendaItem.getRuleExecutor(), agenda, agendaItem, (RuleTerminalNodeLeftTuple) peer ); } return peer; } @@ -1007,7 +1008,7 @@ private static void iterateLeftTuple(TupleImpl lt, InternalWorkingMemory wm) { if (NodeTypeEnums.isTerminalNode(lt.getSink())) { PathMemory pmem = (PathMemory) wm.getNodeMemories().peekNodeMemory( lt.getSink()); if (pmem != null) { - PhreakRuleTerminalNode.doLeftDelete( pmem.getActualActivationsManager( wm ), pmem.getRuleAgendaItem().getRuleExecutor(), lt ); + PhreakRuleTerminalNode.doLeftDelete( pmem.getActualActivationsManager( wm ), pmem.getRuleAgendaItem().getRuleExecutor(), (RuleTerminalNodeLeftTuple) lt ); } } else { if (lt.getContextObject() instanceof AccumulateContext) { diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakAccumulateNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakAccumulateNode.java index 33e72c91ec7..e87a4fba138 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakAccumulateNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakAccumulateNode.java @@ -249,8 +249,7 @@ private void doRightInserts(AccumulateNode accNode, FastIterator leftIt = accNode.getLeftIterator( ltm ); for ( TupleImpl leftTuple = accNode.getFirstLeftTuple( rightTuple, ltm, leftIt ); leftTuple != null; leftTuple = (LeftTuple) leftIt.next( leftTuple ) ) { - if ( constraints.isAllowedCachedRight(leftTuple, contextEntry - ) ) { + if ( constraints.isAllowedCachedRight(leftTuple, contextEntry) ) { final BaseAccumulation accctx = (BaseAccumulation) leftTuple.getContextObject(); addMatch( accNode, accumulate, leftTuple, rightTuple, null, null, reteEvaluator, am, @@ -717,7 +716,7 @@ private void addMatch(final AccumulateNode accNode, final boolean useLeftMemory, final boolean leftPropagation) { TupleImpl tuple = leftTuple; - InternalFactHandle handle = (InternalFactHandle) rightTuple.getFactHandle(); + InternalFactHandle handle = rightTuple.getFactHandle(); if (accNode.isRightInputIsRiaNode()) { // if there is a subnetwork, handle must be unwrapped diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakBranchNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakBranchNode.java index 18c2694df79..06b03f97528 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakBranchNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakBranchNode.java @@ -18,15 +18,16 @@ */ package org.drools.core.phreak; +import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.common.ActivationsManager; import org.drools.core.common.TupleSets; import org.drools.core.reteoo.ConditionalBranchEvaluator; import org.drools.core.reteoo.ConditionalBranchEvaluator.ConditionalExecution; import org.drools.core.reteoo.ConditionalBranchNode; import org.drools.core.reteoo.ConditionalBranchNode.ConditionalBranchMemory; -import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.LeftTupleSink; import org.drools.core.reteoo.RuleTerminalNode; +import org.drools.core.reteoo.RuleTerminalNodeLeftTuple; import org.drools.core.reteoo.TupleFactory; import org.drools.core.reteoo.TupleImpl; @@ -67,8 +68,6 @@ public void doLeftInserts(ConditionalBranchNode branchNode, RuleExecutor executor) { ConditionalBranchEvaluator branchEvaluator = branchNode.getBranchEvaluator(); - RuleAgendaItem ruleAgendaItem = executor.getRuleAgendaItem(); - for (TupleImpl leftTuple = srcLeftTuples.getInsertFirst(); leftTuple != null; ) { TupleImpl next = leftTuple.getStagedNext(); @@ -79,7 +78,7 @@ public void doLeftInserts(ConditionalBranchNode branchNode, if (conditionalExecution != null) { RuleTerminalNode rtn = (RuleTerminalNode) conditionalExecution.getSink().getFirstLeftTupleSink(); - TupleImpl branchedLeftTuple = TupleFactory.createLeftTuple(leftTuple, + RuleTerminalNodeLeftTuple branchedLeftTuple = (RuleTerminalNodeLeftTuple) TupleFactory.createLeftTuple(leftTuple, rtn, leftTuple.getPropagationContext(), useLeftMemory); PhreakRuleTerminalNode.doLeftTupleInsert( rtn, executor, activationsManager, @@ -107,7 +106,6 @@ public void doLeftUpdates(ConditionalBranchNode branchNode, TupleSets stagedLeftTuples, RuleExecutor executor) { ConditionalBranchEvaluator branchEvaluator = branchNode.getBranchEvaluator(); - RuleAgendaItem ruleAgendaItem = executor.getRuleAgendaItem(); for (TupleImpl leftTuple = srcLeftTuples.getUpdateFirst(); leftTuple != null; ) { TupleImpl next = leftTuple.getStagedNext(); @@ -134,7 +132,7 @@ public void doLeftUpdates(ConditionalBranchNode branchNode, if (newRtn == null) { // old exits, new does not, so delete if ( branchTuples.rtnLeftTuple.getMemory() != null ) { - executor.removeLeftTuple(branchTuples.rtnLeftTuple); + executor.removeActiveTuple(branchTuples.rtnLeftTuple); } PhreakRuleTerminalNode.doLeftDelete(activationsManager, executor, branchTuples.rtnLeftTuple); @@ -145,11 +143,11 @@ public void doLeftUpdates(ConditionalBranchNode branchNode, } else { // old and new on different branches, delete one and insert the other if ( branchTuples.rtnLeftTuple.getMemory() != null ) { - executor.removeLeftTuple(branchTuples.rtnLeftTuple); + executor.removeActiveTuple(branchTuples.rtnLeftTuple); } PhreakRuleTerminalNode.doLeftDelete(activationsManager, executor, branchTuples.rtnLeftTuple); - branchTuples.rtnLeftTuple = TupleFactory.createLeftTuple(leftTuple, + branchTuples.rtnLeftTuple = (RuleTerminalNodeLeftTuple) TupleFactory.createLeftTuple(leftTuple, newRtn, leftTuple.getPropagationContext(), true); PhreakRuleTerminalNode.doLeftTupleInsert( newRtn, executor, activationsManager, @@ -158,7 +156,7 @@ public void doLeftUpdates(ConditionalBranchNode branchNode, } else if (newRtn != null) { // old does not exist, new exists, so insert - branchTuples.rtnLeftTuple = TupleFactory.createLeftTuple(leftTuple, newRtn, + branchTuples.rtnLeftTuple = (RuleTerminalNodeLeftTuple) TupleFactory.createLeftTuple(leftTuple, newRtn, leftTuple.getPropagationContext(), true); PhreakRuleTerminalNode.doLeftTupleInsert( newRtn, executor, activationsManager, executor.getRuleAgendaItem(), branchTuples.rtnLeftTuple) ; @@ -168,12 +166,12 @@ public void doLeftUpdates(ConditionalBranchNode branchNode, if (branchTuples.mainLeftTuple != null) { normalizeStagedTuples( stagedLeftTuples, branchTuples.mainLeftTuple ); - if (!breaking) { - // child exist, new one does, so update - trgLeftTuples.addUpdate(branchTuples.mainLeftTuple); - } else { + if (breaking && !NodeTypeEnums.isTerminalNode(branchTuples.mainLeftTuple.getSink())) { // child exist, new one does not, so delete trgLeftTuples.addDelete(branchTuples.mainLeftTuple); + } else { + // child exist, new one does, so update + trgLeftTuples.addUpdate(branchTuples.mainLeftTuple); } } else if (!breaking) { // child didn't exist, new one does, so insert @@ -200,7 +198,7 @@ public void doLeftDeletes(LeftTupleSink sink, if (branchTuples.rtnLeftTuple != null) { if ( branchTuples.rtnLeftTuple.getMemory() != null ) { - executor.removeLeftTuple(branchTuples.rtnLeftTuple); + executor.removeActiveTuple(branchTuples.rtnLeftTuple); } PhreakRuleTerminalNode.doLeftDelete(activationsManager, executor, branchTuples.rtnLeftTuple); } @@ -230,14 +228,14 @@ private BranchTuples getBranchTuples(LeftTupleSink sink, TupleImpl leftTuple) { if (child.getSink() == sink ) { branchTuples.mainLeftTuple = child; } else { - branchTuples.rtnLeftTuple = child; + branchTuples.rtnLeftTuple = (RuleTerminalNodeLeftTuple) child; } child = child.getHandleNext(); if ( child != null ) { if (child.getSink() == sink ) { branchTuples.mainLeftTuple = child; } else { - branchTuples.rtnLeftTuple = child; + branchTuples.rtnLeftTuple = (RuleTerminalNodeLeftTuple) child; } } } @@ -245,7 +243,7 @@ private BranchTuples getBranchTuples(LeftTupleSink sink, TupleImpl leftTuple) { } private static class BranchTuples { - TupleImpl rtnLeftTuple; + RuleTerminalNodeLeftTuple rtnLeftTuple; TupleImpl mainLeftTuple; } } diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakRuleTerminalNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakRuleTerminalNode.java index 2ccd23ed47a..707dccfcca8 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakRuleTerminalNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakRuleTerminalNode.java @@ -26,7 +26,6 @@ import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.TupleSets; -import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.ObjectTypeConf; import org.drools.core.reteoo.RuleTerminalNode; import org.drools.core.reteoo.RuleTerminalNodeLeftTuple; @@ -74,8 +73,8 @@ public void doLeftInserts(TerminalNode rtnNode, activationsManager.getAgendaGroupsManager().setFocus( ruleAgendaItem.getAgendaGroup() ); } - for (TupleImpl leftTuple = srcLeftTuples.getInsertFirst(); leftTuple != null; ) { - TupleImpl next = leftTuple.getStagedNext(); + for (RuleTerminalNodeLeftTuple leftTuple = (RuleTerminalNodeLeftTuple) srcLeftTuples.getInsertFirst(); leftTuple != null; ) { + RuleTerminalNodeLeftTuple next = (RuleTerminalNodeLeftTuple) leftTuple.getStagedNext(); doLeftTupleInsert(rtnNode, executor, activationsManager, ruleAgendaItem, leftTuple); @@ -95,10 +94,10 @@ private static boolean sameRules(TerminalNode rtn1, TerminalNode rtn2) { } public static void doLeftTupleInsert(TerminalNode rtnNode, RuleExecutor executor, ActivationsManager activationsManager, RuleAgendaItem ruleAgendaItem, - TupleImpl leftTuple) { + RuleTerminalNodeLeftTuple leftTuple) { ReteEvaluator reteEvaluator = activationsManager.getReteEvaluator(); if ( reteEvaluator.getRuleSessionConfiguration().isDirectFiring() ) { - executor.addLeftTuple(leftTuple); + executor.addActiveTuple(leftTuple); return; } @@ -112,32 +111,32 @@ public static void doLeftTupleInsert(TerminalNode rtnNode, RuleExecutor executor pctx = leftTuple.getPropagationContext(); } - int salienceInt = getSalienceValue(rtnNode, ruleAgendaItem, (InternalMatch) leftTuple, reteEvaluator); + int salienceInt = getSalienceValue(rtnNode, ruleAgendaItem, leftTuple, reteEvaluator); - RuleTerminalNodeLeftTuple rtnLeftTuple = (RuleTerminalNodeLeftTuple) leftTuple; - activationsManager.createAgendaItem( rtnLeftTuple, salienceInt, pctx, ruleAgendaItem, ruleAgendaItem.getAgendaGroup() ); + activationsManager.createAgendaItem( leftTuple, salienceInt, pctx, ruleAgendaItem, ruleAgendaItem.getAgendaGroup() ); - activationsManager.getAgendaEventSupport().fireActivationCreated(rtnLeftTuple, activationsManager.getReteEvaluator()); + activationsManager.getAgendaEventSupport().fireActivationCreated(leftTuple, activationsManager.getReteEvaluator()); if ( rtnNode.getRule().isLockOnActive() && pctx.getType() != PropagationContext.Type.RULE_ADDITION ) { pctx = leftTuple.findMostRecentPropagationContext(); InternalAgendaGroup agendaGroup = executor.getRuleAgendaItem().getAgendaGroup(); if (blockedByLockOnActive(rtnNode.getRule(), pctx, agendaGroup)) { - activationsManager.getAgendaEventSupport().fireActivationCancelled(rtnLeftTuple, reteEvaluator, MatchCancelledCause.FILTER ); + activationsManager.getAgendaEventSupport().fireActivationCancelled(leftTuple, reteEvaluator, MatchCancelledCause.FILTER ); return; } } - if (activationsManager.getActivationsFilter() != null && !activationsManager.getActivationsFilter().accept( rtnLeftTuple )) { - // only relevant for seralization, to not refire Matches already fired + if (activationsManager.getActivationsFilter() != null && !activationsManager.getActivationsFilter().accept( leftTuple )) { + // only relevant for serialization, to not refire Matches already fired + executor.addDormantTuple(leftTuple ); return; } - executor.addLeftTuple( leftTuple ); + executor.addActiveTuple(leftTuple ); - activationsManager.addItemToActivationGroup( rtnLeftTuple ); + activationsManager.addItemToActivationGroup( leftTuple ); if ( !rtnNode.isFireDirect() && executor.isDeclarativeAgendaEnabled() ) { - insertAndStageActivation( reteEvaluator, rtnLeftTuple ); + insertAndStageActivation( reteEvaluator, leftTuple ); } } @@ -164,8 +163,8 @@ public void doLeftUpdates(TerminalNode rtnNode, activationsManager.getAgendaGroupsManager().setFocus(ruleAgendaItem.getAgendaGroup()); } - for (TupleImpl leftTuple = srcLeftTuples.getUpdateFirst(); leftTuple != null; ) { - TupleImpl next = leftTuple.getStagedNext(); + for (RuleTerminalNodeLeftTuple leftTuple = (RuleTerminalNodeLeftTuple) srcLeftTuples.getUpdateFirst(); leftTuple != null; ) { + RuleTerminalNodeLeftTuple next = (RuleTerminalNodeLeftTuple) leftTuple.getStagedNext(); doLeftTupleUpdate(rtnNode, executor, activationsManager, leftTuple); @@ -175,14 +174,13 @@ public void doLeftUpdates(TerminalNode rtnNode, } public static void doLeftTupleUpdate(TerminalNode rtnNode, RuleExecutor executor, - ActivationsManager activationsManager, TupleImpl leftTuple) { - RuleTerminalNodeLeftTuple rtnLeftTuple = (RuleTerminalNodeLeftTuple) leftTuple; + ActivationsManager activationsManager, RuleTerminalNodeLeftTuple leftTuple) { ReteEvaluator reteEvaluator = activationsManager.getReteEvaluator(); if ( reteEvaluator.getRuleSessionConfiguration().isDirectFiring() ) { - if (!rtnLeftTuple.isQueued() ) { - executor.addLeftTuple( leftTuple ); - reteEvaluator.getRuleEventSupport().onUpdateMatch( rtnLeftTuple ); + if (!leftTuple.isQueued() ) { + executor.modifyActiveTuple(leftTuple ); + reteEvaluator.getRuleEventSupport().onUpdateMatch( leftTuple ); } return; } @@ -191,7 +189,7 @@ public static void doLeftTupleUpdate(TerminalNode rtnNode, RuleExecutor executor boolean blocked = false; if ( executor.isDeclarativeAgendaEnabled() ) { - if ( rtnLeftTuple.hasBlockers() ) { + if ( leftTuple.hasBlockers() ) { blocked = true; // declarativeAgenda still blocking LeftTuple, so don't add back ot list } } else { @@ -203,10 +201,11 @@ public static void doLeftTupleUpdate(TerminalNode rtnNode, RuleExecutor executor } } - int salienceInt = getSalienceValue(rtnNode, executor.getRuleAgendaItem(), (InternalMatch) leftTuple, reteEvaluator); + int salienceInt = getSalienceValue(rtnNode, executor.getRuleAgendaItem(), leftTuple, reteEvaluator); - if (activationsManager.getActivationsFilter() != null && !activationsManager.getActivationsFilter().accept( rtnLeftTuple)) { + if (activationsManager.getActivationsFilter() != null && !activationsManager.getActivationsFilter().accept( leftTuple)) { // only relevant for serialization, to not re-fire Matches already fired + executor.addDormantTuple(leftTuple); return; } @@ -220,23 +219,23 @@ public static void doLeftTupleUpdate(TerminalNode rtnNode, RuleExecutor executor } } if ( addToExector ) { - if (!rtnLeftTuple.isQueued() ) { + if (!leftTuple.isQueued() ) { // not queued, so already fired, so it's effectively recreated - activationsManager.getAgendaEventSupport().fireActivationCreated( rtnLeftTuple, reteEvaluator ); + activationsManager.getAgendaEventSupport().fireActivationCreated( leftTuple, reteEvaluator ); - rtnLeftTuple.update( salienceInt, pctx ); - executor.addLeftTuple( leftTuple ); - reteEvaluator.getRuleEventSupport().onUpdateMatch( rtnLeftTuple ); + leftTuple.update( salienceInt, pctx ); + executor.modifyActiveTuple(leftTuple ); + reteEvaluator.getRuleEventSupport().onUpdateMatch( leftTuple ); } } } else { // LeftTuple is blocked, and thus not queued, so just update it's values - rtnLeftTuple.update(salienceInt, pctx); + leftTuple.update(salienceInt, pctx); } if( !rtnNode.isFireDirect() && executor.isDeclarativeAgendaEnabled()) { - modifyActivation(reteEvaluator, rtnLeftTuple); + modifyActivation(reteEvaluator, leftTuple); } } @@ -255,30 +254,29 @@ public void doLeftDeletes(ActivationsManager activationsManager, for (TupleImpl leftTuple = srcLeftTuples.getDeleteFirst(); leftTuple != null; ) { TupleImpl next = leftTuple.getStagedNext(); - doLeftDelete(activationsManager, executor, leftTuple); + doLeftDelete(activationsManager, executor, (RuleTerminalNodeLeftTuple) leftTuple); leftTuple.clearStaged(); leftTuple = next; } } - public static void doLeftDelete(ActivationsManager activationsManager, RuleExecutor executor, TupleImpl leftTuple) { - RuleTerminalNodeLeftTuple rtnLt = ( RuleTerminalNodeLeftTuple ) leftTuple; - rtnLt.setMatched( false ); + public static void doLeftDelete(ActivationsManager activationsManager, RuleExecutor executor, RuleTerminalNodeLeftTuple leftTuple) { + leftTuple.setMatched( false ); - rtnLt.cancelActivation( activationsManager ); + leftTuple.cancelActivation( activationsManager ); if ( leftTuple.getMemory() != null ) { // Expiration propagations should not be removed from the list, as they still need to fire - executor.removeLeftTuple(leftTuple); + executor.removeActiveTuple( leftTuple ); + } else if ( leftTuple.getStagedType() == Tuple.DELETE && !leftTuple.isQueued() ) { + executor.removeDormantTuple( leftTuple ); } leftTuple.setContextObject( null ); } - private static boolean blockedByLockOnActive(RuleImpl rule, - PropagationContext pctx, - InternalAgendaGroup agendaGroup) { + private static boolean blockedByLockOnActive(RuleImpl rule, PropagationContext pctx, InternalAgendaGroup agendaGroup) { if ( rule.isLockOnActive() ) { long handleRecency = pctx.getFactHandle().getRecency(); boolean isActive = agendaGroup.isActive(); @@ -288,9 +286,8 @@ private static boolean blockedByLockOnActive(RuleImpl rule, if ( isActive && activatedForRecency < handleRecency && agendaGroup.getAutoFocusActivator() != pctx ) { return true; - } else { - return clearedForRecency != -1 && clearedForRecency >= handleRecency; } + return clearedForRecency != -1 && clearedForRecency >= handleRecency; } return false; diff --git a/drools-core/src/main/java/org/drools/core/phreak/RuleExecutor.java b/drools-core/src/main/java/org/drools/core/phreak/RuleExecutor.java index 20d27d68850..675ba550e3f 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/RuleExecutor.java +++ b/drools-core/src/main/java/org/drools/core/phreak/RuleExecutor.java @@ -37,6 +37,7 @@ import org.drools.core.reteoo.TupleImpl; import org.drools.core.rule.consequence.InternalMatch; import org.drools.core.rule.consequence.KnowledgeHelper; +import org.drools.core.util.LinkedList; import org.drools.core.util.Queue; import org.drools.core.util.QueueFactory; import org.drools.core.util.index.TupleList; @@ -48,22 +49,26 @@ public class RuleExecutor { + private static final boolean DEBUG_DORMANT_TUPLE = false; + protected static final Logger log = LoggerFactory.getLogger(RuleExecutor.class); - private final PathMemory pmem; - private final RuleAgendaItem ruleAgendaItem; - private final TupleList tupleList; + private final PathMemory pmem; + private final RuleAgendaItem ruleAgendaItem; + private final TupleList activeMatches; + private final LinkedList dormantMatches; private final Queue queue; - private volatile boolean dirty; - private final boolean declarativeAgendaEnabled; - private boolean fireExitedEarly; + private volatile boolean dirty; + private final boolean declarativeAgendaEnabled; + private boolean fireExitedEarly; public RuleExecutor(final PathMemory pmem, RuleAgendaItem ruleAgendaItem, boolean declarativeAgendaEnabled) { this.pmem = pmem; this.ruleAgendaItem = ruleAgendaItem; - this.tupleList = new TupleList(); + this.activeMatches = new TupleList(); + this.dormantMatches = new LinkedList<>(); this.declarativeAgendaEnabled = declarativeAgendaEnabled; this.queue = ruleAgendaItem.getRule().getSalience().isDynamic() ? QueueFactory.createQueue(MatchConflictResolver.INSTANCE) : null; } @@ -89,15 +94,15 @@ public int evaluateNetworkAndFire( ActivationsManager activationsManager, Agenda private int doDirectFirings(ActivationsManager activationsManager, AgendaFilter filter, ReteEvaluator reteEvaluator) { RuleTerminalNode rtn = (RuleTerminalNode) pmem.getPathEndNode(); - int directFirings = tupleList.size(); + int directFirings = activeMatches.size(); - for (TupleImpl tuple = tupleList.getFirst(); tuple != null; tuple = tupleList.getFirst()) { + for (RuleTerminalNodeLeftTuple tuple = (RuleTerminalNodeLeftTuple) activeMatches.getFirst(); tuple != null; tuple = (RuleTerminalNodeLeftTuple) activeMatches.getFirst()) { if (cancelAndContinue(reteEvaluator, rtn, tuple, filter)) { directFirings--; } else { - fireActivationEvent(reteEvaluator, activationsManager, (InternalMatch) tuple, ((InternalMatch) tuple).getConsequence()); + fireActivationEvent(reteEvaluator, activationsManager, tuple, tuple.getConsequence()); } - removeLeftTuple( tuple ); + removeActiveTuple(tuple ); } ruleAgendaItem.remove(); return directFirings; @@ -114,7 +119,7 @@ public int fire(ActivationsManager activationsManager, AgendaFilter filter, int private int fire( ReteEvaluator reteEvaluator, ActivationsManager activationsManager, AgendaFilter filter, int fireCount, int fireLimit) { int localFireCount = 0; - if (!tupleList.isEmpty()) { + if (!activeMatches.isEmpty()) { if (!fireExitedEarly && isDeclarativeAgendaEnabled()) { // Network Evaluation can notify meta rules, which should be given a chance to fire first RuleAgendaItem nextRule = activationsManager.peekNextRule(); @@ -187,17 +192,19 @@ private int fire( ReteEvaluator reteEvaluator, ActivationsManager activationsMan } private TupleImpl getNextTuple() { - if (tupleList.isEmpty()) { + if (activeMatches.isEmpty()) { return null; } TupleImpl leftTuple; if (queue != null) { leftTuple = (TupleImpl) queue.dequeue(); - tupleList.remove(leftTuple); + activeMatches.remove(leftTuple); } else { - leftTuple = tupleList.removeFirst(); + leftTuple = activeMatches.removeFirst(); ((InternalMatch) leftTuple).setQueued(false); } + + addDormantTuple((RuleTerminalNodeLeftTuple) leftTuple); return leftTuple; } @@ -206,7 +213,7 @@ public PathMemory getPathMemory() { } public void removeRuleAgendaItemWhenEmpty(ReteEvaluator reteEvaluator) { - if (!dirty && tupleList.isEmpty()) { + if (!dirty && activeMatches.isEmpty()) { if (log.isTraceEnabled()) { log.trace("Removing RuleAgendaItem " + ruleAgendaItem); } @@ -282,40 +289,81 @@ private boolean isHigherSalience(RuleAgendaItem nextRule) { return RuleAgendaConflictResolver.doCompare(ruleAgendaItem, nextRule) >= 0; } - public TupleList getLeftTupleList() { - return tupleList; + public TupleList getActiveMatches() { + return activeMatches; + } + + public LinkedList getDormantMatches() { + return dormantMatches; } - public void addLeftTuple(TupleImpl tuple) { - ((RuleTerminalNodeLeftTuple) tuple).setQueued(true); - this.tupleList.add(tuple); + public void addDormantTuple(RuleTerminalNodeLeftTuple tuple) { + if (DEBUG_DORMANT_TUPLE) { + if (tuple.isDormant()) { + throw new IllegalStateException(); + } + } + dormantMatches.add(tuple); + if (DEBUG_DORMANT_TUPLE) { + tuple.setDormant(true); + } + } + + public void removeDormantTuple(RuleTerminalNodeLeftTuple tuple) { + if (DEBUG_DORMANT_TUPLE) { + if (!tuple.isDormant()) { + throw new IllegalStateException(); + } + } + dormantMatches.remove(tuple); + if (DEBUG_DORMANT_TUPLE) { + tuple.setDormant(false); + } + } + + public void addActiveTuple(RuleTerminalNodeLeftTuple tuple) { + tuple.setQueued(true); + if (DEBUG_DORMANT_TUPLE) { + if (tuple.isDormant()) { + throw new IllegalStateException(); + } + } + this.activeMatches.add(tuple); if (queue != null) { addQueuedLeftTuple(tuple); } } - public void addQueuedLeftTuple(Tuple tuple) { - int currentSalience = queue.isEmpty() ? 0 : queue.peek().getSalience(); - queue.enqueue((InternalMatch) tuple); - updateSalience(currentSalience); + public void modifyActiveTuple(RuleTerminalNodeLeftTuple tuple) { + removeDormantTuple(tuple); + addActiveTuple(tuple); } - public void removeLeftTuple(TupleImpl tuple) { - ((RuleTerminalNodeLeftTuple) tuple).setQueued(false); - this.tupleList.remove(tuple); + public void removeActiveTuple(RuleTerminalNodeLeftTuple tuple) { + tuple.setQueued(false); + activeMatches.remove(tuple); + if (tuple.getStagedType() != Tuple.DELETE) { + addDormantTuple(tuple); + } if (queue != null) { removeQueuedLeftTuple(tuple); } } - private void removeQueuedLeftTuple(Tuple tuple) { + public void addQueuedLeftTuple(RuleTerminalNodeLeftTuple tuple) { + int currentSalience = queue.isEmpty() ? 0 : queue.peek().getSalience(); + queue.enqueue(tuple); + updateSalience(currentSalience); + } + + private void removeQueuedLeftTuple(RuleTerminalNodeLeftTuple tuple) { int currentSalience = queue.isEmpty() ? 0 : queue.peek().getSalience(); - queue.dequeue(((InternalMatch) tuple)); + queue.dequeue(tuple); updateSalience(currentSalience); } private void updateSalience(int currentSalience) { - // the queue may be emtpy if no more matches are left, so reset it to default salience 0 + // the queue may be empty if no more matches are left, so reset it to default salience 0 int newSalience = queue.isEmpty() ? SalienceInteger.DEFAULT_SALIENCE.getValue() : queue.peek().getSalience(); if (currentSalience != newSalience) { // salience changed, so the RuleAgendaItem needs to be removed and re-added, for sorting @@ -328,8 +376,8 @@ private void updateSalience(int currentSalience) { } public void cancel(ReteEvaluator reteEvaluator, EventSupport es) { - while (!tupleList.isEmpty()) { - RuleTerminalNodeLeftTuple rtnLt = (RuleTerminalNodeLeftTuple) tupleList.removeFirst(); + while (!activeMatches.isEmpty()) { + RuleTerminalNodeLeftTuple rtnLt = (RuleTerminalNodeLeftTuple) activeMatches.removeFirst(); if (queue != null) { queue.dequeue(rtnLt); } @@ -393,7 +441,6 @@ private void fireActivationEvent(ReteEvaluator reteEvaluator, ActivationsManager internalMatch.setActive(false); knowledgeHelper.reset(); } catch ( final Exception e ) { - e.printStackTrace(); knowledgeHelper.restoreActivationOnConsequenceFailure(internalMatch); activationsManager.handleException(internalMatch, e); } finally { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/AlphaTerminalNode.java b/drools-core/src/main/java/org/drools/core/reteoo/AlphaTerminalNode.java index a44c9b8294b..66b53817c0e 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/AlphaTerminalNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/AlphaTerminalNode.java @@ -47,7 +47,7 @@ public void assertObject( InternalFactHandle factHandle, PropagationContext prop for (int i = 0; i < sinks.length; i++) { TerminalNode rtn = ( TerminalNode ) sinks[i]; RuleAgendaItem agendaItem = getRuleAgendaItem( reteEvaluator, activationsManager, rtn, true ); - TupleImpl leftTuple = TupleFactory.createLeftTuple(rtn, factHandle, true ); + RuleTerminalNodeLeftTuple leftTuple = (RuleTerminalNodeLeftTuple) TupleFactory.createLeftTuple(rtn, factHandle, true ); leftTuple.setPropagationContext( propagationContext ); if ( rtn.getRule().getAutoFocus() && !agendaItem.getAgendaGroup().isActive() ) { @@ -64,9 +64,9 @@ public void modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples mod NetworkNode[] sinks = getSinks(); for (int i = 0; i < sinks.length; i++) { - TerminalNode rtn = ( TerminalNode ) sinks[i]; - ObjectTypeNodeId otnId = rtn.getLeftInputOtnId(); - TupleImpl leftTuple = processDeletesFromModify(modifyPreviousTuples, context, reteEvaluator, otnId); + TerminalNode rtn = ( TerminalNode ) sinks[i]; + ObjectTypeNodeId otnId = rtn.getLeftInputOtnId(); + TupleImpl leftTuple = processDeletesFromModify(modifyPreviousTuples, context, reteEvaluator, otnId); RuleAgendaItem agendaItem = getRuleAgendaItem( reteEvaluator, activationsManager, rtn, true ); RuleExecutor executor = agendaItem.getRuleExecutor(); @@ -76,7 +76,7 @@ public void modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples mod leftTuple.reAdd(); if ( context.getModificationMask().intersects( rtn.getLeftInferredMask() ) ) { leftTuple.setPropagationContext( context ); - PhreakRuleTerminalNode.doLeftTupleUpdate( rtn, executor, activationsManager, leftTuple ); + PhreakRuleTerminalNode.doLeftTupleUpdate( rtn, executor, activationsManager, (RuleTerminalNodeLeftTuple) leftTuple ); if (leftTuple.isFullMatch()) { ((InternalMatch) leftTuple).setActive(true); } @@ -85,7 +85,7 @@ public void modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples mod if ( context.getModificationMask().intersects( rtn.getLeftInferredMask() ) ) { leftTuple = TupleFactory.createLeftTuple( rtn, factHandle, true ); leftTuple.setPropagationContext( context ); - PhreakRuleTerminalNode.doLeftTupleInsert( rtn, executor, activationsManager, agendaItem, leftTuple ); + PhreakRuleTerminalNode.doLeftTupleInsert( rtn, executor, activationsManager, agendaItem, (RuleTerminalNodeLeftTuple) leftTuple ); } } } @@ -96,7 +96,7 @@ public void retractLeftTuple(TupleImpl leftTuple, PropagationContext context, Re ActivationsManager activationsManager = reteEvaluator.getActivationsManager(); leftTuple.setPropagationContext( context ); TerminalNode rtn = (TerminalNode) leftTuple.getSink(); - PhreakRuleTerminalNode.doLeftDelete( activationsManager, getRuleAgendaItem( reteEvaluator, activationsManager, rtn, false ).getRuleExecutor(), leftTuple ); + PhreakRuleTerminalNode.doLeftDelete( activationsManager, getRuleAgendaItem( reteEvaluator, activationsManager, rtn, false ).getRuleExecutor(), (RuleTerminalNodeLeftTuple) leftTuple ); } public static RuleAgendaItem getRuleAgendaItem(ReteEvaluator reteEvaluator, ActivationsManager activationsManager, TerminalNode rtn, boolean linkPmem ) { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ModifyPreviousTuples.java b/drools-core/src/main/java/org/drools/core/reteoo/ModifyPreviousTuples.java index 7dc61d80dff..77b99649a40 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ModifyPreviousTuples.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ModifyPreviousTuples.java @@ -81,7 +81,7 @@ public void doDeleteObject(PropagationContext pctx, ReteEvaluator reteEvaluator, } else { ActivationsManager activationsManager = reteEvaluator.getActivationsManager(); PathMemory pathMemory = reteEvaluator.getNodeMemory( (TerminalNode) leftTuple.getSink() ); - PhreakRuleTerminalNode.doLeftDelete(activationsManager, pathMemory.getRuleAgendaItem().getRuleExecutor(), leftTuple); + PhreakRuleTerminalNode.doLeftDelete(activationsManager, pathMemory.getRuleAgendaItem().getRuleExecutor(), (RuleTerminalNodeLeftTuple) leftTuple); } } diff --git a/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNode.java b/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNode.java index 9bb2559d670..097cd7aa947 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNode.java @@ -26,8 +26,6 @@ import org.drools.base.reteoo.NodeTypeEnums; import org.drools.base.rule.Declaration; import org.drools.base.rule.GroupElement; -import org.drools.core.common.InternalFactHandle; -import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.phreak.PhreakRuleTerminalNode; import org.drools.core.phreak.RuleExecutor; @@ -144,7 +142,7 @@ public void cancelMatch(InternalMatch match, ReteEvaluator reteEvaluator) { } } RuleExecutor ruleExecutor = ((RuleTerminalNodeLeftTuple)leftTuple).getRuleAgendaItem().getRuleExecutor(); - PhreakRuleTerminalNode.doLeftDelete(ruleExecutor.getPathMemory().getActualActivationsManager( reteEvaluator ), ruleExecutor, leftTuple); + PhreakRuleTerminalNode.doLeftDelete(ruleExecutor.getPathMemory().getActualActivationsManager( reteEvaluator ), ruleExecutor, (RuleTerminalNodeLeftTuple) leftTuple); } } diff --git a/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNodeLeftTuple.java b/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNodeLeftTuple.java index c7a3da7192e..b02f2afe6db 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNodeLeftTuple.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNodeLeftTuple.java @@ -65,6 +65,9 @@ public class RuleTerminalNodeLeftTuple extends LeftTuple implements InternalMatc private RuleImpl rule; private Consequence consequence; + // left here for debugging purposes: switch RuleExecutor.DEBUG_DORMANT_TUPLE to true to enable this debugging + // private boolean dormant; + public RuleTerminalNodeLeftTuple() { // constructor needed for serialisation } @@ -221,7 +224,7 @@ public int getQueueIndex() { } public void dequeue() { - ruleAgendaItem.getRuleExecutor().removeLeftTuple(this); + ruleAgendaItem.getRuleExecutor().removeActiveTuple(this); } public void remove() { @@ -348,4 +351,14 @@ public int hashCode() { public boolean isFullMatch() { return true; } + + public boolean isDormant() { + throw new IllegalStateException("This method can be called only for debugging purposes. Uncomment dormant boolean to enable debugging."); + // return dormant; + } + + public void setDormant(boolean dormant) { + throw new IllegalStateException("This method can be called only for debugging purposes. Uncomment dormant boolean to enable debugging."); + // this.dormant = dormant; + } } diff --git a/drools-core/src/main/java/org/drools/core/reteoo/TupleFactory.java b/drools-core/src/main/java/org/drools/core/reteoo/TupleFactory.java index 777ed06c939..f0f9d7a1c6b 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/TupleFactory.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/TupleFactory.java @@ -19,14 +19,13 @@ package org.drools.core.reteoo; import org.drools.base.reteoo.NodeTypeEnums; -import org.drools.core.common.BaseNode; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.PropagationContext; public class TupleFactory { public static TupleImpl createPeer(Sink n, TupleImpl original) { TupleImpl peer; - switch(((BaseNode)n).getType()) { + switch(n.getType()) { case NodeTypeEnums.JoinNode: case NodeTypeEnums.AccumulateNode: case NodeTypeEnums.QueryElementNode: @@ -66,7 +65,7 @@ public static TupleImpl createLeftTuple(Sink s, final InternalFactHandle factHandle, boolean leftTupleMemoryEnabled) { - switch(((BaseNode)s).getType()) { + switch(s.getType()) { case NodeTypeEnums.JoinNode: case NodeTypeEnums.AccumulateNode: case NodeTypeEnums.QueryElementNode: @@ -96,7 +95,7 @@ public static TupleImpl createLeftTuple(Sink s, public static TupleImpl createLeftTuple(final InternalFactHandle factHandle, final TupleImpl leftTuple, final Sink s) { - switch(((BaseNode)s).getType()) { + switch(s.getType()) { case NodeTypeEnums.JoinNode: case NodeTypeEnums.AccumulateNode: case NodeTypeEnums.QueryElementNode: @@ -127,7 +126,7 @@ public static TupleImpl createLeftTuple(TupleImpl leftTuple, Sink s, PropagationContext pctx, boolean leftTupleMemoryEnabled) { - switch(((BaseNode)s).getType()) { + switch(s.getType()) { case NodeTypeEnums.JoinNode: case NodeTypeEnums.AccumulateNode: case NodeTypeEnums.QueryElementNode: @@ -157,7 +156,7 @@ public static TupleImpl createLeftTuple(TupleImpl leftTuple, public static TupleImpl createLeftTuple(TupleImpl leftTuple, TupleImpl rightTuple, Sink s) { - switch(((BaseNode)s).getType()) { + switch(s.getType()) { case NodeTypeEnums.JoinNode: case NodeTypeEnums.AccumulateNode: case NodeTypeEnums.QueryElementNode: @@ -190,7 +189,7 @@ public static TupleImpl createLeftTuple(TupleImpl leftTuple, TupleImpl currentRightChild, Sink s, boolean leftTupleMemoryEnabled) { - switch(((BaseNode)s).getType()) { + switch(s.getType()) { case NodeTypeEnums.JoinNode: case NodeTypeEnums.AccumulateNode: case NodeTypeEnums.QueryElementNode: diff --git a/drools-core/src/main/java/org/drools/core/util/LinkedList.java b/drools-core/src/main/java/org/drools/core/util/LinkedList.java index b6b924ddf8b..cc436849cfd 100644 --- a/drools-core/src/main/java/org/drools/core/util/LinkedList.java +++ b/drools-core/src/main/java/org/drools/core/util/LinkedList.java @@ -22,12 +22,13 @@ import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.util.Collection; import java.util.NoSuchElementException; import org.drools.core.reteoo.TupleImpl; /** - * This is a simple linked linked implementation. Each node must implement LinkedListNode so that it references + * This is a simple linked implementation. Each node must implement LinkedListNode so that it references * the node before and after it. This way a node can be removed without having to scan the list to find it. This class * does not provide an Iterator implementation as its designed for efficiency and not genericity. There are a number of * ways to iterate the list. @@ -468,8 +469,7 @@ public JavaUtilIterator() { } public JavaUtilIterator(final LinkedList list) { - this( list, - true ); + this( list, true ); } public JavaUtilIterator(final LinkedList list, @@ -526,4 +526,10 @@ protected void copyStateInto(LinkedList other) { other.lastNode = lastNode; other.size = size; } + + public void addAllToCollection(Collection c) { + for (T item = getFirst(); item != null; item = item.getNext()) { + c.add((I) item); + } + } } diff --git a/drools-kiesession/src/main/java/org/drools/kiesession/agenda/DefaultAgenda.java b/drools-kiesession/src/main/java/org/drools/kiesession/agenda/DefaultAgenda.java index e74c10e80a7..cd8978d3092 100644 --- a/drools-kiesession/src/main/java/org/drools/kiesession/agenda/DefaultAgenda.java +++ b/drools-kiesession/src/main/java/org/drools/kiesession/agenda/DefaultAgenda.java @@ -284,7 +284,7 @@ public boolean isRuleActiveInRuleFlowGroup(String ruleflowGroupName, String rule // The lazy RuleAgendaItem must be fully evaluated, to see if there is a rule match RuleExecutor ruleExecutor = item.getRuleExecutor(); ruleExecutor.evaluateNetwork(this); - TupleList list = ruleExecutor.getLeftTupleList(); + TupleList list = ruleExecutor.getActiveMatches(); for (RuleTerminalNodeLeftTuple lt = (RuleTerminalNodeLeftTuple) list.getFirst(); lt != null; lt = (RuleTerminalNodeLeftTuple) lt.getNext()) { if ( ruleName.equals( lt.getRule().getName() ) && ( lt.checkProcessInstance( workingMemory, processInstanceId ) )) { return true; diff --git a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELAccumulateBuilderTest.java b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELAccumulateBuilderTest.java index 90bf0047b89..5aefec89e3d 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELAccumulateBuilderTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELAccumulateBuilderTest.java @@ -20,25 +20,24 @@ import java.util.Collections; +import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.base.reteoo.InitialFactImpl; +import org.drools.base.rule.Accumulate; import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.compiler.builder.impl.KnowledgeBuilderImpl; import org.drools.compiler.compiler.DialectCompiletimeRegistry; -import org.drools.core.reteoo.LeftTuple; -import org.drools.drl.ast.descr.AccumulateDescr; -import org.drools.drl.ast.descr.PackageDescr; -import org.drools.drl.ast.descr.PatternDescr; -import org.drools.drl.ast.descr.RuleDescr; import org.drools.compiler.rule.builder.RuleBuildContext; import org.drools.core.common.InternalFactHandle; -import org.drools.base.definitions.InternalKnowledgePackage; -import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.core.reteoo.AccumulateNode; -import org.drools.base.reteoo.InitialFactImpl; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.MockLeftTupleSink; import org.drools.core.reteoo.MockTupleSource; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.rule.Accumulate; +import org.drools.drl.ast.descr.AccumulateDescr; +import org.drools.drl.ast.descr.PackageDescr; +import org.drools.drl.ast.descr.PatternDescr; +import org.drools.drl.ast.descr.RuleDescr; +import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; import org.drools.kiesession.session.StatefulKnowledgeSessionImpl; import org.drools.mvel.MVELDialectRuntimeData; @@ -98,7 +97,7 @@ public void testSimpleExpression() { 10 ); final Cheese cheddar2 = new Cheese( "cheddar", 8 ); - final InternalFactHandle f0 = (InternalFactHandle) ksession.insert( new InitialFactImpl() ); + final InternalFactHandle f0 = (InternalFactHandle) ksession.insert( InitialFactImpl.getInstance() ); final InternalFactHandle f1 = (InternalFactHandle) ksession.insert( cheddar1 ); final InternalFactHandle f2 = (InternalFactHandle) ksession.insert( cheddar2 ); final LeftTuple tuple = new LeftTuple( f0, diff --git a/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/iterators/PhreakActivationIterator.java b/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/iterators/PhreakActivationIterator.java index b12da2c0127..8af734daaa9 100644 --- a/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/iterators/PhreakActivationIterator.java +++ b/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/iterators/PhreakActivationIterator.java @@ -19,55 +19,23 @@ package org.drools.serialization.protobuf.iterators; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; import java.util.List; -import java.util.Set; import org.drools.base.reteoo.NodeTypeEnums; -import org.drools.core.common.InternalFactHandle; -import org.drools.core.common.InternalWorkingMemory; -import org.drools.core.common.Memory; import org.drools.core.common.ReteEvaluator; import org.drools.core.impl.InternalRuleBase; -import org.drools.core.reteoo.AccumulateNode.AccumulateContext; -import org.drools.core.reteoo.AccumulateNode.AccumulateMemory; -import org.drools.core.reteoo.BetaMemory; -import org.drools.core.reteoo.BetaNode; -import org.drools.core.reteoo.FromNode.FromMemory; -import org.drools.core.reteoo.LeftInputAdapterNode; -import org.drools.core.reteoo.LeftTuple; -import org.drools.core.reteoo.LeftTupleSink; -import org.drools.core.reteoo.LeftTupleSource; -import org.drools.core.reteoo.ObjectSource; -import org.drools.core.reteoo.ObjectTypeNode; -import org.drools.core.reteoo.RightTuple; -import org.drools.core.reteoo.RuleTerminalNode; +import org.drools.core.phreak.RuleExecutor; +import org.drools.core.reteoo.PathMemory; import org.drools.core.reteoo.TerminalNode; -import org.drools.core.reteoo.Tuple; -import org.drools.core.reteoo.TupleImpl; -import org.drools.core.reteoo.TupleMemory; import org.drools.core.rule.consequence.InternalMatch; -import org.drools.core.util.FastIterator; import org.drools.core.util.Iterator; -public class PhreakActivationIterator - implements - Iterator { +public class PhreakActivationIterator implements Iterator { - private java.util.Iterator agendaItemIter; - - List internalMatches; - - PhreakActivationIterator() { + private final java.util.Iterator agendaItemIter; - } - - private PhreakActivationIterator(ReteEvaluator reteEvaluator, - InternalRuleBase kbase) { - internalMatches = collectAgendaItems(kbase, reteEvaluator); - agendaItemIter = internalMatches.iterator(); + private PhreakActivationIterator(ReteEvaluator reteEvaluator, InternalRuleBase kbase) { + agendaItemIter = collectAgendaItems(kbase, reteEvaluator).iterator(); } public static PhreakActivationIterator iterator(ReteEvaluator reteEvaluator) { @@ -82,158 +50,22 @@ public InternalMatch next() { } } - public static List populateRuleTerminalNodes(InternalRuleBase kbase, Set nodeSet) { - Collection nodesWithArray = kbase.getReteooBuilder().getTerminalNodes().values(); + private static List collectAgendaItems(InternalRuleBase kbase, ReteEvaluator reteEvaluator) { + List internalMatches = new ArrayList<>(); - for (TerminalNode[] nodeArray : nodesWithArray) { + for (TerminalNode[] nodeArray : kbase.getReteooBuilder().getTerminalNodes().values()) { for (TerminalNode node : nodeArray) { if (node.getType() == NodeTypeEnums.RuleTerminalNode) { - nodeSet.add((RuleTerminalNode) node); - } - } - } - - return Arrays.asList(nodeSet.toArray(new RuleTerminalNode[nodeSet.size()])); - } - - public static List collectAgendaItems(InternalRuleBase kbase, ReteEvaluator reteEvaluator) { - Set nodeSet = new HashSet<>(); - List nodeList = populateRuleTerminalNodes(kbase, nodeSet); - - List internalMatches = new ArrayList<>(); - for ( RuleTerminalNode rtn : nodeList ) { - if ( !nodeSet.contains(rtn) ) { - // this node has already been processed - continue; - } - processLeftTuples(rtn.getLeftTupleSource(), internalMatches, nodeSet, reteEvaluator); - } - return internalMatches; - } - - public static void processLeftTuples(LeftTupleSource node, List internalMatches, Set nodeSet, ReteEvaluator reteEvaluator) { - LeftTupleSource node1 = node; - while (!NodeTypeEnums.isLeftInputAdapterNode((node1))) { - node1 = node1.getLeftTupleSource(); - } - int maxShareCount = node1.getAssociationsSize(); - - while (!NodeTypeEnums.isLeftInputAdapterNode(node)) { - Memory memory = reteEvaluator.getNodeMemories().peekNodeMemory(node); - if (memory == null || memory.getSegmentMemory() == null) { - // segment has never been initialized, which means the rule has never been linked. - return; - } - if ( node.getAssociationsSize() == maxShareCount ) { - // the recurse must start from the first split node, otherwise we get partial overlaps in propagations - if (NodeTypeEnums.isBetaNode(node)) { - BetaMemory bm; - if (NodeTypeEnums.AccumulateNode == node.getType()) { - AccumulateMemory am = (AccumulateMemory) memory; - bm = am.getBetaMemory(); - FastIterator it = bm.getLeftTupleMemory().fullFastIterator(); - Tuple lt = BetaNode.getFirstTuple( bm.getLeftTupleMemory(), it ); - for (; lt != null; lt = (TupleImpl) it.next(lt)) { - AccumulateContext accctx = (AccumulateContext) lt.getContextObject(); - collectFromPeers((TupleImpl) accctx.getResultLeftTuple(), internalMatches, nodeSet, reteEvaluator); - } - } else if ( NodeTypeEnums.ExistsNode == node.getType() ) { - bm = (BetaMemory) reteEvaluator.getNodeMemories().peekNodeMemory(node); - if (bm != null) { - bm = (BetaMemory) reteEvaluator.getNodeMemories().peekNodeMemory(node); - FastIterator it = bm.getRightTupleMemory().fullFastIterator(); // done off the RightTupleMemory, as exists only have unblocked tuples on the left side - RightTuple rt = (RightTuple) BetaNode.getFirstTuple(bm.getRightTupleMemory(), it); - for (; rt != null; rt = (RightTuple) it.next(rt)) { - for (LeftTuple lt = rt.getBlocked(); lt != null; lt = lt.getBlockedNext()) { - if (lt.getFirstChild() != null) { - collectFromPeers(lt.getFirstChild(), internalMatches, nodeSet, reteEvaluator); - } - } - } - } - } else { - bm = (BetaMemory) reteEvaluator.getNodeMemories().peekNodeMemory(node); - if (bm != null) { - FastIterator it = bm.getLeftTupleMemory().fullFastIterator(); - Tuple lt = BetaNode.getFirstTuple(bm.getLeftTupleMemory(), it); - for (; lt != null; lt = (TupleImpl) it.next(lt)) { - if (lt.getFirstChild() != null) { - collectFromLeftInput(lt.getFirstChild(), internalMatches, nodeSet, reteEvaluator); - } - } - } - } - return; - } else if (NodeTypeEnums.FromNode == node.getType()) { - FromMemory fm = (FromMemory) reteEvaluator.getNodeMemories().peekNodeMemory(node); - if (fm != null) { - TupleMemory ltm = fm.getBetaMemory().getLeftTupleMemory(); - FastIterator it = ltm.fullFastIterator(); - for (TupleImpl lt = (TupleImpl) ltm.getFirst(null); lt != null; lt = (TupleImpl) it.next(lt)) { - if (lt.getFirstChild() != null) { - collectFromLeftInput(lt.getFirstChild(), internalMatches, nodeSet, reteEvaluator); - } - } + PathMemory pathMemory = (PathMemory) reteEvaluator.getNodeMemories().peekNodeMemory(node); + if (pathMemory != null && pathMemory.getRuleAgendaItem() != null) { + RuleExecutor ruleExecutor = pathMemory.getRuleAgendaItem().getRuleExecutor(); + ruleExecutor.getDormantMatches().addAllToCollection(internalMatches); + ruleExecutor.getActiveMatches().addAllToCollection(internalMatches); } - return; } } - node = node.getLeftTupleSource(); - } - - // No beta or from nodes, so must retrieve LeftTuples from the LiaNode. - // This is done by scanning all the LeftTuples referenced from the FactHandles in the ObjectTypeNode - LeftInputAdapterNode lian = (LeftInputAdapterNode) node; - if ( !lian.isTerminal() ) { - Memory memory = reteEvaluator.getNodeMemories().peekNodeMemory(node); - if (memory == null || memory.getSegmentMemory() == null) { - // segment has never been initialized, which means the rule has never been linked. - return; - } - } - - ObjectSource os = lian.getObjectSource(); - while (os.getType() != NodeTypeEnums.ObjectTypeNode) { - os = os.getParentObjectSource(); - } - ObjectTypeNode otn = (ObjectTypeNode) os; - LeftTupleSink firstLiaSink = lian.getSinkPropagator().getFirstLeftTupleSink(); - - java.util.Iterator it = otn.getFactHandlesIterator((InternalWorkingMemory) reteEvaluator); - while (it.hasNext()) { - InternalFactHandle fh = it.next(); - fh.forEachLeftTuple( lt -> { - if (lt.getSink() == firstLiaSink ) { - collectFromLeftInput(lt, internalMatches, nodeSet, reteEvaluator); - } - }); } - } - private static void collectFromLeftInput(TupleImpl lt, List internalMatches, Set nodeSet, ReteEvaluator reteEvaluator) { - for (; lt != null; lt = lt.getHandleNext()) { - collectFromPeers(lt, internalMatches, nodeSet, reteEvaluator); - } - } - - private static void collectFromPeers(TupleImpl peer, List internalMatches, Set nodeSet, ReteEvaluator reteEvaluator) { - while (peer != null) { - if (peer.getSink().getType() == NodeTypeEnums.AccumulateNode ) { - Object accctx = peer.getContextObject(); - if (accctx instanceof AccumulateContext) { - // lefttuple representing an accumulated value now have that value as context object (it was null before) and must be skipped here - collectFromLeftInput((TupleImpl) ((AccumulateContext) accctx).getResultLeftTuple(), internalMatches, nodeSet, reteEvaluator); - } - } else if ( peer.getFirstChild() != null ) { - for (TupleImpl childLt = peer.getFirstChild(); childLt != null; childLt = childLt.getHandleNext()) { - collectFromPeers(childLt, internalMatches, nodeSet, reteEvaluator); - } - } else if (peer.getSink().getType() == NodeTypeEnums.RuleTerminalNode ) { - internalMatches.add((InternalMatch) peer); - nodeSet.remove(peer.getSink()); // remove this RuleTerminalNode, as we know we've visited it already - } - peer = peer.getPeer(); - } + return internalMatches; } - } diff --git a/drools-serialization-protobuf/src/test/java/org/drools/serialization/protobuf/MarshallingTest.java b/drools-serialization-protobuf/src/test/java/org/drools/serialization/protobuf/MarshallingTest.java index 9587944533f..3258b90b1f8 100644 --- a/drools-serialization-protobuf/src/test/java/org/drools/serialization/protobuf/MarshallingTest.java +++ b/drools-serialization-protobuf/src/test/java/org/drools/serialization/protobuf/MarshallingTest.java @@ -18,15 +18,38 @@ */ package org.drools.serialization.protobuf; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; + +import org.drools.base.base.ClassObjectType; import org.drools.base.base.ValueResolver; import org.drools.base.common.DroolsObjectInputStream; import org.drools.base.common.DroolsObjectOutputStream; -import org.drools.core.ClockType; -import org.drools.core.SessionConfiguration; -import org.drools.base.base.ClassObjectType; -import org.drools.core.common.*; import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.MapBackedClassLoader; +import org.drools.base.rule.consequence.Consequence; +import org.drools.base.rule.consequence.ConsequenceContext; +import org.drools.core.ClockType; +import org.drools.core.SessionConfiguration; +import org.drools.core.common.BaseNode; +import org.drools.core.common.InternalAgenda; +import org.drools.core.common.InternalFactHandle; +import org.drools.core.common.InternalWorkingMemory; import org.drools.core.impl.EnvironmentFactory; import org.drools.core.impl.RuleBaseFactory; import org.drools.core.marshalling.ClassObjectMarshallingStrategyAcceptor; @@ -35,9 +58,6 @@ import org.drools.core.reteoo.ObjectTypeNode; import org.drools.core.reteoo.RuleTerminalNode; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.rule.MapBackedClassLoader; -import org.drools.base.rule.consequence.Consequence; -import org.drools.base.rule.consequence.ConsequenceContext; import org.drools.core.time.impl.DurationTimer; import org.drools.core.time.impl.PseudoClockScheduler; import org.drools.core.util.KeyStoreConstants; @@ -45,7 +65,15 @@ import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; import org.drools.mvel.CommonTestMethodBase; -import org.drools.mvel.compiler.*; +import org.drools.mvel.compiler.Address; +import org.drools.mvel.compiler.Cell; +import org.drools.mvel.compiler.Cheese; +import org.drools.mvel.compiler.FactA; +import org.drools.mvel.compiler.FactB; +import org.drools.mvel.compiler.FactC; +import org.drools.mvel.compiler.Message; +import org.drools.mvel.compiler.Person; +import org.drools.mvel.compiler.Primitives; import org.drools.mvel.integrationtests.IteratorToList; import org.drools.serialization.protobuf.marshalling.IdentityPlaceholderResolverStrategy; import org.drools.serialization.protobuf.marshalling.RuleBaseNodes; @@ -63,7 +91,11 @@ import org.kie.api.marshalling.Marshaller; import org.kie.api.marshalling.ObjectMarshallingStrategy; import org.kie.api.marshalling.ObjectMarshallingStrategyAcceptor; -import org.kie.api.runtime.*; +import org.kie.api.runtime.Environment; +import org.kie.api.runtime.EnvironmentName; +import org.kie.api.runtime.Globals; +import org.kie.api.runtime.KieSession; +import org.kie.api.runtime.KieSessionConfiguration; import org.kie.api.runtime.conf.ClockTypeOption; import org.kie.api.runtime.conf.TimedRuleExecutionOption; import org.kie.api.runtime.conf.TimerJobFactoryOption; @@ -74,14 +106,6 @@ import org.kie.internal.marshalling.MarshallerFactory; import org.kie.internal.utils.KieHelper; -import java.io.*; -import java.net.URL; -import java.util.*; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.jar.JarEntry; -import java.util.jar.JarInputStream; - import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; import static org.drools.serialization.protobuf.SerializationHelper.getSerialisedStatefulKnowledgeSession; @@ -1491,20 +1515,17 @@ public void testTruthMaintenance() throws Exception { ksession.fireAllRules(); assertThat(list.size()).isEqualTo(1); - ksession = getSerialisedStatefulKnowledgeSession( ksession, - true ); + ksession = getSerialisedStatefulKnowledgeSession( ksession, true ); ksession.fireAllRules(); assertThat(list.size()).isEqualTo(2); - ksession = getSerialisedStatefulKnowledgeSession( ksession, - true ); + ksession = getSerialisedStatefulKnowledgeSession( ksession, true ); ksession.fireAllRules(); assertThat(list.size()).isEqualTo(3); // should not grow any further - ksession = getSerialisedStatefulKnowledgeSession( ksession, - true ); + ksession = getSerialisedStatefulKnowledgeSession( ksession, true ); ksession.fireAllRules(); assertThat(list.size()).isEqualTo(3); } diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/AbstractCepEspTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/AbstractCepEspTest.java index c3a308c7728..0c16e17ee98 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/AbstractCepEspTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/AbstractCepEspTest.java @@ -91,7 +91,7 @@ public void testAssertBehaviorOnEntryPoints() { } } - @Test + @Test(timeout = 10000L) public void testDuplicateFiring2() { final String drl = "package org.test;\n" + diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/ExecutionFlowControlTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/ExecutionFlowControlTest.java index 510bffa593e..ebbd2d9f352 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/ExecutionFlowControlTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/ExecutionFlowControlTest.java @@ -475,31 +475,31 @@ public void testLockOnActiveWithModify() throws Exception { assertThat(group1.size()).isEqualTo(1); RuleAgendaItem ruleItem1 = group1.getActivations().iterator().next(); ruleItem1.getRuleExecutor().evaluateNetwork(wm.getAgenda()); - assertThat(ruleItem1.getRuleExecutor().getLeftTupleList().size()).isEqualTo(3); + assertThat(ruleItem1.getRuleExecutor().getActiveMatches().size()).isEqualTo(3); ruleItem1.getRuleExecutor().fire(agenda); assertThat(group1.size()).isEqualTo(1); - assertThat(ruleItem1.getRuleExecutor().getLeftTupleList().size()).isEqualTo(2); + assertThat(ruleItem1.getRuleExecutor().getActiveMatches().size()).isEqualTo(2); ksession.update( brieHandle, brie ); assertThat(group1.size()).isEqualTo(1); ruleItem1.getRuleExecutor().evaluateNetwork(wm.getAgenda()); - assertThat(ruleItem1.getRuleExecutor().getLeftTupleList().size()).isEqualTo(2); + assertThat(ruleItem1.getRuleExecutor().getActiveMatches().size()).isEqualTo(2); InternalAgendaGroup group2 = agenda.getAgendaGroupsManager().getAgendaGroup( "group2" ); agenda.getAgendaGroupsManager().setFocus( group2); assertThat(group2.size()).isEqualTo(1); RuleAgendaItem ruleItem2 = group2.getActivations().iterator().next(); ruleItem2.getRuleExecutor().evaluateNetwork(wm.getAgenda()); - assertThat(ruleItem2.getRuleExecutor().getLeftTupleList().size()).isEqualTo(3); + assertThat(ruleItem2.getRuleExecutor().getActiveMatches().size()).isEqualTo(3); ruleItem2.getRuleExecutor().fire(agenda); assertThat(group2.size()).isEqualTo(1); - assertThat(ruleItem2.getRuleExecutor().getLeftTupleList().size()).isEqualTo(2); + assertThat(ruleItem2.getRuleExecutor().getActiveMatches().size()).isEqualTo(2); ksession.update( brieHandle, brie ); assertThat(group2.size()).isEqualTo(1); - assertThat(ruleItem2.getRuleExecutor().getLeftTupleList().size()).isEqualTo(2); + assertThat(ruleItem2.getRuleExecutor().getActiveMatches().size()).isEqualTo(2); } @Test diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/NamedConsequencesTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/NamedConsequencesTest.java index f9e77b371cc..3e700bb0041 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/NamedConsequencesTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/NamedConsequencesTest.java @@ -758,7 +758,7 @@ public void testDynamicSalience() { KieBase kbase = KieBaseUtil.getKieBaseFromKieModuleFromDrl("test", kieBaseTestConfiguration, str); KieSession ksession = kbase.newKieSession(); - List results = new ArrayList(); + List results = new ArrayList<>(); ksession.setGlobal("results", results); for (int i = 1; i < 7; i++) { ksession.insert(new Fact(i)); @@ -788,6 +788,11 @@ public Status getStatus() { public void setStatus(Status status) { this.status = status; } + + @Override + public String toString() { + return "Fact(" + id + ")"; + } } @Test diff --git a/drools-tms/src/main/java/org/drools/tms/agenda/TruthMaintenanceSystemRuleTerminalNodeLeftTuple.java b/drools-tms/src/main/java/org/drools/tms/agenda/TruthMaintenanceSystemRuleTerminalNodeLeftTuple.java index 7774161c2ba..0c0a5db05fa 100644 --- a/drools-tms/src/main/java/org/drools/tms/agenda/TruthMaintenanceSystemRuleTerminalNodeLeftTuple.java +++ b/drools-tms/src/main/java/org/drools/tms/agenda/TruthMaintenanceSystemRuleTerminalNodeLeftTuple.java @@ -106,7 +106,7 @@ public void removeAllBlockersAndBlocked(ActivationsManager activationsManager) { removeBlocked(dep); TruthMaintenanceSystemRuleTerminalNodeLeftTuple justified = (TruthMaintenanceSystemRuleTerminalNodeLeftTuple) dep.getJustified(); if (justified.getBlockers().isEmpty() && justified.isActive()) { - activationsManager.stageLeftTuple(ruleAgendaItem, justified); + activationsManager.stageLeftTuple(justified.getRuleAgendaItem(), justified); } dep = tmp; } From f5a441ff6f5d41f0027cc56ba733770475777e5f Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Wed, 10 Apr 2024 17:00:37 +0200 Subject: [PATCH 10/12] [KIE-1077] fix executable model generation with generics (#5836) --- .../execmodel/generator/DrlxParseUtil.java | 12 +- .../expressiontyper/ExpressionTyper.java | 156 ++++++++---------- .../model/codegen/execmodel/GenericsTest.java | 69 ++++++-- .../main/java/org/drools/util/ClassUtils.java | 12 +- 4 files changed, 138 insertions(+), 111 deletions(-) diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/DrlxParseUtil.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/DrlxParseUtil.java index b39396d8ce5..2f19929d3c7 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/DrlxParseUtil.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/DrlxParseUtil.java @@ -89,11 +89,6 @@ import com.github.javaparser.ast.type.UnknownType; import org.drools.drl.ast.descr.AnnotationDescr; import org.drools.drl.ast.descr.PatternDescr; -import org.drools.util.TypeResolver; -import org.drools.util.ClassUtils; -import org.drools.util.IncompatibleGetterOverloadException; -import org.drools.util.MethodUtils; -import org.drools.util.StringUtils; import org.drools.model.Index; import org.drools.model.codegen.execmodel.errors.IncompatibleGetterOverloadError; import org.drools.model.codegen.execmodel.errors.InvalidExpressionErrorResult; @@ -110,15 +105,20 @@ import org.drools.mvelcompiler.ConstraintCompiler; import org.drools.mvelcompiler.MvelCompiler; import org.drools.mvelcompiler.context.MvelCompilerContext; +import org.drools.util.ClassUtils; +import org.drools.util.IncompatibleGetterOverloadException; +import org.drools.util.MethodUtils; +import org.drools.util.StringUtils; +import org.drools.util.TypeResolver; import static java.util.Optional.empty; import static java.util.Optional.of; import static java.util.stream.Collectors.toList; -import static org.drools.util.MethodUtils.findMethod; import static org.drools.model.codegen.execmodel.generator.DslMethodNames.PATTERN_CALL; import static org.drools.model.codegen.execmodel.generator.DslMethodNames.isDslTopLevelNamespace; import static org.drools.model.codegen.execmodel.generator.expressiontyper.ExpressionTyper.findLeftLeafOfNameExprTraversingParent; import static org.drools.util.ClassUtils.toRawClass; +import static org.drools.util.MethodUtils.findMethod; public class DrlxParseUtil { diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/expressiontyper/ExpressionTyper.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/expressiontyper/ExpressionTyper.java index f95c6037920..62795cec94b 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/expressiontyper/ExpressionTyper.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/expressiontyper/ExpressionTyper.java @@ -186,8 +186,7 @@ private Optional toTypedExpressionRec(Expression drlxExpr) { return typedExpression.map(t -> t.cloneWithNewExpression(new EnclosedExpr(t.getExpression()))); } - if (drlxExpr instanceof MethodCallExpr) { - MethodCallExpr methodExpr = (MethodCallExpr) drlxExpr; + if (drlxExpr instanceof MethodCallExpr methodExpr) { Expression expr = methodExpr; if (isEval(methodExpr.getNameAsString(), methodExpr.getScope(), methodExpr.getArguments())) { expr = methodExpr.getArgument(0); @@ -195,8 +194,7 @@ private Optional toTypedExpressionRec(Expression drlxExpr) { drlxExpr = expr; } - if (drlxExpr instanceof NullSafeMethodCallExpr) { - NullSafeMethodCallExpr methodExpr = (NullSafeMethodCallExpr) drlxExpr; + if (drlxExpr instanceof NullSafeMethodCallExpr methodExpr) { Expression expr = methodExpr; if (isEval(methodExpr.getNameAsString(), methodExpr.getScope(), methodExpr.getArguments())) { expr = methodExpr.getArgument(0); @@ -204,14 +202,12 @@ private Optional toTypedExpressionRec(Expression drlxExpr) { drlxExpr = expr; } - if (drlxExpr instanceof UnaryExpr) { - UnaryExpr unaryExpr = (UnaryExpr) drlxExpr; + if (drlxExpr instanceof UnaryExpr unaryExpr) { Optional optTypedExpr = toTypedExpressionRec(unaryExpr.getExpression()); return optTypedExpr.map(typedExpr -> new TypedExpression( new UnaryExpr( typedExpr.getExpression(), unaryExpr.getOperator() ), typedExpr.getType() )); } - if (drlxExpr instanceof BinaryExpr) { - BinaryExpr binaryExpr = (BinaryExpr) drlxExpr; + if (drlxExpr instanceof BinaryExpr binaryExpr) { BinaryExpr.Operator operator = binaryExpr.getOperator(); @@ -263,8 +259,7 @@ private Optional toTypedExpressionRec(Expression drlxExpr) { } - if (drlxExpr instanceof CastExpr) { - CastExpr castExpr = (CastExpr)drlxExpr; + if (drlxExpr instanceof CastExpr castExpr) { Optional optTypedExpr = toTypedExpressionRec(castExpr.getExpression()); return optTypedExpr.map(typedExpr -> new TypedExpression(new CastExpr(castExpr.getType(), typedExpr.getExpression()), getClassFromContext(ruleContext.getTypeResolver(), castExpr.getType().asString()))); } @@ -279,10 +274,7 @@ private Optional toTypedExpressionRec(Expression drlxExpr) { return toTypedExpressionFromMethodCallOrField(drlxExpr).getTypedExpression(); } - if (drlxExpr instanceof PointFreeExpr) { - - final PointFreeExpr pointFreeExpr = (PointFreeExpr)drlxExpr; - + if (drlxExpr instanceof PointFreeExpr pointFreeExpr) { Optional optLeft = toTypedExpressionRec(pointFreeExpr.getLeft()); Optional optRight = pointFreeExpr.getRight().size() == 1 ? toTypedExpressionRec(pointFreeExpr.getRight().get( 0 )) : Optional.empty(); OperatorSpec opSpec = getOperatorSpec(pointFreeExpr.getRight(), pointFreeExpr.getOperator()); @@ -293,8 +285,7 @@ private Optional toTypedExpressionRec(Expression drlxExpr) { .setRight( optRight.orElse( null ) ) ); } - if (drlxExpr instanceof HalfPointFreeExpr) { - final HalfPointFreeExpr halfPointFreeExpr = (HalfPointFreeExpr)drlxExpr; + if (drlxExpr instanceof HalfPointFreeExpr halfPointFreeExpr) { Expression parentLeft = findLeftLeafOfNameExprTraversingParent(halfPointFreeExpr); if (parentLeft == halfPointFreeExpr) { throw new CannotTypeExpressionException("left leaf is the same : halfPointFreeExpr = " + halfPointFreeExpr + ", originalExpression = " + context.getOriginalExpression()); @@ -321,8 +312,7 @@ private Optional toTypedExpressionRec(Expression drlxExpr) { } - if (drlxExpr instanceof ArrayAccessExpr) { - final ArrayAccessExpr arrayAccessExpr = (ArrayAccessExpr)drlxExpr; + if (drlxExpr instanceof ArrayAccessExpr arrayAccessExpr) { if (Map.class.isAssignableFrom( typeCursor )) { return createMapAccessExpression(arrayAccessExpr.getIndex(), arrayAccessExpr.getName() instanceof ThisExpr ? new NameExpr(THIS_PLACEHOLDER) : arrayAccessExpr.getName(), Object.class); } else if (arrayAccessExpr.getName() instanceof FieldAccessExpr ) { @@ -342,8 +332,7 @@ private Optional toTypedExpressionRec(Expression drlxExpr) { } } - if (drlxExpr instanceof InstanceOfExpr) { - InstanceOfExpr instanceOfExpr = (InstanceOfExpr)drlxExpr; + if (drlxExpr instanceof InstanceOfExpr instanceOfExpr) { ruleContext.addInlineCastType(printNode(instanceOfExpr.getExpression()), instanceOfExpr.getType()); return toTypedExpressionRec(instanceOfExpr.getExpression()) .map( e -> new TypedExpression(new InstanceOfExpr(e.getExpression(), instanceOfExpr.getType()), boolean.class) ); @@ -500,7 +489,7 @@ private TypedExpressionResult toTypedExpressionFromMethodCallOrField(Expression if (drlxExpr instanceof FieldAccessExpr) { // try to see if it's a constant final Optional typedExpression = tryParseAsConstantField(ruleContext.getTypeResolver(), ((FieldAccessExpr) drlxExpr).getScope(), ((FieldAccessExpr) drlxExpr).getNameAsString()); - if(typedExpression.isPresent()) { + if (typedExpression.isPresent()) { return new TypedExpressionResult(typedExpression, context); } } @@ -508,61 +497,24 @@ private TypedExpressionResult toTypedExpressionFromMethodCallOrField(Expression if (patternType == null && drlxExpr instanceof NullSafeFieldAccessExpr) { // try to see if it's a constant final Optional typedExpression = tryParseAsConstantField(ruleContext.getTypeResolver(), ((NullSafeFieldAccessExpr) drlxExpr).getScope(), ((NullSafeFieldAccessExpr) drlxExpr).getNameAsString()); - if(typedExpression.isPresent()) { + if (typedExpression.isPresent()) { return new TypedExpressionResult(typedExpression, context); } } final List childrenNodes = flattenScope(ruleContext.getTypeResolver(), drlxExpr); - final Node firstChild = childrenNodes.get(0); - - boolean isInLineCast = firstChild instanceof InlineCastExpr; - java.lang.reflect.Type originalTypeCursor; - final Node firstNode; - if (isInLineCast) { - InlineCastExpr inlineCast = (InlineCastExpr) firstChild; - originalTypeCursor = originalTypeCursorFromInlineCast(inlineCast); - firstNode = inlineCast.getExpression(); - - if (inlineCast.getExpression().isThisExpr()) { - context.setInlineCastExpression( - Optional.of(new InstanceOfExpr(new NameExpr(THIS_PLACEHOLDER), (ReferenceType) inlineCast.getType())) ); - } else { - context.setInlineCastExpression( - toTypedExpression(inlineCast.getExpression()).getTypedExpression().map( TypedExpression::getExpression ) - .map( expr -> new InstanceOfExpr(expr, (ReferenceType) inlineCast.getType())) ); - } - } else { - originalTypeCursor = patternType; - firstNode = firstChild; - } - - if (originalTypeCursor != null && originalTypeCursor.equals(Object.class)) { - // try infer type from the declarations - final Optional declarationById = ruleContext.getTypedDeclarationById(printNode(firstChild)); - originalTypeCursor = declarationById.map(d -> (java.lang.reflect.Type)d.getDeclarationClass()).orElse(originalTypeCursor); - } - - final Optional teCursor = processFirstNode(drlxExpr, childrenNodes, firstNode, isInLineCast, originalTypeCursor); - - if (firstNode instanceof MethodCallExpr) { - MethodCallExpr me = (MethodCallExpr) firstNode; - addReactOnProperty(me.getNameAsString(), me.getArguments()); - } - if (firstNode instanceof NullSafeMethodCallExpr) { - NullSafeMethodCallExpr me = (NullSafeMethodCallExpr) firstNode; - addReactOnProperty(me.getNameAsString(), me.getArguments()); - } + return getTypedExpressionCursor(drlxExpr, childrenNodes) + .map(teCursor -> getTypedExpressionResult(drlxExpr, teCursor, childrenNodes)) + .orElse(new TypedExpressionResult(empty(), context)); + } - if(teCursor.isEmpty()) { - return new TypedExpressionResult(empty(), context); - } + private TypedExpressionResult getTypedExpressionResult(Expression drlxExpr, TypedExpressionCursor teCursor, List childrenNodes) { + Expression previous = teCursor.expressionCursor; + java.lang.reflect.Type typeCursor = teCursor.typeCursor; - Expression previous = teCursor.get().expressionCursor; - java.lang.reflect.Type typeCursor = teCursor.get().typeCursor; + for (int i = 1; i < childrenNodes.size(); i++) { + Node part = childrenNodes.get(i); - List childrenWithoutFirst = childrenNodes.subList(1, childrenNodes.size()); - for (Node part : childrenWithoutFirst) { if (part instanceof SimpleName) { String field = part.toString(); TypedExpression expression = nameExprToMethodCallExpr(field, typeCursor, previous, ruleContext); @@ -583,8 +535,7 @@ private TypedExpressionResult toTypedExpressionFromMethodCallOrField(Expression typeCursor = typedExpr.typeCursor; previous = typedExpr.expressionCursor; - } else if (part instanceof InlineCastExpr && ((InlineCastExpr) part).getExpression() instanceof FieldAccessExpr) { - InlineCastExpr inlineCastExprPart = (InlineCastExpr) part; + } else if (part instanceof InlineCastExpr inlineCastExprPart && ((InlineCastExpr) part).getExpression() instanceof FieldAccessExpr) { final FieldAccessExpr fieldAccessExpr = (FieldAccessExpr) inlineCastExprPart.getExpression(); final TypedExpression toMethodCallExpr = nameExprToMethodCallExpr(fieldAccessExpr.getNameAsString(), typeCursor, previous, ruleContext); if (toMethodCallExpr == null) { @@ -595,8 +546,7 @@ private TypedExpressionResult toTypedExpressionFromMethodCallOrField(Expression previous = addCastToExpression(castClass, toMethodCallExpr.getExpression(), false); typeCursor = castClass; - } else if (part instanceof ArrayAccessExpr) { - final ArrayAccessExpr inlineCastExprPart = (ArrayAccessExpr) part; + } else if (part instanceof ArrayAccessExpr inlineCastExprPart) { TypedExpressionCursor typedExpr = arrayAccessExpr(inlineCastExprPart, typeCursor, previous) .orElseThrow(() -> new NoSuchElementException("ArrayAccessExpr doesn't contain TypedExpressionCursor!")); @@ -612,9 +562,49 @@ private TypedExpressionResult toTypedExpressionFromMethodCallOrField(Expression return new TypedExpressionResult(of(new TypedExpression(previous, typeCursor, accessorToFieldName(drlxExpr))), context); } + private Optional getTypedExpressionCursor(Expression drlxExpr, List childrenNodes) { + final Node firstChild = childrenNodes.get(0); + + boolean isInLineCast = firstChild instanceof InlineCastExpr; + Class originalTypeCursor; + final Node firstNode; + if (isInLineCast) { + InlineCastExpr inlineCast = (InlineCastExpr) firstChild; + originalTypeCursor = originalTypeCursorFromInlineCast(inlineCast); + firstNode = inlineCast.getExpression(); + + if (inlineCast.getExpression().isThisExpr()) { + context.setInlineCastExpression( + Optional.of(new InstanceOfExpr(new NameExpr(THIS_PLACEHOLDER), (ReferenceType) inlineCast.getType())) ); + } else { + context.setInlineCastExpression( + toTypedExpression(inlineCast.getExpression()).getTypedExpression().map( TypedExpression::getExpression ) + .map( expr -> new InstanceOfExpr(expr, (ReferenceType) inlineCast.getType())) ); + } + } else { + originalTypeCursor = patternType; + firstNode = firstChild; + } + + if (originalTypeCursor == Object.class) { + // try infer type from the declarations + final Optional declarationById = ruleContext.getTypedDeclarationById(printNode(firstChild)); + originalTypeCursor = declarationById.map(TypedDeclarationSpec::getDeclarationClass).orElse(originalTypeCursor); + } + + final Optional teCursor = processFirstNode(drlxExpr, childrenNodes, firstNode, isInLineCast, originalTypeCursor); + + if (firstNode instanceof MethodCallExpr me) { + addReactOnProperty(me.getNameAsString(), me.getArguments()); + } + if (firstNode instanceof NullSafeMethodCallExpr me) { + addReactOnProperty(me.getNameAsString(), me.getArguments()); + } + return teCursor; + } + private String accessorToFieldName(Expression drlxExpr) { - if (drlxExpr instanceof MethodCallExpr) { - MethodCallExpr methodCall = ( MethodCallExpr ) drlxExpr; + if (drlxExpr instanceof MethodCallExpr methodCall) { return methodCall.getArguments().isEmpty() ? getter2property( methodCall.getNameAsString() ) : null; } return printNode(drlxExpr); @@ -634,8 +624,7 @@ private void addReactOnProperty(String methodName, NodeList methodAr } private void addReactOnPropertyForArgument( Node arg ) { - if ( arg instanceof MethodCallExpr) { - MethodCallExpr methodArg = ( MethodCallExpr ) arg; + if (arg instanceof MethodCallExpr methodArg) { if ( methodArg.getArguments().isEmpty() && isThisExpression( methodArg.getScope().orElse( null ) ) ) { String firstProp = getter2property(methodArg.getNameAsString()); if (firstProp != null) { @@ -655,7 +644,7 @@ private void addReactOnPropertyForArgument( Node arg ) { return false; } }) - .flatMap(decl -> decl.getBoundVariable()) + .flatMap(TypedDeclarationSpec::getBoundVariable) .ifPresent(context::addReactOnProperties); return; } @@ -1249,10 +1238,10 @@ private static String getFieldName( Expression drlxExpr, SimpleName fieldName ) } public static Expression findLeftLeafOfNameExprTraversingParent(Node expression) { - Optional optParent = expression.findAncestor(Expression.class, expr -> { + Optional optParent = expression.findAncestor(expr -> { Expression leftLeaf = findLeftLeafOfNameExpr(expr); return !(leftLeaf instanceof HalfBinaryExpr || leftLeaf instanceof HalfPointFreeExpr); - }); + }, Expression.class); if (optParent.isPresent()) { return findLeftLeafOfNameExpr(optParent.get()); } else { @@ -1261,14 +1250,13 @@ public static Expression findLeftLeafOfNameExprTraversingParent(Node expression) } public static Expression findLeftLeafOfNameExpr(Node expression) { - if (expression instanceof BinaryExpr) { - BinaryExpr be = (BinaryExpr) expression; + if (expression instanceof BinaryExpr be) { return findLeftLeafOfNameExpr(be.getLeft()); - } else if (expression instanceof PointFreeExpr) { + } + if (expression instanceof PointFreeExpr) { return findLeftLeafOfNameExpr(((PointFreeExpr) expression).getLeft()); - } else { - return (Expression) expression; } + return (Expression) expression; } public static class TypedExpressionCursor { diff --git a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/GenericsTest.java b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/GenericsTest.java index 6fe607e47a3..d6358be006e 100644 --- a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/GenericsTest.java +++ b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/GenericsTest.java @@ -40,20 +40,20 @@ public void testGenericsAccumulateInlineCode() { // accumulate inline code supports generics String str = "import " + Person.class.getCanonicalName() + ";\n" + - "import " + Address.class.getCanonicalName() + ";\n" + - "import " + List.class.getCanonicalName() + ";\n" + - "import " + ArrayList.class.getCanonicalName() + ";\n" + - "global List results;\n" + - "dialect \"mvel\"\n" + - "rule R when\n" + - " $l : List() from accumulate (Person($addrList : addresses),\n" + - " init( List cityList = new ArrayList(); ),\n" + - " action( for(Address addr: $addrList){String city = addr.getCity(); cityList.add(city);} ),\n" + - " result( cityList )\n" + - " )\n" + - "then\n" + - " results.add($l);\n" + - "end"; + "import " + Address.class.getCanonicalName() + ";\n" + + "import " + List.class.getCanonicalName() + ";\n" + + "import " + ArrayList.class.getCanonicalName() + ";\n" + + "global List results;\n" + + "dialect \"mvel\"\n" + + "rule R when\n" + + " $l : List() from accumulate (Person($addrList : addresses),\n" + + " init( List cityList = new ArrayList(); ),\n" + + " action( for(Address addr: $addrList){String city = addr.getCity(); cityList.add(city);} ),\n" + + " result( cityList )\n" + + " )\n" + + "then\n" + + " results.add($l);\n" + + "end"; KieSession ksession = getKieSession(str); List> results = new ArrayList<>(); @@ -76,4 +76,45 @@ public void testGenericsAccumulateInlineCode() { ksession.fireAllRules(); assertThat(results.get(0).size()).isEqualTo(4); } + + public static class ClassWithGenericField

{ + + private P extendedAddress; + + public ClassWithGenericField(final P extendedAddress) { + this.extendedAddress = extendedAddress; + } + + public P getExtendedAddress() { + return extendedAddress; + } + + public void setExtendedAddress(final P extendedAddress) { + this.extendedAddress = extendedAddress; + } + } + + @Test + public void testClassWithGenericField() { + // KIE-1077 + String str = + "import " + ClassWithGenericField.class.getCanonicalName() + ";\n " + + "import " + List.class.getCanonicalName() + ";\n " + + "global List results;\n " + + "rule R when\n " + + " ClassWithGenericField($addressStreet: extendedAddress.street) \n " + + "then\n " + + " results.add($addressStreet);\n " + + "end"; + + KieSession ksession = getKieSession(str); + List results = new ArrayList<>(); + ksession.setGlobal("results", results); + + final Address address = new Address("someStreet", 1, "Levice"); + final ClassWithGenericField

classWithGenericField = new ClassWithGenericField<>(address); + + ksession.insert(classWithGenericField); + assertThat(ksession.fireAllRules()).isEqualTo(1); + } } \ No newline at end of file diff --git a/drools-util/src/main/java/org/drools/util/ClassUtils.java b/drools-util/src/main/java/org/drools/util/ClassUtils.java index 0208c6653b4..90ac3252286 100644 --- a/drools-util/src/main/java/org/drools/util/ClassUtils.java +++ b/drools-util/src/main/java/org/drools/util/ClassUtils.java @@ -271,8 +271,7 @@ public static Object instantiateObject(String className, Object...args) { /** * Populates the import style pattern map from give comma delimited string */ - public static void addImportStylePatterns(Map patterns, - String str) { + public static void addImportStylePatterns(Map patterns, String str) { if ( str == null || "".equals( str.trim() ) ) { return; } @@ -549,8 +548,7 @@ public static Class extractGenericType(Class clazz, final String methodName) java.lang.reflect.Type returnType = method.getGenericReturnType(); - if (returnType instanceof ParameterizedType) { - ParameterizedType type = (ParameterizedType) returnType; + if (returnType instanceof ParameterizedType type) { java.lang.reflect.Type[] typeArguments = type.getActualTypeArguments(); if (typeArguments.length > 0) { return typeArguments[0] instanceof ParameterizedType ? (Class) ((ParameterizedType)typeArguments[0]).getRawType() : (Class) typeArguments[0]; @@ -597,11 +595,11 @@ public static Class toRawClass(Type type) { if (type instanceof Class) { return ( Class ) type; } - if (type instanceof ParameterizedType ) { + if (type instanceof ParameterizedType) { return toRawClass( (( ParameterizedType ) type).getRawType() ); } - if (type instanceof TypeVariable ) { - return Object.class; + if (type instanceof TypeVariable typeVar) { + return typeVar.getBounds().length == 1 ? toRawClass(typeVar.getBounds()[0]) : Object.class; } throw new UnsupportedOperationException( "Unknown type " + type ); } From f02a64db2e92df7316273afbf1be20ef63bcbb2c Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Thu, 11 Apr 2024 10:08:38 +0200 Subject: [PATCH 11/12] [KIE-1079] fix executable model generation when a query name containts an underscore (#5838) --- .../java/org/drools/model/codegen/execmodel/PackageModel.java | 3 +-- .../execmodel/generator/visitor/pattern/PatternVisitor.java | 3 ++- .../java/org/drools/model/codegen/execmodel/QueryTest.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/PackageModel.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/PackageModel.java index 121b722bc18..254ddbb8e5c 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/PackageModel.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/PackageModel.java @@ -418,8 +418,7 @@ public boolean hasQuery(String queryName) { } public void putQueryVariable(String queryName, QueryParameter qp) { - this.queryVariables.computeIfAbsent(queryName, k -> new ArrayList<>()); - this.queryVariables.get(queryName).add(qp); + this.queryVariables.computeIfAbsent(queryName, k -> new ArrayList<>()).add(qp); } public List queryVariables(String queryName) { diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/visitor/pattern/PatternVisitor.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/visitor/pattern/PatternVisitor.java index 8c84f66cc4d..2ddfceeb837 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/visitor/pattern/PatternVisitor.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/visitor/pattern/PatternVisitor.java @@ -31,6 +31,7 @@ import static org.drools.model.codegen.execmodel.generator.QueryGenerator.QUERY_METHOD_PREFIX; import static org.drools.model.codegen.execmodel.generator.QueryGenerator.toQueryDef; +import static org.drools.modelcompiler.util.StringUtil.toId; public class PatternVisitor { @@ -75,7 +76,7 @@ public DSLNode visit(PatternDescr pattern) { private DSLNode parsePatternWithClass(PatternDescr pattern, String className) { List constraintDescrs = pattern.getConstraint().getDescrs(); - String queryName = QUERY_METHOD_PREFIX + className; + String queryName = QUERY_METHOD_PREFIX + toId( className ); String queryDef = toQueryDef( className ); // Expression is a query, get bindings from query parameter type diff --git a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/QueryTest.java b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/QueryTest.java index 8e4d5218e2f..65f5cc039af 100644 --- a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/QueryTest.java +++ b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/QueryTest.java @@ -120,11 +120,11 @@ public void testQueryInRule() { String str = "import " + Result.class.getCanonicalName() + ";" + "import " + Person.class.getCanonicalName() + ";" + - "query olderThan( Person $p, int $age )\n" + + "query older_than( Person $p, int $age )\n" + " $p := Person(age > $age)\n" + "end\n" + "rule R when\n" + - " olderThan( $p, 40; )\n" + + " older_than( $p, 40; )\n" + "then\n" + " insert(new Result($p.getName()));\n" + "end"; From 01a3d93f517d5ffcefe0759dff0d92e00ef67906 Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Mon, 15 Apr 2024 08:26:05 +0200 Subject: [PATCH 12/12] [KIE-1085] avoid wasteful creation of a custom operator per constraint at runtime when using the executable model (#5844) --- .../model/codegen/execmodel/PackageModel.java | 9 ++++++ .../expressiontyper/ExpressionTyper.java | 7 ++--- .../operatorspec/CustomOperatorSpec.java | 30 +++++++++++++++---- .../integrationtests/CustomOperatorTest.java | 21 +++++++++++++ 4 files changed, 57 insertions(+), 10 deletions(-) diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/PackageModel.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/PackageModel.java index 254ddbb8e5c..b3e157b96e0 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/PackageModel.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/PackageModel.java @@ -87,6 +87,7 @@ import org.drools.model.codegen.execmodel.generator.QueryParameter; import org.drools.model.codegen.execmodel.generator.TypedExpression; import org.drools.model.codegen.execmodel.generator.WindowReferenceGenerator; +import org.drools.model.codegen.execmodel.generator.operatorspec.CustomOperatorSpec; import org.drools.model.codegen.execmodel.util.lambdareplace.CreatedClass; import org.drools.model.functions.PredicateInformation; import org.drools.modelcompiler.util.StringUtil; @@ -187,6 +188,8 @@ public class PackageModel { private final boolean prototypesAllowed; + private final CustomOperatorSpec customOperatorSpec = new CustomOperatorSpec(); + private PackageModel( ReleaseId releaseId, String name, KnowledgeBuilderConfigurationImpl configuration, DialectCompiletimeRegistry dialectCompiletimeRegistry, DRLIdGenerator exprIdGenerator) { this(name, configuration, dialectCompiletimeRegistry, exprIdGenerator, getPkgUUID(configuration, releaseId, name)); } @@ -293,6 +296,10 @@ public DRLIdGenerator getExprIdGenerator() { return exprIdGenerator; } + public CustomOperatorSpec getCustomOperatorSpec() { + return customOperatorSpec; + } + public void addImports(Collection imports) { this.imports.addAll(imports); } @@ -612,6 +619,8 @@ public RuleSourceResult getRulesSource() { rulesClass.addMember( generateListField("org.drools.model.Global", "globals", globals.isEmpty() && !hasRuleUnit) ); + customOperatorSpec.getOperatorDeclarations().forEach( op -> rulesClass.addMember( parseBodyDeclaration( op ) ) ); + if ( !typeMetaDataExpressions.isEmpty() ) { BodyDeclaration typeMetaDatasList = parseBodyDeclaration("java.util.List typeMetaDatas = new java.util.ArrayList<>();"); rulesClass.addMember(typeMetaDatasList); diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/expressiontyper/ExpressionTyper.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/expressiontyper/ExpressionTyper.java index 62795cec94b..928ca3f62ac 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/expressiontyper/ExpressionTyper.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/expressiontyper/ExpressionTyper.java @@ -66,14 +66,13 @@ import com.github.javaparser.ast.type.Type; import org.drools.model.codegen.execmodel.errors.InvalidExpressionErrorResult; import org.drools.model.codegen.execmodel.errors.ParseExpressionErrorResult; -import org.drools.model.codegen.execmodel.generator.TypedDeclarationSpec; import org.drools.model.codegen.execmodel.generator.DrlxParseUtil; import org.drools.model.codegen.execmodel.generator.ModelGenerator; import org.drools.model.codegen.execmodel.generator.RuleContext; +import org.drools.model.codegen.execmodel.generator.TypedDeclarationSpec; import org.drools.model.codegen.execmodel.generator.TypedExpression; import org.drools.model.codegen.execmodel.generator.UnificationTypedExpression; import org.drools.model.codegen.execmodel.generator.drlxparse.NumberAndStringArithmeticOperationCoercion; -import org.drools.model.codegen.execmodel.generator.operatorspec.CustomOperatorSpec; import org.drools.model.codegen.execmodel.generator.operatorspec.NativeOperatorSpec; import org.drools.model.codegen.execmodel.generator.operatorspec.OperatorSpec; import org.drools.model.codegen.execmodel.generator.operatorspec.TemporalOperatorSpec; @@ -126,8 +125,8 @@ import static org.drools.mvel.parser.MvelParser.parseType; import static org.drools.mvel.parser.printer.PrintUtil.printNode; import static org.drools.util.ClassUtils.extractGenericType; -import static org.drools.util.ClassUtils.getter2property; import static org.drools.util.ClassUtils.getTypeArgument; +import static org.drools.util.ClassUtils.getter2property; import static org.drools.util.ClassUtils.toRawClass; import static org.kie.internal.ruleunit.RuleUnitUtil.isDataSource; @@ -482,7 +481,7 @@ private OperatorSpec getOperatorSpec(NodeList rightExpressions, Simp if ( org.drools.model.functions.Operator.Register.hasOperator( operator ) ) { return NativeOperatorSpec.INSTANCE; } - return CustomOperatorSpec.INSTANCE; + return ruleContext.getPackageModel().getCustomOperatorSpec(); } private TypedExpressionResult toTypedExpressionFromMethodCallOrField(Expression drlxExpr) { diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/operatorspec/CustomOperatorSpec.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/operatorspec/CustomOperatorSpec.java index d484855c230..a5d2578bdd0 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/operatorspec/CustomOperatorSpec.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/operatorspec/CustomOperatorSpec.java @@ -18,14 +18,22 @@ */ package org.drools.model.codegen.execmodel.generator.operatorspec; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import com.github.javaparser.ast.expr.MethodCallExpr; import org.drools.base.base.ValueType; import org.drools.compiler.rule.builder.EvaluatorDefinition; -import com.github.javaparser.ast.expr.MethodCallExpr; -import org.drools.model.functions.Operator; import org.drools.model.codegen.execmodel.generator.RuleContext; +import org.drools.model.functions.Operator; public class CustomOperatorSpec extends NativeOperatorSpec { - public static final CustomOperatorSpec INSTANCE = new CustomOperatorSpec(); + + private Set generatedOperators = new HashSet<>(); + + private List operatorDeclarations = new ArrayList<>(); @Override protected Operator addOperatorArgument( RuleContext context, MethodCallExpr methodCallExpr, String opName ) { @@ -34,10 +42,20 @@ protected Operator addOperatorArgument( RuleContext context, MethodCallExpr meth throw new RuntimeException( "Unknown custom operator: " + opName ); } - String arg = "new " + CustomOperatorWrapper.class.getCanonicalName() + "( new " + evalDef.getClass().getCanonicalName() + "().getEvaluator(" + - ValueType.class.getCanonicalName() + ".OBJECT_TYPE, \"" + opName + "\", false, null), \"" + opName + "\")"; + String operatorInstance = "OPERATOR_" + opName + "_INSTANCE"; + + if (generatedOperators.add(opName)) { + String operatorFieldDeclaration = "public static final " + Operator.class.getCanonicalName() + ".SingleValue " + operatorInstance + + " = new " + CustomOperatorWrapper.class.getCanonicalName() + "( new " + evalDef.getClass().getCanonicalName() + "().getEvaluator(" + + ValueType.class.getCanonicalName() + ".OBJECT_TYPE, \"" + opName + "\", false, null), \"" + opName + "\");"; + operatorDeclarations.add(operatorFieldDeclaration); + } - methodCallExpr.addArgument( arg ); + methodCallExpr.addArgument( context.getPackageModel().getRulesFileNameWithPackage() + "." + operatorInstance ); return null; } + + public List getOperatorDeclarations() { + return operatorDeclarations; + } } diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/CustomOperatorTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/CustomOperatorTest.java index 1ffeee7c029..8f7c8ef7aab 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/CustomOperatorTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/CustomOperatorTest.java @@ -69,6 +69,18 @@ public void testCustomOperatorUsingCollections() { customOperatorUsingCollections(constraints); } + @Test + public void testNoOperatorInstancesCreatedAtRuntime() { + String constraints = + " $alice : Person(name == \"Alice\")\n" + + " $bob : Person(name == \"Bob\", addresses supersetOf $alice.addresses)\n" + + " Person(name == \"Bob\", addresses supersetOf $alice.addresses)\n"; + + customOperatorUsingCollections(constraints); + + assertThat(SupersetOfEvaluatorDefinition.INSTANCES_COUNTER).isEqualTo(0); + } + @Test public void testCustomOperatorUsingCollectionsInverted() { // DROOLS-6983 @@ -90,6 +102,9 @@ private void customOperatorUsingCollections(String constraints) { System.setProperty(EvaluatorOption.PROPERTY_NAME + "supersetOf", SupersetOfEvaluatorDefinition.class.getName()); try { final KieBase kbase = KieBaseUtil.getKieBaseFromKieModuleFromDrl("custom-operator-test", kieBaseTestConfiguration, drl); + + SupersetOfEvaluatorDefinition.INSTANCES_COUNTER = 0; + final KieSession ksession = kbase.newKieSession(); try { final Person alice = new Person("Alice", 30); @@ -118,6 +133,12 @@ public static class SupersetOfEvaluatorDefinition implements EvaluatorDefinition private Evaluator[] evaluator; + static int INSTANCES_COUNTER = 0; + + public SupersetOfEvaluatorDefinition() { + INSTANCES_COUNTER++; + } + public String[] getEvaluatorIds() { return SupersetOfEvaluatorDefinition.SUPPORTED_IDS; }