From ba61d0d298ec873dacad928003fc0f139b17369c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Fri, 22 Sep 2023 13:58:28 +0200 Subject: [PATCH 01/41] [kie-issues#511] Migrate from jboss-parent to apache parent pom. (#5530) * Align with Apache parent bom. * Fix JavaDoc generation to original state. * Add changes requested in PR review. --- build-parent/pom.xml | 26 +- .../pom.xml | 4 + .../pom.xml | 4 + .../pom.xml | 220 ++++++------- .../pom.xml | 306 +++++++++--------- .../pom.xml | 296 ++++++++--------- .../pom.xml | 304 ++++++++--------- .../drools-impact-analysis-itests/pom.xml | 5 +- drools-legacy-test-util/pom.xml | 1 + drools-reliability/pom.xml | 2 +- .../drools-scenario-simulation-api/pom.xml | 4 + .../pom.xml | 4 + .../pom.xml | 4 + .../kie-ci-with-domain/test-domain/pom.xml | 4 + .../kie-ci-with-domain/test-kjar/pom.xml | 4 + .../kie-ci-with-domain/tests/pom.xml | 4 + .../kie-ci-without-domain/test-domain/pom.xml | 4 + .../kie-ci-without-domain/test-kjar/pom.xml | 4 + .../kie-ci-without-domain/tests/pom.xml | 4 + .../test-integration-ruleunits-jar/pom.xml | 4 + .../test-integration-ruleunits-tests/pom.xml | 2 +- efesto/efesto-common-utils/pom.xml | 1 + efesto/efesto-core/efesto-common-api/pom.xml | 1 + efesto/efesto-core/efesto-common-core/pom.xml | 1 + .../efesto-compilation-manager-api/pom.xml | 1 + .../efesto-compilation-manager-core/pom.xml | 1 + .../efesto-runtime-manager-api/pom.xml | 1 + .../efesto-runtime-manager-core/pom.xml | 1 + efesto/efesto-dependencies/pom.xml | 1 + jpmml-migration-recipe/pom.xml | 3 + kie-dmn/kie-dmn-legacy-tests/pom.xml | 4 + .../kie-dmn-pmml-tests-trusty/pom.xml | 4 + .../kie-dmn-pmml-tests/pom.xml | 4 + .../kie-dmn-ruleset2dmn-cli/pom.xml | 4 + kie-drl/kie-drl-api/pom.xml | 23 +- kie-drl/kie-drl-compilation-common/pom.xml | 75 ++--- .../kie-drl-kiesession-local-runtime/pom.xml | 65 ++-- .../kie-drl-map-input-runtime/pom.xml | 75 ++--- kie-drl/kie-drl-runtime-common/pom.xml | 60 ++-- .../kie-drl-tests-without-index-file/pom.xml | 5 +- kie-drl/kie-drl-tests/pom.xml | 13 +- kie-maven-plugin/pom.xml | 1 + kie-pmml-trusty/kie-pmml-api/pom.xml | 4 + kie-pmml-trusty/kie-pmml-commons/pom.xml | 1 + .../kie-pmml-compiler-api/pom.xml | 4 + .../kie-pmml-compiler-commons/pom.xml | 4 + .../kie-pmml-compiler-core/pom.xml | 1 + kie-pmml-trusty/kie-pmml-dependencies/pom.xml | 4 + .../kie-pmml-evaluator-api/pom.xml | 4 + .../kie-pmml-evaluator-core/pom.xml | 4 + .../kie-pmml-evaluator-utils/pom.xml | 4 + .../pom.xml | 4 + .../pom.xml | 4 + .../kie-pmml-models-clustering-model/pom.xml | 4 + .../kie-pmml-models-clustering-tests/pom.xml | 4 + .../kie-pmml-models-drools-common/pom.xml | 4 + .../pom.xml | 4 + .../pom.xml | 4 + .../pom.xml | 4 + .../pom.xml | 4 + .../pom.xml | 4 + .../pom.xml | 4 + .../kie-pmml-models-drools-tree-model/pom.xml | 4 + .../kie-pmml-models-drools-tree-tests/pom.xml | 4 + .../kie-pmml-models-mining-compiler/pom.xml | 4 + .../kie-pmml-models-mining-evaluator/pom.xml | 4 + .../kie-pmml-models-mining-model/pom.xml | 1 + .../kie-pmml-models-mining-tests/pom.xml | 4 + .../pom.xml | 4 + .../pom.xml | 4 + .../kie-pmml-models-regression-model/pom.xml | 4 + .../kie-pmml-models-regression-tests/pom.xml | 4 + .../pom.xml | 4 + .../pom.xml | 4 + .../kie-pmml-models-scorecard-model/pom.xml | 4 + .../kie-pmml-models-scorecard-tests/pom.xml | 4 + .../kie-pmml-models-tests/pom.xml | 4 + .../kie-pmml-models-tree-compiler/pom.xml | 4 + .../kie-pmml-models-tree-evaluator/pom.xml | 4 + .../kie-pmml-models-tree-model/pom.xml | 4 + .../kie-pmml-models-tree-tests/pom.xml | 4 + pom.xml | 9 +- 82 files changed, 990 insertions(+), 720 deletions(-) diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 0758c53eef4..903733ba328 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -228,6 +228,10 @@ io.smallrye ${jandex.group-id} + + + 3.3.0 + 3.4.0 @@ -1577,7 +1581,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - ${version.checkstyle.plugin} + ${version.maven-checkstyle} validate @@ -1675,7 +1679,7 @@ org.apache.maven.plugins maven-failsafe-plugin - ${version.failsafe.plugin} + ${version.maven-surefire} @@ -1895,7 +1899,7 @@ org.apache.maven.plugins maven-deploy-plugin - ${version.deploy.plugin} + ${version.maven-deploy-plugin} 10 @@ -2049,6 +2053,19 @@ sonar-maven-plugin 3.6.0.1398 + + org.apache.maven.plugins + maven-javadoc-plugin + ${version.maven-javadoc-plugin} + +
${project.name} ${project.version}]]>
+
${project.name} ${project.version}]]>
+ + true + + ${javadoc.additional.params} +
+
@@ -2064,6 +2081,7 @@ org.codehaus.mojo build-helper-maven-plugin + ${version.build.helper.maven.plugin} generate-sources @@ -2083,7 +2101,7 @@ org.apache.maven.plugins maven-jar-plugin - ${version.jar.plugin} + ${version.maven-jar-plugin}
org.apache.maven.plugins diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/pom.xml b/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/pom.xml index db2155ccf77..9d0a5db76a8 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/pom.xml +++ b/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/pom.xml @@ -32,6 +32,10 @@ Drools :: Quarkus Extension :: Examples :: Reactive drools-drl-quarkus-examples-multiunit + + org.drools.drl.quarkus.examples.multiunit + + org.drools diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/pom.xml b/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/pom.xml index 288cadcaec4..a2bb7002d96 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/pom.xml +++ b/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/pom.xml @@ -32,6 +32,10 @@ Drools :: Quarkus Extension :: Examples :: Reactive drools-drl-quarkus-examples-reactive + + org.drools.drl.quarkus.examples.reactive + + org.drools diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/pom.xml b/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/pom.xml index 8e0897ebf1b..60d0b3e4368 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/pom.xml +++ b/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/pom.xml @@ -22,121 +22,125 @@ - 4.0.0 - - org.drools - drools-drl-quarkus-extension - 8.45.0-SNAPSHOT - + 4.0.0 + + org.drools + drools-drl-quarkus-extension + 8.45.0-SNAPSHOT + - Drools :: Quarkus Extension :: Integration Test :: Hotreload - drools-drl-quarkus-integration-test-hotreload + Drools :: Quarkus Extension :: Integration Test :: Hotreload + drools-drl-quarkus-integration-test-hotreload - - - org.drools - drools-drl-quarkus - - - io.quarkus - quarkus-core - + + org.drools.drl.quarkus.integrationtest.hotreload + - - io.quarkus - quarkus-resteasy - - - io.quarkus - quarkus-resteasy-jackson - + + + org.drools + drools-drl-quarkus + + + io.quarkus + quarkus-core + - - io.quarkus - quarkus-junit5 - test - - - io.quarkus - quarkus-junit5-internal - test - - - io.rest-assured - rest-assured - test - + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-resteasy-jackson + - - - org.drools - drools-drl-quarkus-deployment - pom - test - - - * - * - - - - + + io.quarkus + quarkus-junit5 + test + + + io.quarkus + quarkus-junit5-internal + test + + + io.rest-assured + rest-assured + test + - - - - - io.quarkus - quarkus-maven-plugin - ${version.io.quarkus} - - true - ${skipTests} - - - - + + + org.drools + drools-drl-quarkus-deployment + pom + test + + + * + * + + + + - - - io.quarkus - quarkus-maven-plugin - - - - build - - - - + + + + + io.quarkus + quarkus-maven-plugin + ${version.io.quarkus} + + true + ${skipTests} + + + + - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - ban-blacklisted-dependencies - validate - - enforce - - - false - - - - + + + io.quarkus + quarkus-maven-plugin + + + + build + + + + - - maven-failsafe-plugin - - - org.jboss.logmanager.LogManager - - - - - + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + ban-blacklisted-dependencies + validate + + enforce + + + false + + + + + + + maven-failsafe-plugin + + + org.jboss.logmanager.LogManager + + + + + \ No newline at end of file diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/pom.xml b/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/pom.xml index baf5c5fb335..de787a40af8 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/pom.xml +++ b/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/pom.xml @@ -22,165 +22,169 @@ - 4.0.0 - - org.drools - drools-drl-quarkus-extension - 8.45.0-SNAPSHOT - + 4.0.0 + + org.drools + drools-drl-quarkus-extension + 8.45.0-SNAPSHOT + - Drools :: Quarkus Extension :: Integration Test - drools-drl-quarkus-integration-test + Drools :: Quarkus Extension :: Integration Test + drools-drl-quarkus-integration-test - - - org.drools - drools-drl-quarkus - - - org.drools - drools-decisiontables - - - io.quarkus - quarkus-core - - - - - io.quarkus - quarkus-resteasy-reactive - - - org.assertj - assertj-core - - - io.quarkus - quarkus-junit5 - test - - - io.rest-assured - rest-assured - test - + + org.drools.drl.quarkus.integrationtest + - - - org.drools - drools-drl-quarkus-deployment - pom - test - - - * - * - - - + + + org.drools + drools-drl-quarkus + + + org.drools + drools-decisiontables + + + io.quarkus + quarkus-core + - - - - - - io.quarkus - quarkus-maven-plugin - ${version.io.quarkus} - - true - ${skipTests} - - - - + + io.quarkus + quarkus-resteasy-reactive + + + org.assertj + assertj-core + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + + org.drools + drools-drl-quarkus-deployment + pom + test + + + * + * + + + + + + + + + + + io.quarkus + quarkus-maven-plugin + ${version.io.quarkus} + + true + ${skipTests} + + + + + + + + io.quarkus + quarkus-maven-plugin + + + + build + + + + + + maven-failsafe-plugin + + false + + **/*IT.java + + + **/*Test.java + **/Native* + + -Xmx2048m -Xmx4g + + ${session.request.localRepositoryPath.path} + ${session.request.userSettingsFile.path} + + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + ban-blacklisted-dependencies + validate + + enforce + + + false + + + + + + + + + + native + + + native + + + + native + + - - io.quarkus - quarkus-maven-plugin - - - - build - - - - - - maven-failsafe-plugin + + org.apache.maven.plugins + maven-failsafe-plugin + + + + integration-test + verify + - false - - **/*IT.java - - - **/*Test.java - **/Native* - - -Xmx2048m -Xmx4g - - ${session.request.localRepositoryPath.path} - ${session.request.userSettingsFile.path} - + + ${project.build.directory}/${project.build.finalName}-runner + - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - ban-blacklisted-dependencies - validate - - enforce - - - false - - - - +
+
+
- - - - - native - - - native - - - - native - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - integration-test - verify - - - - ${project.build.directory}/${project.build.finalName}-runner - - - - - - - - - + + + \ No newline at end of file diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/pom.xml b/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/pom.xml index f4c892a3b8d..de4818e5152 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/pom.xml +++ b/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/pom.xml @@ -22,161 +22,165 @@ - 4.0.0 - - org.drools - drools-drl-quarkus-extension - 8.45.0-SNAPSHOT - + 4.0.0 + + org.drools + drools-drl-quarkus-extension + 8.45.0-SNAPSHOT + - Drools :: Quarkus Extension :: Quickstart Integration Test - drools-drl-quarkus-quickstart-test + Drools :: Quarkus Extension :: Quickstart Integration Test + drools-drl-quarkus-quickstart-test - - - org.drools - drools-drl-quarkus - - - org.drools - drools-ruleunits-engine - - - io.quarkus - quarkus-core - + + org.drools.drl.quarkus.quickstart.test + - - io.quarkus - quarkus-junit5 - test - - - io.rest-assured - rest-assured - test - - - org.assertj - assertj-core - test - + + + org.drools + drools-drl-quarkus + + + org.drools + drools-ruleunits-engine + + + io.quarkus + quarkus-core + - - - org.drools - drools-drl-quarkus-deployment - pom - test - - - * - * - - - + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + org.assertj + assertj-core + test + - + + + org.drools + drools-drl-quarkus-deployment + pom + test + + + * + * + + + - - - - - io.quarkus - quarkus-maven-plugin - ${version.io.quarkus} - - true - ${skipTests} - - - - + + + + + + io.quarkus + quarkus-maven-plugin + ${version.io.quarkus} + + true + ${skipTests} + + + + + + + + io.quarkus + quarkus-maven-plugin + + + + build + + + + + + maven-failsafe-plugin + + false + + **/*IT.java + + + **/*Test.java + **/Native* + + -Xmx2048m -Xmx4g + + ${session.request.localRepositoryPath.path} + ${session.request.userSettingsFile.path} + + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + ban-blacklisted-dependencies + validate + + enforce + + + false + + + + + + + + + + native + + + native + + + + native + + - - io.quarkus - quarkus-maven-plugin - - - - build - - - - - - maven-failsafe-plugin + + org.apache.maven.plugins + maven-failsafe-plugin + + + + integration-test + verify + - false - - **/*IT.java - - - **/*Test.java - **/Native* - - -Xmx2048m -Xmx4g - - ${session.request.localRepositoryPath.path} - ${session.request.userSettingsFile.path} - + + ${project.build.directory}/${project.build.finalName}-runner + - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - ban-blacklisted-dependencies - validate - - enforce - - - false - - - - + + + - - - - - native - - - native - - - - native - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - integration-test - verify - - - - ${project.build.directory}/${project.build.finalName}-runner - - - - - - - - - + + + \ No newline at end of file diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/pom.xml b/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/pom.xml index 662b66194b2..badddc11e79 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/pom.xml +++ b/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/pom.xml @@ -22,164 +22,168 @@ - 4.0.0 - - org.drools - drools-drl-quarkus-extension - 8.45.0-SNAPSHOT - + 4.0.0 + + org.drools + drools-drl-quarkus-extension + 8.45.0-SNAPSHOT + - Drools :: Quarkus Extension :: Integration Test with Rule Unit - drools-drl-quarkus-ruleunit-integration-test + Drools :: Quarkus Extension :: Integration Test with Rule Unit + drools-drl-quarkus-ruleunit-integration-test - - - org.drools - drools-drl-quarkus - - - org.drools - drools-ruleunits-engine - - - io.quarkus - quarkus-core - - - - io.quarkus - quarkus-resteasy-reactive - - - org.assertj - assertj-core - - - io.quarkus - quarkus-junit5 - test - - - io.rest-assured - rest-assured - test - + + org.drools.drl.quarkus.ruleunit.integrationtest + - - - org.drools - drools-drl-quarkus-deployment - pom - test - - - * - * - - - + + + org.drools + drools-drl-quarkus + + + org.drools + drools-ruleunits-engine + + + io.quarkus + quarkus-core + - + + io.quarkus + quarkus-resteasy-reactive + + + org.assertj + assertj-core + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + - - - - - io.quarkus - quarkus-maven-plugin - ${version.io.quarkus} - - true - ${skipTests} - - - - + + + org.drools + drools-drl-quarkus-deployment + pom + test + + + * + * + + + + + + + + + + io.quarkus + quarkus-maven-plugin + ${version.io.quarkus} + + true + ${skipTests} + + + + + + + + io.quarkus + quarkus-maven-plugin + + + + build + + + + + + maven-failsafe-plugin + + false + + **/*IT.java + + + **/*Test.java + **/Native* + + -Xmx2048m -Xmx4g + + ${session.request.localRepositoryPath.path} + ${session.request.userSettingsFile.path} + + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + ban-blacklisted-dependencies + validate + + enforce + + + false + + + + + + + + + + native + + + native + + + + native + + - - io.quarkus - quarkus-maven-plugin - - - - build - - - - - - maven-failsafe-plugin + + org.apache.maven.plugins + maven-failsafe-plugin + + + + integration-test + verify + - false - - **/*IT.java - - - **/*Test.java - **/Native* - - -Xmx2048m -Xmx4g - - ${session.request.localRepositoryPath.path} - ${session.request.userSettingsFile.path} - + + ${project.build.directory}/${project.build.finalName}-runner + - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - ban-blacklisted-dependencies - validate - - enforce - - - false - - - - + + + - - - - - native - - - native - - - - native - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - integration-test - verify - - - - ${project.build.directory}/${project.build.finalName}-runner - - - - - - - - - + + + \ No newline at end of file diff --git a/drools-impact-analysis/drools-impact-analysis-itests/pom.xml b/drools-impact-analysis/drools-impact-analysis-itests/pom.xml index cd1538c0073..f75835377ad 100644 --- a/drools-impact-analysis/drools-impact-analysis-itests/pom.xml +++ b/drools-impact-analysis/drools-impact-analysis-itests/pom.xml @@ -33,8 +33,11 @@ Drools :: Impact Analysis :: Integration Tests - + + org.drools.impact.analysis.integrationtests + + org.drools drools-impact-analysis-parser diff --git a/drools-legacy-test-util/pom.xml b/drools-legacy-test-util/pom.xml index 26672a8dd7a..ea166eb7e66 100644 --- a/drools-legacy-test-util/pom.xml +++ b/drools-legacy-test-util/pom.xml @@ -38,6 +38,7 @@ Drools :: Legacy Test Util + org.drools.legacytestutil 2 diff --git a/drools-reliability/pom.xml b/drools-reliability/pom.xml index c5f897cae19..e9ac51adab6 100644 --- a/drools-reliability/pom.xml +++ b/drools-reliability/pom.xml @@ -36,7 +36,7 @@ Drools :: Reliability - org.drools.reliability + org.drools.reliability.tests pom diff --git a/drools-scenario-simulation/drools-scenario-simulation-api/pom.xml b/drools-scenario-simulation/drools-scenario-simulation-api/pom.xml index d6f08170c0a..1e98db0011c 100644 --- a/drools-scenario-simulation/drools-scenario-simulation-api/pom.xml +++ b/drools-scenario-simulation/drools-scenario-simulation-api/pom.xml @@ -33,6 +33,10 @@ drools-scenario-simulation-api jar + + org.drools.scenariosimulation.api + + com.thoughtworks.xstream diff --git a/drools-scenario-simulation/drools-scenario-simulation-backend/pom.xml b/drools-scenario-simulation/drools-scenario-simulation-backend/pom.xml index 77b9e05a98f..1f0d8a2434b 100644 --- a/drools-scenario-simulation/drools-scenario-simulation-backend/pom.xml +++ b/drools-scenario-simulation/drools-scenario-simulation-backend/pom.xml @@ -33,6 +33,10 @@ drools-scenario-simulation-backend jar + + org.drools.scenariosimulation.backend + + org.drools diff --git a/drools-scenario-simulation/drools-scenario-simulation-integrationtest/pom.xml b/drools-scenario-simulation/drools-scenario-simulation-integrationtest/pom.xml index b6d0c9afe0e..65565db0f34 100644 --- a/drools-scenario-simulation/drools-scenario-simulation-integrationtest/pom.xml +++ b/drools-scenario-simulation/drools-scenario-simulation-integrationtest/pom.xml @@ -33,6 +33,10 @@ drools-scenario-simulation-integrationtest jar + + org.drools.scenariosimulation.integrationtest + + diff --git a/drools-test-coverage/standalone/kie-ci-with-domain/test-domain/pom.xml b/drools-test-coverage/standalone/kie-ci-with-domain/test-domain/pom.xml index 1e76145292b..203dd83f3b0 100644 --- a/drools-test-coverage/standalone/kie-ci-with-domain/test-domain/pom.xml +++ b/drools-test-coverage/standalone/kie-ci-with-domain/test-domain/pom.xml @@ -35,6 +35,10 @@ Drools :: Test Coverage :: KIE-CI with Domain classes :: Domain + + org.drools.testcoverage.standalone.kieciwithdomain.testdomain + + org.kie diff --git a/drools-test-coverage/standalone/kie-ci-with-domain/test-kjar/pom.xml b/drools-test-coverage/standalone/kie-ci-with-domain/test-kjar/pom.xml index 8984b483d4b..128837f36bc 100644 --- a/drools-test-coverage/standalone/kie-ci-with-domain/test-kjar/pom.xml +++ b/drools-test-coverage/standalone/kie-ci-with-domain/test-kjar/pom.xml @@ -35,6 +35,10 @@ Drools :: Test Coverage :: KIE-CI with Domain classes :: KJar + + org.drools.testcoverage.standalone.kieciwithdomain.testkjar + + org.drools.testcoverage diff --git a/drools-test-coverage/standalone/kie-ci-with-domain/tests/pom.xml b/drools-test-coverage/standalone/kie-ci-with-domain/tests/pom.xml index 3cf39679716..cf6ee6e7478 100644 --- a/drools-test-coverage/standalone/kie-ci-with-domain/tests/pom.xml +++ b/drools-test-coverage/standalone/kie-ci-with-domain/tests/pom.xml @@ -35,6 +35,10 @@ Drools :: Test Coverage :: KIE-CI with Domain classes :: Tests + + org.drools.testcoverage.standalone.kieciwithdomain.tests + + diff --git a/drools-test-coverage/standalone/kie-ci-without-domain/test-domain/pom.xml b/drools-test-coverage/standalone/kie-ci-without-domain/test-domain/pom.xml index 1fb7f9e2202..fd52c34ca44 100644 --- a/drools-test-coverage/standalone/kie-ci-without-domain/test-domain/pom.xml +++ b/drools-test-coverage/standalone/kie-ci-without-domain/test-domain/pom.xml @@ -35,6 +35,10 @@ Drools :: Test Coverage :: KIE-CI without Domain classes :: Domain + + org.drools.testcoverage.standalone.kieciwithoutdomain.testdomain + + org.kie diff --git a/drools-test-coverage/standalone/kie-ci-without-domain/test-kjar/pom.xml b/drools-test-coverage/standalone/kie-ci-without-domain/test-kjar/pom.xml index 86777e6be55..6f6f69b4c65 100644 --- a/drools-test-coverage/standalone/kie-ci-without-domain/test-kjar/pom.xml +++ b/drools-test-coverage/standalone/kie-ci-without-domain/test-kjar/pom.xml @@ -35,6 +35,10 @@ Drools :: Test Coverage :: KIE-CI without Domain classes :: KJar + + org.drools.testcoverage.standalone.kieciwithoutdomain.testkjar + + org.drools.testcoverage diff --git a/drools-test-coverage/standalone/kie-ci-without-domain/tests/pom.xml b/drools-test-coverage/standalone/kie-ci-without-domain/tests/pom.xml index 8e658d58e0e..9aed5bac7f7 100644 --- a/drools-test-coverage/standalone/kie-ci-without-domain/tests/pom.xml +++ b/drools-test-coverage/standalone/kie-ci-without-domain/tests/pom.xml @@ -35,6 +35,10 @@ Drools :: Test Coverage :: KIE-CI without Domain classes :: Tests + + org.drools.testcoverage.standalone.kieciwithoutdomain.tests + + diff --git a/drools-test-coverage/test-integration-ruleunits/test-integration-ruleunits-jar/pom.xml b/drools-test-coverage/test-integration-ruleunits/test-integration-ruleunits-jar/pom.xml index 0aa1aadcf6f..3bd52db4494 100644 --- a/drools-test-coverage/test-integration-ruleunits/test-integration-ruleunits-jar/pom.xml +++ b/drools-test-coverage/test-integration-ruleunits/test-integration-ruleunits-jar/pom.xml @@ -33,6 +33,10 @@ test-integration-ruleunits-jar Drools :: Test Coverage :: Jar for Integration tests with Rule Units + + org.drools.testcoverage.integrationtests.ruleunits.testjar + + org.drools diff --git a/drools-test-coverage/test-integration-ruleunits/test-integration-ruleunits-tests/pom.xml b/drools-test-coverage/test-integration-ruleunits/test-integration-ruleunits-tests/pom.xml index 8111bb520f5..8696d9c7b87 100644 --- a/drools-test-coverage/test-integration-ruleunits/test-integration-ruleunits-tests/pom.xml +++ b/drools-test-coverage/test-integration-ruleunits/test-integration-ruleunits-tests/pom.xml @@ -34,7 +34,7 @@ Drools :: Test Coverage :: Integration tests with Rule Units - org.drools.compiler.integrationtests + org.drools.testcoverage.integrationtests.ruleunit.tests 1 diff --git a/efesto/efesto-common-utils/pom.xml b/efesto/efesto-common-utils/pom.xml index 905f631ac92..d04739c0653 100644 --- a/efesto/efesto-common-utils/pom.xml +++ b/efesto/efesto-common-utils/pom.xml @@ -34,6 +34,7 @@ Efesto :: Common :: Utils + org.drools.efesto.commonutils false diff --git a/efesto/efesto-core/efesto-common-api/pom.xml b/efesto/efesto-core/efesto-common-api/pom.xml index 206fc6366f4..4abc6af3351 100644 --- a/efesto/efesto-core/efesto-common-api/pom.xml +++ b/efesto/efesto-core/efesto-common-api/pom.xml @@ -34,6 +34,7 @@ Efesto :: Common :: Api + org.drools.efesto.core.commonapi false diff --git a/efesto/efesto-core/efesto-common-core/pom.xml b/efesto/efesto-core/efesto-common-core/pom.xml index 268ea6f17ce..a1b8d8dfddf 100644 --- a/efesto/efesto-core/efesto-common-core/pom.xml +++ b/efesto/efesto-core/efesto-common-core/pom.xml @@ -34,6 +34,7 @@ Efesto :: Common :: Core + org.drools.efesto.core.commoncore false diff --git a/efesto/efesto-core/efesto-compilation-manager/efesto-compilation-manager-api/pom.xml b/efesto/efesto-core/efesto-compilation-manager/efesto-compilation-manager-api/pom.xml index 0a54f56ef4c..c2d30943af4 100644 --- a/efesto/efesto-core/efesto-compilation-manager/efesto-compilation-manager-api/pom.xml +++ b/efesto/efesto-core/efesto-compilation-manager/efesto-compilation-manager-api/pom.xml @@ -34,6 +34,7 @@ Efesto :: Compilation :: Manager :: Api + org.drools.efesto.core.compilationmanager.api false diff --git a/efesto/efesto-core/efesto-compilation-manager/efesto-compilation-manager-core/pom.xml b/efesto/efesto-core/efesto-compilation-manager/efesto-compilation-manager-core/pom.xml index ffe371e06a0..014ef2bd832 100644 --- a/efesto/efesto-core/efesto-compilation-manager/efesto-compilation-manager-core/pom.xml +++ b/efesto/efesto-core/efesto-compilation-manager/efesto-compilation-manager-core/pom.xml @@ -46,6 +46,7 @@ Efesto :: Compilation :: Manager :: Core + org.drools.efesto.core.compilationmanager.core false diff --git a/efesto/efesto-core/efesto-runtime-manager/efesto-runtime-manager-api/pom.xml b/efesto/efesto-core/efesto-runtime-manager/efesto-runtime-manager-api/pom.xml index 84c4cf568f7..1a86dfa3b0b 100644 --- a/efesto/efesto-core/efesto-runtime-manager/efesto-runtime-manager-api/pom.xml +++ b/efesto/efesto-core/efesto-runtime-manager/efesto-runtime-manager-api/pom.xml @@ -34,6 +34,7 @@ Efesto :: Runtime :: Manager :: Api + org.drools.efesto.core.runtimemanager.api false diff --git a/efesto/efesto-core/efesto-runtime-manager/efesto-runtime-manager-core/pom.xml b/efesto/efesto-core/efesto-runtime-manager/efesto-runtime-manager-core/pom.xml index 755d943504b..37395b6167e 100644 --- a/efesto/efesto-core/efesto-runtime-manager/efesto-runtime-manager-core/pom.xml +++ b/efesto/efesto-core/efesto-runtime-manager/efesto-runtime-manager-core/pom.xml @@ -34,6 +34,7 @@ Efesto :: Runtime :: Manager :: Core + org.drools.efesto.core.compilationmanager.core false diff --git a/efesto/efesto-dependencies/pom.xml b/efesto/efesto-dependencies/pom.xml index b8e5d043b6c..cc1d1ee5e29 100644 --- a/efesto/efesto-dependencies/pom.xml +++ b/efesto/efesto-dependencies/pom.xml @@ -38,6 +38,7 @@ + org.drools.efesto.dependencies true diff --git a/jpmml-migration-recipe/pom.xml b/jpmml-migration-recipe/pom.xml index c97695b719d..055a1e40b0d 100644 --- a/jpmml-migration-recipe/pom.xml +++ b/jpmml-migration-recipe/pom.xml @@ -35,6 +35,9 @@ Kie :: Jpmml Migration Recipe OpenRewrite recipe to migrate JPMML model library from 1.5.1 to 1.6.4 + + org.kie.jpmml.migration.recipe + diff --git a/kie-dmn/kie-dmn-legacy-tests/pom.xml b/kie-dmn/kie-dmn-legacy-tests/pom.xml index d8fd3fb2092..9b630cd5d81 100644 --- a/kie-dmn/kie-dmn-legacy-tests/pom.xml +++ b/kie-dmn/kie-dmn-legacy-tests/pom.xml @@ -28,6 +28,10 @@ kie-dmn-legacy-tests KIE :: Decision Model Notation :: Legacy tests (previous DMN versions) + + + org.kie.dmn.legacytests + diff --git a/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests-trusty/pom.xml b/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests-trusty/pom.xml index c6e5cbe45a5..1a92672a977 100644 --- a/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests-trusty/pom.xml +++ b/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests-trusty/pom.xml @@ -32,6 +32,10 @@ KiE :: Decision Model Notation - PMML Trusty Tests kie-dmn-pmml-tests-trusty + + org.kie.dmn.pmml.tests.trusty + + diff --git a/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests/pom.xml b/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests/pom.xml index 5c3b3ebe879..6751b8fa07e 100644 --- a/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests/pom.xml +++ b/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests/pom.xml @@ -32,6 +32,10 @@ KiE :: Decision Model Notation - PMML Tests kie-dmn-pmml-tests + + org.kie.dmn.pmml.tests + + org.kie diff --git a/kie-dmn/kie-dmn-ruleset2dmn-parent/kie-dmn-ruleset2dmn-cli/pom.xml b/kie-dmn/kie-dmn-ruleset2dmn-parent/kie-dmn-ruleset2dmn-cli/pom.xml index 201f7a9af21..814380c895e 100644 --- a/kie-dmn/kie-dmn-ruleset2dmn-parent/kie-dmn-ruleset2dmn-cli/pom.xml +++ b/kie-dmn/kie-dmn-ruleset2dmn-parent/kie-dmn-ruleset2dmn-cli/pom.xml @@ -28,6 +28,10 @@ kie-dmn-ruleset2dmn-cli KIE :: Decision Model Notation :: ruleset2dmn CLI + + + org.kie.dmn.ruleset2dmn.cli + diff --git a/kie-drl/kie-drl-api/pom.xml b/kie-drl/kie-drl-api/pom.xml index b4ee5369072..9d6e47297fc 100644 --- a/kie-drl/kie-drl-api/pom.xml +++ b/kie-drl/kie-drl-api/pom.xml @@ -22,17 +22,21 @@ - - kie-drl - org.kie - 8.45.0-SNAPSHOT - - 4.0.0 + + kie-drl + org.kie + 8.45.0-SNAPSHOT + + 4.0.0 - kie-drl-api + kie-drl-api - KIE :: DRL :: API - Common API for DRL + KIE :: DRL :: API + Common API for DRL + + + org.kie.drl.api + @@ -47,5 +51,4 @@ - \ No newline at end of file diff --git a/kie-drl/kie-drl-compilation-common/pom.xml b/kie-drl/kie-drl-compilation-common/pom.xml index 6298d941d32..1e28ad9046a 100644 --- a/kie-drl/kie-drl-compilation-common/pom.xml +++ b/kie-drl/kie-drl-compilation-common/pom.xml @@ -22,47 +22,48 @@ - - kie-drl - org.kie - 8.45.0-SNAPSHOT - - 4.0.0 + + kie-drl + org.kie + 8.45.0-SNAPSHOT + + 4.0.0 - kie-drl-compilation-common + kie-drl-compilation-common - KIE :: DRL :: Compilation :: Common - Common code for DRL Compilation + KIE :: DRL :: Compilation :: Common + Common code for DRL Compilation - - false - + + org.kie.drl.compilationcommon + false + - - - org.kie - efesto-compilation-manager-core - - - org.drools - drools-model-codegen - - - org.drools - drools-ruleunits-api - - - org.drools - drools-ruleunits-impl - - - org.kie - kie-drl-api - - - org.assertj - assertj-core + + + org.kie + efesto-compilation-manager-core + + + org.drools + drools-model-codegen + + + org.drools + drools-ruleunits-api + + + org.drools + drools-ruleunits-impl + + + org.kie + kie-drl-api + + + org.assertj + assertj-core test - + \ No newline at end of file diff --git a/kie-drl/kie-drl-implementations/kie-drl-kiesession-local/kie-drl-kiesession-local-runtime/pom.xml b/kie-drl/kie-drl-implementations/kie-drl-kiesession-local/kie-drl-kiesession-local-runtime/pom.xml index 0b7cda5de46..038712c663e 100644 --- a/kie-drl/kie-drl-implementations/kie-drl-kiesession-local/kie-drl-kiesession-local-runtime/pom.xml +++ b/kie-drl/kie-drl-implementations/kie-drl-kiesession-local/kie-drl-kiesession-local-runtime/pom.xml @@ -22,37 +22,36 @@ - - kie-drl-kiesession-local - org.kie - 8.45.0-SNAPSHOT - - 4.0.0 - - kie-drl-kiesession-local-runtime - - KIE :: DRL :: KieSession :: Local :: Runtime - DRL runtime for local-only usage of KieSession - - - - - org.kie - kie-drl-runtime-common - - - org.drools - drools-canonical-model - compile - - - org.kie - kie-drl-api - - - - - false - - + + kie-drl-kiesession-local + org.kie + 8.45.0-SNAPSHOT + + 4.0.0 + + kie-drl-kiesession-local-runtime + + KIE :: DRL :: KieSession :: Local :: Runtime + DRL runtime for local-only usage of KieSession + + + org.kie.drl.implementations.kiesessionlocal.runtime + false + + + + + org.kie + kie-drl-runtime-common + + + org.drools + drools-canonical-model + compile + + + org.kie + kie-drl-api + + \ No newline at end of file diff --git a/kie-drl/kie-drl-implementations/kie-drl-map-input/kie-drl-map-input-runtime/pom.xml b/kie-drl/kie-drl-implementations/kie-drl-map-input/kie-drl-map-input-runtime/pom.xml index 1b62ce94a98..6ac9940fb7b 100644 --- a/kie-drl/kie-drl-implementations/kie-drl-map-input/kie-drl-map-input-runtime/pom.xml +++ b/kie-drl/kie-drl-implementations/kie-drl-map-input/kie-drl-map-input-runtime/pom.xml @@ -22,41 +22,42 @@ - 4.0.0 - - kie-drl-map-input - org.kie - 8.45.0-SNAPSHOT - - - kie-drl-map-input-runtime - - KIE :: DRL :: MapInput :: Runtime - DRL runtime for sending maps as input. To be used for inter-engine communication (e.g. PMML -> Drl) - - - - org.kie - kie-drl-runtime-common - - - org.drools - drools-canonical-model - compile - - - org.kie - kie-drl-api - - - org.assertj - assertj-core - test - - - - - false - - + 4.0.0 + + kie-drl-map-input + org.kie + 8.45.0-SNAPSHOT + + + kie-drl-map-input-runtime + + KIE :: DRL :: MapInput :: Runtime + DRL runtime for sending maps as input. To be used for inter-engine communication (e.g. PMML -> Drl) + + + + org.kie.drl.implementations.drlmapinput.runtime + false + + + + + org.kie + kie-drl-runtime-common + + + org.drools + drools-canonical-model + compile + + + org.kie + kie-drl-api + + + org.assertj + assertj-core + test + + \ No newline at end of file diff --git a/kie-drl/kie-drl-runtime-common/pom.xml b/kie-drl/kie-drl-runtime-common/pom.xml index cfa6dcc94e4..dc1af215142 100644 --- a/kie-drl/kie-drl-runtime-common/pom.xml +++ b/kie-drl/kie-drl-runtime-common/pom.xml @@ -22,34 +22,38 @@ - - kie-drl - org.kie - 8.45.0-SNAPSHOT - - 4.0.0 - - kie-drl-runtime-common - - KIE :: DRL :: Runtime :: Common - Common code for DRL Runtime - - - - org.kie - efesto-runtime-manager-core - - - org.drools - drools-model-compiler - compile - - - org.assertj - assertj-core - test - - + + kie-drl + org.kie + 8.45.0-SNAPSHOT + + 4.0.0 + + kie-drl-runtime-common + + KIE :: DRL :: Runtime :: Common + Common code for DRL Runtime + + + org.kie.drl.runtimecommon + + + + + org.kie + efesto-runtime-manager-core + + + org.drools + drools-model-compiler + compile + + + org.assertj + assertj-core + test + + \ No newline at end of file diff --git a/kie-drl/kie-drl-tests-without-index-file/pom.xml b/kie-drl/kie-drl-tests-without-index-file/pom.xml index acde5deb6dd..da66e39b4da 100644 --- a/kie-drl/kie-drl-tests-without-index-file/pom.xml +++ b/kie-drl/kie-drl-tests-without-index-file/pom.xml @@ -20,8 +20,8 @@ --> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> kie-drl org.kie @@ -35,6 +35,7 @@ DRL Tests not having a phisical IndexFile in classpath + org.kie.drl.testswithoutindexfile false diff --git a/kie-drl/kie-drl-tests/pom.xml b/kie-drl/kie-drl-tests/pom.xml index 8409dbbba4b..bdf6c6d3795 100644 --- a/kie-drl/kie-drl-tests/pom.xml +++ b/kie-drl/kie-drl-tests/pom.xml @@ -20,8 +20,8 @@ --> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> kie-drl org.kie @@ -35,6 +35,7 @@ DRL Tests + org.kie.drl.tests false @@ -97,10 +98,10 @@ test - org.assertj - assertj-core - test - + org.assertj + assertj-core + test + diff --git a/kie-maven-plugin/pom.xml b/kie-maven-plugin/pom.xml index 92e9aa86d20..0605f956983 100644 --- a/kie-maven-plugin/pom.xml +++ b/kie-maven-plugin/pom.xml @@ -37,6 +37,7 @@ KIE :: Maven Plugin + org.kie.maven.plugin 3.3.0 3.6.4 3.8.4 diff --git a/kie-pmml-trusty/kie-pmml-api/pom.xml b/kie-pmml-trusty/kie-pmml-api/pom.xml index 2b0c57692b2..b3c24f454bc 100644 --- a/kie-pmml-trusty/kie-pmml-api/pom.xml +++ b/kie-pmml-trusty/kie-pmml-api/pom.xml @@ -34,6 +34,10 @@ KIE :: PMML :: API Public APIs from Trusty PMML + + org.kie.pmml.api + + diff --git a/kie-pmml-trusty/kie-pmml-commons/pom.xml b/kie-pmml-trusty/kie-pmml-commons/pom.xml index bc17cc90e9f..45c8734fa4f 100644 --- a/kie-pmml-trusty/kie-pmml-commons/pom.xml +++ b/kie-pmml-trusty/kie-pmml-commons/pom.xml @@ -36,6 +36,7 @@ **/exceptions/**.java,**/model/predicates/**.java + org.kie.pmml.commons diff --git a/kie-pmml-trusty/kie-pmml-compiler/kie-pmml-compiler-api/pom.xml b/kie-pmml-trusty/kie-pmml-compiler/kie-pmml-compiler-api/pom.xml index 4ba94c203c5..605282e1b25 100644 --- a/kie-pmml-trusty/kie-pmml-compiler/kie-pmml-compiler-api/pom.xml +++ b/kie-pmml-trusty/kie-pmml-compiler/kie-pmml-compiler-api/pom.xml @@ -34,6 +34,10 @@ KIE :: PMML :: Compiler :: API API specific for PMML Compiler + + org.kie.pmml.compiler.api + + diff --git a/kie-pmml-trusty/kie-pmml-compiler/kie-pmml-compiler-commons/pom.xml b/kie-pmml-trusty/kie-pmml-compiler/kie-pmml-compiler-commons/pom.xml index a74e41fe2c8..e1d888731d5 100644 --- a/kie-pmml-trusty/kie-pmml-compiler/kie-pmml-compiler-commons/pom.xml +++ b/kie-pmml-trusty/kie-pmml-compiler/kie-pmml-compiler-commons/pom.xml @@ -34,6 +34,10 @@ KIE :: PMML :: Compiler :: Commons Kie PMML Compiler Commons + + org.kie.pmml.compiler.commons + + diff --git a/kie-pmml-trusty/kie-pmml-compiler/kie-pmml-compiler-core/pom.xml b/kie-pmml-trusty/kie-pmml-compiler/kie-pmml-compiler-core/pom.xml index 09cb55d63f0..55dd8e36591 100644 --- a/kie-pmml-trusty/kie-pmml-compiler/kie-pmml-compiler-core/pom.xml +++ b/kie-pmml-trusty/kie-pmml-compiler/kie-pmml-compiler-core/pom.xml @@ -35,6 +35,7 @@ PMML Compiler Core + org.kie.pmml.compiler.core false diff --git a/kie-pmml-trusty/kie-pmml-dependencies/pom.xml b/kie-pmml-trusty/kie-pmml-dependencies/pom.xml index 9b21b78c7be..75c4f782510 100644 --- a/kie-pmml-trusty/kie-pmml-dependencies/pom.xml +++ b/kie-pmml-trusty/kie-pmml-dependencies/pom.xml @@ -37,6 +37,10 @@ Declare this artifact as "pom" dependency to import all default kie-pmml-trusty modules. + + org.kie.pmml.dependencies + + diff --git a/kie-pmml-trusty/kie-pmml-evaluator/kie-pmml-evaluator-api/pom.xml b/kie-pmml-trusty/kie-pmml-evaluator/kie-pmml-evaluator-api/pom.xml index 02cdab6de56..aada4fd85a8 100644 --- a/kie-pmml-trusty/kie-pmml-evaluator/kie-pmml-evaluator-api/pom.xml +++ b/kie-pmml-trusty/kie-pmml-evaluator/kie-pmml-evaluator-api/pom.xml @@ -34,6 +34,10 @@ KIE :: PMML :: Evaluator :: API API specific for PMML evaluator + + org.kie.pmml.evaluator.api + + diff --git a/kie-pmml-trusty/kie-pmml-evaluator/kie-pmml-evaluator-core/pom.xml b/kie-pmml-trusty/kie-pmml-evaluator/kie-pmml-evaluator-core/pom.xml index 655d34bec72..bc263e4544a 100644 --- a/kie-pmml-trusty/kie-pmml-evaluator/kie-pmml-evaluator-core/pom.xml +++ b/kie-pmml-trusty/kie-pmml-evaluator/kie-pmml-evaluator-core/pom.xml @@ -34,6 +34,10 @@ KIE :: PMML :: Evaluator :: Core PMML Evaluator Core + + org.kie.pmml.evaluator.core + + diff --git a/kie-pmml-trusty/kie-pmml-evaluator/kie-pmml-evaluator-utils/pom.xml b/kie-pmml-trusty/kie-pmml-evaluator/kie-pmml-evaluator-utils/pom.xml index e4be4e23442..5cbc7f06332 100644 --- a/kie-pmml-trusty/kie-pmml-evaluator/kie-pmml-evaluator-utils/pom.xml +++ b/kie-pmml-trusty/kie-pmml-evaluator/kie-pmml-evaluator-utils/pom.xml @@ -33,6 +33,10 @@ KIE :: PMML :: Evaluator :: Utils Evaluation utils for PMML models inside KIE runtime environment + + org.kie.pmml.evaluator.utils + + org.kie diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-compiler/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-compiler/pom.xml index 5552d187e54..35f97762224 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-compiler/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-compiler/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Clustering :: Compiler PMML Clustering Compiler + + org.kie.pmml.models.clustering.compiler + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-evaluator/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-evaluator/pom.xml index c2f83f073fb..aff176a5197 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-evaluator/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-evaluator/pom.xml @@ -31,6 +31,10 @@ KIE :: PMML :: Models :: Clustering :: Evaluator PMML Clustering Evaluator + + org.kie.pmml.models.clustering.evaluator + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-model/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-model/pom.xml index 916e4f0cea9..2f2795527c9 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-model/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-model/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Clustering :: Model KiePMML Model for Clustering implementation + + org.kie.pmml.models.clustering.model + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-tests/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-tests/pom.xml index f258cdbc5a4..e78728e36aa 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-tests/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-clustering/kie-pmml-models-clustering-tests/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Clustering :: Tests PMML Clustering Tests + + org.kie.pmml.models.clustering.tests + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-common/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-common/pom.xml index a24b9cf02d3..9b6fb40f42b 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-common/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-common/pom.xml @@ -34,6 +34,10 @@ KIE :: PMML :: Models :: Drools :: Common Common code for PMML Models with Drools Implementations + + org.kie.pmml.models.drools.common + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-compiler/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-compiler/pom.xml index f74c6dde8d7..9d5732ac2cc 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-compiler/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-compiler/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Drools :: Scorecard :: Compiler PMML Scorecard Compiler + + org.kie.pmml.models.drools.scorecard.compiler + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-evaluator/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-evaluator/pom.xml index 471c12cca9e..05d07d7edb9 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-evaluator/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-evaluator/pom.xml @@ -31,6 +31,10 @@ KIE :: PMML :: Models :: Drools :: Scorecard :: Evaluator PMML Scorecard Evaluator + + org.kie.pmml.models.drools.scorecard.evaluator + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-model/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-model/pom.xml index 8b035cb452d..e42e86ef80f 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-model/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-model/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Drools :: Scorecard :: Model KiePMML Model for Scorecard implementation + + org.kie.pmml.models.drools.scorecard.model + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-tests/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-tests/pom.xml index 50330f10c8f..eb49f7fa11b 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-tests/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-scorecard/kie-pmml-models-drools-scorecard-tests/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Drools :: Scorecard :: Tests PMML Scorecard Tests + + org.kie.pmml.models.drools.scorecard.tests + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-compiler/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-compiler/pom.xml index 35fbef7d6e6..7b29b143623 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-compiler/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-compiler/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Drools :: Tree :: Compiler PMML Tree Compiler + + org.kie.pmml.models.drools.tree.compiler + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-evaluator/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-evaluator/pom.xml index 01adce46be5..55574196290 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-evaluator/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-evaluator/pom.xml @@ -31,6 +31,10 @@ KIE :: PMML :: Models :: Drools :: Tree :: Evaluator PMML Tree Evaluator + + org.kie.pmml.models.drools.tree.evaluator + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-model/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-model/pom.xml index 27ef5aa9110..95525b20b87 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-model/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-model/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Drools :: Tree :: Model KiePMML Model for Tree implementation + + org.kie.pmml.models.drools.tree.model + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-tests/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-tests/pom.xml index 337110d3a8c..1e8c0f65251 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-tests/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-drools/kie-pmml-models-drools-tree/kie-pmml-models-drools-tree-tests/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Drools :: Tree :: Tests PMML Tree Tests + + org.kie.pmml.models.drools.tree.tests + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-compiler/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-compiler/pom.xml index 781c57e07e7..2dc483c3a04 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-compiler/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-compiler/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Mining :: Compiler PMML Mining Compiler + + org.kie.pmml.models.mining.compiler + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-evaluator/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-evaluator/pom.xml index 82d6682dbcf..93491b13333 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-evaluator/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-evaluator/pom.xml @@ -31,6 +31,10 @@ KIE :: PMML :: Models :: Mining :: Evaluator PMML Mining Evaluator + + org.kie.pmml.models.mining.evaluator + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-model/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-model/pom.xml index eff43e174e0..953a5aa8ba3 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-model/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-model/pom.xml @@ -33,6 +33,7 @@ KiePMML Model for Mining implementation + org.kie.pmml.models.mining.model **/segmentation/**.java diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-tests/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-tests/pom.xml index 85daf3c613d..34cc05a9ddc 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-tests/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-mining/kie-pmml-models-mining-tests/pom.xml @@ -31,6 +31,10 @@ KIE :: PMML :: Models :: Mining :: Tests PMML Mining Tests + + org.kie.pmml.models.mining.tests + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-compiler/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-compiler/pom.xml index 05497231632..b14d8eda108 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-compiler/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-compiler/pom.xml @@ -34,6 +34,10 @@ KIE :: PMML :: Models :: Regression :: Compiler PMML Regression Compiler + + org.kie.pmml.models.regression.compiler + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-evaluator/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-evaluator/pom.xml index 0ea7affc350..a08d611e914 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-evaluator/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-evaluator/pom.xml @@ -34,6 +34,10 @@ KIE :: PMML :: Models :: Regression :: Evaluator PMML Regression Evaluator + + org.kie.pmml.models.regression.evaluator + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-model/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-model/pom.xml index 5ce9c45e7e9..c0e201ac130 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-model/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-model/pom.xml @@ -34,6 +34,10 @@ KIE :: PMML :: Models :: Regression :: Model KiePMML Model for Regression implementation + + org.kie.pmml.models.regression.model + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-tests/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-tests/pom.xml index 9270398cc58..2367db9129c 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-tests/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-tests/pom.xml @@ -33,6 +33,10 @@ KIE :: PMML :: Models :: Regression :: Tests PMML Regression Tests + + org.kie.pmml.models.regression.tests + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-compiler/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-compiler/pom.xml index 8594c812602..67fc90f4164 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-compiler/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-compiler/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Scorecard :: Compiler PMML Scorecard Compiler + + org.kie.pmml.models.scorecard.compiler + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-evaluator/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-evaluator/pom.xml index 336abba50b6..76bfd50d4ba 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-evaluator/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-evaluator/pom.xml @@ -31,6 +31,10 @@ KIE :: PMML :: Models :: Scorecard :: Evaluator PMML Scorecard Evaluator + + org.kie.pmml.models.scorecard.evaluator + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-model/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-model/pom.xml index 4706404dde0..f3fa07de21f 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-model/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-model/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Scorecard :: Model KiePMML Model for Scorecard implementation + + org.kie.pmml.models.scorecard.model + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-tests/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-tests/pom.xml index eee4cf3d844..482e06e0f87 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-tests/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-scorecard/kie-pmml-models-scorecard-tests/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Scorecard :: Tests PMML Scorecard Tests + + org.kie.pmml.models.scorecard.tests + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tests/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tests/pom.xml index b5ec63f099d..584f28b851f 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tests/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tests/pom.xml @@ -34,6 +34,10 @@ KIE :: PMML :: Models :: Tests PMML Common classes for Tests + + org.kie.pmml.models.tests + + org.kie diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-compiler/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-compiler/pom.xml index 50cf2455a64..952c4a2f9ab 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-compiler/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-compiler/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Tree :: Compiler PMML Tree Compiler + + org.kie.pmml.models.tree.compiler + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-evaluator/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-evaluator/pom.xml index cf120af9657..93cac08382a 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-evaluator/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-evaluator/pom.xml @@ -31,6 +31,10 @@ KIE :: PMML :: Models :: Tree :: Evaluator PMML Tree Evaluator + + org.kie.pmml.models.tree.evaluator + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-model/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-model/pom.xml index 8c81a8675ef..76e491d014b 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-model/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-model/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Tree :: Model KiePMML Model for Tree implementation + + org.kie.pmml.models.tree.model + + diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-tests/pom.xml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-tests/pom.xml index 2785431b7a7..87af1f5651e 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-tests/pom.xml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-tests/pom.xml @@ -32,6 +32,10 @@ KIE :: PMML :: Models :: Tree :: Tests PMML Tree Tests + + org.kie.pmml.models.tree.tests + + diff --git a/pom.xml b/pom.xml index af6a8eb7f17..15fc1477990 100644 --- a/pom.xml +++ b/pom.xml @@ -3,11 +3,10 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - - org.jboss - jboss-parent - - 36 + + org.apache + apache + 30 org.kie From 7da6adf296a2f6e5cf813a20cb2acbfd640fc275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Wed, 4 Oct 2023 13:35:41 +0200 Subject: [PATCH 02/41] Fix javadoc, sources and distribution generation. (#5541) * Fix javadoc, sources and distribution generation. * Remove duplicate javadoc plugin declaration. * Fix alphanetworkcompiler Java module name. --- build-parent/pom.xml | 39 +++++++++---------- drools-alphanetwork-compiler/pom.xml | 17 +------- .../src/main/assembly/assembly-drools.xml | 4 +- .../pom.xml | 2 +- drools-ruleunits/drools-ruleunits-dsl/pom.xml | 2 +- drools-traits/pom.xml | 18 +-------- 6 files changed, 24 insertions(+), 58 deletions(-) diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 903733ba328..c6cf48d5787 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -35,7 +35,6 @@ - -Xdoclint:none 11 ${maven.compiler.release} ${maven.compiler.release} @@ -232,7 +231,7 @@ 3.3.0 3.4.0 - + 3.6.0 @@ -1759,7 +1758,7 @@ org.apache.maven.plugins maven-source-plugin - ${version.source.plugin} + ${version.maven-source-plugin} attach-sources @@ -1964,22 +1963,6 @@ **/*Constants.properties,**/*Constants_en.properties - - org.apache.maven.plugins - maven-javadoc-plugin - - - http://docs.oracle.com/javase/8/docs/api - - ${maven.compiler.source} - 128m - 512m - false - true - true - ${javadoc.additional.params} - - @@ -2056,14 +2039,16 @@ org.apache.maven.plugins maven-javadoc-plugin - ${version.maven-javadoc-plugin} + ${version.maven-javadoc-plugin.override}
${project.name} ${project.version}]]>
${project.name} ${project.version}]]>
true - ${javadoc.additional.params} + true + none + true
@@ -2097,6 +2082,18 @@ + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar-no-fork + + + + org.apache.maven.plugins diff --git a/drools-alphanetwork-compiler/pom.xml b/drools-alphanetwork-compiler/pom.xml index 7200a26642a..1075b38644d 100644 --- a/drools-alphanetwork-compiler/pom.xml +++ b/drools-alphanetwork-compiler/pom.xml @@ -36,7 +36,7 @@ Drools :: Alpha Network Compiler - org.drools.core.alphanetworkcompiler + org.drools.ancompiler @@ -112,21 +112,6 @@ src/main/filtered-resources - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - - **/MetaProperty.java - - - - -
\ No newline at end of file diff --git a/drools-distribution/src/main/assembly/assembly-drools.xml b/drools-distribution/src/main/assembly/assembly-drools.xml index 0e5f7d5aa91..ac57abe6e75 100644 --- a/drools-distribution/src/main/assembly/assembly-drools.xml +++ b/drools-distribution/src/main/assembly/assembly-drools.xml @@ -14,7 +14,7 @@ - ../LICENSE-ASL-2.0.txt + ../LICENSE-Apache-2.0.txt @@ -89,7 +89,7 @@ ch.qos.logback:logback-classic - *:sources + *:*:jar:sources examples/binaries true diff --git a/drools-impact-analysis/drools-impact-analysis-graph/drools-impact-analysis-graph-common/pom.xml b/drools-impact-analysis/drools-impact-analysis-graph/drools-impact-analysis-graph-common/pom.xml index ea3858d5a5c..0f27e9eb2d3 100644 --- a/drools-impact-analysis/drools-impact-analysis-graph/drools-impact-analysis-graph-common/pom.xml +++ b/drools-impact-analysis/drools-impact-analysis-graph/drools-impact-analysis-graph-common/pom.xml @@ -34,7 +34,7 @@ Drools :: Impact Analysis Graph :: Common - org.drools.impact.analysis.graph + org.drools.impact.analysis.graph.common diff --git a/drools-ruleunits/drools-ruleunits-dsl/pom.xml b/drools-ruleunits/drools-ruleunits-dsl/pom.xml index bef6fae8dc7..7441a9b54dc 100755 --- a/drools-ruleunits/drools-ruleunits-dsl/pom.xml +++ b/drools-ruleunits/drools-ruleunits-dsl/pom.xml @@ -39,7 +39,7 @@ - org.drools.ruleunits.impl + org.drools.ruleunits.dsl diff --git a/drools-traits/pom.xml b/drools-traits/pom.xml index 4f4a128fc4c..b717b853857 100644 --- a/drools-traits/pom.xml +++ b/drools-traits/pom.xml @@ -36,7 +36,7 @@ Drools :: Traits - org.drools.core.traits + org.drools.traits 2 - - **/MetaProperty.java - - - - - From 3bb61c6b9e22b5547d3a451cc1dd62cccbcebf7a Mon Sep 17 00:00:00 2001 From: Matteo Mortari Date: Thu, 5 Oct 2023 09:09:33 +0200 Subject: [PATCH 03/41] Fix forloop variables scoping for closures (#5537) --- .../kie/dmn/feel/codegen/feel11/CompiledFEELSupport.java | 2 ++ .../java/org/kie/dmn/feel/codegen/feel11/Functions.java | 2 +- .../org/kie/dmn/feel/lang/ast/ForExpressionNode.java | 9 +++++++++ .../kie/dmn/feel/runtime/FEEL12ExtendedForLoopTest.java | 2 ++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSupport.java b/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSupport.java index 9761b6d6732..99785c45082 100644 --- a/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSupport.java +++ b/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSupport.java @@ -262,6 +262,7 @@ public Object rreturn(Function expression) { while (ForExpressionNode.nextIteration(ctx, ictx)) { Object result = expression.apply(ctx); results.add(result); + ctx.exitFrame(); // last i-th scope unrolled, see also ForExpressionNode.nextIteration(...) } return results; } catch (EndpointOfRangeNotOfNumberException e) { @@ -278,6 +279,7 @@ private ForIteration[] initializeContexts(EvaluationContext ctx, List= 0 && i < ictx.length ) { if ( ictx[i].hasNextValue() ) { + ctx.enterFrame(); // on first iter, open last scope frame; or new ones when prev unrolled setValueIntoContext( ctx, ictx[i] ); i++; } else { + if ( i > 0 ) { + // end of iter loop for this i-th scope; i-th scope is always unrolled as part of the + // for-loop cycle, so here must unroll the _prev_ scope; + // the if-guard for this code block makes sure NOT to unroll bottom one. + ctx.exitFrame(); + } i--; } } @@ -114,6 +122,7 @@ private ForIteration[] initializeContexts(EvaluationContext ctx, List data() { {"{ a: 1, b : 3, c : for x in a+2..b-2 return x+1}", mapOf(entry("a", BigDecimal.valueOf(1)), entry("b", BigDecimal.valueOf(3)), entry("c", Stream.of(3, 2, 1 ).map(x -> BigDecimal.valueOf(x + 1 ) ).collect(Collectors.toList() )) ), null}, {"{ a: \"ciao\", b : 3, c : for x in a..b return x+1}", mapOf(entry("a", "ciao"), entry("b", BigDecimal.valueOf(3)), entry("c", null)), FEELEvent.Severity.ERROR}, {"for i in 0..10 return if i = 0 then 1 else i * partial[-1]", Stream.of(1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800 ).map(BigDecimal::valueOf).collect(Collectors.toList() ), null}, + {"{xs: for i in 1..10 return function() i, ys: for f in xs return f()}.ys", IntStream.range(1, 11).boxed().map(BigDecimal::valueOf).collect(Collectors.toList()), null}, }; return addAdditionalParameters(cases, false); From 92b0a9975c65c229e0ef736d116d30d71a0b2b79 Mon Sep 17 00:00:00 2001 From: Luca Molteni Date: Fri, 6 Oct 2023 10:15:43 +0200 Subject: [PATCH 04/41] Removed hardcoded jmh version only for drools-model-codegen (#5525) --- drools-model/drools-model-codegen/pom.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drools-model/drools-model-codegen/pom.xml b/drools-model/drools-model-codegen/pom.xml index 35579358bfd..0d836c6499a 100644 --- a/drools-model/drools-model-codegen/pom.xml +++ b/drools-model/drools-model-codegen/pom.xml @@ -37,7 +37,6 @@ org.drools.model.codegen - 1.19 @@ -45,13 +44,13 @@ org.openjdk.jmh jmh-core - ${version.jmh} + ${version.org.openjdk.jmh} test org.openjdk.jmh jmh-generator-annprocess - ${version.jmh} + ${version.org.openjdk.jmh} test From e1c2c53c4836979ad6ab4a10421c70d126f6be8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Wed, 11 Oct 2023 08:58:31 +0200 Subject: [PATCH 05/41] [kie-issues#624] Fix coercing double type in Mvel compiler (#5550) --- .../mvelcompiler/MethodCallExprVisitor.java | 6 +-- .../org/drools/mvelcompiler/RHSPhase.java | 7 +++ .../mvelcompiler/ReProcessRHSPhase.java | 7 +++ .../ast/DoubleLiteralExpressionT.java | 52 +++++++++++++++++++ .../mvelcompiler/ConstraintCompilerTest.java | 14 +++++ .../drools/mvelcompiler/MvelCompilerTest.java | 11 ++++ 6 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/ast/DoubleLiteralExpressionT.java diff --git a/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/MethodCallExprVisitor.java b/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/MethodCallExprVisitor.java index 723147e5ea5..4d0b38ed080 100644 --- a/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/MethodCallExprVisitor.java +++ b/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/MethodCallExprVisitor.java @@ -59,7 +59,7 @@ public TypedExpression visit(MethodCallExpr n, RHSPhase.Context arg) { Optional scope = n.getScope().map(s -> s.accept(this, arg)); TypedExpression name = n.getName().accept(this, new RHSPhase.Context(scope.orElse(null))); final List arguments = new ArrayList<>(n.getArguments().size()); - for(Expression child : n.getArguments()) { + for (Expression child : n.getArguments()) { TypedExpression a = child.accept(this, arg); arguments.add(a); } @@ -94,7 +94,7 @@ private MethodCallExprT parseMethod(MethodCallExpr n, .>map(ClassUtils::classFromType) .map(scopeClazz -> MethodUtils.findMethod(scopeClazz, n.getNameAsString(), argumentsType)); - if(method.isEmpty()) { + if (method.isEmpty()) { method = mvelCompilerContext.getRootPattern() .map(scopeClazz -> MethodUtils.findMethod(scopeClazz, n.getNameAsString(), argumentsType)); if(method.isPresent()) { @@ -102,7 +102,7 @@ private MethodCallExprT parseMethod(MethodCallExpr n, } } - if(method.isEmpty()) { + if (method.isEmpty()) { method = mvelCompilerContext.findStaticMethod(n.getNameAsString()); } diff --git a/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/RHSPhase.java b/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/RHSPhase.java index 90210cfc37b..d85917abc3a 100644 --- a/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/RHSPhase.java +++ b/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/RHSPhase.java @@ -35,6 +35,7 @@ import com.github.javaparser.ast.expr.BooleanLiteralExpr; import com.github.javaparser.ast.expr.CastExpr; import com.github.javaparser.ast.expr.CharLiteralExpr; +import com.github.javaparser.ast.expr.DoubleLiteralExpr; import com.github.javaparser.ast.expr.EnclosedExpr; import com.github.javaparser.ast.expr.Expression; import com.github.javaparser.ast.expr.FieldAccessExpr; @@ -63,6 +64,7 @@ import org.drools.mvelcompiler.ast.BooleanLiteralExpressionT; import org.drools.mvelcompiler.ast.CastExprT; import org.drools.mvelcompiler.ast.CharacterLiteralExpressionT; +import org.drools.mvelcompiler.ast.DoubleLiteralExpressionT; import org.drools.mvelcompiler.ast.FieldAccessTExpr; import org.drools.mvelcompiler.ast.FieldToAccessorTExpr; import org.drools.mvelcompiler.ast.IntegerLiteralExpressionT; @@ -331,6 +333,11 @@ public TypedExpression visit(IntegerLiteralExpr n, Context arg) { return new IntegerLiteralExpressionT(n); } + @Override + public TypedExpression visit(DoubleLiteralExpr n, Context arg) { + return new DoubleLiteralExpressionT(n); + } + @Override public TypedExpression visit(CharLiteralExpr n, Context arg) { return new CharacterLiteralExpressionT(n); diff --git a/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/ReProcessRHSPhase.java b/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/ReProcessRHSPhase.java index 98b07901bda..4221b92c85e 100644 --- a/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/ReProcessRHSPhase.java +++ b/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/ReProcessRHSPhase.java @@ -24,12 +24,14 @@ import com.github.javaparser.ast.Node; import com.github.javaparser.ast.expr.BinaryExpr; +import com.github.javaparser.ast.expr.DoubleLiteralExpr; import com.github.javaparser.ast.expr.IntegerLiteralExpr; import com.github.javaparser.ast.expr.LongLiteralExpr; import com.github.javaparser.ast.expr.NameExpr; import com.github.javaparser.ast.expr.UnaryExpr; import org.drools.mvel.parser.ast.visitor.DrlGenericVisitor; import org.drools.mvelcompiler.ast.BigDecimalConvertedExprT; +import org.drools.mvelcompiler.ast.DoubleLiteralExpressionT; import org.drools.mvelcompiler.ast.IntegerLiteralExpressionT; import org.drools.mvelcompiler.ast.LongLiteralExpressionT; import org.drools.mvelcompiler.ast.TypedExpression; @@ -86,6 +88,11 @@ public Optional visit(IntegerLiteralExpr n, ReProcessRHSPhase.C return convertWhenLHSISBigDecimal(() -> new IntegerLiteralExpressionT(n), context); } + @Override + public Optional visit(DoubleLiteralExpr n, ReProcessRHSPhase.Context context) { + return convertWhenLHSISBigDecimal(() -> new DoubleLiteralExpressionT(n), context); + } + @Override public Optional visit(LongLiteralExpr n, ReProcessRHSPhase.Context context) { return convertWhenLHSISBigDecimal(() -> new LongLiteralExpressionT(n), context); diff --git a/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/ast/DoubleLiteralExpressionT.java b/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/ast/DoubleLiteralExpressionT.java new file mode 100644 index 00000000000..8a965390e82 --- /dev/null +++ b/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/ast/DoubleLiteralExpressionT.java @@ -0,0 +1,52 @@ +/** + * 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.mvelcompiler.ast; + +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.expr.DoubleLiteralExpr; + +import java.lang.reflect.Type; +import java.util.Optional; + +public class DoubleLiteralExpressionT implements TypedExpression { + + private final DoubleLiteralExpr doubleLiteralExpr; + + public DoubleLiteralExpressionT(DoubleLiteralExpr doubleLiteralExpr) { + + this.doubleLiteralExpr = doubleLiteralExpr; + } + + @Override + public Optional getType() { + return Optional.of(double.class); + } + + @Override + public Node toJavaExpression() { + return doubleLiteralExpr; + } + + @Override + public String toString() { + return "DoubleLiteralExpressionT{" + + "originalExpression=" + doubleLiteralExpr + + '}'; + } +} diff --git a/drools-model/drools-mvel-compiler/src/test/java/org/drools/mvelcompiler/ConstraintCompilerTest.java b/drools-model/drools-mvel-compiler/src/test/java/org/drools/mvelcompiler/ConstraintCompilerTest.java index 42046262b57..a84d73bd9f0 100644 --- a/drools-model/drools-mvel-compiler/src/test/java/org/drools/mvelcompiler/ConstraintCompilerTest.java +++ b/drools-model/drools-mvel-compiler/src/test/java/org/drools/mvelcompiler/ConstraintCompilerTest.java @@ -98,6 +98,20 @@ public void testBigDecimalModInt() { "$bd1.remainder(new java.math.BigDecimal(10), java.math.MathContext.DECIMAL128)"); } + @Test + public void testBigDecimalValueOfInteger() { + testExpression(c -> c.addDeclaration("$bdvalue", BigDecimal.class), + "$bdvalue + BigDecimal.valueOf(10)", + "$bdvalue.add(BigDecimal.valueOf(10), java.math.MathContext.DECIMAL128)"); + } + + @Test + public void testBigDecimalValueOfDouble() { + testExpression(c -> c.addDeclaration("$bdvalue", BigDecimal.class), + "$bdvalue + BigDecimal.valueOf(0.5)", + "$bdvalue.add(BigDecimal.valueOf(0.5), java.math.MathContext.DECIMAL128)"); + } + public void testExpression(Consumer testFunction, String inputExpression, String expectedResult, diff --git a/drools-model/drools-mvel-compiler/src/test/java/org/drools/mvelcompiler/MvelCompilerTest.java b/drools-model/drools-mvel-compiler/src/test/java/org/drools/mvelcompiler/MvelCompilerTest.java index 67b6b5884fd..4db881fb600 100644 --- a/drools-model/drools-mvel-compiler/src/test/java/org/drools/mvelcompiler/MvelCompilerTest.java +++ b/drools-model/drools-mvel-compiler/src/test/java/org/drools/mvelcompiler/MvelCompilerTest.java @@ -801,6 +801,17 @@ public void testBigDecimalArithmetic() { "}"); } + @Test + public void testBigDecimalArithmeticWithValueOfDouble() { + test(ctx -> ctx.addDeclaration("$p", Person.class), + "{ " + + " $p.salary = $p.salary + BigDecimal.valueOf(0.5);\n" + + "}", + "{ " + + " $p.setSalary($p.getSalary().add(BigDecimal.valueOf(0.5), java.math.MathContext.DECIMAL128));\n" + + "}"); + } + @Test public void testBigDecimalArithmeticWithConversionLiteral() { test(ctx -> ctx.addDeclaration("$p", Person.class), From 878850c21fe121f2eebeebe637a70eb1e3d4be7c Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Wed, 11 Oct 2023 11:26:02 +0200 Subject: [PATCH 06/41] [DROOLS-7555] move automatic rest endpoints generation from Kogito to Drools (#5548) * [DROOLS-7555] move automatic rest endpoints generation from Kogito to Drools * wip --- .../drools-drl-quarkus-deployment/pom.xml | 27 +- .../deployment/DroolsAssetsProcessor.java | 39 ++- .../pom.xml | 31 ++ .../pom.xml | 35 +++ .../quarkus/ruleunit/test/AlertingService.drl | 34 +++ .../test/AutomaticRestEndpointIT.java | 46 +++ .../DroolsQuarkusResourceUtils.java | 50 ++-- drools-model/drools-codegen-common/pom.xml | 6 + .../common/DroolsModelBuildContext.java | 28 ++ .../codegen/common/GeneratedFileType.java | 7 + .../AbstractDroolsModelBuildContext.java | 32 ++- .../context/JavaDroolsModelBuildContext.java | 12 +- .../QuarkusDroolsModelBuildContext.java | 20 +- .../SpringBootDroolsModelBuildContext.java | 20 +- .../di/DependencyInjectionAnnotator.java | 270 ++++++++++++++++++ .../impl/CDIDependencyInjectionAnnotator.java | 186 ++++++++++++ .../SpringDependencyInjectionAnnotator.java | 189 ++++++++++++ .../codegen/common/rest/RestAnnotator.java | 29 ++ .../common/rest/impl/CDIRestAnnotator.java | 42 +++ .../common/rest/impl/SpringRestAnnotator.java | 47 +++ .../codegen/execmodel/GeneratedFile.java | 104 ------- .../model/codegen/execmodel/ModelWriter.java | 15 +- .../model/codegen/execmodel/PackageModel.java | 38 +-- .../codegen/execmodel/PackageSources.java | 29 +- .../execmodel/RuleObjectMapperWriter.java | 45 +++ .../RuleUnitQueryEndpointWriter.java | 201 +++++++++++++ .../execmodel/RuleUnitQueryWriter.java | 232 +++++++++++++++ .../codegen/execmodel/RuleUnitWriter.java | 77 ++++- .../util/BodyDeclarationComparator.java | 55 ++++ .../execmodel/util/RuleCodegenUtils.java | 76 +++++ .../project/CodegenPackageSources.java | 7 +- .../codegen/project/DroolsModelBuilder.java | 35 +-- .../project/KieSessionModelBuilder.java | 15 +- .../model/codegen/project/RuleCodegen.java | 11 +- .../RestObjectMapperQuarkusTemplate.java | 130 +++++++++ .../RestObjectMapperSpringTemplate.java | 123 ++++++++ .../ruleunits/RestQueryJavaTemplate.java | 63 ++++ .../ruleunits/RestQueryQuarkusTemplate.java | 64 +++++ .../ruleunits/RestQuerySpringTemplate.java | 62 ++++ .../ruleunits/RuleUnitQueryJavaTemplate.java | 34 +++ .../ConstraintEvaluationExceptionTest.java | 12 +- .../codegen/ruleunits/RuleUnitWriterTest.java | 18 +- .../impl/GeneratedRuleUnitDescription.java | 9 +- .../impl/SimpleRuleUnitVariable.java | 10 +- .../src/test/resources/logback-test.xml | 2 +- .../ExplicitCanonicalModelCompilerTest.java | 15 +- .../compilation/utils/DrlCompilerHelper.java | 28 +- .../utils/DrlCompilerHelperTest.java | 2 +- .../ruleunit/RuleUnitDescription.java | 10 +- .../internal/ruleunit/RuleUnitVariable.java | 1 + 50 files changed, 2379 insertions(+), 294 deletions(-) create mode 100644 drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/resources/org/drools/quarkus/ruleunit/test/AlertingService.drl create mode 100644 drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/AutomaticRestEndpointIT.java create mode 100644 drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/di/DependencyInjectionAnnotator.java create mode 100644 drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/di/impl/CDIDependencyInjectionAnnotator.java create mode 100644 drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/di/impl/SpringDependencyInjectionAnnotator.java create mode 100644 drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/rest/RestAnnotator.java create mode 100644 drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/rest/impl/CDIRestAnnotator.java create mode 100644 drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/rest/impl/SpringRestAnnotator.java delete mode 100644 drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/GeneratedFile.java create mode 100644 drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleObjectMapperWriter.java create mode 100644 drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitQueryEndpointWriter.java create mode 100644 drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitQueryWriter.java create mode 100644 drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/util/BodyDeclarationComparator.java create mode 100644 drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/util/RuleCodegenUtils.java create mode 100644 drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestObjectMapperQuarkusTemplate.java create mode 100644 drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestObjectMapperSpringTemplate.java create mode 100644 drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQueryJavaTemplate.java create mode 100644 drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQueryQuarkusTemplate.java create mode 100644 drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQuerySpringTemplate.java create mode 100644 drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RuleUnitQueryJavaTemplate.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/pom.xml b/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/pom.xml index fb215db80d1..38c4ffeba49 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/pom.xml +++ b/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/pom.xml @@ -64,10 +64,6 @@ org.drools drools-model-codegen
- - org.kie - kie-drl-map-input-runtime - @@ -84,6 +80,10 @@ io.quarkus quarkus-arc-deployment + + io.quarkus + quarkus-resteasy-reactive-spi-deployment + io.quarkus quarkus-vertx-http-deployment-spi @@ -149,6 +149,25 @@ + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + ban-blacklisted-dependencies + validate + + enforce + + + false + + + + diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java b/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java index c679cb7bcd3..ee5021f590b 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java +++ b/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java @@ -18,31 +18,19 @@ */ package org.drools.drl.quarkus.deployment; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; - -import javax.inject.Inject; - import io.quarkus.arc.deployment.GeneratedBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.annotations.Produce; import io.quarkus.deployment.builditem.ArchiveRootBuildItem; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.builditem.GeneratedResourceBuildItem; import io.quarkus.deployment.builditem.LiveReloadBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; -import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; -import io.quarkus.deployment.pkg.builditem.ArtifactResultBuildItem; import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem; import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem; import io.quarkus.maven.dependency.ResolvedDependency; +import io.quarkus.resteasy.reactive.spi.GeneratedJaxRsResourceBuildItem; import io.quarkus.vertx.http.deployment.spi.AdditionalStaticResourceBuildItem; import org.drools.codegen.common.DroolsModelBuildContext; import org.drools.codegen.common.GeneratedFile; @@ -53,10 +41,14 @@ import org.drools.model.codegen.execmodel.PackageModel; import org.drools.model.codegen.project.RuleCodegen; import org.kie.api.io.Resource; -import org.kie.drl.engine.runtime.mapinput.service.KieRuntimeServiceDrlMapInput; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.inject.Inject; +import java.util.Collection; +import java.util.Set; +import java.util.stream.Collectors; + import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.HOT_RELOAD_SUPPORT_PATH; import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.compileGeneratedSources; import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.createDroolsBuildContext; @@ -64,6 +56,7 @@ import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.getHotReloadSupportSource; import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.getRuleUnitDefProducerSource; import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.registerResources; +import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.toClassName; import static org.drools.model.codegen.project.RuleCodegen.ofResources; public class DroolsAssetsProcessor { @@ -95,7 +88,8 @@ public void generateSources( BuildProducer generatedBean BuildProducer genResBI, BuildProducer otnClasesBI, BuildProducer kbaseModelsBI, - BuildProducer globalsBI) { + BuildProducer globalsBI, + BuildProducer jaxrsProducer) { DroolsModelBuildContext context = createDroolsBuildContext(outputTargetBuildItem.getOutputDirectory(), root.getPaths(), combinedIndexBuildItem.getIndex()); @@ -128,14 +122,13 @@ public void generateSources( BuildProducer generatedBean kbaseModelsBI.produce(new KmoduleKieBaseModelsBuiltItem(ruleCodegen.getKmoduleKieBaseModels())); } globalsBI.produce(new GlobalsBuildItem(ruleCodegen.getPackageModels().stream().collect(Collectors.toMap(PackageModel::getName, PackageModel::getGlobals)))); - } - @BuildStep - public List reflectiveEfestoRules() { - LOGGER.debug("reflectiveEfestoRules()"); - final List toReturn = new ArrayList<>(); - toReturn.add(new ReflectiveClassBuildItem(true, true, KieRuntimeServiceDrlMapInput.class)); - LOGGER.debug("toReturn {}", toReturn.size()); - return toReturn; + Set restResourceClassNameSet = generatedFiles.stream() + .filter(file -> file.type() == GeneratedFileType.REST) + .map(file -> toClassName(file.path().toString())) + .collect(Collectors.toSet()); + generatedBeanBuildItems.stream() + .filter(b -> restResourceClassNameSet.contains(b.getName())) + .forEach(b -> jaxrsProducer.produce(new GeneratedJaxRsResourceBuildItem(b.getName(), b.getData()))); } } diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/pom.xml b/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/pom.xml index de4818e5152..783c8e9f52b 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/pom.xml +++ b/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/pom.xml @@ -179,6 +179,37 @@ + + + io.quarkus + quarkus-maven-plugin + + + + build + + + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + ban-blacklisted-dependencies + validate + + enforce + + + false + + + + diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/pom.xml b/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/pom.xml index badddc11e79..37a6d04fb5e 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/pom.xml +++ b/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/pom.xml @@ -54,6 +54,10 @@ io.quarkus quarkus-resteasy-reactive + + io.quarkus + quarkus-resteasy-reactive-jackson + org.assertj assertj-core @@ -182,6 +186,37 @@ + + + io.quarkus + quarkus-maven-plugin + + + + build + + + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + ban-blacklisted-dependencies + validate + + enforce + + + false + + + + diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/resources/org/drools/quarkus/ruleunit/test/AlertingService.drl b/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/resources/org/drools/quarkus/ruleunit/test/AlertingService.drl new file mode 100644 index 00000000000..da0fef6ecf9 --- /dev/null +++ b/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/resources/org/drools/quarkus/ruleunit/test/AlertingService.drl @@ -0,0 +1,34 @@ +package org.drools.quarkus.ruleunit.test; +unit AlertingService; + +import org.drools.ruleunits.api.DataStream; +import org.drools.ruleunits.api.RuleUnitData + + +declare Event + type: String + value: int +end + +declare Alert + severity: String + message: String +end + +declare AlertingService extends RuleUnitData + eventData: DataStream + alertData: DataStream +end + + +rule IncomingEvent when + // matches when a temperature higher than 30 °C is registered (OOPath syntax) + $e : /eventData [ type == "temperature", value >= 30 ] +then + System.out.println("incoming event: "+ $e); + alertData.append( new Alert( "warning", $e.toString() ) ); +end + +query Warnings + alerts: /alertData [ severity == "warning" ] +end \ No newline at end of file diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/AutomaticRestEndpointIT.java b/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/AutomaticRestEndpointIT.java new file mode 100644 index 00000000000..979ad9801d8 --- /dev/null +++ b/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/AutomaticRestEndpointIT.java @@ -0,0 +1,46 @@ +/* + * 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.quarkus.ruleunit.test; + +import io.quarkus.test.junit.QuarkusIntegrationTest; +import io.restassured.RestAssured; +import io.restassured.http.ContentType; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.startsWith; + +@QuarkusIntegrationTest +public class AutomaticRestEndpointIT { + + @Test + public void test() { + String payload = "{ \"eventData\": [{ \"type\": \"temperature\", \"value\" : 40 }] }"; + RestAssured.given() + .contentType(ContentType.JSON) + .accept(ContentType.JSON) + .body(payload) + .when() + .post("/warnings/first") + .then() + .statusCode(200) + .body("severity", is("warning")) + .body("message", startsWith("Event")); + } +} diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java b/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java index a51374ae81f..6e39dd215d6 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java +++ b/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java @@ -18,22 +18,19 @@ */ package org.drools.drl.quarkus.util.deployment; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; - +import io.quarkus.arc.deployment.GeneratedBeanBuildItem; +import io.quarkus.bootstrap.classloading.QuarkusClassLoader; +import io.quarkus.deployment.annotations.BuildProducer; +import io.quarkus.deployment.builditem.GeneratedResourceBuildItem; +import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; +import io.quarkus.maven.dependency.ResolvedDependency; +import io.quarkus.vertx.http.deployment.spi.AdditionalStaticResourceBuildItem; +import org.drools.base.util.Drools; import org.drools.codegen.common.AppPaths; import org.drools.codegen.common.DroolsModelBuildContext; import org.drools.codegen.common.GeneratedFile; import org.drools.codegen.common.GeneratedFileType; import org.drools.codegen.common.context.QuarkusDroolsModelBuildContext; -import org.drools.base.util.Drools; import org.drools.wiring.api.ComponentsSupplier; import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; @@ -44,12 +41,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.quarkus.arc.deployment.GeneratedBeanBuildItem; -import io.quarkus.deployment.annotations.BuildProducer; -import io.quarkus.deployment.builditem.GeneratedResourceBuildItem; -import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; -import io.quarkus.maven.dependency.ResolvedDependency; -import io.quarkus.vertx.http.deployment.spi.AdditionalStaticResourceBuildItem; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; import static org.drools.util.Config.getConfig; import static org.kie.memorycompiler.KieMemoryCompiler.compileNoLoad; @@ -92,7 +92,7 @@ public static DroolsModelBuildContext createDroolsBuildContext(Path outputTarget ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); DroolsModelBuildContext context = QuarkusDroolsModelBuildContext.builder() .withClassLoader(classLoader) - .withClassAvailabilityResolver(className -> classAvailabilityResolver(classLoader, index, className)) + .withClassAvailabilityResolver(className -> classAvailabilityResolver(index, className)) .withAppPaths(appPaths) .build(); @@ -101,12 +101,8 @@ public static DroolsModelBuildContext createDroolsBuildContext(Path outputTarget /** * Verify if a class is available. First uses jandex indexes, then fallback on classLoader - * - * @param classLoader - * @param className - * @return */ - private static boolean classAvailabilityResolver(ClassLoader classLoader, IndexView index, String className) { + private static boolean classAvailabilityResolver(IndexView index, String className) { if (index != null) { DotName classDotName = DotName.createSimple(className); boolean classFound = !index.getAnnotations(classDotName).isEmpty() || @@ -115,12 +111,8 @@ private static boolean classAvailabilityResolver(ClassLoader classLoader, IndexV return true; } } - try { - classLoader.loadClass(className); - return true; - } catch (ClassNotFoundException e) { - return false; - } + + return QuarkusClassLoader.isClassPresentAtRuntime(className); } public static void dumpFilesToDisk(AppPaths appPaths, Collection generatedFiles) { diff --git a/drools-model/drools-codegen-common/pom.xml b/drools-model/drools-codegen-common/pom.xml index b230f530523..19e95a2cdb6 100644 --- a/drools-model/drools-codegen-common/pom.xml +++ b/drools-model/drools-codegen-common/pom.xml @@ -39,4 +39,10 @@ org.drools.codegen.common + + + com.github.javaparser + javaparser-core + + \ No newline at end of file diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/DroolsModelBuildContext.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/DroolsModelBuildContext.java index 82612be3351..b3f4ffe37c6 100644 --- a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/DroolsModelBuildContext.java +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/DroolsModelBuildContext.java @@ -18,6 +18,9 @@ */ package org.drools.codegen.common; +import org.drools.codegen.common.di.DependencyInjectionAnnotator; +import org.drools.codegen.common.rest.RestAnnotator; + import java.io.File; import java.util.Collection; import java.util.Optional; @@ -45,6 +48,31 @@ public interface DroolsModelBuildContext { String name(); + DependencyInjectionAnnotator getDependencyInjectionAnnotator(); + + RestAnnotator getRestAnnotator(); + + boolean hasRest(); + + boolean hasDI(); + + default boolean hasJackson() { + return hasClassAvailable("com.fasterxml.jackson.core.JsonParser"); + } + + default boolean hasJacksonDatabind() { + return hasClassAvailable("com.fasterxml.jackson.databind.ObjectMapper"); + } + + default boolean hasClassAvailable(String fqcn) { + try { + getClassLoader().loadClass(fqcn); + return true; + } catch (ClassNotFoundException ex) { + return false; + } + } + interface Builder { Builder withPackageName(String packageName); diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/GeneratedFileType.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/GeneratedFileType.java index 9952a818693..8818f461f8e 100644 --- a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/GeneratedFileType.java +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/GeneratedFileType.java @@ -33,6 +33,13 @@ public interface GeneratedFileType { GeneratedFileType STATIC_HTTP_RESOURCE = of(Category.STATIC_HTTP_RESOURCE); GeneratedFileType COMPILED_CLASS = of(Category.COMPILED_CLASS); + GeneratedFileType RULE = of("RULE", Category.SOURCE); + + GeneratedFileType CONFIG = of("CONFIG", Category.SOURCE); + GeneratedFileType DECLARED_TYPE = of("DECLARED_TYPE", Category.SOURCE); + + GeneratedFileType REST = of("REST", Category.SOURCE, true, true); + String name(); Category category(); diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/AbstractDroolsModelBuildContext.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/AbstractDroolsModelBuildContext.java index 64aa3be22d3..65d28dec01b 100644 --- a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/AbstractDroolsModelBuildContext.java +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/AbstractDroolsModelBuildContext.java @@ -18,6 +18,15 @@ */ package org.drools.codegen.common.context; +import org.drools.codegen.common.AppPaths; +import org.drools.codegen.common.DroolsModelApplicationPropertyProvider; +import org.drools.codegen.common.DroolsModelBuildContext; +import org.drools.codegen.common.di.DependencyInjectionAnnotator; +import org.drools.codegen.common.rest.RestAnnotator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.lang.model.SourceVersion; import java.io.File; import java.io.FileReader; import java.io.IOException; @@ -30,13 +39,6 @@ import java.util.Optional; import java.util.Properties; import java.util.function.Predicate; -import javax.lang.model.SourceVersion; - -import org.drools.codegen.common.AppPaths; -import org.drools.codegen.common.DroolsModelApplicationPropertyProvider; -import org.drools.codegen.common.DroolsModelBuildContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public abstract class AbstractDroolsModelBuildContext implements DroolsModelBuildContext { @@ -51,9 +53,15 @@ public abstract class AbstractDroolsModelBuildContext implements DroolsModelBuil protected final String contextName; protected final Map contextAttributes; + protected final DependencyInjectionAnnotator dependencyInjectionAnnotator; + protected final RestAnnotator restAnnotator; protected AbstractDroolsModelBuildContext(AbstractBuilder builder, + DependencyInjectionAnnotator dependencyInjectionAnnotator, + RestAnnotator restAnnotator, String contextName) { + this.dependencyInjectionAnnotator = dependencyInjectionAnnotator; + this.restAnnotator = restAnnotator; this.packageName = builder.packageName; this.classAvailabilityResolver = builder.classAvailabilityResolver; this.applicationProperties = builder.applicationProperties; @@ -117,6 +125,16 @@ public AppPaths getAppPaths() { return appPaths; } + @Override + public DependencyInjectionAnnotator getDependencyInjectionAnnotator() { + return dependencyInjectionAnnotator; + } + + @Override + public RestAnnotator getRestAnnotator() { + return restAnnotator; + } + @Override public String toString() { return "KogitoBuildContext{" + diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/JavaDroolsModelBuildContext.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/JavaDroolsModelBuildContext.java index db6f1f433dd..5543a9c1cd4 100644 --- a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/JavaDroolsModelBuildContext.java +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/JavaDroolsModelBuildContext.java @@ -23,13 +23,23 @@ public class JavaDroolsModelBuildContext extends AbstractDroolsModelBuildContext public static final String CONTEXT_NAME = "Java"; protected JavaDroolsModelBuildContext(JavaKogitoBuildContextBuilder builder) { - super(builder, CONTEXT_NAME); + super(builder, null, null, CONTEXT_NAME); } public static Builder builder() { return new JavaKogitoBuildContextBuilder(); } + @Override + public boolean hasRest() { + return false; + } + + @Override + public boolean hasDI() { + return false; + } + protected static class JavaKogitoBuildContextBuilder extends AbstractBuilder { protected JavaKogitoBuildContextBuilder() { diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/QuarkusDroolsModelBuildContext.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/QuarkusDroolsModelBuildContext.java index 362f1deea54..9a4b9005f7b 100644 --- a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/QuarkusDroolsModelBuildContext.java +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/QuarkusDroolsModelBuildContext.java @@ -18,20 +18,38 @@ */ package org.drools.codegen.common.context; +import org.drools.codegen.common.di.impl.CDIDependencyInjectionAnnotator; +import org.drools.codegen.common.rest.impl.CDIRestAnnotator; + public class QuarkusDroolsModelBuildContext extends AbstractDroolsModelBuildContext { public static final String CONTEXT_NAME = "Quarkus"; public static final String QUARKUS_REST = "javax.ws.rs.Path"; public static final String QUARKUS_DI = "javax.inject.Inject"; + public final boolean hasRest; + public final boolean hasDI; + protected QuarkusDroolsModelBuildContext(QuarkusKogitoBuildContextBuilder builder) { - super(builder, /*new CDIDependencyInjectionAnnotator(), new CDIRestAnnotator(), */ CONTEXT_NAME); + super(builder, new CDIDependencyInjectionAnnotator(), new CDIRestAnnotator(), CONTEXT_NAME); + this.hasRest = hasClassAvailable(QUARKUS_REST); + this.hasDI = hasClassAvailable(QUARKUS_DI); } public static Builder builder() { return new QuarkusKogitoBuildContextBuilder(); } + @Override + public boolean hasRest() { + return hasRest; + } + + @Override + public boolean hasDI() { + return hasDI; + } + protected static class QuarkusKogitoBuildContextBuilder extends AbstractBuilder { protected QuarkusKogitoBuildContextBuilder() { diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/SpringBootDroolsModelBuildContext.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/SpringBootDroolsModelBuildContext.java index f81f63ad415..d3e4b5709b5 100644 --- a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/SpringBootDroolsModelBuildContext.java +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/SpringBootDroolsModelBuildContext.java @@ -18,20 +18,38 @@ */ package org.drools.codegen.common.context; +import org.drools.codegen.common.di.impl.SpringDependencyInjectionAnnotator; +import org.drools.codegen.common.rest.impl.SpringRestAnnotator; + public class SpringBootDroolsModelBuildContext extends AbstractDroolsModelBuildContext { public static final String CONTEXT_NAME = "Spring"; public static final String SPRING_REST = "org.springframework.web.bind.annotation.RestController"; public static final String SPRING_DI = "org.springframework.beans.factory.annotation.Autowired"; + public final boolean hasRest; + public final boolean hasDI; + protected SpringBootDroolsModelBuildContext(SpringBootKogitoBuildContextBuilder builder) { - super(builder, /* new SpringDependencyInjectionAnnotator(), new SpringRestAnnotator(),*/ CONTEXT_NAME); + super(builder, new SpringDependencyInjectionAnnotator(), new SpringRestAnnotator(), CONTEXT_NAME); + this.hasRest = hasClassAvailable(SPRING_REST); + this.hasDI = hasClassAvailable(SPRING_DI); } public static Builder builder() { return new SpringBootKogitoBuildContextBuilder(); } + @Override + public boolean hasRest() { + return hasRest; + } + + @Override + public boolean hasDI() { + return hasDI; + } + protected static class SpringBootKogitoBuildContextBuilder extends AbstractBuilder { protected SpringBootKogitoBuildContextBuilder() { diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/di/DependencyInjectionAnnotator.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/di/DependencyInjectionAnnotator.java new file mode 100644 index 00000000000..e31288ebea4 --- /dev/null +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/di/DependencyInjectionAnnotator.java @@ -0,0 +1,270 @@ +/* + * 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.codegen.common.di; + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.expr.ArrayInitializerExpr; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.MemberValuePair; +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.expr.Name; +import com.github.javaparser.ast.expr.NameExpr; +import com.github.javaparser.ast.expr.SingleMemberAnnotationExpr; +import com.github.javaparser.ast.expr.StringLiteralExpr; +import com.github.javaparser.ast.nodeTypes.NodeWithAnnotations; + +import java.util.ArrayList; +import java.util.List; + +/** + * Generic abstraction for dependency injection annotations that allow to + * use different frameworks based needs. + *

+ * Currently in scope + * + *

    + *
  • CDI
  • + *
  • Spring
  • + *
+ */ +public interface DependencyInjectionAnnotator { + + /** + * Annotates the given node with an annotation to produce a DI instance of the node target class, e.g. Produces, + * Bean. This is used by configuration classes in the DI, like a factory method. + * + * @param node + * @param isDefault indicates if the bean instance is created only if there are not any other bean of this type + * already declared in the application, e.g DefaultBean + */ + > T withProduces(T node, boolean isDefault); + + /** + * Annotates given node with name annotation e.g. Named, Qualifier + * + * @param node node to be annotated + */ + > T withNamed(T node, String name); + + /** + * Annotates given node with application level annotations e.g. ApplicationScoped, Component + * + * @param node node to be annotated + */ + > T withApplicationComponent(T node); + + /** + * Annotates given node with application level annotations e.g. ApplicationScoped, Component + * additionally adding name to it + * + * @param node node to be annotated + * @param name name to be assigned to given node + */ + > T withNamedApplicationComponent(T node, String name); + + /** + * Annotates given node with singleton level annotations e.g. Singleton, Component + * + * @param node node to be annotated + */ + > T withSingletonComponent(T node); + + /** + * Annotates given node with singleton level annotations e.g. Singleton, Component + * additionally adding name to it + * + * @param node node to be annotated + * @param name name to be assigned to given node + */ + > T withNamedSingletonComponent(T node, String name); + + /** + * Annotates given node with injection annotations e.g. Inject, Autowire + * + * @param node node to be annotated + * @boolean forceLazyInit use lazy initialization (for those container that applies) + */ + > T withInjection(T node, boolean forceLazyInit); + + /** + * Annotates given node with injection annotations e.g. Inject, Autowire + * + * @param node node to be annotated + */ + default > T withInjection(T node) { + return withInjection(node, false); + } + + /** + * Annotates given node with injection annotations e.g. Inject, Autowire + * additionally adding name to it + * + * @param node node to be annotated + * @param name name to be assigned to given node + */ + > T withNamedInjection(T node, String name); + + /** + * Annotates given node with optional injection annotations e.g. Inject, Autowire + * + * @param node node to be annotated + */ + > T withOptionalInjection(T node); + + /** + * Annotates given node with incoming message that it should consume from + * + * @param node node to be annotated + * @param channel name of the channel messages should be consumer from + */ + > T withIncomingMessage(T node, String channel); + + /** + * Annotates given node with outgoing message that it should send to + * + * @param node node to be annotated + * @param channel name of the channel messages should be send to + */ + > T withOutgoingMessage(T node, String channel); + + /** + * Annotates given node with configuration parameter injection + * + * @param node node to be annotated + * @param configKey name of the configuration property to be injected + */ + > T withConfigInjection(T node, String configKey); + + /** + * Annotates given node with configuration parameter injection with default value + * + * @param node node to be annotated + * @param configKey name of the configuration property to be injected + * @param defaultValue value to be used in case there is no config parameter defined + */ + > T withConfigInjection(T node, String configKey, String defaultValue); + + /** + * Annotates and enhances method used to produce messages + * + * @param produceMethod method to be annotated + * @param channel channel on which messages should be produced + * @param event actual data to be send + */ + MethodCallExpr withMessageProducer(MethodCallExpr produceMethod, String channel, Expression event); + + /** + * Annotates given node with set of roles to enforce security + * + * @param node node to be annotated + * @param roles roles that are allowed + */ + default > T withSecurityRoles(T node, String[] roles) { + if (roles != null && roles.length > 0) { + List rolesExpr = new ArrayList<>(); + + for (String role : roles) { + rolesExpr.add(new StringLiteralExpr(role.trim())); + } + + node.addAnnotation(new SingleMemberAnnotationExpr(new Name("javax.annotation.security.RolesAllowed"), new ArrayInitializerExpr(NodeList.nodeList(rolesExpr)))); + } + return node; + } + + /** + * Returns type that allows to inject optional instances of the same type + * + * @return fully qualified class name + */ + String optionalInstanceInjectionType(); + + /** + * Creates an expression that represents optional instance for given field + * + * @param fieldName name of the field that should be considered optional + * @return complete expression for optional instance + */ + Expression optionalInstanceExists(String fieldName); + + /** + * Creates an expression that returns instance for given optional field + * + * @param fieldName name of the optional field that should be accessed + * @return complete expression for optional instance + */ + default Expression getOptionalInstance(String fieldName) { + return new MethodCallExpr(new NameExpr(fieldName), "get"); + } + + /** + * Returns type that allows to inject multiple instances of the same type + * + * @return fully qualified class name + */ + String multiInstanceInjectionType(); + + /** + * Creates an expression that returns a list of instances for given multi instance field + * + * @param fieldName name of the multi field that should be accessed + * @return complete expression for multi instance + */ + Expression getMultiInstance(String fieldName); + + /** + * Returns type that allows to mark instance as application component e.g. ApplicationScoped, Component + * + * @return fully qualified class name + */ + String applicationComponentType(); + + /** + * Returns type to be used as message emitter + * + * @param dataType type of the data produces by the emitter + * @return fully qualified class name + */ + String emitterType(String dataType); + + /** + * Annotates given node with a initializing annotation e.g. Startup + * + * @param node node to be annotated + */ + > T withEagerStartup(T node); + + /** + * Annotates given node with factory class annotations e.g. Configuration for Spring Boot + * + * @param node node to be annotated + */ + > T withFactoryClass(T node); + + /** + * Annotates given node with factory method annotations e.g. Produces, Bean + * + * @param node node to be annotated + */ + > T withFactoryMethod(T node); + + default > T withTagAnnotation(T node, NodeList attributes) { + return node; + } +} diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/di/impl/CDIDependencyInjectionAnnotator.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/di/impl/CDIDependencyInjectionAnnotator.java new file mode 100644 index 00000000000..47e33bd14cb --- /dev/null +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/di/impl/CDIDependencyInjectionAnnotator.java @@ -0,0 +1,186 @@ +/* + * 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.codegen.common.di.impl; + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.expr.BinaryExpr; +import com.github.javaparser.ast.expr.BooleanLiteralExpr; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.MemberValuePair; +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.expr.Name; +import com.github.javaparser.ast.expr.NameExpr; +import com.github.javaparser.ast.expr.NormalAnnotationExpr; +import com.github.javaparser.ast.expr.SingleMemberAnnotationExpr; +import com.github.javaparser.ast.expr.StringLiteralExpr; +import com.github.javaparser.ast.nodeTypes.NodeWithAnnotations; +import org.drools.codegen.common.di.DependencyInjectionAnnotator; + +public class CDIDependencyInjectionAnnotator implements DependencyInjectionAnnotator { + + @Override + public > T withProduces(T node, boolean isDefault) { + node.addAndGetAnnotation("javax.enterprise.inject.Produces"); + if (isDefault) { + node.addAndGetAnnotation("io.quarkus.arc.DefaultBean"); + } + return node; + } + + @Override + public > T withNamed(T node, String name) { + node.addAnnotation(new SingleMemberAnnotationExpr(new Name("javax.inject.Named"), new StringLiteralExpr(name))); + return node; + } + + @Override + public > T withApplicationComponent(T node) { + node.addAnnotation("javax.enterprise.context.ApplicationScoped"); + return node; + } + + @Override + public > T withNamedApplicationComponent(T node, String name) { + return withNamed(withApplicationComponent(node), name); + } + + @Override + public > T withSingletonComponent(T node) { + node.addAnnotation("javax.inject.Singleton"); + return node; + } + + @Override + public > T withNamedSingletonComponent(T node, String name) { + return withNamed(withSingletonComponent(node), name); + } + + @Override + public > T withInjection(T node, boolean lazy) { + node.addAnnotation("javax.inject.Inject"); + return node; + } + + @Override + public > T withNamedInjection(T node, String name) { + return withNamed(withInjection(node), name); + } + + @Override + public > T withOptionalInjection(T node) { + return withInjection(node); + } + + @Override + public > T withIncomingMessage(T node, String channel) { + node.addAnnotation(new SingleMemberAnnotationExpr(new Name("org.eclipse.microprofile.reactive.messaging.Incoming"), new StringLiteralExpr(channel))); + return node; + } + + @Override + public > T withOutgoingMessage(T node, String channel) { + node.addAnnotation(new SingleMemberAnnotationExpr(new Name("org.eclipse.microprofile.reactive.messaging.Channel"), new StringLiteralExpr(channel))); + return node; + } + + @Override + public MethodCallExpr withMessageProducer(MethodCallExpr produceMethod, String channel, Expression event) { + produceMethod.addArgument(event); + return produceMethod; + } + + @Override + public String optionalInstanceInjectionType() { + return "javax.enterprise.inject.Instance"; + } + + @Override + public Expression optionalInstanceExists(String fieldName) { + MethodCallExpr condition = new MethodCallExpr(new NameExpr(fieldName), "isUnsatisfied"); + return new BinaryExpr(condition, new BooleanLiteralExpr(false), BinaryExpr.Operator.EQUALS); + } + + @Override + public String multiInstanceInjectionType() { + return optionalInstanceInjectionType(); + } + + @Override + public Expression getMultiInstance(String fieldName) { + return new MethodCallExpr( + new MethodCallExpr(new NameExpr("java.util.stream.StreamSupport"), "stream", NodeList.nodeList( + new MethodCallExpr(new NameExpr(fieldName), "spliterator"), + new BooleanLiteralExpr(false))), + "collect", + NodeList.nodeList( + new MethodCallExpr(new NameExpr("java.util.stream.Collectors"), "toList"))); + } + + @Override + public String applicationComponentType() { + return "javax.enterprise.context.ApplicationScoped"; + } + + @Override + public String emitterType(String dataType) { + return "org.eclipse.microprofile.reactive.messaging.Emitter<" + dataType + ">"; + } + + @Override + public > T withConfigInjection(T node, String configKey) { + node.addAnnotation(new NormalAnnotationExpr( + new Name("org.eclipse.microprofile.config.inject.ConfigProperty"), + NodeList.nodeList( + new MemberValuePair("name", new StringLiteralExpr(configKey))))); + return node; + } + + @Override + public > T withConfigInjection(T node, String configKey, String defaultValue) { + node.addAnnotation(new NormalAnnotationExpr( + new Name("org.eclipse.microprofile.config.inject.ConfigProperty"), + NodeList.nodeList( + new MemberValuePair("name", new StringLiteralExpr(configKey)), + new MemberValuePair("defaultValue", new StringLiteralExpr(defaultValue))))); + return node; + } + + @Override + public > T withEagerStartup(T node) { + node.addAnnotation("io.quarkus.runtime.Startup"); + return node; + } + + @Override + public > T withFactoryClass(T node) { + return node; + } + + @Override + public > T withFactoryMethod(T node) { + node.addAnnotation("javax.enterprise.inject.Produces"); + return node; + } + + @Override + public > T withTagAnnotation(T node, NodeList attributes) { + node.addAnnotation(new NormalAnnotationExpr(new Name("org.eclipse.microprofile.openapi.annotations.tags.Tag"), attributes)); + return node; + } +} diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/di/impl/SpringDependencyInjectionAnnotator.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/di/impl/SpringDependencyInjectionAnnotator.java new file mode 100644 index 00000000000..d9a5edf7f52 --- /dev/null +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/di/impl/SpringDependencyInjectionAnnotator.java @@ -0,0 +1,189 @@ +/* + * 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.codegen.common.di.impl; + +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.expr.BinaryExpr; +import com.github.javaparser.ast.expr.BooleanLiteralExpr; +import com.github.javaparser.ast.expr.ConditionalExpr; +import com.github.javaparser.ast.expr.Expression; +import com.github.javaparser.ast.expr.MemberValuePair; +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.expr.Name; +import com.github.javaparser.ast.expr.NameExpr; +import com.github.javaparser.ast.expr.NormalAnnotationExpr; +import com.github.javaparser.ast.expr.NullLiteralExpr; +import com.github.javaparser.ast.expr.SingleMemberAnnotationExpr; +import com.github.javaparser.ast.expr.StringLiteralExpr; +import com.github.javaparser.ast.expr.TypeExpr; +import com.github.javaparser.ast.nodeTypes.NodeWithAnnotations; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import org.drools.codegen.common.di.DependencyInjectionAnnotator; + +import java.util.Collection; +import java.util.Collections; +import java.util.Optional; + +public class SpringDependencyInjectionAnnotator implements DependencyInjectionAnnotator { + + @Override + public > T withProduces(T node, boolean isDefault) { + node.addAnnotation("org.springframework.context.annotation.Bean"); + if (isDefault) { + node.addAnnotation("org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean"); + } + return node; + } + + @Override + public > T withNamed(T node, String name) { + node.addAnnotation(new SingleMemberAnnotationExpr(new Name("org.springframework.beans.factory.annotation.Qualifier"), new StringLiteralExpr(name))); + return node; + } + + @Override + public > T withApplicationComponent(T node) { + node.addAnnotation("org.springframework.stereotype.Component"); + return node; + } + + @Override + public > T withNamedApplicationComponent(T node, String name) { + node.addAnnotation(new SingleMemberAnnotationExpr(new Name("org.springframework.stereotype.Component"), new StringLiteralExpr(name))); + return node; + } + + @Override + public > T withSingletonComponent(T node) { + return withApplicationComponent(node); + } + + @Override + public > T withNamedSingletonComponent(T node, String name) { + return withNamedApplicationComponent(node, name); + } + + @Override + public > T withInjection(T node, boolean lazy) { + node.addAnnotation("org.springframework.beans.factory.annotation.Autowired"); + if (lazy) { + node.addAnnotation("org.springframework.context.annotation.Lazy"); + } + return node; + } + + @Override + public > T withNamedInjection(T node, String name) { + return withNamed(withInjection(node), name); + } + + @Override + public > T withOptionalInjection(T node) { + node.addAnnotation( + new NormalAnnotationExpr(new Name("org.springframework.beans.factory.annotation.Autowired"), NodeList.nodeList(new MemberValuePair("required", new BooleanLiteralExpr(false))))); + node.addAnnotation("org.springframework.context.annotation.Lazy"); + return node; + } + + @Override + public > T withIncomingMessage(T node, String channel) { + node.addAnnotation(new NormalAnnotationExpr(new Name("org.springframework.kafka.annotation.KafkaListener"), NodeList.nodeList(new MemberValuePair("topics", new StringLiteralExpr(channel))))); + return node; + } + + @Override + public > T withOutgoingMessage(T node, String channel) { + // currently no-op + return node; + } + + @Override + public MethodCallExpr withMessageProducer(MethodCallExpr produceMethod, String channel, Expression event) { + produceMethod.addArgument(new StringLiteralExpr(channel)).addArgument(event); + return produceMethod; + } + + @Override + public String optionalInstanceInjectionType() { + return Optional.class.getCanonicalName(); + } + + @Override + public Expression optionalInstanceExists(String fieldName) { + return new MethodCallExpr(new NameExpr(fieldName), "isPresent"); + } + + @Override + public String multiInstanceInjectionType() { + return Collection.class.getCanonicalName(); + } + + @Override + public Expression getMultiInstance(String fieldName) { + return new ConditionalExpr( + new BinaryExpr(new NameExpr(fieldName), new NullLiteralExpr(), BinaryExpr.Operator.NOT_EQUALS), + new NameExpr(fieldName), + new MethodCallExpr(new TypeExpr(new ClassOrInterfaceType(null, Collections.class.getCanonicalName())), "emptyList")); + } + + @Override + public String applicationComponentType() { + return "org.springframework.stereotype.Component"; + } + + @Override + public String emitterType(String dataType) { + return "org.springframework.kafka.core.KafkaTemplate"; + } + + @Override + public > T withConfigInjection(T node, String configKey) { + node.addAnnotation(new SingleMemberAnnotationExpr(new Name("org.springframework.beans.factory.annotation.Value"), new StringLiteralExpr("${" + configKey + ":#{null}}"))); + return node; + } + + @Override + public > T withConfigInjection(T node, String configKey, String defaultValue) { + node.addAnnotation(new SingleMemberAnnotationExpr(new Name("org.springframework.beans.factory.annotation.Value"), new StringLiteralExpr("${" + configKey + ":" + defaultValue + "}"))); + return node; + } + + /** + * no-op, Spring beans are not lazy by default. + * + * @param node node to be annotated + * @return + */ + @Override + public > T withEagerStartup(T node) { + return node; + } + + @Override + public > T withFactoryClass(T node) { + node.addAnnotation("org.springframework.context.annotation.Configuration"); + return node; + } + + @Override + public > T withFactoryMethod(T node) { + node.addAnnotation("org.springframework.context.annotation.Bean"); + return node; + } +} diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/rest/RestAnnotator.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/rest/RestAnnotator.java new file mode 100644 index 00000000000..e5886fb3418 --- /dev/null +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/rest/RestAnnotator.java @@ -0,0 +1,29 @@ +/* + * 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.codegen.common.rest; + +import com.github.javaparser.ast.nodeTypes.NodeWithAnnotations; + +import java.util.Optional; + +public interface RestAnnotator { + > boolean isRestAnnotated(T node); + + > Optional getEndpointValue(T node); +} diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/rest/impl/CDIRestAnnotator.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/rest/impl/CDIRestAnnotator.java new file mode 100644 index 00000000000..600eff5f833 --- /dev/null +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/rest/impl/CDIRestAnnotator.java @@ -0,0 +1,42 @@ +/* + * 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.codegen.common.rest.impl; + +import com.github.javaparser.ast.expr.AnnotationExpr; +import com.github.javaparser.ast.nodeTypes.NodeWithAnnotations; +import org.drools.codegen.common.rest.RestAnnotator; + +import java.util.Optional; +import java.util.stream.Stream; + +public class CDIRestAnnotator implements RestAnnotator { + + @Override + public > boolean isRestAnnotated(T node) { + return Stream.of("POST", "GET", "PUT", "DELETE") + .map(node::getAnnotationByName) + .anyMatch(Optional::isPresent); + } + + @Override + public > Optional getEndpointValue(T node) { + Optional path = node.getAnnotationByName("Path"); + return path.map(annotationExpr -> annotationExpr.asSingleMemberAnnotationExpr().getMemberValue().asStringLiteralExpr().asString()); + } +} diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/rest/impl/SpringRestAnnotator.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/rest/impl/SpringRestAnnotator.java new file mode 100644 index 00000000000..1258b4d9d5c --- /dev/null +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/rest/impl/SpringRestAnnotator.java @@ -0,0 +1,47 @@ +/* + * 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.codegen.common.rest.impl; + +import com.github.javaparser.ast.expr.AnnotationExpr; +import com.github.javaparser.ast.nodeTypes.NodeWithAnnotations; +import org.drools.codegen.common.rest.RestAnnotator; + +import java.util.Optional; +import java.util.stream.Stream; + +public class SpringRestAnnotator implements RestAnnotator { + + @Override + public > boolean isRestAnnotated(T node) { + return Stream.of("PostMapping", "GetMapping", "PutMapping", "DeleteMapping") + .map(node::getAnnotationByName) + .anyMatch(Optional::isPresent); + } + + @Override + public > Optional getEndpointValue(T node) { + Optional path = node.getAnnotationByName("PostMapping"); + return path + .flatMap(p -> p.asNormalAnnotationExpr() + .getPairs() + .stream() + .filter(x -> "value".equals(x.getName().asString())).findFirst()) + .map(value -> value.getValue().asStringLiteralExpr().asString()); + } +} diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/GeneratedFile.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/GeneratedFile.java deleted file mode 100644 index 9090214c731..00000000000 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/GeneratedFile.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.drools.model.codegen.execmodel; - -import java.nio.charset.StandardCharsets; -import java.util.Objects; - -import org.drools.util.PortablePath; - -public class GeneratedFile { - - public enum Type { - APPLICATION, - PROCESS, - PROCESS_INSTANCE, - REST, - RULE, - DECLARED_TYPE, - QUERY, - MODEL, - CLASS, - MESSAGE_CONSUMER, - MESSAGE_PRODUCER, - PMML; - } - - private final PortablePath path; - private final byte[] data; - private final Type type; - - public GeneratedFile(String path, String data) { - this(Type.RULE, path, data); - } - - public GeneratedFile(String path, byte[] data) { - this(Type.RULE, path, data); - } - - public GeneratedFile(Type type, String path, String data) { - this(type, path, data.getBytes(StandardCharsets.UTF_8)); - } - - private GeneratedFile(Type type, String path, byte[] data) { - this.type = type; - this.path = PortablePath.of(path); - this.data = data; - } - - public byte[] getData() { - return data; - } - - public String getPath() { - return path.asString(); - } - - public PortablePath getKiePath() { - return path; - } - - public Type getType() { - return type; - } - - @Override - public String toString() { - return "GeneratedFile{" + - "path='" + path.asString() + '\'' + - '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GeneratedFile that = (GeneratedFile) o; - return path.equals(that.path); - } - - @Override - public int hashCode() { - return Objects.hash(path); - } -} diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/ModelWriter.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/ModelWriter.java index af46901cd68..44676d24993 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/ModelWriter.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/ModelWriter.java @@ -18,17 +18,18 @@ */ package org.drools.model.codegen.execmodel; +import org.drools.base.util.Drools; +import org.drools.codegen.common.GeneratedFile; +import org.drools.compiler.compiler.io.memory.MemoryFileSystem; +import org.drools.util.PortablePath; +import org.kie.api.builder.ReleaseId; + import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; import java.util.stream.Collectors; -import org.drools.compiler.compiler.io.memory.MemoryFileSystem; -import org.drools.base.util.Drools; -import org.kie.api.builder.ReleaseId; -import org.drools.util.PortablePath; - import static org.drools.modelcompiler.CanonicalKieModule.MODEL_VERSION; import static org.drools.modelcompiler.CanonicalKieModule.RULE_UNIT_SERVICES_FILE; import static org.drools.modelcompiler.CanonicalKieModule.getGeneratedClassNamesFile; @@ -59,9 +60,9 @@ public Result writeModel(MemoryFileSystem srcMfs, Collection pac List sourceFiles = new ArrayList<>(); for (GeneratedFile generatedFile : generatedFiles) { - PortablePath path = basePath.resolve(generatedFile.getKiePath()); + PortablePath path = basePath.resolve(generatedFile.relativePath()); sourceFiles.add(path.asString()); - srcMfs.write(path, generatedFile.getData()); + srcMfs.write(path, generatedFile.contents()); } return new Result(sourceFiles, modelFiles, ruleUnitClassNames); 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 0f5a065330d..530da853b3f 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 @@ -18,21 +18,6 @@ */ package org.drools.model.codegen.execmodel; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - import com.github.javaparser.StaticJavaParser; import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.ImportDeclaration; @@ -59,6 +44,8 @@ import com.github.javaparser.ast.stmt.ReturnStmt; import com.github.javaparser.ast.type.ClassOrInterfaceType; import com.github.javaparser.ast.type.Type; +import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.base.factmodel.ClassDefinition; import org.drools.codegen.common.DroolsModelBuildContext; import org.drools.compiler.builder.impl.BuildResultCollector; import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; @@ -67,8 +54,6 @@ import org.drools.compiler.builder.impl.TypeDeclarationUtils; import org.drools.compiler.compiler.DialectCompiletimeRegistry; import org.drools.compiler.compiler.PackageRegistry; -import org.drools.base.definitions.InternalKnowledgePackage; -import org.drools.base.factmodel.ClassDefinition; import org.drools.drl.ast.descr.EntryPointDeclarationDescr; import org.drools.drl.ast.descr.PackageDescr; import org.drools.model.DomainClassMetadata; @@ -96,6 +81,21 @@ import org.kie.internal.ruleunit.RuleUnitDescription; import org.kie.internal.ruleunit.RuleUnitVariable; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; + import static com.github.javaparser.StaticJavaParser.parseBodyDeclaration; import static com.github.javaparser.ast.Modifier.finalModifier; import static com.github.javaparser.ast.Modifier.publicModifier; @@ -468,6 +468,10 @@ public void addRuleUnits(Collection ruleUnitDescriptions) { this.ruleUnits.addAll(ruleUnitDescriptions); } + public boolean hasRuleUnits() { + return !ruleUnits.isEmpty(); + } + public Collection getRuleUnits() { return ruleUnits; } diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/PackageSources.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/PackageSources.java index 13c912e325b..522ca02beb2 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/PackageSources.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/PackageSources.java @@ -18,13 +18,15 @@ */ package org.drools.model.codegen.execmodel; +import org.drools.codegen.common.GeneratedFile; +import org.drools.codegen.common.GeneratedFileType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - public class PackageSources { private static final Logger logger = LoggerFactory.getLogger(PackageSources.class); @@ -38,7 +40,7 @@ public class PackageSources { protected GeneratedFile domainClassSource; private Collection modelNames; - private Collection ruleUnitClassNames = new ArrayList<>(); + private final Collection ruleUnitClassNames = new ArrayList<>(); protected Collection executableRulesClasses; @@ -47,7 +49,7 @@ public static PackageSources dumpSources(PackageModel pkgModel) { PackageModelWriter packageModelWriter = new PackageModelWriter(pkgModel); for (DeclaredTypeWriter declaredType : packageModelWriter.getDeclaredTypes()) { - sources.pojoSources.add(new GeneratedFile( GeneratedFile.Type.DECLARED_TYPE, declaredType.getName(), logSource( declaredType.getSource() ))); + sources.pojoSources.add(new GeneratedFile( GeneratedFileType.DECLARED_TYPE, declaredType.getName(), logSource( declaredType.getSource() ))); } RuleWriter rules = writeRules( pkgModel, sources, packageModelWriter ); @@ -58,30 +60,33 @@ public static PackageSources dumpSources(PackageModel pkgModel) { protected static RuleWriter writeRules( PackageModel pkgModel, PackageSources sources, PackageModelWriter packageModelWriter ) { for (AccumulateClassWriter accumulateClassWriter : packageModelWriter.getAccumulateClasses()) { - sources.accumulateSources.add(new GeneratedFile(accumulateClassWriter.getName(), logSource( accumulateClassWriter.getSource() ))); + sources.accumulateSources.add(new GeneratedFile( GeneratedFileType.RULE, accumulateClassWriter.getName(), logSource( accumulateClassWriter.getSource() ))); } RuleWriter rules = packageModelWriter.getRules(); - sources.mainSource = new GeneratedFile(rules.getName(), logSource( rules.getMainSource() )); + sources.mainSource = new GeneratedFile( GeneratedFileType.RULE, rules.getName(), logSource( rules.getMainSource() )); for (RuleWriter.RuleFileSource ruleSource : rules.getRuleSources()) { - sources.ruleSources.add(new GeneratedFile(ruleSource.getName(), logSource( ruleSource.getSource() ))); + sources.ruleSources.add(new GeneratedFile( GeneratedFileType.RULE, ruleSource.getName(), logSource( ruleSource.getSource() ))); } for (RuleUnitWriter ruleUnitWriter : packageModelWriter.getRuleUnitWriters()) { - sources.ruleSources.add(new GeneratedFile(ruleUnitWriter.getUnitName(), logSource( ruleUnitWriter.getUnitSource() ))); - sources.ruleSources.add(new GeneratedFile(ruleUnitWriter.getInstanceName(), logSource( ruleUnitWriter.getInstanceSource() ))); + sources.ruleSources.addAll(ruleUnitWriter.generate()); sources.ruleUnitClassNames.add( ruleUnitWriter.getRuleUnitClassName() ); } + if (pkgModel.hasRuleUnits() && pkgModel.getContext() != null && pkgModel.getContext().hasRest() && pkgModel.getContext().hasJacksonDatabind()) { + sources.ruleSources.add(new RuleObjectMapperWriter(pkgModel.getContext()).generate()); + } + pkgModel.getLambdaClasses() .values() .stream() - .map(gc -> new GeneratedFile(gc.getClassNamePath(), logSource(gc.getContents()))) + .map(gc -> new GeneratedFile(GeneratedFileType.RULE, gc.getClassNamePath(), logSource(gc.getContents()))) .forEach(sources.lambdaClasses::add); PackageModelWriter.DomainClassesMetadata domainClassesMetadata = packageModelWriter.getDomainClassesMetadata(); - sources.domainClassSource = new GeneratedFile(domainClassesMetadata.getName(), logSource( domainClassesMetadata.getSource() )); + sources.domainClassSource = new GeneratedFile(GeneratedFileType.RULE, domainClassesMetadata.getName(), logSource( domainClassesMetadata.getSource() )); return rules; } diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleObjectMapperWriter.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleObjectMapperWriter.java new file mode 100644 index 00000000000..eb12b979068 --- /dev/null +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleObjectMapperWriter.java @@ -0,0 +1,45 @@ +/* + * 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.model.codegen.execmodel; + +import org.drools.codegen.common.DroolsModelBuildContext; +import org.drools.codegen.common.GeneratedFile; +import org.drools.codegen.common.GeneratedFileType; +import org.drools.model.codegen.project.template.TemplatedGenerator; + +import static org.drools.model.codegen.execmodel.RuleUnitWriter.TEMPLATE_RULE_UNITS_FOLDER; + +public class RuleObjectMapperWriter { + + private final DroolsModelBuildContext context; + + public RuleObjectMapperWriter(DroolsModelBuildContext context) { + this.context = context; + } + + GeneratedFile generate() { + TemplatedGenerator generator = TemplatedGenerator.builder() + .withTemplateBasePath(TEMPLATE_RULE_UNITS_FOLDER) + .build(context, "RestObjectMapper"); + + return new GeneratedFile(GeneratedFileType.RULE, + generator.generatedFilePath(), + generator.compilationUnitOrThrow().toString()); + } +} diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitQueryEndpointWriter.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitQueryEndpointWriter.java new file mode 100644 index 00000000000..2e777153f91 --- /dev/null +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitQueryEndpointWriter.java @@ -0,0 +1,201 @@ +/* + * 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.model.codegen.execmodel; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.ConstructorDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.expr.NameExpr; +import com.github.javaparser.ast.expr.StringLiteralExpr; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.CatchClause; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.stmt.ThrowStmt; +import com.github.javaparser.ast.stmt.TryStmt; +import com.github.javaparser.ast.type.Type; +import org.drools.codegen.common.context.JavaDroolsModelBuildContext; +import org.drools.model.codegen.execmodel.util.BodyDeclarationComparator; +import org.drools.model.codegen.project.template.TemplatedGenerator; +import org.kie.internal.ruleunit.RuleUnitDescription; + +import java.util.Map; +import java.util.NoSuchElementException; + +import static com.github.javaparser.StaticJavaParser.parseStatement; +import static org.drools.model.codegen.execmodel.RuleUnitWriter.TEMPLATE_RULE_UNITS_FOLDER; +import static org.drools.model.codegen.execmodel.util.RuleCodegenUtils.setGeneric; +import static org.drools.model.codegen.execmodel.util.RuleCodegenUtils.toKebabCase; +import static org.drools.model.codegen.execmodel.util.RuleCodegenUtils.toNonPrimitiveType; + +public class RuleUnitQueryEndpointWriter { + + private final TemplatedGenerator.Builder templateBuilder; + + private final PackageModel pkgModel; + + private final RuleUnitDescription ruleUnit; + private final RuleUnitQueryWriter query; + + private final String queryName; + private final String queryClassName; + private final String targetClassName; + + private final String endpointName; + + public RuleUnitQueryEndpointWriter(PackageModel pkgModel, RuleUnitQueryWriter query) { + this.ruleUnit = query.ruleUnit(); + this.pkgModel = pkgModel; + this.query = query; + + this.queryName = query.name(); + this.queryClassName = ruleUnit.getSimpleName() + "Query" + queryName; + this.targetClassName = queryClassName + "Endpoint"; + + this.templateBuilder = TemplatedGenerator.builder() + .withPackageName(query.model().getNamespace()) + .withTemplateBasePath(TEMPLATE_RULE_UNITS_FOLDER) + .withTargetTypeName(targetClassName) + .withFallbackContext(JavaDroolsModelBuildContext.CONTEXT_NAME); + this.endpointName = toKebabCase(queryName); + } + + public String generatedFilePath() { + String targetCanonicalName = this.pkgModel.getName() + "." + this.targetClassName; + return targetCanonicalName.replace('.', '/') + ".java"; + } + + public String getEndpointSource() { + CompilationUnit cu = templateBuilder.build(pkgModel.getContext(), "RestQuery").compilationUnitOrThrow("Could not create CompilationUnit"); + cu.setPackageDeclaration(query.model().getNamespace()); + + ClassOrInterfaceDeclaration clazz = cu + .findFirst(ClassOrInterfaceDeclaration.class) + .orElseThrow(() -> new NoSuchElementException("Compilation unit doesn't contain a class or interface declaration!")); + clazz.setName(targetClassName); + + cu.findAll(StringLiteralExpr.class).forEach(this::interpolateStrings); + + FieldDeclaration ruleUnitDeclaration = clazz + .getFieldByName("ruleUnit") + .orElseThrow(() -> new NoSuchElementException("ClassOrInterfaceDeclaration doesn't contain a field named ruleUnit!")); + setUnitGeneric(ruleUnitDeclaration.getElementType()); + + String returnType = getReturnType(); + generateConstructors(clazz); + generateQueryMethods(cu, clazz, returnType); + clazz.getMembers().sort(BodyDeclarationComparator.INSTANCE); + + return cu.toString(); + } + + public String getEndpointName() { + return endpointName; + } + + private void generateConstructors(ClassOrInterfaceDeclaration clazz) { + for (ConstructorDeclaration c : clazz.getConstructors()) { + c.setName(targetClassName); + if (!c.getParameters().isEmpty()) { + setUnitGeneric(c.getParameter(0).getType()); + } + } + } + + private void generateQueryMethods(CompilationUnit cu, ClassOrInterfaceDeclaration clazz, String returnType) { + boolean hasDI = true; + MethodDeclaration queryMethod = clazz.getMethodsByName("executeQuery").get(0); + queryMethod.getParameter(0).setType(ruleUnit.getCanonicalName() + (hasDI ? "" : "DTO")); + setGeneric(queryMethod.getType(), returnType); + + Statement statement = queryMethod + .getBody() + .orElseThrow(() -> new NoSuchElementException("A method declaration doesn't contain a body!")) + .getStatement(0); + statement.findAll(VariableDeclarator.class).forEach(decl -> setUnitGeneric(decl.getType())); + statement.findAll(MethodCallExpr.class).forEach(m -> m.addArgument(hasDI ? "unitDTO" : "unitDTO.get()")); + + Statement returnStatement = queryMethod + .getBody() + .orElseThrow(() -> new NoSuchElementException("A method declaration doesn't contain a body!")) + .getStatement(1); + returnStatement.findAll(VariableDeclarator.class).forEach(decl -> setGeneric(decl.getType(), returnType)); + returnStatement.findAll(MethodCallExpr.class).forEach(expr -> expr.setScope(new NameExpr(queryClassName))); + + MethodDeclaration queryMethodSingle = clazz.getMethodsByName("executeQueryFirst").get(0); + queryMethodSingle.getParameter(0).setType(ruleUnit.getCanonicalName() + (hasDI ? "" : "DTO")); + queryMethodSingle.setType(toNonPrimitiveType(returnType)); + + Statement statementSingle = queryMethodSingle + .getBody() + .orElseThrow(() -> new NoSuchElementException("A method declaration doesn't contain a body!")) + .getStatement(0); + statementSingle.findAll(VariableDeclarator.class).forEach(decl -> setGeneric(decl.getType(), returnType)); + + Statement returnMethodSingle = queryMethodSingle + .getBody() + .orElseThrow(() -> new NoSuchElementException("A method declaration doesn't contain a body!")) + .getStatement(1); + returnMethodSingle.findAll(VariableDeclarator.class).forEach(decl -> decl.setType(toNonPrimitiveType(returnType))); + } + + private BlockStmt wrapBodyAddingExceptionLogging(BlockStmt body, String nameURL) { + TryStmt ts = new TryStmt(); + ts.setTryBlock(body); + CatchClause cc = new CatchClause(); + String exceptionName = "e"; + cc.setParameter(new Parameter().setName(exceptionName).setType(Exception.class)); + BlockStmt cb = new BlockStmt(); + cb.addStatement(parseStatement( + String.format( + "systemMetricsCollectorProvider.get().registerException(\"%s\", %s.getStackTrace()[0].toString());", + nameURL, + exceptionName))); + cb.addStatement(new ThrowStmt(new NameExpr(exceptionName))); + cc.setBody(cb); + ts.setCatchClauses(new NodeList<>(cc)); + return new BlockStmt(new NodeList<>(ts)); + } + + private String getReturnType() { + if (query.model().getBindings().size() == 1) { + Map.Entry> binding = query.model().getBindings().entrySet().iterator().next(); + return binding.getValue().getCanonicalName(); + } + return queryClassName + ".Result"; + } + + private void interpolateStrings(StringLiteralExpr vv) { + String interpolated = vv.getValue() + .replace("$name$", queryName) + .replace("$endpointName$", endpointName) + .replace("$queryName$", query.model().getName()) + .replace("$prometheusName$", endpointName); + vv.setString(interpolated); + } + + private void setUnitGeneric(Type type) { + setGeneric(type, ruleUnit); + } +} diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitQueryWriter.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitQueryWriter.java new file mode 100644 index 00000000000..b64864a9abc --- /dev/null +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitQueryWriter.java @@ -0,0 +1,232 @@ +/* + * 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.model.codegen.execmodel; + +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.ConstructorDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.expr.AssignExpr; +import com.github.javaparser.ast.expr.CastExpr; +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.expr.MethodReferenceExpr; +import com.github.javaparser.ast.expr.NameExpr; +import com.github.javaparser.ast.expr.ObjectCreationExpr; +import com.github.javaparser.ast.expr.StringLiteralExpr; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.ReturnStmt; +import com.github.javaparser.ast.stmt.Statement; +import org.drools.codegen.common.GeneratedFile; +import org.drools.codegen.common.GeneratedFileType; +import org.drools.codegen.common.context.JavaDroolsModelBuildContext; +import org.drools.drl.parser.DroolsError; +import org.drools.model.codegen.execmodel.util.BodyDeclarationComparator; +import org.drools.model.codegen.project.template.TemplatedGenerator; +import org.kie.internal.ruleunit.RuleUnitDescription; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; + +import static org.drools.model.codegen.execmodel.PackageSources.logSource; +import static org.drools.model.codegen.execmodel.RuleUnitWriter.TEMPLATE_RULE_UNITS_FOLDER; +import static org.drools.model.codegen.execmodel.generator.DrlxParseUtil.classToReferenceType; +import static org.drools.model.codegen.execmodel.util.RuleCodegenUtils.setGeneric; +import static org.drools.model.codegen.execmodel.util.RuleCodegenUtils.toCamelCase; +import static org.drools.util.StringUtils.ucFirst; + +public class RuleUnitQueryWriter { + + private final TemplatedGenerator.Builder templateBuilder; + private final RuleUnitDescription ruleUnit; + private final PackageModel pkgModel; + private final QueryModel queryModel; + + private final String targetClassName; + private final String name; + private final boolean hasRest; + + public RuleUnitQueryWriter(PackageModel pkgModel, RuleUnitDescription ruleUnit, QueryModel queryModel) { + this.ruleUnit = ruleUnit; + this.pkgModel = pkgModel; + this.queryModel = queryModel; + this.name = toCamelCase(queryModel.getName()); + this.hasRest = pkgModel.getContext() != null && pkgModel.getContext().hasRest(); + + this.targetClassName = ruleUnit.getSimpleName() + "Query" + name; + this.templateBuilder = TemplatedGenerator.builder() + .withTemplateBasePath(TEMPLATE_RULE_UNITS_FOLDER) + .withPackageName(ruleUnit.getPackageName()) + .withTargetTypeName(targetClassName) + .withFallbackContext(JavaDroolsModelBuildContext.CONTEXT_NAME); + } + + public String name() { + return name; + } + + public RuleUnitDescription ruleUnit() { + return ruleUnit; + } + + public QueryModel model() { + return queryModel; + } + + public Collection generate() { + Collection generatedFiles = new ArrayList<>(); + generatedFiles.add( new GeneratedFile( GeneratedFileType.RULE, generatedFilePath(), logSource( getQuerySource() ) ) ); + if (hasRest) { + RuleUnitQueryEndpointWriter queryEndpointWriter = new RuleUnitQueryEndpointWriter(pkgModel, this); + generatedFiles.add( new GeneratedFile( GeneratedFileType.REST, queryEndpointWriter.generatedFilePath(), logSource( queryEndpointWriter.getEndpointSource() )) ); + } + return generatedFiles; + } + + public String generatedFilePath() { + String targetCanonicalName = this.pkgModel.getName() + "." + this.targetClassName; + return targetCanonicalName.replace('.', '/') + ".java"; + } + + public String getQuerySource() { + CompilationUnit cu = templateBuilder.build(pkgModel.getContext(), "RuleUnitQuery").compilationUnitOrThrow(); + + ClassOrInterfaceDeclaration clazz = cu + .findFirst(ClassOrInterfaceDeclaration.class) + .orElseThrow(() -> new NoSuchElementException("Compilation unit doesn't contain a class or interface declaration!")); + clazz.setName(targetClassName); + + cu.findAll(StringLiteralExpr.class).forEach(this::interpolateStrings); + + String returnType = getReturnType(clazz); + generateQueryMethod(clazz, returnType); + clazz.getMembers().sort(BodyDeclarationComparator.INSTANCE); + return cu.toString(); + } + + private void generateQueryMethod(ClassOrInterfaceDeclaration clazz, String returnType) { + MethodDeclaration queryMethod = clazz.getMethodsByName("execute").get(0); + setGeneric(queryMethod.getType(), returnType); + setGeneric(queryMethod.getParameter(0).getType(), ruleUnit); + queryMethod.findAll(MethodReferenceExpr.class).forEach(mr -> mr.setScope(new NameExpr(targetClassName))); + } + + private String getReturnType(ClassOrInterfaceDeclaration clazz) { + MethodDeclaration toResultMethod = clazz.getMethodsByName("toResult").get(0); + String returnType; + if (queryModel.getBindings().size() == 1) { + Map.Entry> binding = queryModel.getBindings().entrySet().iterator().next(); + String name = binding.getKey(); + returnType = binding.getValue().getCanonicalName(); + + Statement statement = toResultMethod + .getBody() + .orElseThrow(() -> new NoSuchElementException("A method declaration doesn't contain a body!")) + .getStatement(0); + + statement.findFirst(CastExpr.class).orElseThrow(() -> new NoSuchElementException("CastExpr not found in template.")).setType(returnType); + statement.findFirst(StringLiteralExpr.class).orElseThrow(() -> new NoSuchElementException("StringLiteralExpr not found in template.")).setString(name); + } else { + returnType = targetClassName + ".Result"; + generateResultClass(clazz, toResultMethod); + } + + toResultMethod.setType(returnType); + return returnType; + } + + private void generateResultClass(ClassOrInterfaceDeclaration clazz, MethodDeclaration toResultMethod) { + ClassOrInterfaceDeclaration resultClass = new ClassOrInterfaceDeclaration(new NodeList<>(Modifier.publicModifier(), Modifier.staticModifier()), false, "Result"); + clazz.addMember(resultClass); + + ConstructorDeclaration constructor = resultClass.addConstructor(Modifier.Keyword.PUBLIC); + BlockStmt constructorBody = constructor.createBody(); + + ObjectCreationExpr resultCreation = new ObjectCreationExpr(); + resultCreation.setType("Result"); + BlockStmt resultMethodBody = toResultMethod.createBody(); + resultMethodBody.addStatement(new ReturnStmt(resultCreation)); + + queryModel.getBindings().forEach((name, type) -> { + resultClass.addField(type, name, Modifier.Keyword.PRIVATE, Modifier.Keyword.FINAL); + + MethodDeclaration getterMethod = resultClass.addMethod("get" + ucFirst(name), Modifier.Keyword.PUBLIC); + getterMethod.setType(type); + BlockStmt body = getterMethod.createBody(); + body.addStatement(new ReturnStmt(new NameExpr(name))); + + constructor.addAndGetParameter(type, name); + constructorBody.addStatement(new AssignExpr(new NameExpr("this." + name), new NameExpr(name), AssignExpr.Operator.ASSIGN)); + + MethodCallExpr callExpr = new MethodCallExpr(new NameExpr("tuple"), "get"); + callExpr.addArgument(new StringLiteralExpr(name)); + resultCreation.addArgument(new CastExpr(classToReferenceType(type), callExpr)); + }); + } + + private void interpolateStrings(StringLiteralExpr vv) { + String interpolated = vv.getValue().replace("$queryName$", queryModel.getName()); + vv.setString(interpolated); + } + + public static class NoBindingQuery extends DroolsError { + + private static final int[] ERROR_LINES = new int[0]; + + private final QueryModel query; + + public NoBindingQuery(QueryModel query) { + this.query = query; + } + + @Override + public String getMessage() { + return "Query " + query.getName() + " has no bound variable. At least one binding is required to determine the value returned by this query"; + } + + @Override + public int[] getLines() { + return ERROR_LINES; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + NoBindingQuery that = (NoBindingQuery) o; + return Objects.equals(query, that.query); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), query); + } + } +} diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitWriter.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitWriter.java index dac585dc3a6..5f5acf356d3 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitWriter.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitWriter.java @@ -18,16 +18,14 @@ */ package org.drools.model.codegen.execmodel; -import java.io.IOException; -import java.io.UncheckedIOException; -import java.util.Collection; - import com.github.javaparser.StaticJavaParser; import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.ConstructorDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.VariableDeclarator; import com.github.javaparser.ast.expr.ArrayCreationExpr; import com.github.javaparser.ast.expr.ArrayInitializerExpr; import com.github.javaparser.ast.expr.BinaryExpr; @@ -40,6 +38,8 @@ import com.github.javaparser.ast.stmt.BlockStmt; import com.github.javaparser.ast.stmt.IfStmt; import com.github.javaparser.ast.type.ClassOrInterfaceType; +import org.drools.codegen.common.GeneratedFile; +import org.drools.codegen.common.GeneratedFileType; import org.drools.codegen.common.context.JavaDroolsModelBuildContext; import org.drools.model.codegen.project.template.TemplatedGenerator; import org.kie.api.conf.EventProcessingOption; @@ -48,14 +48,24 @@ import org.kie.internal.ruleunit.RuleUnitDescription; import org.kie.internal.ruleunit.RuleUnitVariable; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + import static com.github.javaparser.StaticJavaParser.parseExpression; +import static java.util.stream.Collectors.toList; import static org.drools.model.codegen.execmodel.JavaParserCompiler.getPrettyPrinter; +import static org.drools.model.codegen.execmodel.PackageSources.logSource; +import static org.drools.util.ClassUtils.rawType; public class RuleUnitWriter { private static final String RULE_UNIT_VAR = "ruleUnit"; - private static final String TEMPLATE_RULE_UNITS_FOLDER = "/class-templates/ruleunits/"; + static final String TEMPLATE_RULE_UNITS_FOLDER = "/class-templates/ruleunits/"; private final TemplatedGenerator.Builder templateBuilder; @@ -67,6 +77,7 @@ public RuleUnitWriter(PackageModel pkgModel, PackageModel.RuleSourceResult ruleS this.pkgModel = pkgModel; this.ruleSourceResult = ruleSourceResult; this.ruleUnitDescr = ruleUnitDescr; + this.templateBuilder = TemplatedGenerator.builder() .withTemplateBasePath(TEMPLATE_RULE_UNITS_FOLDER) .withPackageName(pkgModel.getName()) @@ -77,6 +88,10 @@ public String getUnitName() { return pkgModel.getPathName() + "/" + getRuleUnitSimpleClassName() + ".java"; } + public String getUnitPojoName() { + return pkgModel.getPathName() + "/" + ruleUnitDescr.getSimpleName() + ".java"; + } + public String getInstanceName() { return pkgModel.getPathName() + "/" + getRuleUnitInstanceSimpleClassName() + ".java"; } @@ -93,6 +108,25 @@ private String getRuleUnitInstanceSimpleClassName() { return ruleUnitDescr.getSimpleName() + "RuleUnitInstance"; } + public Collection generate() { + Collection generatedFiles = new ArrayList<>(); + generatedFiles.add( new GeneratedFile( GeneratedFileType.RULE, getUnitName(), logSource( getUnitSource() ) ) ); + generatedFiles.add( new GeneratedFile( GeneratedFileType.RULE, getInstanceName(), logSource( getInstanceSource() ) ) ); + if (ruleUnitDescr.isGenerated()) { + generatedFiles.add( new GeneratedFile( GeneratedFileType.RULE, getUnitPojoName(), logSource( getRuleUnitPojoSource() ) ) ); + } + + List queryWriters = pkgModel.getQueriesInRuleUnit(ruleUnitDescr).stream() + .filter(query -> !query.hasParameters()) + .map(query -> new RuleUnitQueryWriter(pkgModel, ruleUnitDescr, query)) + .collect(toList()); + + for (RuleUnitQueryWriter queryWriter : queryWriters) { + generatedFiles.addAll( queryWriter.generate() ); + } + return generatedFiles; + } + public String getUnitSource() { CompilationUnit cu = templateBuilder.build(pkgModel.getContext(), "RuleUnit").compilationUnitOrThrow("Could not create CompilationUnit"); @@ -100,8 +134,6 @@ public String getUnitSource() { .getClassByName("CLASS_NAME") .orElseThrow(RuntimeException::new); - cu.setPackageDeclaration(pkgModel.getName()); - parsedClass.setName(getRuleUnitSimpleClassName()); parsedClass.findAll(ConstructorDeclaration.class) .forEach(c -> c.setName(getRuleUnitSimpleClassName())); @@ -239,4 +271,35 @@ private Expression eventProcessingOptionExpression(EventProcessingOption eventPr sb.append(eventProcessingOption.getMode().toUpperCase()); return parseExpression(sb.toString()); } + + private String getRuleUnitPojoSource() { + ClassOrInterfaceDeclaration generatedPojoSource = + new ClassOrInterfaceDeclaration() + .setPublic(true) + .addImplementedType("org.drools.ruleunits.api.RuleUnitData") + .setName(ruleUnitDescr.getSimpleName()); + + for (RuleUnitVariable v : ruleUnitDescr.getUnitVarDeclarations()) { + ClassOrInterfaceType t = new ClassOrInterfaceType() + .setName(rawType(v.getType()).getCanonicalName()); + FieldDeclaration f = new FieldDeclaration(); + VariableDeclarator vd = new VariableDeclarator(t, v.getName()); + f.getVariables().add(vd); + if (v.isDataSource()) { + t.setTypeArguments(StaticJavaParser.parseType(v.getDataSourceParameterType().getCanonicalName())); + if (v.isDataStore()) { + vd.setInitializer("org.drools.ruleunits.api.DataSource.createStore()"); + } else { + vd.setInitializer("org.drools.ruleunits.api.DataSource.createSingleton()"); + } + } + generatedPojoSource.addMember(f); + f.createGetter(); + if (v.setter() != null) { + f.createSetter(); + } + } + + return JavaParserCompiler.toPojoSource(ruleUnitDescr.getPackageName(), Collections.emptyList(), Collections.emptyList(), generatedPojoSource); + } } diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/util/BodyDeclarationComparator.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/util/BodyDeclarationComparator.java new file mode 100644 index 00000000000..59b4f0780d9 --- /dev/null +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/util/BodyDeclarationComparator.java @@ -0,0 +1,55 @@ +/* + * 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.model.codegen.execmodel.util; + +import com.github.javaparser.ast.body.BodyDeclaration; +import com.github.javaparser.ast.body.ConstructorDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; + +import java.util.Comparator; + +public class BodyDeclarationComparator implements Comparator> { + + public static final BodyDeclarationComparator INSTANCE = new BodyDeclarationComparator(); + + private BodyDeclarationComparator() { } + + @Override + public int compare(BodyDeclaration o1, BodyDeclaration o2) { + if (o1 instanceof FieldDeclaration && o2 instanceof FieldDeclaration) { + return 0; + } + if (o1 instanceof FieldDeclaration && !(o2 instanceof FieldDeclaration)) { + return -1; + } + + if (o1 instanceof ConstructorDeclaration && o2 instanceof ConstructorDeclaration) { + return 0; + } + if (o1 instanceof ConstructorDeclaration && o2 instanceof MethodDeclaration) { + return -1; + } + if (o1 instanceof ConstructorDeclaration && o2 instanceof FieldDeclaration) { + return 1; + } + return 1; + } + +} diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/util/RuleCodegenUtils.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/util/RuleCodegenUtils.java new file mode 100644 index 00000000000..f4ce3f010a5 --- /dev/null +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/util/RuleCodegenUtils.java @@ -0,0 +1,76 @@ +/* + * 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.model.codegen.execmodel.util; + +import com.github.javaparser.ast.type.Type; +import org.kie.internal.ruleunit.RuleUnitDescription; + +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static com.github.javaparser.StaticJavaParser.parseClassOrInterfaceType; +import static org.drools.model.codegen.execmodel.generator.DrlxParseUtil.toClassOrInterfaceType; + +public class RuleCodegenUtils { + + private RuleCodegenUtils() { + // utility class + } + + public static void setGeneric(Type type, RuleUnitDescription ruleUnit) { + type.asClassOrInterfaceType().setTypeArguments(toClassOrInterfaceType(ruleUnit.getCanonicalName())); + } + + public static void setGeneric(Type type, String typeArgument) { + type.asClassOrInterfaceType().setTypeArguments(parseClassOrInterfaceType(toNonPrimitiveType(typeArgument))); + } + + public static String toNonPrimitiveType(String type) { + switch (type) { + case "int": + return "Integer"; + case "long": + return "Long"; + case "double": + return "Double"; + case "float": + return "Float"; + case "short": + return "Short"; + case "byte": + return "Byte"; + case "char": + return "Character"; + case "boolean": + return "Boolean"; + default: + return type; + } + } + + public static String toCamelCase(String inputString) { + return Stream.of(inputString.split(" ")) + .map(s -> s.length() > 1 ? s.substring(0, 1).toUpperCase() + s.substring(1) : s.substring(0, 1).toUpperCase()) + .collect(Collectors.joining()); + } + + public static String toKebabCase(String inputString) { + return inputString.replaceAll("(.)(\\p{Upper})", "$1-$2").toLowerCase(); + } +} diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/CodegenPackageSources.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/CodegenPackageSources.java index 86498da0e7e..3c7072c4f04 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/CodegenPackageSources.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/CodegenPackageSources.java @@ -18,8 +18,9 @@ */ package org.drools.model.codegen.project; +import org.drools.codegen.common.GeneratedFile; +import org.drools.codegen.common.GeneratedFileType; import org.drools.model.codegen.execmodel.DeclaredTypeWriter; -import org.drools.model.codegen.execmodel.GeneratedFile; import org.drools.model.codegen.execmodel.PackageModel; import org.drools.model.codegen.execmodel.PackageModelWriter; import org.drools.model.codegen.execmodel.PackageSources; @@ -91,7 +92,7 @@ private static CodegenPackageSources dumpPojos(PackageModelWriter packageModelWr List pojoClasses = new ArrayList<>(); for (DeclaredTypeWriter declaredType : packageModelWriter.getDeclaredTypes()) { - sources.pojoSources.add(new GeneratedFile(declaredType.getName(), + sources.pojoSources.add(new GeneratedFile(GeneratedFileType.DECLARED_TYPE, declaredType.getName(), PackageSources.logSource(declaredType.getSource()))); pojoClasses.add(declaredType.getClassName()); } @@ -104,7 +105,7 @@ private static CodegenPackageSources dumpPojos(PackageModelWriter packageModelWr } public static GeneratedFile getReflectConfigFile(String pathName, List pojoClasses) { - return new GeneratedFile("META-INF/native-image/" + pathName + "/reflect-config.json", + return new GeneratedFile(GeneratedFileType.CONFIG, "META-INF/native-image/" + pathName + "/reflect-config.json", reflectConfigSource(pojoClasses)); } diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/DroolsModelBuilder.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/DroolsModelBuilder.java index 3b19c1ed5da..15640645286 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/DroolsModelBuilder.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/DroolsModelBuilder.java @@ -18,16 +18,6 @@ */ package org.drools.model.codegen.project; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - import org.drools.codegen.common.DroolsModelBuildContext; import org.drools.codegen.common.GeneratedFile; import org.drools.codegen.common.GeneratedFileType; @@ -52,7 +42,16 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static java.util.stream.Collectors.toList; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + import static org.drools.compiler.kie.builder.impl.AbstractKieModule.loadResourceConfiguration; import static org.kie.internal.builder.KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration; @@ -167,14 +166,14 @@ private void handleDrl(DrlResourceHandler drlResourceHandler, Map generateCanonicalModelSources() { List modelFiles = new ArrayList<>(); - List legacyModelFiles = new ArrayList<>(); + List legacyModelFiles = new ArrayList<>(); for (CodegenPackageSources pkgSources : this.codegenPackageSources) { pkgSources.collectGeneratedFiles(legacyModelFiles); modelFiles.addAll(generateInternalResource(pkgSources)); } - modelFiles.addAll(convertGeneratedRuleFile(legacyModelFiles)); + modelFiles.addAll(legacyModelFiles); return modelFiles; } @@ -195,11 +194,11 @@ private void checkDependencyTableSupport() { private List generateInternalResource(CodegenPackageSources pkgSources) { List modelFiles = new ArrayList<>(); - org.drools.model.codegen.execmodel.GeneratedFile reflectConfigSource = pkgSources.getReflectConfigSource(); + GeneratedFile reflectConfigSource = pkgSources.getReflectConfigSource(); if (reflectConfigSource != null) { modelFiles.add(new GeneratedFile(GeneratedFileType.INTERNAL_RESOURCE, - reflectConfigSource.getPath(), - reflectConfigSource.getData())); + reflectConfigSource.relativePath(), + reflectConfigSource.contents())); } return modelFiles; } @@ -236,8 +235,4 @@ private static Collection parseWorksheetConfig(DecisionTa private Resource findPropertiesResource(Resource resource) { return resources.stream().filter(r -> r.getSourcePath().equals(resource.getSourcePath() + ".properties")).findFirst().orElse(null); } - - private Collection convertGeneratedRuleFile(Collection legacyModelFiles) { - return legacyModelFiles.stream().map(f -> new GeneratedFile(RuleCodegen.RULE_TYPE, f.getPath(), f.getData())).collect(toList()); - } } diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/KieSessionModelBuilder.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/KieSessionModelBuilder.java index fe20cf8bc21..d0542bbf8a7 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/KieSessionModelBuilder.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/KieSessionModelBuilder.java @@ -18,6 +18,12 @@ */ package org.drools.model.codegen.project; +import org.drools.codegen.common.DroolsModelBuildContext; +import org.drools.codegen.common.GeneratedFile; +import org.drools.codegen.common.GeneratedFileType; +import org.drools.model.codegen.execmodel.ModelSourceClass; +import org.kie.api.builder.model.KieBaseModel; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -27,11 +33,6 @@ import java.util.Map; import java.util.Objects; -import org.drools.codegen.common.GeneratedFile; -import org.drools.codegen.common.DroolsModelBuildContext; -import org.drools.model.codegen.execmodel.ModelSourceClass; -import org.kie.api.builder.model.KieBaseModel; - import static java.util.stream.Collectors.toList; /** @@ -57,9 +58,9 @@ public List generate() { new ProjectRuntimeGenerator(modelSourceClass.getModelMethod(), context); return Arrays.asList( - new GeneratedFile(RuleCodegen.RULE_TYPE, + new GeneratedFile(GeneratedFileType.RULE, modelSourceClass.getName(), modelSourceClass.generate()), - new GeneratedFile(RuleCodegen.RULE_TYPE, + new GeneratedFile(GeneratedFileType.RULE, projectRuntimeGenerator.getName(), projectRuntimeGenerator.generate())); } diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/RuleCodegen.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/RuleCodegen.java index f6b371aaed1..3a0de0a66fa 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/RuleCodegen.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/RuleCodegen.java @@ -18,13 +18,8 @@ */ package org.drools.model.codegen.project; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; -import java.util.Objects; import org.drools.codegen.common.DroolsModelBuildContext; import org.drools.codegen.common.GeneratedFile; -import org.drools.codegen.common.GeneratedFileType; import org.drools.drl.extensions.DecisionTableFactory; import org.drools.model.codegen.execmodel.PackageModel; import org.drools.model.codegen.execmodel.PackageModelWriter; @@ -33,9 +28,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class RuleCodegen { +import java.util.Collection; +import java.util.Collections; +import java.util.Objects; - public static final GeneratedFileType RULE_TYPE = GeneratedFileType.of("RULE", GeneratedFileType.Category.SOURCE); +public class RuleCodegen { public static final String GENERATOR_NAME = "rules"; diff --git a/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestObjectMapperQuarkusTemplate.java b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestObjectMapperQuarkusTemplate.java new file mode 100644 index 00000000000..6bc3c5e4050 --- /dev/null +++ b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestObjectMapperQuarkusTemplate.java @@ -0,0 +1,130 @@ +/* + * 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 $Package$; + +import java.util.List; + +import java.io.IOException; + +import com.fasterxml.jackson.databind.JavaType; +import javax.inject.Singleton; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.BeanProperty; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.deser.ContextualDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.type.CollectionType; + +import org.drools.ruleunits.api.DataSource; +import org.drools.ruleunits.api.DataStore; +import org.drools.ruleunits.api.DataStream; +import org.drools.ruleunits.api.SingletonStore; + +import io.quarkus.jackson.ObjectMapperCustomizer; + +@Singleton +public class RestObjectMapper implements ObjectMapperCustomizer { + + public void customize(ObjectMapper mapper) { + mapper.registerModule(new DroolsModule()); + } + + public static class DroolsModule extends SimpleModule { + + public DroolsModule() { + addDefaultSerializers(); + addDefaultDeserializers(); + } + + private void addDefaultSerializers() { + } + + private void addDefaultDeserializers() { + addDeserializer( DataStream.class, new DataStreamDeserializer() ); + addDeserializer( DataStore.class, new DataStoreDeserializer() ); + addDeserializer( SingletonStore.class, new SingletonStoreDeserializer() ); + } + + public static class DataStreamDeserializer extends JsonDeserializer> implements ContextualDeserializer { + + private CollectionType collectionType; + + @Override + public DataStream deserialize( JsonParser jp, DeserializationContext ctxt) throws IOException { + DataStream stream = DataSource.createBufferedStream(16); + List list = ctxt.readValue( jp, collectionType ); + list.forEach( stream::append ); + return stream; + } + + @Override + public JsonDeserializer createContextual( DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { + CollectionType collectionType = ctxt.getTypeFactory().constructCollectionType(List.class, property.getType().containedType(0)); + DataStreamDeserializer deserializer = new DataStreamDeserializer(); + deserializer.collectionType = collectionType; + return deserializer; + } + } + + public static class DataStoreDeserializer extends JsonDeserializer> implements ContextualDeserializer { + + private CollectionType collectionType; + + @Override + public DataStore deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + DataStore store = DataSource.createStore(); + List list = ctxt.readValue( jp, collectionType ); + list.forEach( store::add ); + return store; + } + + @Override + public JsonDeserializer createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { + CollectionType collectionType = ctxt.getTypeFactory().constructCollectionType(List.class, property.getType().containedType(0)); + DataStoreDeserializer deserializer = new DataStoreDeserializer(); + deserializer.collectionType = collectionType; + return deserializer; + } + } + + public static class SingletonStoreDeserializer extends JsonDeserializer> implements ContextualDeserializer { + + private JavaType javaType ; + + @Override + public SingletonStore deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + SingletonStore store = DataSource.createSingleton(); + store.set( ctxt.readValue( jp, javaType ) ); + return store; + } + + @Override + public JsonDeserializer createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { + JavaType javaType = property.getType().containedType(0); + SingletonStoreDeserializer deserializer = new DroolsModule.SingletonStoreDeserializer(); + deserializer.javaType = javaType; + return deserializer; + } + } + } +} \ No newline at end of file diff --git a/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestObjectMapperSpringTemplate.java b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestObjectMapperSpringTemplate.java new file mode 100644 index 00000000000..dd479555b54 --- /dev/null +++ b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestObjectMapperSpringTemplate.java @@ -0,0 +1,123 @@ +/* + * 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 $Package$; + +import java.util.List; + +import java.io.IOException; +import java.util.List; + +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.BeanProperty; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.deser.ContextualDeserializer; +import com.fasterxml.jackson.databind.type.CollectionType; + +import org.drools.ruleunits.api.DataSource; +import org.drools.ruleunits.api.DataStore; +import org.drools.ruleunits.api.DataStream; +import org.drools.ruleunits.api.SingletonStore; + +import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; +import org.springframework.boot.SpringBootConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; + +@SpringBootConfiguration +public class RestObjectMapper { + + @Bean + public Jackson2ObjectMapperBuilderCustomizer customizeObjectMapper() { + return new Jackson2ObjectMapperBuilderCustomizer() { + @Override + public void customize(Jackson2ObjectMapperBuilder builder) { + //addDefaultDeserializers + builder.deserializerByType(DataStream.class, new DataStreamDeserializer()); + builder.deserializerByType(DataStore.class, new DataStoreDeserializer()); + builder.deserializerByType(SingletonStore.class, new SingletonStoreDeserializer()); + } + }; + } + + public static class DataStreamDeserializer extends JsonDeserializer> implements ContextualDeserializer { + + private CollectionType collectionType; + + @Override + public DataStream deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + DataStream stream = DataSource.createBufferedStream(16); + List list = ctxt.readValue(jp, collectionType); + list.forEach(stream::append); + return stream; + } + + @Override + public JsonDeserializer createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { + CollectionType collectionType = ctxt.getTypeFactory().constructCollectionType(List.class, property.getType().containedType(0)); + DataStreamDeserializer deserializer = new DataStreamDeserializer(); + deserializer.collectionType = collectionType; + return deserializer; + } + } + + public static class DataStoreDeserializer extends JsonDeserializer> implements ContextualDeserializer { + + private CollectionType collectionType; + + @Override + public DataStore deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + DataStore store = DataSource.createStore(); + List list = ctxt.readValue(jp, collectionType); + list.forEach(store::add); + return store; + } + + @Override + public JsonDeserializer createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { + CollectionType collectionType = ctxt.getTypeFactory().constructCollectionType(List.class, property.getType().containedType(0)); + DataStoreDeserializer deserializer = new DataStoreDeserializer(); + deserializer.collectionType = collectionType; + return deserializer; + } + } + + public static class SingletonStoreDeserializer extends JsonDeserializer> implements ContextualDeserializer { + + private JavaType javaType; + + @Override + public SingletonStore deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + SingletonStore store = DataSource.createSingleton(); + store.set(ctxt.readValue(jp, javaType)); + return store; + } + + @Override + public JsonDeserializer createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { + JavaType javaType = property.getType().containedType(0); + SingletonStoreDeserializer deserializer = new SingletonStoreDeserializer(); + deserializer.javaType = javaType; + return deserializer; + } + } +} \ No newline at end of file diff --git a/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQueryJavaTemplate.java b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQueryJavaTemplate.java new file mode 100644 index 00000000000..3cd2a6b68d1 --- /dev/null +++ b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQueryJavaTemplate.java @@ -0,0 +1,63 @@ +/* + * 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. + */ +import java.util.List; +import java.util.Map; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.drools.ruleunits.api.RuleUnit; +import org.drools.ruleunits.api.RuleUnitInstance; + +import static java.util.stream.Collectors.toList; +@Path("/$endpointName$") +public class $unit$Query$name$Endpoint { + + RuleUnit<$UnitType$> ruleUnit; + + public $unit$Query$name$Endpoint() { } + + public $unit$Query$name$Endpoint(RuleUnit<$UnitType$> ruleUnit) { + this.ruleUnit = ruleUnit; + } + + @POST() + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public List<$ReturnType$> executeQuery($UnitTypeDTO$ unitDTO) { + RuleUnitInstance<$UnitType$> instance = ruleUnit.createInstance(); + // Do not return the result directly to allow post execution codegen (like monitoring) + List<$ReturnType$> response = $unit$Query$name$.execute(instance); + instance.close(); + return response; + } + + @POST() + @Path("/first") + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public $ReturnType$ executeQueryFirst($UnitTypeDTO$ unitDTO) { + List<$ReturnType$> results = executeQuery(unitDTO); + $ReturnType$ response = results.isEmpty() ? null : results.get(0); + return response; + } +} diff --git a/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQueryQuarkusTemplate.java b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQueryQuarkusTemplate.java new file mode 100644 index 00000000000..338697d185f --- /dev/null +++ b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQueryQuarkusTemplate.java @@ -0,0 +1,64 @@ +/* + * 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. + */ +import java.util.List; +import java.util.Map; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.drools.ruleunits.api.RuleUnit; +import org.drools.ruleunits.api.RuleUnitInstance; + +import static java.util.stream.Collectors.toList; +@Path("/$endpointName$") +public class $unit$Query$name$Endpoint { + + @javax.inject.Inject + RuleUnit<$UnitType$> ruleUnit; + + public $unit$Query$name$Endpoint() { } + + public $unit$Query$name$Endpoint(RuleUnit<$UnitType$> ruleUnit) { + this.ruleUnit = ruleUnit; + } + + @POST() + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public List<$ReturnType$> executeQuery($UnitTypeDTO$ unitDTO) { + RuleUnitInstance<$UnitType$> instance = ruleUnit.createInstance(); + // Do not return the result directly to allow post execution codegen (like monitoring) + List<$ReturnType$> response = $unit$Query$name$.execute(instance); + instance.close(); + return response; + } + + @POST() + @Path("/first") + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public $ReturnType$ executeQueryFirst($UnitTypeDTO$ unitDTO) { + List<$ReturnType$> results = executeQuery(unitDTO); + $ReturnType$ response = results.isEmpty() ? null : results.get(0); + return response; + } +} diff --git a/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQuerySpringTemplate.java b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQuerySpringTemplate.java new file mode 100644 index 00000000000..0fcf2806978 --- /dev/null +++ b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQuerySpringTemplate.java @@ -0,0 +1,62 @@ +/* + * 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. + */ +import java.util.List; +import java.util.Map; + +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.beans.factory.annotation.Autowired; + +import org.drools.ruleunits.api.RuleUnit; +import org.drools.ruleunits.api.RuleUnitInstance; + +import static java.util.stream.Collectors.toList; +@RestController +@RequestMapping("/$endpointName$") +public class $unit$Query$name$Endpoint { + + @Autowired + RuleUnit<$UnitType$> ruleUnit; + + public $unit$Query$name$Endpoint() { } + + public $unit$Query$name$Endpoint(RuleUnit<$UnitType$> ruleUnit) { + this.ruleUnit = ruleUnit; + } + + @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) + public List<$ReturnType$> executeQuery(@RequestBody(required = true) $UnitTypeDTO$ unitDTO) { + RuleUnitInstance<$UnitType$> instance = ruleUnit.createInstance(); + // Do not return the result directly to allow post execution codegen (like monitoring) + List<$ReturnType$> response = $unit$Query$name$.execute(instance); + instance.close(); + return response; + } + + @PostMapping(value = "/first", produces = MediaType.APPLICATION_JSON_VALUE, consumes = + MediaType.APPLICATION_JSON_VALUE) + public $ReturnType$ executeQueryFirst(@RequestBody(required = true) $UnitTypeDTO$ unitDTO) { + List<$ReturnType$> results = executeQuery(unitDTO); + $ReturnType$ response = results.isEmpty() ? null : results.get(0); + return response; + } +} \ No newline at end of file diff --git a/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RuleUnitQueryJavaTemplate.java b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RuleUnitQueryJavaTemplate.java new file mode 100644 index 00000000000..bb46057247a --- /dev/null +++ b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RuleUnitQueryJavaTemplate.java @@ -0,0 +1,34 @@ +/* + * 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. + */ +import org.drools.ruleunits.api.RuleUnitInstance; + +import java.util.List; +import java.util.Map; + +import static java.util.stream.Collectors.toList; +public class $unit$Query$name$ { + + public static List<$ReturnType$> execute(RuleUnitInstance<$UnitType$> instance) { + return instance.executeQuery( "$queryName$" ).toList().stream().map($unit$Query$name$::toResult).collect(toList()); + } + + private static $ReturnType$ toResult(Map tuple) { + return ($ReturnType$) tuple.get(""); + } +} diff --git a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/constraints/ConstraintEvaluationExceptionTest.java b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/constraints/ConstraintEvaluationExceptionTest.java index 9ffd1a087cb..896985761cd 100644 --- a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/constraints/ConstraintEvaluationExceptionTest.java +++ b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/constraints/ConstraintEvaluationExceptionTest.java @@ -18,20 +18,20 @@ */ package org.drools.model.codegen.execmodel.constraints; -import java.util.Collections; - import org.drools.base.definitions.rule.impl.RuleImpl; -import org.drools.kiesession.rulebase.InternalKnowledgeBase; -import org.drools.modelcompiler.constraints.ConstraintEvaluationException; -import org.drools.io.ByteArrayResource; import org.drools.core.reteoo.builder.BuildContext; +import org.drools.io.ByteArrayResource; +import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; -import org.drools.model.functions.PredicateInformation; import org.drools.model.codegen.execmodel.BaseModelTest; +import org.drools.model.functions.PredicateInformation; +import org.drools.modelcompiler.constraints.ConstraintEvaluationException; import org.drools.mvel.MVELConstraint; import org.junit.Test; import org.kie.api.io.Resource; +import java.util.Collections; + import static org.assertj.core.api.Assertions.assertThat; public class ConstraintEvaluationExceptionTest extends BaseModelTest { diff --git a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/ruleunits/RuleUnitWriterTest.java b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/ruleunits/RuleUnitWriterTest.java index 68eb1e76f8c..b7a0b85bc0e 100644 --- a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/ruleunits/RuleUnitWriterTest.java +++ b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/ruleunits/RuleUnitWriterTest.java @@ -18,18 +18,11 @@ */ package org.drools.model.codegen.ruleunits; -import java.lang.reflect.Type; -import java.util.Arrays; -import java.util.Collection; -import java.util.Optional; -import java.util.stream.Stream; - import com.github.javaparser.ast.CompilationUnit; import org.drools.codegen.common.DroolsModelBuildContext; import org.drools.codegen.common.context.JavaDroolsModelBuildContext; import org.drools.codegen.common.context.QuarkusDroolsModelBuildContext; import org.drools.codegen.common.context.SpringBootDroolsModelBuildContext; -import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationFactories; import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.compiler.compiler.DialectCompiletimeRegistry; import org.drools.model.codegen.execmodel.PackageModel; @@ -45,6 +38,12 @@ import org.kie.internal.ruleunit.RuleUnitDescription; import org.kie.internal.ruleunit.RuleUnitVariable; +import java.lang.reflect.Type; +import java.util.Arrays; +import java.util.Collection; +import java.util.Optional; +import java.util.stream.Stream; + import static org.assertj.core.api.Assertions.assertThat; public class RuleUnitWriterTest { @@ -157,6 +156,11 @@ public boolean isDataSource() { return true; } + @Override + public boolean isDataStore() { + return true; + } + @Override public String getName() { return "strings"; diff --git a/drools-ruleunits/drools-ruleunits-impl/src/main/java/org/drools/ruleunits/impl/GeneratedRuleUnitDescription.java b/drools-ruleunits/drools-ruleunits-impl/src/main/java/org/drools/ruleunits/impl/GeneratedRuleUnitDescription.java index 9ca3e56d8cc..5481977037f 100644 --- a/drools-ruleunits/drools-ruleunits-impl/src/main/java/org/drools/ruleunits/impl/GeneratedRuleUnitDescription.java +++ b/drools-ruleunits/drools-ruleunits-impl/src/main/java/org/drools/ruleunits/impl/GeneratedRuleUnitDescription.java @@ -18,12 +18,12 @@ */ package org.drools.ruleunits.impl; -import java.util.function.Function; - import org.drools.ruleunits.api.conf.RuleUnitConfig; import org.drools.util.TypeResolver; import org.kie.internal.ruleunit.RuleUnitVariable; +import java.util.function.Function; + public class GeneratedRuleUnitDescription extends AbstractRuleUnitDescription { private final Function> typeResolver; @@ -120,4 +120,9 @@ private static Class uncheckedLoadClass(ClassLoader classLoader, String fqcn) throw new IllegalArgumentException(e); } } + + @Override + public boolean isGenerated() { + return true; + } } diff --git a/drools-ruleunits/drools-ruleunits-impl/src/main/java/org/drools/ruleunits/impl/SimpleRuleUnitVariable.java b/drools-ruleunits/drools-ruleunits-impl/src/main/java/org/drools/ruleunits/impl/SimpleRuleUnitVariable.java index 47f5bf38257..f3f4aca02fa 100644 --- a/drools-ruleunits/drools-ruleunits-impl/src/main/java/org/drools/ruleunits/impl/SimpleRuleUnitVariable.java +++ b/drools-ruleunits/drools-ruleunits-impl/src/main/java/org/drools/ruleunits/impl/SimpleRuleUnitVariable.java @@ -18,11 +18,12 @@ */ package org.drools.ruleunits.impl; -import java.lang.reflect.Type; - import org.drools.ruleunits.api.DataSource; +import org.drools.ruleunits.api.DataStore; import org.kie.internal.ruleunit.RuleUnitVariable; +import java.lang.reflect.Type; + import static org.drools.util.ClassUtils.rawType; import static org.drools.util.StringUtils.ucFirst; import static org.drools.wiring.api.util.ClassUtils.convertFromPrimitiveType; @@ -58,6 +59,11 @@ public boolean isDataSource() { return DataSource.class.isAssignableFrom(boxedVarType) && dataSourceParameterType != null; } + @Override + public boolean isDataStore() { + return DataStore.class.isAssignableFrom(boxedVarType) && dataSourceParameterType != null; + } + @Override public String getName() { return name; diff --git a/drools-ruleunits/drools-ruleunits-impl/src/test/resources/logback-test.xml b/drools-ruleunits/drools-ruleunits-impl/src/test/resources/logback-test.xml index 00bd6193102..1b28764a217 100644 --- a/drools-ruleunits/drools-ruleunits-impl/src/test/resources/logback-test.xml +++ b/drools-ruleunits/drools-ruleunits-impl/src/test/resources/logback-test.xml @@ -31,7 +31,7 @@ - + diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/phases/ExplicitCanonicalModelCompilerTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/phases/ExplicitCanonicalModelCompilerTest.java index 2c579f065a0..85277cc8989 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/phases/ExplicitCanonicalModelCompilerTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/phases/ExplicitCanonicalModelCompilerTest.java @@ -18,26 +18,25 @@ */ package org.drools.compiler.integrationtests.phases; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - +import org.drools.codegen.common.GeneratedFile; import org.drools.compiler.builder.impl.BuildResultCollectorImpl; import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.compiler.builder.impl.resources.DrlResourceHandler; import org.drools.compiler.lang.descr.CompositePackageDescr; import org.drools.drl.ast.descr.PackageDescr; import org.drools.drl.parser.DroolsParserException; -import org.drools.model.codegen.execmodel.GeneratedFile; +import org.drools.io.ClassPathResource; import org.drools.model.codegen.execmodel.PackageSources; import org.drools.model.codegen.tool.ExplicitCanonicalModelCompiler; -import org.drools.io.ClassPathResource; import org.junit.Test; import org.kie.api.io.Resource; import org.kie.internal.builder.KnowledgeBuilderFactory; -import static java.util.Arrays.asList; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + import static org.assertj.core.api.Assertions.assertThat; public class ExplicitCanonicalModelCompilerTest { diff --git a/kie-drl/kie-drl-compilation-common/src/main/java/org/kie/drl/engine/compilation/utils/DrlCompilerHelper.java b/kie-drl/kie-drl-compilation-common/src/main/java/org/kie/drl/engine/compilation/utils/DrlCompilerHelper.java index 46ac2ae8032..217de997808 100644 --- a/kie-drl/kie-drl-compilation-common/src/main/java/org/kie/drl/engine/compilation/utils/DrlCompilerHelper.java +++ b/kie-drl/kie-drl-compilation-common/src/main/java/org/kie/drl/engine/compilation/utils/DrlCompilerHelper.java @@ -18,17 +18,7 @@ */ package org.kie.drl.engine.compilation.utils; -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - +import org.drools.codegen.common.GeneratedFile; import org.drools.compiler.builder.impl.BuildResultCollector; import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.compiler.builder.impl.resources.DrlResourceHandler; @@ -36,7 +26,6 @@ import org.drools.drl.ast.descr.PackageDescr; import org.drools.drl.parser.DroolsParserException; import org.drools.io.FileSystemResource; -import org.drools.model.codegen.execmodel.GeneratedFile; import org.drools.model.codegen.execmodel.PackageModelWriter; import org.drools.model.codegen.project.CodegenPackageSources; import org.drools.model.codegen.project.RuleCodegenError; @@ -58,6 +47,17 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + public class DrlCompilerHelper { private static final Logger logger = LoggerFactory.getLogger(DrlCompilerHelper.class); @@ -111,10 +111,10 @@ public static ExecutableModelClassesContainer pkgDescrToExecModel(Collection sourceCode = new HashMap<>(); for (GeneratedFile generatedFile : modelFiles) { - String key = generatedFile.getPath() + String key = generatedFile.relativePath() .replace(".java", "") .replace(File.separatorChar, '.'); - String value = new String(generatedFile.getData(), + String value = new String(generatedFile.contents(), StandardCharsets.UTF_8); sourceCode.put(key, value); } diff --git a/kie-drl/kie-drl-compilation-common/src/test/java/org/kie/drl/engine/compilation/utils/DrlCompilerHelperTest.java b/kie-drl/kie-drl-compilation-common/src/test/java/org/kie/drl/engine/compilation/utils/DrlCompilerHelperTest.java index 9c63d7f67d7..88bfa9c4247 100644 --- a/kie-drl/kie-drl-compilation-common/src/test/java/org/kie/drl/engine/compilation/utils/DrlCompilerHelperTest.java +++ b/kie-drl/kie-drl-compilation-common/src/test/java/org/kie/drl/engine/compilation/utils/DrlCompilerHelperTest.java @@ -90,7 +90,7 @@ private void commonVerifyEfestoCompilationOutput(EfestoCompilationOutput toVerif assertThat(retrieved.getModelLocalUriId().model()).isEqualTo("drl"); assertThat(retrieved.getModelLocalUriId().basePath()).isEqualTo(SLASH + baseBath); assertThat(retrieved.getFullClassNames()).hasSize(3); // magic number due to compiled resources - assertThat(retrieved.getCompiledClassesMap()).hasSize(45); // magic number due to compiled resources + assertThat(retrieved.getCompiledClassesMap()).hasSize(49); // magic number due to compiled resources } } \ No newline at end of file diff --git a/kie-internal/src/main/java/org/kie/internal/ruleunit/RuleUnitDescription.java b/kie-internal/src/main/java/org/kie/internal/ruleunit/RuleUnitDescription.java index 400644c4702..cd0a33e5e9e 100644 --- a/kie-internal/src/main/java/org/kie/internal/ruleunit/RuleUnitDescription.java +++ b/kie-internal/src/main/java/org/kie/internal/ruleunit/RuleUnitDescription.java @@ -18,13 +18,13 @@ */ package org.kie.internal.ruleunit; +import org.kie.api.conf.KieBaseOption; +import org.kie.api.runtime.conf.ClockTypeOption; + import java.lang.reflect.Type; import java.util.Collection; import java.util.Optional; -import org.kie.api.conf.KieBaseOption; -import org.kie.api.runtime.conf.ClockTypeOption; - public interface RuleUnitDescription { default Class getRuleUnitClass() { @@ -60,4 +60,8 @@ default String getEntryPointName(String name) { ClockTypeOption getClockType(); Collection getKieBaseOptions(); + + default boolean isGenerated() { + return false; + } } diff --git a/kie-internal/src/main/java/org/kie/internal/ruleunit/RuleUnitVariable.java b/kie-internal/src/main/java/org/kie/internal/ruleunit/RuleUnitVariable.java index 0a6163c80e0..7b0e9508cc4 100644 --- a/kie-internal/src/main/java/org/kie/internal/ruleunit/RuleUnitVariable.java +++ b/kie-internal/src/main/java/org/kie/internal/ruleunit/RuleUnitVariable.java @@ -23,6 +23,7 @@ public interface RuleUnitVariable { boolean isDataSource(); + boolean isDataStore(); String getName(); From 0bad651e6bf6263f361523746fa110baf3260b00 Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Wed, 11 Oct 2023 15:04:27 +0200 Subject: [PATCH 07/41] [KIE-627] remove no longer necesary PredicateConstraint (#5551) --- .../drools/base/rule/PredicateConstraint.java | 379 ------------------ .../rule/accessor/PredicateExpression.java | 38 -- .../org/drools/compiler/compiler/Dialect.java | 20 +- .../compiler/rule/builder/PatternBuilder.java | 84 ++-- .../rule/builder/PredicateBuilder.java | 35 -- .../core/rule/JavaDialectRuntimeData.java | 49 +-- .../mvel/asm/ASMPredicateStubBuilder.java | 127 ------ .../mvel/asm/AbstractASMPredicateBuilder.java | 58 --- .../drools/mvel/asm/PredicateGenerator.java | 124 ------ .../org/drools/mvel/asm/PredicateStub.java | 26 -- .../org/drools/mvel/builder/MVELDialect.java | 41 +- .../org/drools/mvel/java/JavaDialect.java | 7 - .../org/drools/mvel/java/javaInvokers.mvel | 41 -- .../mvel/CompositeObjectSinkAdapterTest.java | 85 +++- .../org/drools/mvel/FieldConstraintTest.java | 123 +----- .../PackageBuilderConfigurationTest.java | 27 +- 16 files changed, 160 insertions(+), 1104 deletions(-) delete mode 100644 drools-base/src/main/java/org/drools/base/rule/PredicateConstraint.java delete mode 100644 drools-base/src/main/java/org/drools/base/rule/accessor/PredicateExpression.java delete mode 100644 drools-compiler/src/main/java/org/drools/compiler/rule/builder/PredicateBuilder.java delete mode 100644 drools-mvel/src/main/java/org/drools/mvel/asm/ASMPredicateStubBuilder.java delete mode 100644 drools-mvel/src/main/java/org/drools/mvel/asm/AbstractASMPredicateBuilder.java delete mode 100644 drools-mvel/src/main/java/org/drools/mvel/asm/PredicateGenerator.java delete mode 100644 drools-mvel/src/main/java/org/drools/mvel/asm/PredicateStub.java diff --git a/drools-base/src/main/java/org/drools/base/rule/PredicateConstraint.java b/drools-base/src/main/java/org/drools/base/rule/PredicateConstraint.java deleted file mode 100644 index 9a78c0ba00c..00000000000 --- a/drools-base/src/main/java/org/drools/base/rule/PredicateConstraint.java +++ /dev/null @@ -1,379 +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.base.rule; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.drools.base.base.ValueResolver; -import org.drools.base.rule.accessor.CompiledInvoker; -import org.drools.base.rule.accessor.Evaluator; -import org.drools.base.rule.accessor.PredicateExpression; -import org.drools.base.rule.accessor.Wireable; -import org.drools.base.reteoo.BaseTuple; -import org.drools.base.rule.accessor.ReadAccessor; -import org.kie.api.runtime.rule.FactHandle; - -/** - * A predicate can be written as a top level constraint or be nested - * inside inside a field constraint (and as so, must implement the - * Restriction interface). - */ -public class PredicateConstraint extends MutableTypeConstraint - implements - Wireable, - Externalizable { - - private static final long serialVersionUID = 510l; - - private PredicateExpression expression; - - private Declaration[] requiredDeclarations; - - private Declaration[] previousDeclarations; - - private Declaration[] localDeclarations; - - private List cloned = Collections.emptyList(); - - private static final Declaration[] EMPTY_DECLARATIONS = new Declaration[0]; - - public PredicateConstraint() { - this( null ); - } - - public PredicateConstraint(final PredicateExpression evaluator) { - this( evaluator, - null, - null ); - } - - public PredicateConstraint(final Declaration[] previousDeclarations, - final Declaration[] localDeclarations) { - this( null, - previousDeclarations, - localDeclarations ); - } - - public PredicateConstraint(final PredicateExpression expression, - final Declaration[] previousDeclarations, - final Declaration[] localDeclarations ) { - - this.expression = expression; - - if ( previousDeclarations == null ) { - this.previousDeclarations = PredicateConstraint.EMPTY_DECLARATIONS; - } else { - this.previousDeclarations = previousDeclarations; - } - - if ( localDeclarations == null ) { - this.localDeclarations = PredicateConstraint.EMPTY_DECLARATIONS; - } else { - this.localDeclarations = localDeclarations; - } - - this.requiredDeclarations = new Declaration[this.previousDeclarations.length + this.localDeclarations.length]; - System.arraycopy( this.previousDeclarations, - 0, - this.requiredDeclarations, - 0, - this.previousDeclarations.length ); - System.arraycopy( this.localDeclarations, - 0, - this.requiredDeclarations, - this.previousDeclarations.length, - this.localDeclarations.length ); - } - - @SuppressWarnings("unchecked") - public void readExternal(ObjectInput in) throws IOException, - ClassNotFoundException { - super.readExternal( in ); - this.expression = (PredicateExpression) in.readObject(); - this.requiredDeclarations = (Declaration[]) in.readObject(); - this.previousDeclarations = (Declaration[]) in.readObject(); - this.localDeclarations = (Declaration[]) in.readObject(); - this.cloned = (List) in.readObject(); - } - - public void writeExternal(ObjectOutput out) throws IOException { - super.writeExternal( out ); - if ( CompiledInvoker.isCompiledInvoker(this.expression) ) { - out.writeObject( null ); - } else { - out.writeObject( this.expression ); - } - out.writeObject( this.requiredDeclarations ); - out.writeObject( this.previousDeclarations ); - out.writeObject( this.localDeclarations ); - out.writeObject( this.cloned ); - } - - public Declaration[] getRequiredDeclarations() { - return this.requiredDeclarations; - } - - public void replaceDeclaration(Declaration oldDecl, - Declaration newDecl) { - for ( int i = 0; i < this.requiredDeclarations.length; i++ ) { - if ( this.requiredDeclarations[i].equals( oldDecl ) ) { - this.requiredDeclarations[i] = newDecl; - } - } - for ( int i = 0; i < this.previousDeclarations.length; i++ ) { - if ( this.previousDeclarations[i].equals( oldDecl ) ) { - this.previousDeclarations[i] = newDecl; - } - } - for ( int i = 0; i < this.localDeclarations.length; i++ ) { - if ( this.localDeclarations[i].equals( oldDecl ) ) { - this.localDeclarations[i] = newDecl; - } - } - } - - public void wire(Object object) { - setPredicateExpression( (PredicateExpression) object ); - for ( PredicateConstraint clone : this.cloned ) { - clone.wire( object ); - } - } - - public void setPredicateExpression(final PredicateExpression expression) { - this.expression = expression; - } - - public PredicateExpression getPredicateExpression() { - return this.expression; - } - - public boolean isTemporal() { - return false; - } - - public String toString() { - return "[PredicateConstraint previousDeclarations=" + Arrays.toString(this.previousDeclarations) + - " localDeclarations=" + Arrays.toString(this.localDeclarations) + "]"; - } - - public int hashCode() { - return this.expression != null ? this.expression.hashCode() : 0; - } - - public boolean equals(final Object object) { - if ( object == this ) { - return true; - } - - if ( object == null || object.getClass() != PredicateConstraint.class ) { - return false; - } - - final PredicateConstraint other = (PredicateConstraint) object; - - if ( this.previousDeclarations.length != other.previousDeclarations.length ) { - return false; - } - - if ( this.localDeclarations.length != other.localDeclarations.length ) { - return false; - } - - for ( int i = 0, length = this.previousDeclarations.length; i < length; i++ ) { - if (this.previousDeclarations[i].getTupleIndex() != other.previousDeclarations[i].getTupleIndex() ) { - return false; - } - - if ( !this.previousDeclarations[i].getExtractor().equals( other.previousDeclarations[i].getExtractor() ) ) { - return false; - } - } - - for ( int i = 0, length = this.localDeclarations.length; i < length; i++ ) { - if (this.localDeclarations[i].getTupleIndex() != other.localDeclarations[i].getTupleIndex() ) { - return false; - } - - if ( !this.localDeclarations[i].getExtractor().equals( other.localDeclarations[i].getExtractor() ) ) { - return false; - } - } - - return this.expression.equals( other.expression ); - } - - public ContextEntry createContextEntry() { - PredicateContextEntry ctx = new PredicateContextEntry(); - ctx.dialectContext = this.expression.createContext(); - return ctx; - } - - public boolean isAllowed(final FactHandle handle, - final ValueResolver valueResolver) { - try { - return this.expression.evaluate( handle, - null, - this.previousDeclarations, - this.localDeclarations, - valueResolver, - null ); //((PredicateContextEntry) ctx).dialectContext ); - } catch ( final Exception e ) { - throw new RuntimeException( "Exception executing predicate " + this.expression, - e ); - } - } - - public boolean isAllowed(ReadAccessor extractor, - final FactHandle handle, - final ValueResolver valueResolver, - ContextEntry context) { - throw new UnsupportedOperationException( "Method not supported. Please contact development team." ); - } - - public boolean isAllowedCachedLeft(final ContextEntry context, - final FactHandle handle) { - try { - final PredicateContextEntry ctx = (PredicateContextEntry) context; - return this.expression.evaluate( handle, - ctx.tuple, - this.previousDeclarations, - this.localDeclarations, - ctx.valueResolver, - ctx.dialectContext ); - } catch ( final Exception e ) { - throw new RuntimeException( "Exception executing predicate " + this.expression, - e ); - } - } - - public boolean isAllowedCachedRight(final BaseTuple tuple, - final ContextEntry context) { - try { - final PredicateContextEntry ctx = (PredicateContextEntry) context; - return this.expression.evaluate( ctx.rightHandle, - tuple, - this.previousDeclarations, - this.localDeclarations, - ctx.valueResolver, - ctx.dialectContext ); - } catch ( final Exception e ) { - throw new RuntimeException( "Exception executing predicate " + this.expression, - e ); - } - } - - public PredicateConstraint clone() { - Declaration[] previous = new Declaration[this.previousDeclarations.length]; - for ( int i = 0; i < previous.length; i++ ) { - previous[i] = this.previousDeclarations[i].clone(); - } - - Declaration[] local = new Declaration[this.localDeclarations.length]; - for ( int i = 0; i < local.length; i++ ) { - local[i] = this.localDeclarations[i].clone(); - } - - PredicateConstraint clone = new PredicateConstraint( this.expression, - previous, - local ); - - if ( this.cloned == Collections.EMPTY_LIST ) { - this.cloned = new ArrayList<>( 1 ); - } - - this.cloned.add( clone ); - - return clone; - - } - - public static class PredicateContextEntry - implements - ContextEntry { - - private static final long serialVersionUID = 510l; - - public BaseTuple tuple; - public FactHandle rightHandle; - public ValueResolver valueResolver; - - public Object dialectContext; - - private ContextEntry entry; - - public PredicateContextEntry() { - } - - public void readExternal(ObjectInput in) throws IOException, - ClassNotFoundException { - tuple = (BaseTuple) in.readObject(); - rightHandle = (FactHandle) in.readObject(); - valueResolver = (ValueResolver) in.readObject(); - dialectContext = in.readObject(); - entry = (ContextEntry) in.readObject(); - } - - public void writeExternal(ObjectOutput out) throws IOException { - out.writeObject( tuple ); - out.writeObject( rightHandle ); - out.writeObject( valueResolver ); - out.writeObject( dialectContext ); - out.writeObject( entry ); - } - - public ContextEntry getNext() { - return this.entry; - } - - public void setNext(final ContextEntry entry) { - this.entry = entry; - } - - public void updateFromFactHandle(final ValueResolver valueResolver, - final FactHandle handle) { - this.valueResolver = valueResolver; - this.rightHandle = handle; - } - - public void updateFromTuple(final ValueResolver valueResolver, - final BaseTuple tuple) { - this.valueResolver = valueResolver; - this.tuple = tuple; - } - - public void resetTuple() { - this.tuple = null; - } - - public void resetFactHandle() { - this.rightHandle = null; - } - } - - public Evaluator getEvaluator() { - return null; - } -} diff --git a/drools-base/src/main/java/org/drools/base/rule/accessor/PredicateExpression.java b/drools-base/src/main/java/org/drools/base/rule/accessor/PredicateExpression.java deleted file mode 100644 index 6dd3f6c55e6..00000000000 --- a/drools-base/src/main/java/org/drools/base/rule/accessor/PredicateExpression.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.drools.base.rule.accessor; - -import org.drools.base.base.ValueResolver; -import org.drools.base.reteoo.BaseTuple; -import org.drools.base.rule.Declaration; -import org.kie.api.runtime.rule.FactHandle; - -public interface PredicateExpression - extends - Invoker { - - Object createContext(); - - public boolean evaluate(FactHandle handle, - BaseTuple tuple, - Declaration[] previousDeclarations, - Declaration[] localDeclarations, - ValueResolver valueResolver, - Object context ) throws Exception; -} diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/Dialect.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/Dialect.java index 228c45ccda6..c679080d1f1 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/Dialect.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/Dialect.java @@ -18,9 +18,8 @@ */ package org.drools.compiler.compiler; -import java.util.List; -import java.util.Map; - +import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.compiler.rule.builder.AccumulateBuilder; import org.drools.compiler.rule.builder.ConsequenceBuilder; import org.drools.compiler.rule.builder.EnabledBuilder; @@ -32,15 +31,11 @@ import org.drools.compiler.rule.builder.PackageBuildContext; import org.drools.compiler.rule.builder.PatternBuilder; import org.drools.compiler.rule.builder.PatternBuilderForQuery; -import org.drools.compiler.rule.builder.PredicateBuilder; import org.drools.compiler.rule.builder.RuleBuildContext; import org.drools.compiler.rule.builder.RuleClassBuilder; import org.drools.compiler.rule.builder.RuleConditionBuilder; import org.drools.compiler.rule.builder.SalienceBuilder; -import org.drools.util.TypeResolver; -import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.core.rule.JavaDialectRuntimeData; -import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.drl.ast.descr.AndDescr; import org.drools.drl.ast.descr.BaseDescr; import org.drools.drl.ast.descr.EntryPointDescr; @@ -52,9 +47,13 @@ import org.drools.drl.ast.descr.PatternDescr; import org.drools.drl.ast.descr.ProcessDescr; import org.drools.drl.ast.descr.RuleDescr; +import org.drools.util.TypeResolver; import org.kie.api.io.Resource; import org.kie.internal.builder.KnowledgeBuilderResult; +import java.util.List; +import java.util.Map; + import static org.drools.base.base.CoreComponentsBuilder.throwExceptionForMissingMvel; /** @@ -85,8 +84,6 @@ public interface Dialect { GroupByBuilder getGroupByBuilder(); - PredicateBuilder getPredicateBuilder(); - ConsequenceBuilder getConsequenceBuilder(); RuleClassBuilder getRuleClassBuilder(); @@ -259,11 +256,6 @@ public GroupByBuilder getGroupByBuilder() { return throwExceptionForMissingMvel(); } - @Override - public PredicateBuilder getPredicateBuilder() { - return throwExceptionForMissingMvel(); - } - @Override public ConsequenceBuilder getConsequenceBuilder() { return throwExceptionForMissingMvel(); diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java index 0fd9d75de1b..3f0aec39b78 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java @@ -18,36 +18,8 @@ */ package org.drools.compiler.rule.builder; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; - -import org.drools.compiler.builder.impl.TypeDeclarationContext; -import org.drools.compiler.compiler.AnalysisResult; -import org.drools.compiler.compiler.BoundIdentifiers; -import org.drools.compiler.compiler.DescrBuildError; -import org.drools.compiler.compiler.Dialect; -import org.drools.compiler.compiler.DroolsErrorWrapper; -import org.drools.compiler.compiler.DroolsWarningWrapper; -import org.drools.compiler.compiler.PackageRegistry; -import org.drools.compiler.lang.DescrDumper; -import org.drools.compiler.lang.DumperContext; -import org.drools.compiler.rule.builder.EvaluatorDefinition.Target; -import org.drools.compiler.rule.builder.XpathAnalysis.XpathPart; -import org.drools.compiler.rule.builder.util.ConstraintUtil; import org.drools.base.base.AcceptsClassObjectType; import org.drools.base.base.ClassObjectType; -import org.drools.core.base.FieldNameSupplier; import org.drools.base.base.ObjectType; import org.drools.base.base.ValueType; import org.drools.base.definitions.InternalKnowledgePackage; @@ -60,14 +32,10 @@ import org.drools.base.facttemplates.FactTemplateFieldExtractor; import org.drools.base.facttemplates.FactTemplateObjectType; import org.drools.base.reteoo.SortDeclarations; -import org.drools.core.rule.BehaviorRuntime; import org.drools.base.rule.Declaration; import org.drools.base.rule.Pattern; import org.drools.base.rule.PatternSource; -import org.drools.base.rule.PredicateConstraint; import org.drools.base.rule.RuleConditionElement; -import org.drools.core.rule.SlidingLengthWindow; -import org.drools.core.rule.SlidingTimeWindow; import org.drools.base.rule.TypeDeclaration; import org.drools.base.rule.XpathBackReference; import org.drools.base.rule.accessor.AcceptsReadAccessor; @@ -80,6 +48,23 @@ import org.drools.base.rule.constraint.XpathConstraint; import org.drools.base.time.TimeUtils; import org.drools.base.util.index.ConstraintTypeOperator; +import org.drools.compiler.builder.impl.TypeDeclarationContext; +import org.drools.compiler.compiler.AnalysisResult; +import org.drools.compiler.compiler.BoundIdentifiers; +import org.drools.compiler.compiler.DescrBuildError; +import org.drools.compiler.compiler.Dialect; +import org.drools.compiler.compiler.DroolsErrorWrapper; +import org.drools.compiler.compiler.DroolsWarningWrapper; +import org.drools.compiler.compiler.PackageRegistry; +import org.drools.compiler.lang.DescrDumper; +import org.drools.compiler.lang.DumperContext; +import org.drools.compiler.rule.builder.EvaluatorDefinition.Target; +import org.drools.compiler.rule.builder.XpathAnalysis.XpathPart; +import org.drools.compiler.rule.builder.util.ConstraintUtil; +import org.drools.core.base.FieldNameSupplier; +import org.drools.core.rule.BehaviorRuntime; +import org.drools.core.rule.SlidingLengthWindow; +import org.drools.core.rule.SlidingTimeWindow; import org.drools.drl.ast.descr.AnnotationDescr; import org.drools.drl.ast.descr.AtomicExprDescr; import org.drools.drl.ast.descr.BaseDescr; @@ -112,6 +97,20 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; + import static org.drools.compiler.lang.DescrDumper.normalizeEval; import static org.drools.compiler.rule.builder.util.AnnotationFactory.getTypedAnnotation; import static org.drools.compiler.rule.builder.util.PatternBuilderUtil.getNormalizeDate; @@ -1521,27 +1520,6 @@ protected Constraint buildEval(final RuleBuildContext context, Arrays.sort(previousDeclarations, SortDeclarations.instance); Arrays.sort(localDeclarations, SortDeclarations.instance); - boolean isJavaEval = isEvalExpression && context.getDialect().isJava(); - - if (isJavaEval) { - final PredicateConstraint predicateConstraint = new PredicateConstraint(null, - previousDeclarations, - localDeclarations); - - final PredicateBuilder builder = context.getDialect().getPredicateBuilder(); - - builder.build(context, - usedIdentifiers, - previousDeclarations, - localDeclarations, - predicateConstraint, - predicateDescr, - analysis); - - return predicateConstraint; - } - - String[] requiredGlobals = usedIdentifiers.getGlobals().keySet().toArray(new String[usedIdentifiers.getGlobals().size()]); Declaration[] mvelDeclarations = new Declaration[previousDeclarations.length + localDeclarations.length + requiredGlobals.length]; int i = 0; diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PredicateBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PredicateBuilder.java deleted file mode 100644 index 771f7c1241e..00000000000 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PredicateBuilder.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.drools.compiler.rule.builder; - -import org.drools.compiler.compiler.AnalysisResult; -import org.drools.compiler.compiler.BoundIdentifiers; -import org.drools.drl.ast.descr.PredicateDescr; -import org.drools.base.rule.Declaration; -import org.drools.base.rule.PredicateConstraint; - -public interface PredicateBuilder { - public void build(final RuleBuildContext context, - final BoundIdentifiers usedIdentifiers, - final Declaration[] previousDeclarations, - final Declaration[] localDeclarations, - final PredicateConstraint predicateConstraint, - final PredicateDescr predicateDescr, - AnalysisResult analysis); -} diff --git a/drools-core/src/main/java/org/drools/core/rule/JavaDialectRuntimeData.java b/drools-core/src/main/java/org/drools/core/rule/JavaDialectRuntimeData.java index 0597748a0ef..bef6fa7a4ca 100644 --- a/drools-core/src/main/java/org/drools/core/rule/JavaDialectRuntimeData.java +++ b/drools-core/src/main/java/org/drools/core/rule/JavaDialectRuntimeData.java @@ -18,6 +18,24 @@ */ package org.drools.core.rule; +import org.drools.base.definitions.impl.KnowledgePackageImpl; +import org.drools.base.definitions.rule.impl.QueryImpl; +import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.ConditionalElement; +import org.drools.base.rule.DialectRuntimeData; +import org.drools.base.rule.DialectRuntimeRegistry; +import org.drools.base.rule.EvalCondition; +import org.drools.base.rule.Function; +import org.drools.base.rule.GroupElement; +import org.drools.base.rule.accessor.Wireable; +import org.drools.core.util.KeyStoreHelper; +import org.drools.util.StringUtils; +import org.drools.wiring.api.ComponentsFactory; +import org.drools.wiring.api.classloader.ProjectClassLoader; +import org.kie.internal.concurrent.ExecutorProviderFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.Externalizable; @@ -40,27 +58,6 @@ import java.util.concurrent.CompletionService; import java.util.concurrent.ConcurrentHashMap; -import org.drools.base.definitions.impl.KnowledgePackageImpl; -import org.drools.base.definitions.rule.impl.QueryImpl; -import org.drools.base.definitions.rule.impl.RuleImpl; -import org.drools.base.rule.ConditionalElement; -import org.drools.base.rule.DialectRuntimeData; -import org.drools.base.rule.DialectRuntimeRegistry; -import org.drools.base.rule.EvalCondition; -import org.drools.base.rule.Function; -import org.drools.base.rule.GroupElement; -import org.drools.base.rule.Pattern; -import org.drools.base.rule.PredicateConstraint; -import org.drools.base.rule.constraint.Constraint; -import org.drools.base.rule.accessor.Wireable; -import org.drools.core.util.KeyStoreHelper; -import org.drools.util.StringUtils; -import org.drools.wiring.api.ComponentsFactory; -import org.drools.wiring.api.classloader.ProjectClassLoader; -import org.kie.internal.concurrent.ExecutorProviderFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import static org.drools.util.ClassUtils.convertClassToResourcePath; import static org.drools.util.ClassUtils.convertResourceToClassName; @@ -392,8 +389,6 @@ private void removeClasses( final ConditionalElement ce ) { for (final Object object : group.getChildren()) { if (object instanceof ConditionalElement) { removeClasses((ConditionalElement) object); - } else if (object instanceof Pattern) { - removeClasses((Pattern) object); } } } else if (ce instanceof EvalCondition) { @@ -401,14 +396,6 @@ private void removeClasses( final ConditionalElement ce ) { } } - private void removeClasses( final Pattern pattern ) { - for (final Constraint object : pattern.getConstraints()) { - if (object instanceof PredicateConstraint) { - remove(((PredicateConstraint) object).getPredicateExpression().getClass().getName()); - } - } - } - public byte[] read( final String resourceName ) { return getStore().get( resourceName ); } diff --git a/drools-mvel/src/main/java/org/drools/mvel/asm/ASMPredicateStubBuilder.java b/drools-mvel/src/main/java/org/drools/mvel/asm/ASMPredicateStubBuilder.java deleted file mode 100644 index 50b1071436e..00000000000 --- a/drools-mvel/src/main/java/org/drools/mvel/asm/ASMPredicateStubBuilder.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.drools.mvel.asm; - -import java.util.Map; - -import org.drools.base.base.ValueResolver; -import org.drools.compiler.rule.builder.RuleBuildContext; -import org.drools.base.reteoo.BaseTuple; -import org.drools.base.rule.Declaration; -import org.drools.base.rule.accessor.CompiledInvoker; -import org.drools.base.rule.accessor.PredicateExpression; -import org.drools.mvel.asm.ClassGenerator.MethodBody; -import org.kie.api.runtime.rule.FactHandle; -import org.mvel2.asm.Label; -import org.mvel2.asm.MethodVisitor; - -import static org.mvel2.asm.Opcodes.ACC_PRIVATE; -import static org.mvel2.asm.Opcodes.ACC_PUBLIC; -import static org.mvel2.asm.Opcodes.ACC_VOLATILE; -import static org.mvel2.asm.Opcodes.ACONST_NULL; -import static org.mvel2.asm.Opcodes.ALOAD; -import static org.mvel2.asm.Opcodes.ARETURN; -import static org.mvel2.asm.Opcodes.ASTORE; -import static org.mvel2.asm.Opcodes.ATHROW; -import static org.mvel2.asm.Opcodes.DUP; -import static org.mvel2.asm.Opcodes.GOTO; -import static org.mvel2.asm.Opcodes.IFNONNULL; -import static org.mvel2.asm.Opcodes.IRETURN; -import static org.mvel2.asm.Opcodes.MONITORENTER; -import static org.mvel2.asm.Opcodes.MONITOREXIT; -import static org.mvel2.asm.Opcodes.RETURN; - -public class ASMPredicateStubBuilder extends AbstractASMPredicateBuilder { - - protected byte[] createPredicateBytecode(final RuleBuildContext ruleContext, final Map vars) { - final InvokerDataProvider data = new InvokerContext(vars); - final ClassGenerator generator = InvokerGenerator.createInvokerStubGenerator(data, ruleContext); - createStubPredicate(generator, data, vars); - return generator.generateBytecode(); - } - - private void createStubPredicate(final ClassGenerator generator, final InvokerDataProvider data, final Map vars) { - generator.setInterfaces(PredicateStub.class, CompiledInvoker.class) - .addField(ACC_PRIVATE + ACC_VOLATILE, "predicate", PredicateExpression.class); - - generator.addMethod(ACC_PUBLIC, "createContext", generator.methodDescr(Object.class), new MethodBody() { - public void body(MethodVisitor mv) { - mv.visitInsn(ACONST_NULL); - mv.visitInsn(ARETURN); - } - }).addMethod(ACC_PUBLIC, "evaluate", generator.methodDescr(Boolean.TYPE, FactHandle.class, BaseTuple.class, Declaration[].class, Declaration[].class, ValueResolver.class, Object.class), new String[]{"java/lang/Exception"}, new MethodBody() { - public void body(MethodVisitor mv) { - Label syncStart = new Label(); - Label syncEnd = new Label(); - Label l1 = new Label(); - Label l2 = new Label(); - mv.visitTryCatchBlock(syncStart, l1, l2, null); - Label l3 = new Label(); - mv.visitTryCatchBlock(l2, l3, l2, null); - getFieldFromThis("predicate", PredicateExpression.class); - mv.visitJumpInsn(IFNONNULL, syncEnd); - mv.visitVarInsn(ALOAD, 0); - mv.visitInsn(DUP); - mv.visitVarInsn(ASTORE, 7); - // synchronized(this) { - mv.visitInsn(MONITORENTER); - mv.visitLabel(syncStart); - getFieldFromThis("predicate", PredicateExpression.class); - // if (predicate == null) ... - Label ifNotInitialized = new Label(); - mv.visitJumpInsn(IFNONNULL, ifNotInitialized); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitVarInsn(ALOAD, 3); - mv.visitVarInsn(ALOAD, 4); - mv.visitVarInsn(ALOAD, 5); - // ... PredicateGenerator.generate(this, tuple, declarations, declarations, workingMemory) - invokeStatic(PredicateGenerator.class, "generate", null, PredicateStub.class, BaseTuple.class, Declaration[].class, Declaration[].class, ValueResolver.class); - mv.visitLabel(ifNotInitialized); - mv.visitVarInsn(ALOAD, 7); - mv.visitInsn(MONITOREXIT); - mv.visitLabel(l1); - mv.visitJumpInsn(GOTO, syncEnd); - mv.visitLabel(l2); - mv.visitVarInsn(ASTORE, 8); - mv.visitVarInsn(ALOAD, 7); - mv.visitInsn(MONITOREXIT); - mv.visitLabel(l3); - mv.visitVarInsn(ALOAD, 8); - mv.visitInsn(ATHROW); - mv.visitLabel(syncEnd); - // } end of synchronized - getFieldFromThis("predicate", PredicateExpression.class); - mv.visitVarInsn(ALOAD, 1); - mv.visitVarInsn(ALOAD, 2); - mv.visitVarInsn(ALOAD, 3); - mv.visitVarInsn(ALOAD, 4); - mv.visitVarInsn(ALOAD, 5); - mv.visitVarInsn(ALOAD, 6); - invokeInterface(PredicateExpression.class, "evaluate", Boolean.TYPE, FactHandle.class, BaseTuple.class, Declaration[].class, Declaration[].class, ValueResolver.class, Object.class); - mv.visitInsn(IRETURN); - } - }).addMethod(ACC_PUBLIC, "setPredicate", generator.methodDescr(null, PredicateExpression.class), new ClassGenerator.MethodBody() { - public void body(MethodVisitor mv) { - putFieldInThisFromRegistry("predicate", PredicateExpression.class, 1); - mv.visitInsn(RETURN); - } - }); - } - } diff --git a/drools-mvel/src/main/java/org/drools/mvel/asm/AbstractASMPredicateBuilder.java b/drools-mvel/src/main/java/org/drools/mvel/asm/AbstractASMPredicateBuilder.java deleted file mode 100644 index e459c97fd50..00000000000 --- a/drools-mvel/src/main/java/org/drools/mvel/asm/AbstractASMPredicateBuilder.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.drools.mvel.asm; - -import java.util.Map; - -import org.drools.compiler.compiler.AnalysisResult; -import org.drools.compiler.compiler.BoundIdentifiers; -import org.drools.drl.ast.descr.PredicateDescr; -import org.drools.compiler.rule.builder.PredicateBuilder; -import org.drools.compiler.rule.builder.RuleBuildContext; -import org.drools.mvel.java.JavaRuleBuilderHelper; -import org.drools.base.rule.Declaration; -import org.drools.base.rule.PredicateConstraint; - -public abstract class AbstractASMPredicateBuilder implements PredicateBuilder { - public void build(final RuleBuildContext context, - final BoundIdentifiers usedIdentifiers, - final Declaration[] previousDeclarations, - final Declaration[] localDeclarations, - final PredicateConstraint predicateConstraint, - final PredicateDescr predicateDescr, - final AnalysisResult analysis) { - - final String className = "predicate" + context.getNextId(); - predicateDescr.setClassMethodName( className ); - - final Map vars = JavaRuleBuilderHelper.createVariableContext(className, - (String) predicateDescr.getContent(), - context, - previousDeclarations, - localDeclarations, - usedIdentifiers.getGlobals()); - - JavaRuleBuilderHelper.generateMethodTemplate("predicateMethod", context, vars); - - byte[] bytecode = createPredicateBytecode(context, vars); - JavaRuleBuilderHelper.registerInvokerBytecode(context, vars, bytecode, predicateConstraint); - } - - protected abstract byte[] createPredicateBytecode(RuleBuildContext context, Map vars); -} diff --git a/drools-mvel/src/main/java/org/drools/mvel/asm/PredicateGenerator.java b/drools-mvel/src/main/java/org/drools/mvel/asm/PredicateGenerator.java deleted file mode 100644 index 507af97b890..00000000000 --- a/drools-mvel/src/main/java/org/drools/mvel/asm/PredicateGenerator.java +++ /dev/null @@ -1,124 +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.mvel.asm; - -import java.util.List; - -import org.drools.base.base.ValueResolver; -import org.drools.core.common.InternalFactHandle; -import org.drools.base.reteoo.BaseTuple; -import org.drools.core.reteoo.LeftTuple; -import org.drools.base.rule.Declaration; -import org.drools.base.rule.accessor.CompiledInvoker; -import org.drools.base.rule.accessor.PredicateExpression; -import org.drools.mvel.asm.GeneratorHelper.DeclarationMatcher; -import org.kie.api.runtime.rule.FactHandle; -import org.mvel2.asm.MethodVisitor; - -import static org.drools.mvel.asm.GeneratorHelper.createInvokerClassGenerator; -import static org.drools.mvel.asm.GeneratorHelper.matchDeclarationsToTuple; -import static org.mvel2.asm.Opcodes.AALOAD; -import static org.mvel2.asm.Opcodes.ACC_PUBLIC; -import static org.mvel2.asm.Opcodes.ACONST_NULL; -import static org.mvel2.asm.Opcodes.ALOAD; -import static org.mvel2.asm.Opcodes.ARETURN; -import static org.mvel2.asm.Opcodes.ASTORE; -import static org.mvel2.asm.Opcodes.INVOKESTATIC; -import static org.mvel2.asm.Opcodes.IRETURN; - -public class PredicateGenerator { - public static void generate(final PredicateStub stub, - final BaseTuple tuple, - final Declaration[] previousDeclarations, - final Declaration[] localDeclarations, - final ValueResolver valueResolver) { - - final String[] globals = stub.getGlobals(); - final String[] globalTypes = stub.getGlobalTypes(); - - // Sort declarations based on their offset, so it can ascend the tuple's parents stack only once - final List declarationMatchers = matchDeclarationsToTuple(previousDeclarations); - - final ClassGenerator generator = createInvokerClassGenerator(stub, valueResolver) - .setInterfaces(PredicateExpression.class, CompiledInvoker.class); - - generator.addMethod(ACC_PUBLIC, "createContext", generator.methodDescr(Object.class), new ClassGenerator.MethodBody() { - public void body(MethodVisitor mv) { - mv.visitInsn(ACONST_NULL); - mv.visitInsn(ARETURN); - } - }).addMethod(ACC_PUBLIC, "evaluate", generator.methodDescr(Boolean.TYPE, FactHandle.class, BaseTuple.class, Declaration[].class, Declaration[].class, ValueResolver.class, Object.class), new String[]{"java/lang/Exception"}, new GeneratorHelper.EvaluateMethod() { - public void body(MethodVisitor mv) { - objAstorePos = 9; - - int[] previousDeclarationsParamsPos = new int[previousDeclarations.length]; - - mv.visitVarInsn( ALOAD, 1 ); - invokeInterface( FactHandle.class, "getObject", Object.class ); - mv.visitVarInsn( ASTORE, 1 ); - - - mv.visitVarInsn( ALOAD, 2 ); - cast(LeftTuple.class); - mv.visitVarInsn(ASTORE, 7); // LeftTuple - - BaseTuple currentTuple = tuple; - for (DeclarationMatcher matcher : declarationMatchers) { - int i = matcher.getMatcherIndex(); - previousDeclarationsParamsPos[i] = objAstorePos; - - currentTuple = traverseTuplesUntilDeclaration(currentTuple, matcher.getTupleIndex(), 7); - - mv.visitVarInsn(ALOAD, 3); - push(i); - mv.visitInsn(AALOAD); // declarations[i] - mv.visitVarInsn(ALOAD, 5); // reteEvaluator - - mv.visitVarInsn(ALOAD, 7); - invokeInterface(LeftTuple.class, "getFactHandle", InternalFactHandle.class); - invokeInterface(FactHandle.class, "getObject", Object.class); // tuple.getFactHandle().getObject() - - storeObjectFromDeclaration(previousDeclarations[i], previousDeclarations[i].getTypeName()); - } - - int[] localDeclarationsParamsPos = parseDeclarations(localDeclarations, 4, 2, 5, false); - - // @{ruleClassName}.@{methodName}(@foreach{previousDeclarations}, @foreach{localDeclarations}, @foreach{globals}) - StringBuilder predicateMethodDescr = new StringBuilder("("); - for (int i = 0; i < previousDeclarations.length; i++) { - load(previousDeclarationsParamsPos[i]); // previousDeclarations[i] - predicateMethodDescr.append(typeDescr(previousDeclarations[i].getTypeName())); - } - for (int i = 0; i < localDeclarations.length; i++) { - load(localDeclarationsParamsPos[i]); // localDeclarations[i] - predicateMethodDescr.append(typeDescr(localDeclarations[i].getTypeName())); - } - - // @foreach{type : globalTypes, identifier : globals} @{type} @{identifier} = ( @{type} ) workingMemory.getGlobal( "@{identifier}" ); - parseGlobals(globals, globalTypes, 5, predicateMethodDescr); - - predicateMethodDescr.append(")Z"); - mv.visitMethodInsn(INVOKESTATIC, stub.getInternalRuleClassName(), stub.getMethodName(), predicateMethodDescr.toString()); - mv.visitInsn(IRETURN); - } - }); - - stub.setPredicate(generator.newInstance()); - } -} diff --git a/drools-mvel/src/main/java/org/drools/mvel/asm/PredicateStub.java b/drools-mvel/src/main/java/org/drools/mvel/asm/PredicateStub.java deleted file mode 100644 index a3c2aab0b16..00000000000 --- a/drools-mvel/src/main/java/org/drools/mvel/asm/PredicateStub.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.drools.mvel.asm; - -import org.drools.base.rule.accessor.PredicateExpression; - -public interface PredicateStub extends PredicateExpression, InvokerStub { - - void setPredicate(PredicateExpression predicate); -} diff --git a/drools-mvel/src/main/java/org/drools/mvel/builder/MVELDialect.java b/drools-mvel/src/main/java/org/drools/mvel/builder/MVELDialect.java index b6131ce7ad0..7cb63bd657b 100644 --- a/drools-mvel/src/main/java/org/drools/mvel/builder/MVELDialect.java +++ b/drools-mvel/src/main/java/org/drools/mvel/builder/MVELDialect.java @@ -18,20 +18,10 @@ */ package org.drools.mvel.builder; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - +import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.base.definitions.rule.impl.QueryImpl; +import org.drools.base.rule.Declaration; +import org.drools.base.rule.LineMappings; import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.compiler.compiler.AnalysisResult; import org.drools.compiler.compiler.BoundIdentifiers; @@ -56,7 +46,6 @@ import org.drools.compiler.rule.builder.PatternBuilder; import org.drools.compiler.rule.builder.PatternBuilderForAbductiveQuery; import org.drools.compiler.rule.builder.PatternBuilderForQuery; -import org.drools.compiler.rule.builder.PredicateBuilder; import org.drools.compiler.rule.builder.RuleBuildContext; import org.drools.compiler.rule.builder.RuleClassBuilder; import org.drools.compiler.rule.builder.RuleConditionBuilder; @@ -64,10 +53,6 @@ import org.drools.compiler.rule.builder.WindowReferenceBuilder; import org.drools.compiler.rule.builder.dialect.DialectUtil; import org.drools.core.common.InternalWorkingMemory; -import org.drools.base.definitions.InternalKnowledgePackage; -import org.drools.base.definitions.rule.impl.QueryImpl; -import org.drools.base.rule.Declaration; -import org.drools.base.rule.LineMappings; import org.drools.core.rule.consequence.KnowledgeHelper; import org.drools.drl.ast.descr.AccumulateDescr; import org.drools.drl.ast.descr.AndDescr; @@ -103,6 +88,20 @@ import org.mvel2.MVEL; import org.mvel2.optimizers.OptimizerFactory; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + import static org.drools.compiler.lang.DescrDumper.WM_ARGUMENT; public class MVELDialect @@ -711,10 +710,6 @@ public EntryPointBuilder getEntryPointBuilder() { return ENTRY_POINT_BUILDER; } - public PredicateBuilder getPredicateBuilder() { - throw new RuntimeException("mvel PredicateBuilder is no longer in use"); - } - public SalienceBuilder getSalienceBuilder() { return SALIENCE_BUILDER; } diff --git a/drools-mvel/src/main/java/org/drools/mvel/java/JavaDialect.java b/drools-mvel/src/main/java/org/drools/mvel/java/JavaDialect.java index ae2ec1f294f..81584f6d2f5 100644 --- a/drools-mvel/src/main/java/org/drools/mvel/java/JavaDialect.java +++ b/drools-mvel/src/main/java/org/drools/mvel/java/JavaDialect.java @@ -81,7 +81,6 @@ import org.drools.compiler.rule.builder.NamedConsequenceBuilder; import org.drools.compiler.rule.builder.PackageBuildContext; import org.drools.compiler.rule.builder.PatternBuilder; -import org.drools.compiler.rule.builder.PredicateBuilder; import org.drools.compiler.rule.builder.PatternBuilderForQuery; import org.drools.compiler.rule.builder.RuleBuildContext; import org.drools.compiler.rule.builder.RuleClassBuilder; @@ -102,7 +101,6 @@ import org.drools.util.StringUtils; import org.drools.mvel.asm.ASMConsequenceStubBuilder; import org.drools.mvel.asm.ASMEvalStubBuilder; -import org.drools.mvel.asm.ASMPredicateStubBuilder; import org.drools.mvel.builder.MVELEnabledBuilder; import org.drools.mvel.builder.MVELFromBuilder; import org.drools.mvel.builder.MVELSalienceBuilder; @@ -133,7 +131,6 @@ public class JavaDialect implements Dialect { protected static final JavaGroupByBuilder GROUP_BY_BUILDER = new JavaGroupByBuilder(); protected static final RuleConditionBuilder EVAL_BUILDER = new ASMEvalStubBuilder(); - protected static final PredicateBuilder PREDICATE_BUILDER = new ASMPredicateStubBuilder(); protected static final ConsequenceBuilder CONSEQUENCE_BUILDER = new ASMConsequenceStubBuilder(); protected static final JavaRuleClassBuilder RULE_CLASS_BUILDER = new JavaRuleClassBuilder(); @@ -379,10 +376,6 @@ public RuleConditionBuilder getEvalBuilder() { return EVAL_BUILDER; } - public PredicateBuilder getPredicateBuilder() { - return PREDICATE_BUILDER; - } - public ConsequenceBuilder getConsequenceBuilder() { return CONSEQUENCE_BUILDER; } diff --git a/drools-mvel/src/main/resources/org/drools/mvel/java/javaInvokers.mvel b/drools-mvel/src/main/resources/org/drools/mvel/java/javaInvokers.mvel index 0129c773793..fa76eb26f47 100644 --- a/drools-mvel/src/main/resources/org/drools/mvel/java/javaInvokers.mvel +++ b/drools-mvel/src/main/resources/org/drools/mvel/java/javaInvokers.mvel @@ -78,47 +78,6 @@ public class @{invokerClassName} implements org.drools.base.rule.accessor.Return } @end{} -@declare{"predicateInvoker"} -package @{package}; - -public class @{invokerClassName} implements org.drools.base.rule.accessor.PredicateExpression, org.drools.base.rule.accessor.CompiledInvoker -{ - private static final long serialVersionUID = 510l; - - public Object createContext() { return null; } - - public boolean evaluate(org.kie.api.runtime.rule.FactHandle handle, - org.drools.base.reteoo.BaseTuple tuple, - org.drools.base.rule.Declaration[] previousDeclarations, - org.drools.base.rule.Declaration[] localDeclarations, - org.drools.base.base.ValueResolver valueResolver, - Object context ) throws Exception { - - @code{i0=0}@foreach{declr : declarations} @{declr.typeName} @{declr.identifier} = ( @{declr.boxedTypeName} ) previousDeclarations[@{i0}].getValue( valueResolver, tuple ) ); - @code{i0++} - @end{} - @code{i0=0}@foreach{declr : localDeclarations} @{declr.typeName} @{declr.identifier} = ( @{declr.boxedTypeName} ) localDeclarations[@{i0}].getValue( valueResolver, handle ); - @code{i0++} - @end{} - @foreach{type : globalTypes, identifier : globals} @{type} @{identifier} = ( @{type} ) valueResolver.getGlobal( "@{identifier}" ); - @end{} - - return @{ruleClassName}.@{methodName}( - @foreach{declr : declarations} @{declr.identifier} - @end{","} @if{localDeclarations != empty && declarations != empty},@end{} - @foreach{declr : localDeclarations} @{declr.identifier} - @end{","}@if{globals != empty && (localDeclarations != empty || declarations != empty)},@end{} - @foreach{identifier : globals}@{identifier} - @end{","} ); - } - - @includeNamed{"hashCode"} - - @includeNamed{"getMethodBytecode"} - - @includeNamed{"equals"} -} -@end{} @declare{"evalInvoker"} package @{package}; diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/CompositeObjectSinkAdapterTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/CompositeObjectSinkAdapterTest.java index ccf0c42d9e2..afd7692759a 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/CompositeObjectSinkAdapterTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/CompositeObjectSinkAdapterTest.java @@ -18,19 +18,14 @@ */ package org.drools.mvel; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.drools.core.base.ClassFieldAccessorCache; +import org.drools.base.base.ValueResolver; +import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.Declaration; import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.kiesession.rulebase.InternalKnowledgeBase; -import org.drools.mvel.accessors.ClassFieldAccessorStore; -import org.drools.kiesession.entrypoints.DisconnectedWorkingMemoryEntryPoint; +import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; +import org.drools.base.rule.constraint.Constraint; +import org.drools.core.base.ClassFieldAccessorCache; import org.drools.core.common.InternalFactHandle; -import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.core.reteoo.AlphaNode; import org.drools.core.reteoo.BetaNode; import org.drools.core.reteoo.CompositeObjectSinkAdapter; @@ -38,15 +33,26 @@ import org.drools.core.reteoo.ObjectSink; import org.drools.core.reteoo.ReteooFactHandleFactory; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.rule.PredicateConstraint; -import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; +import org.drools.kiesession.entrypoints.DisconnectedWorkingMemoryEntryPoint; +import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; +import org.drools.mvel.accessors.ClassFieldAccessorStore; import org.drools.mvel.model.Cheese; import org.drools.mvel.model.MockObjectSource; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; +import org.kie.api.runtime.rule.FactHandle; + +import java.io.IOException; +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.List; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; @@ -113,7 +119,7 @@ public void testAddBetaRemoveBeta() { @Test public void testAddOneAlphaNotHashable() { - final AlphaNode al = createAlphaNode(new PredicateConstraint( null, null )); + final AlphaNode al = createAlphaNode(new AlphaNodeFieldConstraintMock()); ad.addObjectSink( al ); sinksAre(al); @@ -122,7 +128,7 @@ public void testAddOneAlphaNotHashable() { @Test public void testAddOneAlphaNotHashableRemoveOneAlpha() { - final AlphaNode al = createAlphaNode(new PredicateConstraint( null, null )); + final AlphaNode al = createAlphaNode(new AlphaNodeFieldConstraintMock()); ad.addObjectSink( al ); ad.removeObjectSink( al ); @@ -417,7 +423,54 @@ private AlphaNode createAlphaNode(AlphaNodeFieldConstraint lit) { new MockObjectSource( buildContext.getNextNodeId() ), buildContext ); } - + + private static class AlphaNodeFieldConstraintMock implements AlphaNodeFieldConstraint { + + @Override + public boolean isAllowed(FactHandle handle, ValueResolver valueResolver) { + return false; + } + + @Override + public AlphaNodeFieldConstraint cloneIfInUse() { + return this; + } + + @Override + public Declaration[] getRequiredDeclarations() { + return new Declaration[0]; + } + + @Override + public void replaceDeclaration(Declaration oldDecl, Declaration newDecl) { + + } + + @Override + public Constraint clone() { + return this; + } + + @Override + public ConstraintType getType() { + return null; + } + + @Override + public boolean isTemporal() { + return false; + } + + @Override + public void writeExternal(ObjectOutput out) throws IOException { + + } + + @Override + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + + } + } private MockBetaNode createBetaNode() { return new MockBetaNode( buildContext.getNextNodeId(), diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/FieldConstraintTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/FieldConstraintTest.java index 0b1440c456c..75c6e9f9c97 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/FieldConstraintTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/FieldConstraintTest.java @@ -18,37 +18,22 @@ */ package org.drools.mvel; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; -import java.util.Collection; - -import org.drools.base.base.ValueResolver; +import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; import org.drools.core.base.ClassFieldAccessorCache; -import org.drools.base.reteoo.BaseTuple; -import org.drools.kiesession.rulebase.InternalKnowledgeBase; -import org.drools.mvel.accessors.ClassFieldAccessorStore; -import org.drools.mvel.accessors.ClassFieldReader; -import org.drools.base.base.ClassObjectType; import org.drools.core.common.InternalFactHandle; -import org.drools.core.reteoo.JoinNodeLeftTuple; -import org.drools.core.reteoo.RightTupleImpl; -import org.drools.base.rule.Declaration; -import org.drools.base.rule.Pattern; -import org.drools.base.rule.PredicateConstraint; -import org.drools.base.rule.PredicateConstraint.PredicateContextEntry; -import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; -import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.base.rule.accessor.PredicateExpression; +import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; import org.drools.kiesession.session.StatefulKnowledgeSessionImpl; +import org.drools.mvel.accessors.ClassFieldAccessorStore; +import org.drools.mvel.accessors.ClassFieldReader; import org.drools.mvel.model.Cheese; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import org.kie.api.runtime.rule.FactHandle; + +import java.util.ArrayList; +import java.util.Collection; import static org.assertj.core.api.Assertions.assertThat; @@ -155,98 +140,4 @@ public void testPrimitiveLiteralConstraint() { assertThat(constraint.isAllowed(stiltonHandle, ksession)).isFalse(); } - - /** - *
-     *
-     *
-     *                (Cheese (price ?price1 )
-     *                (Cheese (price ?price2&:(= ?price2 (* 2 ?price1) )
-     *
-     *
-     * 
- */ - @Test - public void testPredicateConstraint() { - InternalKnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase();; - StatefulKnowledgeSessionImpl ksession = (StatefulKnowledgeSessionImpl)kBase.newKieSession(); - - final ReadAccessor priceExtractor = store.getReader( Cheese.class, - "price" ); - - Pattern pattern = new Pattern( 0, - new ClassObjectType( Cheese.class ) ); - - // Bind the extractor to a decleration - // Declarations know the pattern they derive their value form - final Declaration price1Declaration = new Declaration( "price1", - priceExtractor, - pattern ); - - pattern = new Pattern( 1, - new ClassObjectType( Cheese.class ) ); - - // Bind the extractor to a decleration - // Declarations know the pattern they derive their value form - final Declaration price2Declaration = new Declaration( "price2", - priceExtractor, - pattern ); - - final PredicateExpression evaluator = new PredicateExpression() { - - private static final long serialVersionUID = 510l; - - public boolean evaluate(FactHandle handle, - BaseTuple tuple, - Declaration[] previousDeclarations, - Declaration[] localDeclarations, - ValueResolver valueResolver, - Object context) { - int price1 = previousDeclarations[0].getIntValue( valueResolver, - tuple.getObject( previousDeclarations[0] ) ); - int price2 = localDeclarations[0].getIntValue( valueResolver, - handle.getObject() ); - - return (price2 == (price1 * 2)); - - } - - public Object createContext() { - return null; - } - - public void readExternal(ObjectInput in) throws IOException, - ClassNotFoundException { - } - - public void writeExternal(ObjectOutput out) throws IOException { - } - }; - - final PredicateConstraint constraint1 = new PredicateConstraint( evaluator, - new Declaration[]{price1Declaration}, - new Declaration[]{price2Declaration} ); - - final Cheese cheddar0 = new Cheese( "cheddar", - 5 ); - final InternalFactHandle f0 = (InternalFactHandle) ksession.insert( cheddar0 ); - JoinNodeLeftTuple tuple = new JoinNodeLeftTuple( f0, - null, - true ); - - final Cheese cheddar1 = new Cheese( "cheddar", - 10 ); - final InternalFactHandle f1 = (InternalFactHandle) ksession.insert( cheddar1 ); - - tuple = new JoinNodeLeftTuple( tuple, - new RightTupleImpl( f1, null ), - null, - true ); - - final PredicateContextEntry context = (PredicateContextEntry) constraint1.createContextEntry(); - context.updateFromTuple(ksession, - tuple); - assertThat(constraint1.isAllowedCachedLeft(context, - f1)).isTrue(); - } } diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/compiler/PackageBuilderConfigurationTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/compiler/PackageBuilderConfigurationTest.java index 013bac852bd..579f1a48415 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/compiler/PackageBuilderConfigurationTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/compiler/PackageBuilderConfigurationTest.java @@ -18,11 +18,11 @@ */ package org.drools.mvel.compiler.compiler; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Properties; - +import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.base.definitions.rule.impl.QueryImpl; +import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.Pattern; +import org.drools.base.rule.RuleConditionElement; import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.compiler.builder.impl.KnowledgeBuilderImpl; import org.drools.compiler.compiler.AnalysisResult; @@ -42,18 +42,11 @@ import org.drools.compiler.rule.builder.PackageBuildContext; import org.drools.compiler.rule.builder.PatternBuilder; import org.drools.compiler.rule.builder.PatternBuilderForQuery; -import org.drools.compiler.rule.builder.PredicateBuilder; import org.drools.compiler.rule.builder.RuleBuildContext; import org.drools.compiler.rule.builder.RuleClassBuilder; import org.drools.compiler.rule.builder.RuleConditionBuilder; import org.drools.compiler.rule.builder.SalienceBuilder; -import org.drools.util.TypeResolver; -import org.drools.base.definitions.InternalKnowledgePackage; -import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.core.reteoo.CoreComponentFactory; -import org.drools.base.rule.Pattern; -import org.drools.base.definitions.rule.impl.QueryImpl; -import org.drools.base.rule.RuleConditionElement; import org.drools.drl.ast.descr.AndDescr; import org.drools.drl.ast.descr.AttributeDescr; import org.drools.drl.ast.descr.BaseDescr; @@ -65,6 +58,7 @@ import org.drools.drl.ast.descr.ProcessDescr; import org.drools.drl.ast.descr.RuleDescr; import org.drools.mvel.java.JavaForMvelDialectConfiguration; +import org.drools.util.TypeResolver; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; @@ -77,6 +71,11 @@ import org.kie.internal.builder.conf.DefaultDialectOption; import org.kie.internal.builder.conf.KBuilderSeverityOption; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Properties; + import static org.assertj.core.api.Assertions.assertThat; public class PackageBuilderConfigurationTest { @@ -347,10 +346,6 @@ public PatternBuilder getPatternBuilder() { return null; } - public PredicateBuilder getPredicateBuilder() { - return null; - } - public PatternBuilderForQuery getPatternBuilderForQuery(QueryImpl query) { return null; } From 9f4f1d52f9f622537dd7dedb682c0c81ef49a753 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Thu, 12 Oct 2023 13:03:36 +0200 Subject: [PATCH 08/41] Upgrade Commons Compress to version 1.24.0 (#5549) --- build-parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-parent/pom.xml b/build-parent/pom.xml index c6cf48d5787..dc151bf97e7 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -173,7 +173,7 @@ 3.6.0 0.9.1 3.3.4 - 1.22 + 1.24.0 1.3 From 512655c008df0031550a61c5118cb704eb4992b6 Mon Sep 17 00:00:00 2001 From: nprentza <90831697+nprentza@users.noreply.github.com> Date: Fri, 13 Oct 2023 09:35:26 +0300 Subject: [PATCH 09/41] DROOLS-7552: improve updateObjectTypesList() (#5552) * updateObjectTypesList() improvements * use isEmpty with findAny --- ...leSerializationReliableRefObjectStore.java | 28 ++++++------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/drools-reliability/drools-reliability-core/src/main/java/org/drools/reliability/core/SimpleSerializationReliableRefObjectStore.java b/drools-reliability/drools-reliability-core/src/main/java/org/drools/reliability/core/SimpleSerializationReliableRefObjectStore.java index 53edfafa269..747df903ef0 100644 --- a/drools-reliability/drools-reliability-core/src/main/java/org/drools/reliability/core/SimpleSerializationReliableRefObjectStore.java +++ b/drools-reliability/drools-reliability-core/src/main/java/org/drools/reliability/core/SimpleSerializationReliableRefObjectStore.java @@ -23,23 +23,20 @@ import java.lang.reflect.Field; import java.util.Arrays; -import java.util.HashMap; import java.util.HashSet; import java.util.IdentityHashMap; import java.util.List; -import java.util.Map; import java.util.Set; -import java.util.function.Function; import java.util.stream.Collectors; public class SimpleSerializationReliableRefObjectStore extends SimpleSerializationReliableObjectStore { - private Map uniqueObjectTypesInStore; // object type name, occurances + private Set uniqueObjectTypesInStorage; private transient IdentityHashMap inverseStorage; public SimpleSerializationReliableRefObjectStore(Storage storage) { super(storage); - uniqueObjectTypesInStore = new HashMap<>(); + uniqueObjectTypesInStorage = new HashSet<>(); setInverseStorage(storage); if (!storage.isEmpty()) { updateObjectTypesList(); @@ -119,32 +116,25 @@ private Long fromObjectToFactHandleId(Object object) { private List getReferencedObjects(Object object) { Field[] fields = object.getClass().getDeclaredFields(); - return Arrays.stream(fields) - .filter(field -> uniqueObjectTypesInStore.containsKey(field.getType().getName())) + .filter(field -> uniqueObjectTypesInStorage.contains(field.getType().getName())) .collect(Collectors.toList()); } private void updateObjectTypesList(Object object) { - uniqueObjectTypesInStore.put(object.getClass().getName(), - storage.values().stream().filter(sObject -> sObject.getObject().getClass().equals(object.getClass())).count()); - // if count==0 then remove entry - if (uniqueObjectTypesInStore.get(object.getClass().getName()) == 0) { - uniqueObjectTypesInStore.remove(object.getClass().getName()); + if (!inverseStorage.keySet().stream().filter(sObject -> sObject.getClass().equals(object.getClass())).findAny().isEmpty()){ + uniqueObjectTypesInStorage.add(object.getClass().getName()); + }else{ + uniqueObjectTypesInStorage.remove(object.getClass().getName()); } } private void updateObjectTypesList() { // list of unique object types in storage - Set uTypeNames = new HashSet(); + uniqueObjectTypesInStorage.clear(); storage.values().forEach(sObject -> { - uTypeNames.add(sObject.getObject().getClass().getName()); + uniqueObjectTypesInStorage.add(sObject.getObject().getClass().getName()); }); - // add unique object types + their occurrences in the uniqueObjectTypesInStore - uniqueObjectTypesInStore.putAll(storage.values().stream() - .map(sObject -> sObject.getObject().getClass().getName()) - .filter(uTypeNames::contains) - .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))); } } From 5569ca3dd5aaab48ca4e5424d6093785f4c28266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Mon, 16 Oct 2023 08:34:40 +0200 Subject: [PATCH 10/41] [kie-issues#628] Update repositories and other small changes to Apache (#5553) * Update repositories and other small changes to Apache * Add missing mailing list configuration. --- bom/drools-bom/pom.xml | 24 +++--- bom/kie-core-bom/pom.xml | 74 +------------------ bom/kie-dmn-bom/pom.xml | 22 +++--- bom/kie-efesto-bom/pom.xml | 22 +++--- bom/kie-pmml-bom/pom.xml | 22 +++--- build-parent/pom.xml | 10 --- drools-examples/pom.xml | 19 ----- .../resources/dmnPmml/test_regression.pmml | 2 +- .../compiler/runtime/pipeline/impl/simple.xsd | 31 ++++---- .../org/drools/verifier/report/html/basic.css | 3 - .../org/kie/dmn/pmml/test_regression.pmml | 2 +- .../kie/dmn/pmml/test_regression_clax.pmml | 2 +- .../src/test/resources/test_regression.pmml | 2 +- .../test/resources/test_regression_clax.pmml | 2 +- pom.xml | 54 +++++++------- 15 files changed, 99 insertions(+), 192 deletions(-) diff --git a/bom/drools-bom/pom.xml b/bom/drools-bom/pom.xml index 3e2733cac14..19e29a05651 100644 --- a/bom/drools-bom/pom.xml +++ b/bom/drools-bom/pom.xml @@ -22,13 +22,13 @@ https://www.drools.org - scm:git:https://github.com/kiegroup/drools.git - scm:git:git@github.com:kiegroup/drools.git - https://github.com/kiegroup/drools + scm:git:https://github.com/apache/incubator-kie-drools.git + scm:git:git@github.com:apache/incubator-kie-drools.git + https://github.com/apache/incubator-kie-drools - jira - https://issues.jboss.org/browse/DROOLS + GitHub Issues + https://github.com/apache/incubator-kie-issues/issues @@ -44,7 +44,14 @@ - setup + Development mailing list + dev@kie.apache.org + dev-subscribe@kie.apache.org + dev-unsubscribe@kie.apache.org + https://lists.apache.org/list.html?dev@kie.apache.org + + + Users https://groups.google.com/forum/#!forum/drools-setup https://groups.google.com/forum/#!forum/drools-setup @@ -57,11 +64,6 @@ https://groups.google.com/forum/#!forum/drools-usage https://groups.google.com/forum/#!forum/drools-usage - - development - https://groups.google.com/forum/#!forum/drools-development - https://groups.google.com/forum/#!forum/drools-development - diff --git a/bom/kie-core-bom/pom.xml b/bom/kie-core-bom/pom.xml index d5329807d5d..ae8a394988a 100644 --- a/bom/kie-core-bom/pom.xml +++ b/bom/kie-core-bom/pom.xml @@ -21,8 +21,8 @@ http://www.kiegroup.org 2001 - JBoss by Red Hat - http://www.jboss.org/ + The Apache Software Foundation + https://apache.org/ @@ -33,76 +33,6 @@ - - https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/ - https://repository.jboss.org/nexus/content/repositories/snapshots/ - - - - - - - central - Central Repository - https://repo.maven.apache.org/maven2 - default - - false - - - - - - jboss-public-repository-group - JBoss Public Repository Group - https://repository.jboss.org/nexus/content/groups/public/ - - true - never - - - true - daily - - - - - - - central - Central Repository - https://repo.maven.apache.org/maven2 - default - - false - - - - jboss-public-repository-group - JBoss Public Repository Group - https://repository.jboss.org/nexus/content/groups/public/ - - true - - - true - - - - diff --git a/bom/kie-dmn-bom/pom.xml b/bom/kie-dmn-bom/pom.xml index 2275d4e11fc..89d21bdfb26 100644 --- a/bom/kie-dmn-bom/pom.xml +++ b/bom/kie-dmn-bom/pom.xml @@ -21,13 +21,13 @@ https://www.drools.org - scm:git:https://github.com/kiegroup/drools.git - scm:git:git@github.com:kiegroup/drools.git - https://github.com/kiegroup/drools + scm:git:https://github.com/apache/incubator-kie-drools.git + scm:git:git@github.com:apache/incubator-kie-drools.git + https://github.com/apache/incubator-kie-drools - jira - https://issues.jboss.org/browse/DROOLS + GitHub Issues + https://github.com/apache/incubator-kie-issues/issues @@ -42,6 +42,13 @@ + + Development mailing list + dev@kie.apache.org + dev-subscribe@kie.apache.org + dev-unsubscribe@kie.apache.org + https://lists.apache.org/list.html?dev@kie.apache.org + setup https://groups.google.com/forum/#!forum/drools-setup @@ -52,11 +59,6 @@ https://groups.google.com/forum/#!forum/drools-usage https://groups.google.com/forum/#!forum/drools-usage - - development - https://groups.google.com/forum/#!forum/drools-development - https://groups.google.com/forum/#!forum/drools-development - diff --git a/bom/kie-efesto-bom/pom.xml b/bom/kie-efesto-bom/pom.xml index b52c9812a09..cc0668ba5d0 100644 --- a/bom/kie-efesto-bom/pom.xml +++ b/bom/kie-efesto-bom/pom.xml @@ -21,13 +21,13 @@ https://www.drools.org - scm:git:https://github.com/kiegroup/drools.git - scm:git:git@github.com:kiegroup/drools.git - https://github.com/kiegroup/drools + scm:git:https://github.com/apache/incubator-kie-drools.git + scm:git:git@github.com:apache/incubator-kie-drools.git + https://github.com/apache/incubator-kie-drools - jira - https://issues.jboss.org/browse/DROOLS + GitHub Issues + https://github.com/apache/incubator-kie-issues/issues @@ -42,6 +42,13 @@ + + Development mailing list + dev@kie.apache.org + dev-subscribe@kie.apache.org + dev-unsubscribe@kie.apache.org + https://lists.apache.org/list.html?dev@kie.apache.org + setup https://groups.google.com/forum/#!forum/drools-setup @@ -52,11 +59,6 @@ https://groups.google.com/forum/#!forum/drools-usage https://groups.google.com/forum/#!forum/drools-usage - - development - https://groups.google.com/forum/#!forum/drools-development - https://groups.google.com/forum/#!forum/drools-development - diff --git a/bom/kie-pmml-bom/pom.xml b/bom/kie-pmml-bom/pom.xml index bf1d694eb6e..dd93396cd03 100644 --- a/bom/kie-pmml-bom/pom.xml +++ b/bom/kie-pmml-bom/pom.xml @@ -21,13 +21,13 @@ https://www.drools.org - scm:git:https://github.com/kiegroup/drools.git - scm:git:git@github.com:kiegroup/drools.git - https://github.com/kiegroup/drools + scm:git:https://github.com/apache/incubator-kie-drools.git + scm:git:git@github.com:apache/incubator-kie-drools.git + https://github.com/apache/incubator-kie-drools - jira - https://issues.jboss.org/browse/DROOLS + GitHub Issues + https://github.com/apache/incubator-kie-issues/issues @@ -42,6 +42,13 @@ + + Development mailing list + dev@kie.apache.org + dev-subscribe@kie.apache.org + dev-unsubscribe@kie.apache.org + https://lists.apache.org/list.html?dev@kie.apache.org + setup https://groups.google.com/forum/#!forum/drools-setup @@ -52,11 +59,6 @@ https://groups.google.com/forum/#!forum/drools-usage https://groups.google.com/forum/#!forum/drools-usage - - development - https://groups.google.com/forum/#!forum/drools-development - https://groups.google.com/forum/#!forum/drools-development - diff --git a/build-parent/pom.xml b/build-parent/pom.xml index dc151bf97e7..1930d9f338b 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -236,14 +236,6 @@ - - ch.qos.logback @@ -921,8 +913,6 @@ ${version.xmlunit} - - org.openjdk.jmh diff --git a/drools-examples/pom.xml b/drools-examples/pom.xml index ebe595cbce2..0c29bff3b2f 100644 --- a/drools-examples/pom.xml +++ b/drools-examples/pom.xml @@ -39,25 +39,6 @@ org.drools.examples.generic - - - - - jboss-public-repository-group - JBoss Public Repository Group - https://repository.jboss.org/nexus/content/groups/public/ - default - - true - never - - - true - daily - - - - diff --git a/drools-scenario-simulation/drools-scenario-simulation-integrationtest/src/test/resources/dmnPmml/test_regression.pmml b/drools-scenario-simulation/drools-scenario-simulation-integrationtest/src/test/resources/dmnPmml/test_regression.pmml index 2c18ff0c235..b6e6f6ca864 100644 --- a/drools-scenario-simulation/drools-scenario-simulation-integrationtest/src/test/resources/dmnPmml/test_regression.pmml +++ b/drools-scenario-simulation/drools-scenario-simulation-integrationtest/src/test/resources/dmnPmml/test_regression.pmml @@ -1,5 +1,5 @@ -
+
diff --git a/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/compiler/runtime/pipeline/impl/simple.xsd b/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/compiler/runtime/pipeline/impl/simple.xsd index dfbdb343c91..1f6e73227c4 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/compiler/runtime/pipeline/impl/simple.xsd +++ b/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/compiler/runtime/pipeline/impl/simple.xsd @@ -1,20 +1,21 @@ - + + + + + + + + + + + + + + + + diff --git a/drools-verifier/drools-verifier-drl/src/main/resources/org/drools/verifier/report/html/basic.css b/drools-verifier/drools-verifier-drl/src/main/resources/org/drools/verifier/report/html/basic.css index 25bda4d3e7e..8b35118eaa4 100644 --- a/drools-verifier/drools-verifier-drl/src/main/resources/org/drools/verifier/report/html/basic.css +++ b/drools-verifier/drools-verifier-drl/src/main/resources/org/drools/verifier/report/html/basic.css @@ -1,6 +1,3 @@ -/* JBoss Drools Verifier Style Sheet */ -/* Website: http://labs.jboss.com/jbossrules/ */ - ul,p,table { padding:0px 0px 0px 20px; diff --git a/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests/src/test/resources/org/kie/dmn/pmml/test_regression.pmml b/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests/src/test/resources/org/kie/dmn/pmml/test_regression.pmml index 2c18ff0c235..b6e6f6ca864 100644 --- a/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests/src/test/resources/org/kie/dmn/pmml/test_regression.pmml +++ b/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests/src/test/resources/org/kie/dmn/pmml/test_regression.pmml @@ -1,5 +1,5 @@ -
+
diff --git a/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests/src/test/resources/org/kie/dmn/pmml/test_regression_clax.pmml b/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests/src/test/resources/org/kie/dmn/pmml/test_regression_clax.pmml index e376389fc53..0664d21bc44 100644 --- a/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests/src/test/resources/org/kie/dmn/pmml/test_regression_clax.pmml +++ b/kie-dmn/kie-dmn-pmml-tests-parent/kie-dmn-pmml-tests/src/test/resources/org/kie/dmn/pmml/test_regression_clax.pmml @@ -1,5 +1,5 @@ -
+
diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-compiler/src/test/resources/test_regression.pmml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-compiler/src/test/resources/test_regression.pmml index 246ca450f5d..a4f6f56b668 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-compiler/src/test/resources/test_regression.pmml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-compiler/src/test/resources/test_regression.pmml @@ -1,5 +1,5 @@ -
+
diff --git a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-compiler/src/test/resources/test_regression_clax.pmml b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-compiler/src/test/resources/test_regression_clax.pmml index b99991838be..e1833f78a6d 100644 --- a/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-compiler/src/test/resources/test_regression_clax.pmml +++ b/kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-compiler/src/test/resources/test_regression_clax.pmml @@ -1,5 +1,5 @@ -
+
diff --git a/pom.xml b/pom.xml index 15fc1477990..d2863b62236 100644 --- a/pom.xml +++ b/pom.xml @@ -21,8 +21,8 @@ http://www.drools.org 2001 - JBoss by Red Hat - http://www.jboss.org/ + The Apache Software Foundation + https://apache.org/ @@ -35,10 +35,10 @@ + first repository the Apache Nexus would be contacted first and since it is quite slow it slows down the build. + We use Apache repo only to download our SNAPSHOTs. --> central Central Repository https://repo.maven.apache.org/maven2 @@ -47,12 +47,10 @@ false - - - jboss-public-repository-group - JBoss Public Repository Group - https://repository.jboss.org/nexus/content/groups/public/ + apache-public-repository-group + Apache Public Repository Group + https://repository.apache.org/content/groups/public/ true never @@ -67,10 +65,10 @@ + first repository the Apache Nexus would be contacted first and since it is quite slow it slows down the build. + We use Apache repo only to download our SNAPSHOTs. --> central Central Repository https://repo.maven.apache.org/maven2 @@ -80,9 +78,9 @@ - jboss-public-repository-group - JBoss Public Repository Group - https://repository.jboss.org/nexus/content/groups/public/ + apache-public-repository-group + Apache Public Repository Group + https://repository.apache.org/content/groups/public/ true @@ -93,18 +91,18 @@ - scm:git:https://github.com/kiegroup/drools.git - scm:git:git@github.com:kiegroup/drools.git - https://github.com/kiegroup/drools + scm:git:https://github.com/apache/incubator-kie-drools.git + scm:git:git@github.com:apache/incubator-kie-drools.git + https://github.com/apache/incubator-kie-drools jenkins - https://jenkins-kieci.rhcloud.com + https://ci-builds.apache.org/job/KIE/ - jira - https://issues.jboss.org/browse/DROOLS + GitHub Issues + https://github.com/apache/incubator-kie-issues/issues @@ -119,6 +117,13 @@ + + Development mailing list + dev@kie.apache.org + dev-subscribe@kie.apache.org + dev-unsubscribe@kie.apache.org + https://lists.apache.org/list.html?dev@kie.apache.org + setup https://groups.google.com/forum/#!forum/drools-setup @@ -133,11 +138,6 @@ https://groups.google.com/forum/#!forum/drools-usage https://groups.google.com/forum/#!forum/drools-usage - - development - https://groups.google.com/forum/#!forum/drools-development - https://groups.google.com/forum/#!forum/drools-development - From a3308ac4db1b3ee6316d74c11bdfb32d8864b8bf Mon Sep 17 00:00:00 2001 From: Toshiya Kobayashi Date: Wed, 18 Oct 2023 15:42:00 +0900 Subject: [PATCH 11/41] [DROOLS-7560] Improve getting started experience (#5554) --- .../getting-started/_first-rule-project.adoc | 131 +++++++++++++++++- .../kie-drools-exec-model-archetype/pom.xml | 2 +- 2 files changed, 125 insertions(+), 8 deletions(-) diff --git a/drools-docs/src/modules/ROOT/pages/getting-started/_first-rule-project.adoc b/drools-docs/src/modules/ROOT/pages/getting-started/_first-rule-project.adoc index 9637f43355d..5b729135bac 100644 --- a/drools-docs/src/modules/ROOT/pages/getting-started/_first-rule-project.adoc +++ b/drools-docs/src/modules/ROOT/pages/getting-started/_first-rule-project.adoc @@ -11,6 +11,10 @@ This guide walks you through the process of creating a simple Drools application == Creating a project with maven archetype +You can choose a style of rule project from Rule Unit or traditional style. Rule Unit is a new style that is recommended for microservices and cloud native applications. Traditional style is the same as Drools 7. Both styles are supported in Drools 8. + +=== Rule Unit style + Create a project with the following command. [source,shell,subs=attributes+] @@ -31,7 +35,7 @@ Define value for property 'package' org.example: : [INFO] BUILD SUCCESS ---- -Now your first rule project is created. Let's look into the project. +Now your first rule project of Rule Unit is created. Let's look into the project. Firstly, `pom.xml`. [source,xml] @@ -41,12 +45,7 @@ Firstly, `pom.xml`. drools-ruleunits-engine ---- -This is a required dependency for rule unit use cases. - -[NOTE] -==== -You can still use traditional Drools 7 style rules without rule unit. In this case, use `kie-drools-exec-model-archetype`. -==== +This is a required dependency for Rule Unit. The archetype contains one DRL file as an example `src/main/resources/org/example/rules.drl`. @@ -135,3 +134,121 @@ Now you can add your own rules and facts to this project! ==== The rule project requires code generation that is triggered by mvn compile phase. If you directly run `RuleTest.java` in IDE, you may need to run `mvn compile` first. ==== + +=== Traditional style + +Create a project with the following command. + +[source,shell,subs=attributes+] +---- +mvn archetype:generate -DarchetypeGroupId=org.kie -DarchetypeArtifactId=kie-drools-exec-model-archetype -DarchetypeVersion={drools-version} +---- + + +During the command execution, input property values interactively. +[source,subs=attributes+] +---- +Define value for property 'groupId': org.example +Define value for property 'artifactId': my-project +Define value for property 'version' 1.0-SNAPSHOT: : +Define value for property 'package' org.example: : +... + Y: : Y +... +[INFO] BUILD SUCCESS +---- + +Now your first rule project of traditional style is created. Let's look into the project. + +Firstly, `pom.xml`. +[source,xml] +---- + + org.drools + drools-engine + +---- +This is a required dependency for traditional style. + +The archetype contains one DRL file as an example `src/main/resources/org/example/rules.drl`. + +[source] +---- +package org.example; + +global java.util.Set controlSet; + +rule "will execute per each Measurement having ID color" +when + Measurement( id == "color", $colorVal : val ) +then + controlSet.add($colorVal); +end +---- +This rule checks incoming `Measurement` data and stores its value in a global variable `controlSet` when it's color information. + +`when` part implements the pattern matching and `then` part implements the action when the conditions are met. + +`src/main/java/org/example/Measurement.java` is a Java bean class used in the rule. Such an object is called `Fact`. + +Finally, `src/test/java/org/example/RuleTest.java` is the test case that executes the rule. You can learn the basic API usage that is used in your own applications. + +[source,java] +---- + KieContainer kContainer = createKieContainer(); + ... + KieBase kieBase = kContainer.getKieBase(); + ... + KieSession session = kieBase.newKieSession(); +---- +Create a `KieContainer` which collects resources. Then get a `KieBase` and creates a `KieSession`. `KieSession` is a unit of execution in {RULE_ENGINE}. + +[source,java] +---- + Set check = new HashSet(); + session.setGlobal("controlSet", check); +---- +Set `controlSet` global to `session`. + + +[source,java] +---- + Measurement mRed = new Measurement("color", "red"); + session.insert(mRed); + session.fireAllRules(); + + Measurement mGreen = new Measurement("color", "green"); + session.insert(mGreen); + session.fireAllRules(); + + Measurement mBlue = new Measurement("color", "blue"); + session.insert(mBlue); + session.fireAllRules(); +---- +Insert `Measurement` facts into `session`. Then fire all rules. + +[source,java] +---- + session.dispose(); +---- +At the end, call `dispose()` to release resources retained by the `KieSession`. + +Let's run the test with `mvn clean test`. +---- +[INFO] ------------------------------------------------------- +[INFO] T E S T S +[INFO] ------------------------------------------------------- +[INFO] Running org.example.RuleTest +2023-10-03 12:27:29,182 [main] INFO Creating kieBase +2023-10-03 12:27:29,185 [main] INFO Start creation of KieBase: defaultKieBase +2023-10-03 12:27:29,293 [main] INFO End creation of KieBase: defaultKieBase +2023-10-03 12:27:29,293 [main] INFO There should be rules: +2023-10-03 12:27:29,294 [main] INFO kp [Package name=org.example] rule will execute per each Measurement having ID color +2023-10-03 12:27:29,294 [main] INFO Creating kieSession +2023-10-03 12:27:29,322 [main] INFO Populating globals +2023-10-03 12:27:29,322 [main] INFO Now running data +2023-10-03 12:27:29,348 [main] INFO Final checks +[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.586 s - in org.example.RuleTest +---- + +Now you can add your own rules and facts to this project! diff --git a/kie-archetypes/kie-drools-exec-model-archetype/pom.xml b/kie-archetypes/kie-drools-exec-model-archetype/pom.xml index 450a18b949e..e12b110a15a 100644 --- a/kie-archetypes/kie-drools-exec-model-archetype/pom.xml +++ b/kie-archetypes/kie-drools-exec-model-archetype/pom.xml @@ -32,7 +32,7 @@ KIE :: Drools Maven Archetype with Executable Model and traditional rule style - Drools rule example with executable model and traditional (Drools 7) API and rule style. + Drools rule example with executable model and traditional API and rule style. Use property droolsVersion to specify which version of Drools to use in a generated project. http://drools.org From 015b5510fe5d64e6b089de44c3de732a0e8e20b3 Mon Sep 17 00:00:00 2001 From: Luca Molteni Date: Wed, 18 Oct 2023 08:48:13 +0200 Subject: [PATCH 12/41] Antlr 4.10.1 -> 4.13.0 (#5555) --- build-parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 1930d9f338b..574eddbde41 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -137,7 +137,7 @@ - 4.10.1 + 4.13.0 3.13.0 4.15.0.Final 1.1.0 From d54261548a659556e375d99c4e619fbb449c0c86 Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Wed, 18 Oct 2023 16:47:52 +0200 Subject: [PATCH 13/41] bump to Quarkus 2.16.12 (#5556) --- build-parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 574eddbde41..f3ec1cdcf94 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -73,7 +73,7 @@ 0.18.0 4.7.1 1.10.2 - 2.16.10.Final + 2.16.12.Final 3.1.1 8.5.11 4.13.1 From db6e548e9c5230be0ff72bc22822f52937f2fada Mon Sep 17 00:00:00 2001 From: Enrique Date: Wed, 18 Oct 2023 19:26:37 +0200 Subject: [PATCH 14/41] [kie-issues-249] Data index improvements (#5529) --- .../kie/api/event/usertask/Attachment.java | 37 +++++++++++ .../org/kie/api/event/usertask/Comment.java | 34 ++++++++++ .../usertask/UserTaskAssignmentEvent.java | 30 +++++++++ .../usertask/UserTaskAttachmentEvent.java | 28 +++++++++ .../event/usertask/UserTaskCommentEvent.java | 28 +++++++++ .../event/usertask/UserTaskDeadlineEvent.java | 56 +++++++++++++++++ .../kie/api/event/usertask/UserTaskEvent.java | 62 +++++++++++++++++++ .../event/usertask/UserTaskStateEvent.java | 26 ++++++++ .../event/usertask/UserTaskVariableEvent.java | 34 ++++++++++ .../api/runtime/process/ProcessInstance.java | 2 + 10 files changed, 337 insertions(+) create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/Attachment.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/Comment.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAssignmentEvent.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAttachmentEvent.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/UserTaskCommentEvent.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/UserTaskDeadlineEvent.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/UserTaskEvent.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/UserTaskStateEvent.java create mode 100644 kie-api/src/main/java/org/kie/api/event/usertask/UserTaskVariableEvent.java diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/Attachment.java b/kie-api/src/main/java/org/kie/api/event/usertask/Attachment.java new file mode 100644 index 00000000000..ded0ce0df24 --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/Attachment.java @@ -0,0 +1,37 @@ +/* + * 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.event.usertask; + +import java.net.URI; +import java.util.Date; + +public interface Attachment { + + String getAttachmentId(); + + String getAttachmentName(); + + URI getAttachmentURI(); + + String getUpdatedBy(); + + Date getUpdatedAt(); + +} diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/Comment.java b/kie-api/src/main/java/org/kie/api/event/usertask/Comment.java new file mode 100644 index 00000000000..004d3e7d6ee --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/Comment.java @@ -0,0 +1,34 @@ +/* + * 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.event.usertask; + +import java.util.Date; + +public interface Comment { + + String getCommentId(); + + String getCommentContent(); + + String getUpdatedBy(); + + Date getUpdatedAt(); + +} diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAssignmentEvent.java b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAssignmentEvent.java new file mode 100644 index 00000000000..01d460e0ddb --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAssignmentEvent.java @@ -0,0 +1,30 @@ +/* + * 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.event.usertask; + +public interface UserTaskAssignmentEvent extends UserTaskEvent { + + String getAssignmentType(); + + String[] getNewUsersId(); + + String[] getOldUsersId(); + +} diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAttachmentEvent.java b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAttachmentEvent.java new file mode 100644 index 00000000000..9f82c73605e --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskAttachmentEvent.java @@ -0,0 +1,28 @@ +/* + * 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.event.usertask; + +public interface UserTaskAttachmentEvent extends UserTaskEvent { + + Attachment getOldAttachment(); + + Attachment getNewAttachment(); + +} diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskCommentEvent.java b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskCommentEvent.java new file mode 100644 index 00000000000..b51eb3e6bd6 --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskCommentEvent.java @@ -0,0 +1,28 @@ +/* + * 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.event.usertask; + +public interface UserTaskCommentEvent extends UserTaskEvent { + + Comment getOldComment(); + + Comment getNewComment(); + +} diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskDeadlineEvent.java b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskDeadlineEvent.java new file mode 100644 index 00000000000..c1c46b7a1d0 --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskDeadlineEvent.java @@ -0,0 +1,56 @@ +/* + * 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.event.usertask; + +import java.util.Map; + +import org.kie.api.runtime.process.WorkItem; + +/** + * An event when a dealine for task has expired + */ +public interface UserTaskDeadlineEvent extends UserTaskEvent { + + enum DeadlineType { + Started, + Completed + } + + /** + * Returns work item which timeout expires + * + * @return work item + */ + WorkItem getWorkItem(); + + /** + * Returns notification data + * + * @return key-value pair list + */ + Map getNotification(); + + /** + * Returns dealine type + * + * @return not started or not completed + */ + DeadlineType getType(); +} \ No newline at end of file diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskEvent.java b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskEvent.java new file mode 100644 index 00000000000..8f45c48b905 --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskEvent.java @@ -0,0 +1,62 @@ +/* + * 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.event.usertask; + +import java.util.Date; + +import org.kie.api.event.KieRuntimeEvent; +import org.kie.api.runtime.process.NodeInstance; +import org.kie.api.runtime.process.ProcessInstance; +import org.kie.api.runtime.process.WorkItem; + +/** + * A runtime event related to the execution of process instances. + */ +public interface UserTaskEvent + extends + KieRuntimeEvent { + + /** + * The ProcessInstance this event relates to. + * + * @return the process instance + */ + ProcessInstance getProcessInstance(); + + NodeInstance getNodeInstance(); + + WorkItem getWorkItem(); + + String getUserTaskId(); + + String getUserTaskDefinitionId(); + + /** + * Returns exact date when the event was created + * @return time when event was created + */ + Date getEventDate(); + + /** + * @return associated identity that performed the event + */ + String getEventUser(); + +} diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskStateEvent.java b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskStateEvent.java new file mode 100644 index 00000000000..41c2ecf021c --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskStateEvent.java @@ -0,0 +1,26 @@ +/* + * 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.event.usertask; + +public interface UserTaskStateEvent extends UserTaskEvent { + + + +} diff --git a/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskVariableEvent.java b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskVariableEvent.java new file mode 100644 index 00000000000..a7dab82d79f --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/event/usertask/UserTaskVariableEvent.java @@ -0,0 +1,34 @@ +/* + * 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.event.usertask; + +public interface UserTaskVariableEvent extends UserTaskEvent { + + enum VariableEventType { + INPUT, OUTPUT + } + + String getVariableName(); + + Object getOldValue(); + + Object getNewValue(); + + VariableEventType getVariableType(); +} diff --git a/kie-api/src/main/java/org/kie/api/runtime/process/ProcessInstance.java b/kie-api/src/main/java/org/kie/api/runtime/process/ProcessInstance.java index 7d46c14a1b8..68789b07dea 100644 --- a/kie-api/src/main/java/org/kie/api/runtime/process/ProcessInstance.java +++ b/kie-api/src/main/java/org/kie/api/runtime/process/ProcessInstance.java @@ -89,4 +89,6 @@ public interface ProcessInstance */ String getParentProcessInstanceId(); + String getProcessVersion(); + } From fea9042b8fea648d41c3366fae3265b7a95d805f Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Thu, 19 Oct 2023 08:32:06 +0200 Subject: [PATCH 15/41] [KIE-635] implement a cache for loaded services (#5557) --- .../impl/CompositeKnowledgeBuilderImpl.java | 8 +-- .../builder/impl/KnowledgeBuilderImpl.java | 67 +++++++++---------- .../kie/builder/impl/KieServicesImpl.java | 34 +++++----- .../drools/core/impl/KnowledgeBaseImpl.java | 10 +-- .../StatelessKnowledgeSessionImpl.java | 25 ++++--- .../ruleunits/dsl/RuleUnitProviderForDSL.java | 4 +- .../kie/api/internal/utils/KieService.java | 30 +-------- .../api/internal/utils/KieServiceLoader.java | 61 +++++++++++++++++ 8 files changed, 135 insertions(+), 104 deletions(-) create mode 100644 kie-api/src/main/java/org/kie/api/internal/utils/KieServiceLoader.java diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeKnowledgeBuilderImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeKnowledgeBuilderImpl.java index 1d0f2bbacb2..5c521da7bf4 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeKnowledgeBuilderImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeKnowledgeBuilderImpl.java @@ -40,6 +40,8 @@ public class CompositeKnowledgeBuilderImpl implements CompositeKnowledgeBuilder { + private static final KieAssemblers ASSEMBLERS = KieService.load(KieAssemblers.class); + private final KnowledgeBuilderImpl kBuilder; private final Map> resourcesByType = new HashMap<>(); @@ -176,13 +178,12 @@ private Collection buildPackageDescr() { } private void buildAssemblerResourcesBeforeRules() { - KieAssemblers assemblers = KieService.load(KieAssemblers.class); try { for (Map.Entry> resourceTypeListEntry : resourcesByType.entrySet()) { ResourceType type = resourceTypeListEntry.getKey(); List descrs = resourceTypeListEntry.getValue(); for (ResourceDescr descr : descrs) { - assemblers.addResourceBeforeRules(this.kBuilder, descr.resource, type, descr.configuration); + ASSEMBLERS.addResourceBeforeRules(this.kBuilder, descr.resource, type, descr.configuration); } } } catch (RuntimeException e) { @@ -197,11 +198,10 @@ private void buildAssemblerResourcesBeforeRules() { } private void buildAssemblerResourcesAfterRules() { - KieAssemblers assemblers = KieService.load(KieAssemblers.class); try { for (Map.Entry> entry : resourcesByType.entrySet()) { List rds = entry.getValue().stream().map(CompositeKnowledgeBuilderImpl::descrToResourceWithConfiguration).collect(Collectors.toList()); - assemblers.addResourcesAfterRules(kBuilder, rds, entry.getKey()); + ASSEMBLERS.addResourcesAfterRules(kBuilder, rds, entry.getKey()); } } catch (RuntimeException e) { throw e; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java index 2820f541925..de0b6592eb8 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java @@ -18,24 +18,12 @@ */ package org.drools.compiler.builder.impl; -import static java.util.Arrays.asList; - -import java.io.File; -import java.io.IOException; -import java.io.Reader; -import java.lang.reflect.Type; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Deque; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.ForkJoinPool; -import java.util.function.Supplier; - +import org.drools.base.base.ObjectType; +import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.Function; +import org.drools.base.rule.ImportDeclaration; +import org.drools.base.rule.TypeDeclaration; import org.drools.compiler.builder.InternalKnowledgeBuilder; import org.drools.compiler.builder.PackageRegistryManager; import org.drools.compiler.builder.impl.processors.CompilationPhase; @@ -56,14 +44,8 @@ import org.drools.compiler.compiler.ResourceTypeDeclarationWarning; import org.drools.compiler.kie.builder.impl.BuildContext; import org.drools.compiler.lang.descr.CompositePackageDescr; -import org.drools.base.base.ObjectType; -import org.drools.base.definitions.InternalKnowledgePackage; -import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.core.impl.InternalRuleBase; import org.drools.core.impl.RuleBaseFactory; -import org.drools.base.rule.Function; -import org.drools.base.rule.ImportDeclaration; -import org.drools.base.rule.TypeDeclaration; import org.drools.drl.ast.descr.AttributeDescr; import org.drools.drl.ast.descr.ImportDescr; import org.drools.drl.ast.descr.PackageDescr; @@ -81,6 +63,7 @@ import org.drools.wiring.api.ComponentsFactory; import org.kie.api.KieBase; import org.kie.api.KieBaseConfiguration; +import org.kie.api.KieServices; import org.kie.api.builder.ReleaseId; import org.kie.api.definition.KiePackage; import org.kie.api.definition.process.Process; @@ -91,7 +74,6 @@ import org.kie.api.io.ResourceConfiguration; import org.kie.api.io.ResourceType; import org.kie.api.io.ResourceWithConfiguration; -import org.kie.api.KieServices; import org.kie.internal.builder.CompositeKnowledgeBuilder; import org.kie.internal.builder.KnowledgeBuilderConfiguration; import org.kie.internal.builder.KnowledgeBuilderError; @@ -107,9 +89,29 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.File; +import java.io.IOException; +import java.io.Reader; +import java.lang.reflect.Type; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Deque; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.ForkJoinPool; +import java.util.function.Supplier; + +import static java.util.Arrays.asList; + public class KnowledgeBuilderImpl implements InternalKnowledgeBuilder, TypeDeclarationContext, BuildResultCollector, GlobalVariableContext { protected static final transient Logger logger = LoggerFactory.getLogger(KnowledgeBuilderImpl.class); + private static final KieAssemblers ASSEMBLERS = KieService.load(KieAssemblers.class); + private final PackageRegistryManagerImpl pkgRegistryManager; private final BuildResultCollectorImpl results; @@ -393,22 +395,13 @@ public void addKnowledgeResource(Resource resource, } @Deprecated - void addPackageForExternalType(Resource resource, - ResourceType type, - ResourceConfiguration configuration) throws Exception { - KieAssemblers assemblers = KieService.load(KieAssemblers.class); - - assemblers.addResourceAfterRules(this, - resource, - type, - configuration); + void addPackageForExternalType(Resource resource, ResourceType type, ResourceConfiguration configuration) throws Exception { + ASSEMBLERS.addResourceAfterRules(this, resource, type, configuration); } @Deprecated void addPackageForExternalType(ResourceType type, List resources) throws Exception { - KieAssemblers assemblers = KieService.load(KieAssemblers.class); - - assemblers.addResourcesAfterRules(this, resources, type); + ASSEMBLERS.addResourcesAfterRules(this, resources, type); } void addPackageFromXSD(Resource resource, ResourceConfiguration configuration) throws IOException { diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieServicesImpl.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieServicesImpl.java index 0722212ab5f..2b964647143 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieServicesImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieServicesImpl.java @@ -18,13 +18,6 @@ */ package org.drools.compiler.kie.builder.impl; -import java.io.File; -import java.lang.ref.WeakReference; -import java.util.Properties; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - import org.drools.compiler.kie.builder.impl.event.KieServicesEventListerner; import org.drools.compiler.kproject.models.KieModuleModelImpl; import org.drools.core.BaseConfigurationFactories; @@ -32,8 +25,8 @@ import org.drools.core.SessionConfigurationFactories; import org.drools.core.concurrent.ExecutorProviderImpl; import org.drools.core.impl.EnvironmentFactory; -import org.drools.kiesession.audit.KnowledgeRuntimeLoggerProviderImpl; import org.drools.io.ResourceFactoryServiceImpl; +import org.drools.kiesession.audit.KnowledgeRuntimeLoggerProviderImpl; import org.drools.wiring.api.classloader.ProjectClassLoader; import org.kie.api.KieBaseConfiguration; import org.kie.api.builder.KieBuilder; @@ -57,10 +50,18 @@ import org.kie.internal.utils.ChainedProperties; import org.kie.util.maven.support.ReleaseIdImpl; +import java.io.File; +import java.lang.ref.WeakReference; +import java.util.Properties; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + import static org.drools.compiler.compiler.io.memory.MemoryFileSystem.readFromJar; import static org.drools.util.ClassUtils.findParentClassLoader; public class KieServicesImpl implements InternalKieServices { + private volatile KieContainer classpathKContainer; private volatile String classpathKContainerId; @@ -137,8 +138,7 @@ public KieContainer newKieClasspathContainer(String containerId, ClassLoader cla @Override public KieContainer newKieClasspathContainer(String containerId, ClassLoader classLoader, ReleaseId releaseId) { if (containerId == null) { - KieContainerImpl newContainer = new KieContainerImpl(UUID.randomUUID().toString(), new ClasspathKieProject(classLoader, listener, releaseId), null); - return newContainer; + return new KieContainerImpl(UUID.randomUUID().toString(), new ClasspathKieProject(classLoader, listener, releaseId), null); } if ( kContainers.get(containerId) == null ) { KieContainerImpl newContainer = new KieContainerImpl(containerId, new ClasspathKieProject(classLoader, listener, releaseId), null, releaseId); @@ -204,9 +204,9 @@ public KieContainer newKieContainer(String containerId, ReleaseId releaseId, Cla } if (containerId == null) { - KieContainerImpl newContainer = new KieContainerImpl( UUID.randomUUID().toString(), kProject, getRepository(), releaseId ); - return newContainer; + return new KieContainerImpl( UUID.randomUUID().toString(), kProject, getRepository(), releaseId ); } + if ( kContainers.get(containerId) == null ) { KieContainerImpl newContainer = new KieContainerImpl( containerId, kProject, getRepository(), releaseId ); KieContainer check = kContainers.putIfAbsent(containerId, newContainer); @@ -254,11 +254,14 @@ public KieResources getResources() { } public KieCommands getCommands() { - return KieService.load( KieCommands.class ); + return KieCommandsHolder.KIE_COMMANDS; + } + + private static class KieCommandsHolder { + private static final KieCommands KIE_COMMANDS = KieService.load( KieCommands.class ); } public KieMarshallers getMarshallers() { - // instantiating directly, but we might want to use the service registry instead KieMarshallers kieMarshallers = KieService.load( KieMarshallers.class ); if (kieMarshallers == null) { throw new RuntimeException("Marshaller not available, please add the module org.drools:drools-serialization-protobuf to your classpath."); @@ -333,8 +336,7 @@ public KieSessionConfiguration newKieSessionConfiguration(Properties properties, } private ClassLoader getClassLoader(ClassLoader classLoader) { - ClassLoader projClassLoader = classLoader instanceof ProjectClassLoader ? classLoader : ProjectClassLoader.getClassLoader(classLoader, getClass()); - return projClassLoader; + return classLoader instanceof ProjectClassLoader ? classLoader : ProjectClassLoader.getClassLoader(classLoader, getClass()); } public Environment newEnvironment() { diff --git a/drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java b/drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java index 064ad42c7d0..dfd978c3f7c 100644 --- a/drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java +++ b/drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java @@ -105,6 +105,8 @@ public class KnowledgeBaseImpl implements InternalRuleBase { protected static final Logger logger = LoggerFactory.getLogger(KnowledgeBaseImpl.class); + private static final KieWeavers WEAVERS = KieService.load( KieWeavers.class ); + private Set addedEntryNodeCache; private Set removedEntryNodeCache; @@ -445,9 +447,8 @@ public void kBaseInternal_addPackages(Collection clone } if ( ! newPkg.getResourceTypePackages().isEmpty() ) { - KieWeavers weavers = KieService.load( KieWeavers.class ); for ( ResourceTypePackage rtkKpg : newPkg.getResourceTypePackages().values() ) { - weavers.weave( newPkg, rtkKpg ); + WEAVERS.weave( newPkg, rtkKpg ); } } @@ -817,12 +818,11 @@ private void mergePackage( InternalKnowledgePackage pkg, InternalKnowledgePackag } if ( ! newPkg.getResourceTypePackages().isEmpty() ) { - KieWeavers weavers = KieService.load(KieWeavers.class); - if (weavers == null) { + if (WEAVERS == null) { throw new IllegalStateException("Unable to find KieWeavers implementation"); } for ( ResourceTypePackage rtkKpg : newPkg.getResourceTypePackages().values() ) { - weavers.merge( pkg, rtkKpg ); + WEAVERS.merge( pkg, rtkKpg ); } } } diff --git a/drools-kiesession/src/main/java/org/drools/kiesession/session/StatelessKnowledgeSessionImpl.java b/drools-kiesession/src/main/java/org/drools/kiesession/session/StatelessKnowledgeSessionImpl.java index 7ed4aaab000..48e593d65d8 100644 --- a/drools-kiesession/src/main/java/org/drools/kiesession/session/StatelessKnowledgeSessionImpl.java +++ b/drools-kiesession/src/main/java/org/drools/kiesession/session/StatelessKnowledgeSessionImpl.java @@ -18,17 +18,6 @@ */ package org.drools.kiesession.session; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.EventListener; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicLong; - import org.drools.core.SessionConfiguration; import org.drools.core.base.MapGlobalResolver; import org.drools.core.common.InternalFactHandle; @@ -58,6 +47,17 @@ import org.kie.internal.command.RegistryContext; import org.kie.internal.runtime.StatefulKnowledgeSession; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.EventListener; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; + public class StatelessKnowledgeSessionImpl extends AbstractRuntime implements StatelessKieSession { private InternalKnowledgeBase kBase; @@ -217,8 +217,7 @@ public Globals getGlobals() { } @Override - public void registerChannel(String name, - Channel channel) { + public void registerChannel(String name, Channel channel) { this.channels.put(name, channel); } diff --git a/drools-ruleunits/drools-ruleunits-dsl/src/main/java/org/drools/ruleunits/dsl/RuleUnitProviderForDSL.java b/drools-ruleunits/drools-ruleunits-dsl/src/main/java/org/drools/ruleunits/dsl/RuleUnitProviderForDSL.java index f810c0e079a..b7ee4316099 100644 --- a/drools-ruleunits/drools-ruleunits-dsl/src/main/java/org/drools/ruleunits/dsl/RuleUnitProviderForDSL.java +++ b/drools-ruleunits/drools-ruleunits-dsl/src/main/java/org/drools/ruleunits/dsl/RuleUnitProviderForDSL.java @@ -18,8 +18,6 @@ */ package org.drools.ruleunits.dsl; -import java.util.Map; - import org.drools.core.common.ReteEvaluator; import org.drools.core.impl.InternalRuleBase; import org.drools.core.reteoo.ReteDumper; @@ -37,6 +35,8 @@ import org.drools.ruleunits.impl.sessions.RuleUnitExecutorImpl; import org.kie.api.runtime.rule.EntryPoint; +import java.util.Map; + public class RuleUnitProviderForDSL extends RuleUnitProviderImpl { private static final boolean DUMP_GENERATED_RETE = false; diff --git a/kie-api/src/main/java/org/kie/api/internal/utils/KieService.java b/kie-api/src/main/java/org/kie/api/internal/utils/KieService.java index a0bf1b2ad9f..f8f78bdcb91 100644 --- a/kie-api/src/main/java/org/kie/api/internal/utils/KieService.java +++ b/kie-api/src/main/java/org/kie/api/internal/utils/KieService.java @@ -18,11 +18,9 @@ */ package org.kie.api.internal.utils; -import java.util.ServiceLoader; - public interface KieService extends Comparable { - public static final String UNDEFINED = "undefined"; + String UNDEFINED = "undefined"; default int servicePriority() { return 0; @@ -42,32 +40,10 @@ default int compareTo(KieService other) { } static T load(Class serviceClass) { - ServiceLoader loader = ServiceLoader.load(serviceClass, serviceClass.getClassLoader()); - T service = null; - for (T impl : loader) { - if (service == null || impl.compareTo(service) > 0) { - service = impl; - } - } - return service; + return KieServiceLoader.INSTANCE.lookup(serviceClass); } static T loadWithTag(Class serviceClass, String tag) { - if (tag == null || tag.equals(UNDEFINED)) { - return load(serviceClass); // fall back to priority based loading - } - - ServiceLoader loader = ServiceLoader.load(serviceClass, serviceClass.getClassLoader()); - T service = null; - for (T impl : loader) { - if (tag.equals(impl.serviceTag())) { // accept only services with the specified tag - if (service == null) { - service = impl; - } else { - throw new IllegalStateException("Found 2 services with the same tag \"" + tag + "\": " + service.getClass().getCanonicalName() + " and " + impl.getClass().getCanonicalName()); - } - } - } - return service; + return KieServiceLoader.INSTANCE.lookup(serviceClass, tag); } } diff --git a/kie-api/src/main/java/org/kie/api/internal/utils/KieServiceLoader.java b/kie-api/src/main/java/org/kie/api/internal/utils/KieServiceLoader.java new file mode 100644 index 00000000000..eba502dc9a2 --- /dev/null +++ b/kie-api/src/main/java/org/kie/api/internal/utils/KieServiceLoader.java @@ -0,0 +1,61 @@ +/** + * 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.internal.utils; + +import java.util.HashMap; +import java.util.Map; +import java.util.ServiceLoader; + +import static org.kie.api.internal.utils.KieService.UNDEFINED; + +public class KieServiceLoader { + + static final KieServiceLoader INSTANCE = new KieServiceLoader(); + + private final Map serviceCache = new HashMap<>(); + + private KieServiceLoader() {} + + T lookup(Class serviceClass) { + return lookup(serviceClass, UNDEFINED); + } + + T lookup(Class serviceClass, String tag) { + String serviceKey = serviceClass.getName() + ":" + tag; + if (serviceCache.containsKey(serviceKey)) { + return (T) serviceCache.get(serviceKey); + } + T loadedService = load(serviceClass, tag); + serviceCache.put(serviceKey, load(serviceClass, tag)); + return loadedService; + } + + T load(Class serviceClass, String tag) { + ServiceLoader loader = ServiceLoader.load(serviceClass, serviceClass.getClassLoader()); + T service = null; + for (T impl : loader) { + if ( tag.equals(impl.serviceTag()) ) { // accept only services with the specified tag + if (service == null || impl.compareTo(service) > 0) { + service = impl; + } + } + } + return service; + } +} From 45a263d07afbbeb499f686f58f8b1d089715336d Mon Sep 17 00:00:00 2001 From: Jan Stastny Date: Tue, 24 Oct 2023 13:59:50 +0200 Subject: [PATCH 16/41] kie-issues#647: add writeJunitReport to invoker configuration (#5561) --- build-parent/pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build-parent/pom.xml b/build-parent/pom.xml index f3ec1cdcf94..817329c2584 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -1884,6 +1884,9 @@ org.apache.maven.plugins maven-invoker-plugin 3.2.1 + + true + org.apache.maven.plugins From 78a84719cef8a2ff0e25f065d0e962d4d62ecd86 Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Wed, 25 Oct 2023 12:53:20 +0200 Subject: [PATCH 17/41] [DROOLS-6834] remove drl prefix from drools quarkus extension + create drools-drl parent module (#5564) --- .../quarkus-3/patches/0001_before_sh.patch | 122 +++++++++--------- .../patches/0004_hardcoded-javax-string.patch | 8 +- bom/drools-bom/pom.xml | 20 +-- ...quarkus.deployment.dev.CompilationProvider | 1 - .../drools-drl-ast}/pom.xml | 5 +- .../AbstractClassTypeDeclarationDescr.java | 0 .../drools/drl/ast/descr/AccessorDescr.java | 0 .../drools/drl/ast/descr/AccumulateDescr.java | 0 .../drl/ast/descr/AccumulateImportDescr.java | 0 .../org/drools/drl/ast/descr/ActionDescr.java | 0 .../org/drools/drl/ast/descr/AndDescr.java | 0 .../drl/ast/descr/AnnotatedBaseDescr.java | 0 .../drools/drl/ast/descr/AnnotationDescr.java | 0 .../drools/drl/ast/descr/AtomicExprDescr.java | 0 .../drools/drl/ast/descr/AttributeDescr.java | 0 .../org/drools/drl/ast/descr/BaseDescr.java | 0 .../drools/drl/ast/descr/BehaviorDescr.java | 0 .../drools/drl/ast/descr/BindingDescr.java | 0 .../drools/drl/ast/descr/CollectDescr.java | 0 .../drl/ast/descr/ConditionalBranchDescr.java | 0 .../ast/descr/ConditionalElementDescr.java | 0 .../drools/drl/ast/descr/ConnectiveDescr.java | 0 .../drools/drl/ast/descr/ConnectiveType.java | 0 .../ast/descr/ConstraintConnectiveDescr.java | 0 .../ast/descr/DeclarativeInvokerDescr.java | 0 .../drools/drl/ast/descr/DescrVisitor.java | 0 .../ast/descr/EntryPointDeclarationDescr.java | 0 .../drools/drl/ast/descr/EntryPointDescr.java | 0 .../drl/ast/descr/EnumDeclarationDescr.java | 0 .../drl/ast/descr/EnumLiteralDescr.java | 0 .../org/drools/drl/ast/descr/EvalDescr.java | 0 .../descr/EvaluatorBasedRestrictionDescr.java | 0 .../org/drools/drl/ast/descr/ExistsDescr.java | 0 .../drl/ast/descr/ExprConstraintDescr.java | 0 .../drools/drl/ast/descr/ExpressionDescr.java | 0 .../drl/ast/descr/FactTemplateDescr.java | 0 .../drl/ast/descr/FieldConstraintDescr.java | 0 .../drl/ast/descr/FieldTemplateDescr.java | 0 .../drl/ast/descr/ForFunctionDescr.java | 0 .../org/drools/drl/ast/descr/ForallDescr.java | 0 .../org/drools/drl/ast/descr/FromDescr.java | 0 .../drools/drl/ast/descr/FunctionDescr.java | 0 .../drl/ast/descr/FunctionImportDescr.java | 0 .../org/drools/drl/ast/descr/GlobalDescr.java | 0 .../drools/drl/ast/descr/GroupByDescr.java | 0 .../org/drools/drl/ast/descr/ImportDescr.java | 0 .../drools/drl/ast/descr/LiteralDescr.java | 0 .../ast/descr/LiteralRestrictionDescr.java | 0 .../drools/drl/ast/descr/MVELExprDescr.java | 0 .../descr/MultiPatternDestinationDescr.java | 0 .../drl/ast/descr/NamedConsequenceDescr.java | 0 .../drools/drl/ast/descr/Namespaceable.java | 0 .../org/drools/drl/ast/descr/NotDescr.java | 0 .../drools/drl/ast/descr/OperatorDescr.java | 0 .../org/drools/drl/ast/descr/OrDescr.java | 0 .../drools/drl/ast/descr/PackageDescr.java | 0 .../drl/ast/descr/PackageDescrDumper.java | 0 .../drools/drl/ast/descr/PatternDescr.java | 0 .../ast/descr/PatternDestinationDescr.java | 0 .../drl/ast/descr/PatternSourceDescr.java | 0 .../drools/drl/ast/descr/PredicateDescr.java | 0 .../drools/drl/ast/descr/ProcessDescr.java | 0 .../QualifiedIdentifierRestrictionDescr.java | 0 .../drools/drl/ast/descr/QualifiedName.java | 0 .../org/drools/drl/ast/descr/QueryDescr.java | 0 .../drl/ast/descr/RelationalExprDescr.java | 0 .../org/drools/drl/ast/descr/Restriction.java | 0 .../ast/descr/RestrictionConnectiveDescr.java | 0 .../drl/ast/descr/RestrictionDescr.java | 0 .../drl/ast/descr/ReturnValueDescr.java | 0 .../descr/ReturnValueRestrictionDescr.java | 0 .../org/drools/drl/ast/descr/RuleDescr.java | 0 .../drl/ast/descr/TypeDeclarationDescr.java | 0 .../drools/drl/ast/descr/TypeFieldDescr.java | 0 .../org/drools/drl/ast/descr/UnitDescr.java | 0 .../ast/descr/VariableRestrictionDescr.java | 0 .../drl/ast/descr/WindowDeclarationDescr.java | 0 .../drl/ast/descr/WindowReferenceDescr.java | 0 .../AbstractClassTypeDeclarationBuilder.java | 0 .../drl/ast/dsl/AccumulateDescrBuilder.java | 0 .../ast/dsl/AccumulateImportDescrBuilder.java | 0 .../drl/ast/dsl/AnnotatedDescrBuilder.java | 0 .../drl/ast/dsl/AnnotationDescrBuilder.java | 0 .../drl/ast/dsl/AttributeDescrBuilder.java | 0 .../drl/ast/dsl/AttributeSupportBuilder.java | 0 .../drl/ast/dsl/BehaviorDescrBuilder.java | 0 .../drools/drl/ast/dsl/CEDescrBuilder.java | 0 .../drl/ast/dsl/CollectDescrBuilder.java | 0 .../dsl/ConditionalBranchDescrBuilder.java | 0 .../drl/ast/dsl/DeclareDescrBuilder.java | 0 .../org/drools/drl/ast/dsl/DescrBuilder.java | 0 .../org/drools/drl/ast/dsl/DescrFactory.java | 0 .../EntryPointDeclarationDescrBuilder.java | 0 .../ast/dsl/EnumDeclarationDescrBuilder.java | 0 .../drl/ast/dsl/EnumLiteralDescrBuilder.java | 0 .../drools/drl/ast/dsl/EvalDescrBuilder.java | 0 .../drools/drl/ast/dsl/FieldDescrBuilder.java | 0 .../drl/ast/dsl/ForallDescrBuilder.java | 0 .../drl/ast/dsl/FunctionDescrBuilder.java | 0 .../drl/ast/dsl/GlobalDescrBuilder.java | 0 .../drl/ast/dsl/GroupByDescrBuilder.java | 0 .../drl/ast/dsl/ImportDescrBuilder.java | 0 .../ast/dsl/NamedConsequenceDescrBuilder.java | 0 .../drl/ast/dsl/PackageDescrBuilder.java | 0 .../drl/ast/dsl/ParameterSupportBuilder.java | 0 .../ast/dsl/PatternContainerDescrBuilder.java | 0 .../drl/ast/dsl/PatternDescrBuilder.java | 0 .../drools/drl/ast/dsl/QueryDescrBuilder.java | 0 .../drools/drl/ast/dsl/RuleDescrBuilder.java | 0 .../drl/ast/dsl/SourceDescrBuilder.java | 0 .../ast/dsl/TypeDeclarationDescrBuilder.java | 0 .../drools/drl/ast/dsl/UnitDescrBuilder.java | 0 .../dsl/WindowDeclarationDescrBuilder.java | 0 .../dsl/impl/AccumulateDescrBuilderImpl.java | 0 .../AccumulateImportDescrBuilderImpl.java | 0 .../dsl/impl/AnnotationDescrBuilderImpl.java | 0 .../dsl/impl/AttributeDescrBuilderImpl.java | 0 .../ast/dsl/impl/BaseDescrBuilderImpl.java | 0 .../dsl/impl/BehaviorDescrBuilderImpl.java | 0 .../drl/ast/dsl/impl/CEDescrBuilderImpl.java | 0 .../ast/dsl/impl/CollectDescrBuilderImpl.java | 0 .../ConditionalBranchDescrBuilderImpl.java | 0 .../ast/dsl/impl/DeclareDescrBuilderImpl.java | 0 ...EntryPointDeclarationDescrBuilderImpl.java | 0 .../impl/EnumDeclarationDescrBuilderImpl.java | 0 .../dsl/impl/EnumLiteralDescrBuilderImpl.java | 0 .../ast/dsl/impl/EvalDescrBuilderImpl.java | 0 .../ast/dsl/impl/FieldDescrBuilderImpl.java | 0 .../ast/dsl/impl/ForallDescrBuilderImpl.java | 0 .../dsl/impl/FunctionDescrBuilderImpl.java | 0 .../ast/dsl/impl/GlobalDescrBuilderImpl.java | 0 .../ast/dsl/impl/GroupByDescrBuilderImpl.java | 0 .../ast/dsl/impl/ImportDescrBuilderImpl.java | 0 .../NamedConsequenceDescrBuilderImpl.java | 0 .../ast/dsl/impl/PackageDescrBuilderImpl.java | 0 .../ast/dsl/impl/PatternDescrBuilderImpl.java | 0 .../ast/dsl/impl/QueryDescrBuilderImpl.java | 0 .../ast/dsl/impl/RuleDescrBuilderImpl.java | 0 .../ast/dsl/impl/SourceDescrBuilderImpl.java | 0 .../impl/TypeDeclarationDescrBuilderImpl.java | 0 .../ast/dsl/impl/UnitDescrBuilderImpl.java | 0 .../WindowDeclarationDescrBuilderImpl.java | 0 .../java/org/drools/drl/ast/util/AstUtil.java | 0 .../drools-drl-extensions}/pom.xml | 5 +- .../drl/extensions/DecisionTableFactory.java | 0 .../drl/extensions/DecisionTableProvider.java | 0 .../extensions/GuidedRuleTemplateFactory.java | 0 .../GuidedRuleTemplateProvider.java | 0 .../extensions/ResourceConversionResult.java | 0 .../drools-drl-parser}/pom.xml | 5 +- .../BaseKnowledgeBuilderResultImpl.java | 0 .../org/drools/drl/parser/DRLFactory.java | 0 .../org/drools/drl/parser/DrlExprParser.java | 0 .../java/org/drools/drl/parser/DrlParser.java | 0 .../org/drools/drl/parser/DroolsError.java | 0 .../drl/parser/DroolsParserException.java | 0 .../org/drools/drl/parser/MessageImpl.java | 0 .../org/drools/drl/parser/ParserError.java | 0 .../org/drools/drl/parser/impl/Operator.java | 0 .../drl/parser/lang/AbstractDRLLexer.java | 0 .../drl/parser/lang/AbstractDRLParser.java | 0 .../drl/parser/lang/DRL5Expressions.java | 0 .../org/drools/drl/parser/lang/DRL5Lexer.java | 0 .../drools/drl/parser/lang/DRL5Parser.java | 0 .../drl/parser/lang/DRL6Expressions.java | 0 .../org/drools/drl/parser/lang/DRL6Lexer.java | 0 .../drools/drl/parser/lang/DRL6Parser.java | 0 .../drl/parser/lang/DRL6StrictParser.java | 0 .../drl/parser/lang/DRLExpressions.java | 0 .../org/drools/drl/parser/lang/DRLLexer.java | 0 .../org/drools/drl/parser/lang/DRLParser.java | 0 .../drl/parser/lang/DroolsEditorType.java | 0 .../lang/DroolsMismatchedSetException.java | 0 .../lang/DroolsMismatchedTokenException.java | 0 .../lang/DroolsMissingTokenException.java | 0 .../parser/lang/DroolsParaphraseTypes.java | 0 .../lang/DroolsParserExceptionFactory.java | 0 .../drl/parser/lang/DroolsSentence.java | 0 .../drl/parser/lang/DroolsSentenceType.java | 0 .../drl/parser/lang/DroolsSoftKeywords.java | 0 .../drools/drl/parser/lang/DroolsToken.java | 0 .../drools/drl/parser/lang/DroolsTree.java | 0 .../DroolsUnexpectedAnnotationException.java | 0 .../org/drools/drl/parser/lang/Expander.java | 0 .../drl/parser/lang/ExpanderException.java | 0 .../drl/parser/lang/ExpanderResolver.java | 0 .../parser/lang/GeneralParseException.java | 0 .../org/drools/drl/parser/lang/Location.java | 0 .../drl/parser/lang/ParseException.java | 0 .../drools/drl/parser/lang/ParserHelper.java | 0 .../lang/dsl/AbstractDSLMappingEntry.java | 0 .../parser/lang/dsl/AntlrDSLMappingEntry.java | 0 .../drl/parser/lang/dsl/DSLMapLexer.java | 0 .../drl/parser/lang/dsl/DSLMapParser.java | 0 .../drl/parser/lang/dsl/DSLMapWalker.java | 0 .../drl/parser/lang/dsl/DSLMapping.java | 0 .../drl/parser/lang/dsl/DSLMappingEntry.java | 0 .../drl/parser/lang/dsl/DSLMappingFile.java | 0 .../lang/dsl/DSLMappingParseException.java | 0 .../lang/dsl/DSLTokenizedMappingFile.java | 0 .../parser/lang/dsl/DefaultDSLMapping.java | 0 .../drl/parser/lang/dsl/DefaultExpander.java | 0 .../lang/dsl/DefaultExpanderResolver.java | 0 .../drl/parser/lang/dsl/MappingError.java | 0 .../org/drools/drl/parser/DRL5Expressions.g | 0 .../org/drools/drl/parser/DRL5Lexer.g | 0 .../org/drools/drl/parser/DRL6Expressions.g | 0 .../org/drools/drl/parser/DRL6Lexer.g | 0 .../org/drools/drl/parser/dsl/DSLMap.g | 0 .../org/drools/drl/parser/dsl/DSLMapWalker.g | 0 .../org/drools/drl/parser/package.html | 0 drools-drl/pom.xml | 57 ++++++++ .../project/KieModuleModelWrapper.java | 2 +- .../drools-quarkus-deployment}/pom.xml | 10 +- .../AbstractCompilationProvider.java | 6 +- .../deployment/DroolsAssetsProcessor.java | 26 ++-- .../deployment/DroolsCompilationProvider.java | 2 +- .../quarkus/deployment/ResourceCollector.java | 2 +- ...quarkus.deployment.dev.CompilationProvider | 1 + .../quarkus/deployment/BuildItemsTest.java | 8 +- .../otn/model/ASubclassOfMeasurement.java | 0 .../examples/otn/model/Measurement.java | 0 .../examples/otn/model/MyImplementation.java | 0 .../examples/otn/model/MyInterface.java | 0 .../examples/otn/model/MyUnusedClass.java | 0 .../src/test/resources/rules.txt | 0 .../pom.xml | 10 +- .../examples/multiunit/FirstUnit.java | 0 .../examples/multiunit/RuleInput.java | 0 .../examples/multiunit/RuleOutput1.java | 0 .../examples/multiunit/RuleOutput2.java | 0 .../examples/multiunit/SecondUnit.java | 0 .../ruleunit/examples/multiunit/First.drl | 0 .../ruleunit/examples/multiunit/Second.drl | 0 .../examples/multiunit/RuntimeTest.java | 0 .../README.md | 0 .../docker-compose.yml | 0 .../drools-quarkus-examples-reactive}/pom.xml | 10 +- .../ruleunit/examples/reactive/Adaptor.java | 0 .../ruleunit/examples/reactive/Alert.java | 0 .../examples/reactive/AlertingUnit.java | 0 .../ruleunit/examples/reactive/Event.java | 0 .../examples/reactive/EventDeserializer.java | 0 .../src/main/resources/application.properties | 0 .../examples/reactive/AlertingRules.drl | 0 .../KafkaTestResourceLifecycleManager.java | 0 .../examples/reactive/RuntimeTest.java | 0 .../drools-quarkus-examples}/pom.xml | 8 +- .../pom.xml | 10 +- .../test/hotreload/FindAdultEndpoint.java | 0 .../drools/quarkus/test/hotreload/Person.java | 0 .../src/main/resources/META-INF/kmodule.xml | 0 .../src/main/resources/application.properties | 0 .../resources/org/drools/hotreload/adult.txt | 0 .../quarkus/test/hotreload/HotReloadIT.java | 0 .../drools-quarkus-integration-test}/pom.xml | 10 +- .../java/org/drools/quarkus/test/Person.java | 0 .../org/drools/quarkus/test/ProbeCounter.java | 0 .../org/drools/quarkus/test/ProbeEvent.java | 0 .../java/org/drools/quarkus/test/Result.java | 0 .../org/drools/quarkus/test/StockTick.java | 0 .../drools/quarkus/test/TestableResource.java | 0 .../src/main/resources/META-INF/kmodule.xml | 0 .../src/main/resources/org/drools/cep/cep.drl | 0 .../resources/org/drools/drl/CanDrink.drl | 0 .../org/drools/dtable/CanDrink.drl.xls | Bin .../main/resources/org/drools/probe/probe.drl | 0 .../src/main/resources/org/drools/tms/tms.drl | 0 .../org/drools/quarkus/test/RuntimeTest.java | 0 .../org/drools/quarkus/test/TestableIT.java | 0 .../guide.adoc | 4 +- .../drools-quarkus-quickstart-test}/pom.xml | 10 +- .../quickstart/test/HomeAlertsBean.java | 0 .../quickstart/test/HomeRuleUnitData.java | 0 .../quarkus/quickstart/test/model/Alert.java | 0 .../quarkus/quickstart/test/model/CCTV.java | 0 .../quarkus/quickstart/test/model/Light.java | 0 .../quickstart/test/model/Smartphone.java | 0 .../drools/quarkus/quickstart/test/rules.drl | 0 .../quarkus/quickstart/test/BeanTest.java | 0 .../quarkus/quickstart/test/RuntimeIT.java | 0 .../pom.xml | 10 +- .../quarkus/ruleunit/test/HelloWorldUnit.java | 0 .../quarkus/ruleunit/test/SimpleDTUnit.java | 0 .../ruleunit/test/TestableResource.java | 0 .../quarkus/ruleunit/test/AlertingService.drl | 0 .../drools/quarkus/ruleunit/test/rules.drl | 0 .../test/AutomaticRestEndpointIT.java | 0 .../ruleunit/test/RuntimeDslRuleUnitTest.java | 0 .../quarkus/ruleunit/test/RuntimeTest.java | 0 .../quarkus/ruleunit/test/TestableIT.java | 0 .../drools-quarkus-util-deployment}/pom.xml | 6 +- .../DroolsQuarkusResourceUtils.java | 2 +- .../util/deployment/GeneratedFileWriter.java | 2 +- .../util/deployment/GlobalsBuildItem.java | 2 +- .../KmoduleKieBaseModelsBuiltItem.java | 2 +- .../deployment/PatternsTypesBuildItem.java | 2 +- .../util/deployment/QuarkusAppPaths.java | 2 +- .../drools-quarkus}/pom.xml | 6 +- .../resources/META-INF/quarkus-extension.yaml | 0 .../pom.xml | 18 +-- pom.xml | 8 +- 302 files changed, 227 insertions(+), 175 deletions(-) delete mode 100644 drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/resources/META-INF/services/io.quarkus.deployment.dev.CompilationProvider rename {drools-drl-ast => drools-drl/drools-drl-ast}/pom.xml (94%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/AbstractClassTypeDeclarationDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/AccessorDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/AccumulateDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/AccumulateImportDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ActionDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/AndDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/AnnotatedBaseDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/AnnotationDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/AtomicExprDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/AttributeDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/BaseDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/BehaviorDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/BindingDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/CollectDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ConditionalBranchDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ConditionalElementDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ConnectiveDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ConnectiveType.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ConstraintConnectiveDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/DeclarativeInvokerDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/DescrVisitor.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/EntryPointDeclarationDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/EntryPointDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/EnumDeclarationDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/EnumLiteralDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/EvalDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/EvaluatorBasedRestrictionDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ExistsDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ExprConstraintDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ExpressionDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/FactTemplateDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/FieldConstraintDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/FieldTemplateDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ForFunctionDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ForallDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/FromDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/FunctionDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/FunctionImportDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/GlobalDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/GroupByDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ImportDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/LiteralDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/LiteralRestrictionDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/MVELExprDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/MultiPatternDestinationDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/NamedConsequenceDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/Namespaceable.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/NotDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/OperatorDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/OrDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/PackageDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/PackageDescrDumper.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/PatternDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/PatternDestinationDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/PatternSourceDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/PredicateDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ProcessDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/QualifiedIdentifierRestrictionDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/QualifiedName.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/QueryDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/RelationalExprDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/Restriction.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/RestrictionConnectiveDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/RestrictionDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ReturnValueDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/ReturnValueRestrictionDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/RuleDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/TypeDeclarationDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/TypeFieldDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/UnitDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/VariableRestrictionDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/WindowDeclarationDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/descr/WindowReferenceDescr.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/AbstractClassTypeDeclarationBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/AccumulateDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/AccumulateImportDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/AnnotatedDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/AnnotationDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/AttributeDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/AttributeSupportBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/BehaviorDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/CEDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/CollectDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/ConditionalBranchDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/DeclareDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/DescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/DescrFactory.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/EntryPointDeclarationDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/EnumDeclarationDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/EnumLiteralDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/EvalDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/FieldDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/ForallDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/FunctionDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/GlobalDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/GroupByDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/ImportDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/NamedConsequenceDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/PackageDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/ParameterSupportBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/PatternContainerDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/PatternDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/QueryDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/RuleDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/SourceDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/TypeDeclarationDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/UnitDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/WindowDeclarationDescrBuilder.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/AccumulateDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/AccumulateImportDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/AnnotationDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/AttributeDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/BaseDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/BehaviorDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/CEDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/CollectDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/ConditionalBranchDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/DeclareDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/EntryPointDeclarationDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/EnumDeclarationDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/EnumLiteralDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/EvalDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/FieldDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/ForallDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/FunctionDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/GlobalDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/GroupByDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/ImportDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/NamedConsequenceDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/PackageDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/PatternDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/QueryDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/RuleDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/SourceDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/TypeDeclarationDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/UnitDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/dsl/impl/WindowDeclarationDescrBuilderImpl.java (100%) rename {drools-drl-ast => drools-drl/drools-drl-ast}/src/main/java/org/drools/drl/ast/util/AstUtil.java (100%) rename {drools-drl-extensions => drools-drl/drools-drl-extensions}/pom.xml (92%) rename {drools-drl-extensions => drools-drl/drools-drl-extensions}/src/main/java/org/drools/drl/extensions/DecisionTableFactory.java (100%) rename {drools-drl-extensions => drools-drl/drools-drl-extensions}/src/main/java/org/drools/drl/extensions/DecisionTableProvider.java (100%) rename {drools-drl-extensions => drools-drl/drools-drl-extensions}/src/main/java/org/drools/drl/extensions/GuidedRuleTemplateFactory.java (100%) rename {drools-drl-extensions => drools-drl/drools-drl-extensions}/src/main/java/org/drools/drl/extensions/GuidedRuleTemplateProvider.java (100%) rename {drools-drl-extensions => drools-drl/drools-drl-extensions}/src/main/java/org/drools/drl/extensions/ResourceConversionResult.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/pom.xml (98%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/BaseKnowledgeBuilderResultImpl.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/DRLFactory.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/DrlExprParser.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/DrlParser.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/DroolsError.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/DroolsParserException.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/MessageImpl.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/ParserError.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/impl/Operator.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/AbstractDRLLexer.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/AbstractDRLParser.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DRL5Expressions.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DRL5Lexer.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DRL5Parser.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DRL6Expressions.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DRL6Lexer.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DRL6Parser.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DRL6StrictParser.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DRLExpressions.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DRLLexer.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DRLParser.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DroolsEditorType.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DroolsMismatchedSetException.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DroolsMismatchedTokenException.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DroolsMissingTokenException.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DroolsParaphraseTypes.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DroolsParserExceptionFactory.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DroolsSentence.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DroolsSentenceType.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DroolsSoftKeywords.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DroolsToken.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DroolsTree.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/DroolsUnexpectedAnnotationException.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/Expander.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/ExpanderException.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/ExpanderResolver.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/GeneralParseException.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/Location.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/ParseException.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/ParserHelper.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/dsl/AbstractDSLMappingEntry.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/dsl/AntlrDSLMappingEntry.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapLexer.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapParser.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapWalker.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapping.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingEntry.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingFile.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingParseException.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/dsl/DSLTokenizedMappingFile.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/dsl/DefaultDSLMapping.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/dsl/DefaultExpander.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/dsl/DefaultExpanderResolver.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/java/org/drools/drl/parser/lang/dsl/MappingError.java (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/resources/org/drools/drl/parser/DRL5Expressions.g (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/resources/org/drools/drl/parser/DRL5Lexer.g (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/resources/org/drools/drl/parser/DRL6Expressions.g (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/resources/org/drools/drl/parser/DRL6Lexer.g (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/resources/org/drools/drl/parser/dsl/DSLMap.g (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/resources/org/drools/drl/parser/dsl/DSLMapWalker.g (100%) rename {drools-drl-parser => drools-drl/drools-drl-parser}/src/main/resources/org/drools/drl/parser/package.html (100%) create mode 100644 drools-drl/pom.xml rename {drools-drl-quarkus-extension/drools-drl-quarkus-deployment => drools-quarkus-extension/drools-quarkus-deployment}/pom.xml (95%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl => drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools}/quarkus/deployment/AbstractCompilationProvider.java (89%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl => drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools}/quarkus/deployment/DroolsAssetsProcessor.java (84%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl => drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools}/quarkus/deployment/DroolsCompilationProvider.java (97%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl => drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools}/quarkus/deployment/ResourceCollector.java (99%) create mode 100644 drools-quarkus-extension/drools-quarkus-deployment/src/main/resources/META-INF/services/io.quarkus.deployment.dev.CompilationProvider rename {drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/java/org/drools/drl => drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools}/quarkus/deployment/BuildItemsTest.java (96%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-deployment => drools-quarkus-extension/drools-quarkus-deployment}/src/test/java/org/drools/quarkus/examples/otn/model/ASubclassOfMeasurement.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-deployment => drools-quarkus-extension/drools-quarkus-deployment}/src/test/java/org/drools/quarkus/examples/otn/model/Measurement.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-deployment => drools-quarkus-extension/drools-quarkus-deployment}/src/test/java/org/drools/quarkus/examples/otn/model/MyImplementation.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-deployment => drools-quarkus-extension/drools-quarkus-deployment}/src/test/java/org/drools/quarkus/examples/otn/model/MyInterface.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-deployment => drools-quarkus-extension/drools-quarkus-deployment}/src/test/java/org/drools/quarkus/examples/otn/model/MyUnusedClass.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-deployment => drools-quarkus-extension/drools-quarkus-deployment}/src/test/resources/rules.txt (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit}/pom.xml (93%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit}/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/FirstUnit.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit}/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleInput.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit}/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleOutput1.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit}/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleOutput2.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit}/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/SecondUnit.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit}/src/main/resources/org/drools/quarkus/ruleunit/examples/multiunit/First.drl (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit}/src/main/resources/org/drools/quarkus/ruleunit/examples/multiunit/Second.drl (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit}/src/test/java/org/drools/quarkus/ruleunit/examples/multiunit/RuntimeTest.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive}/README.md (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive}/docker-compose.yml (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive}/pom.xml (94%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive}/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Adaptor.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive}/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Alert.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive}/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/AlertingUnit.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive}/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Event.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive}/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/EventDeserializer.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive}/src/main/resources/application.properties (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive}/src/main/resources/org/drools/quarkus/ruleunit/examples/reactive/AlertingRules.drl (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive}/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/KafkaTestResourceLifecycleManager.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive => drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive}/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/RuntimeTest.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-examples => drools-quarkus-extension/drools-quarkus-examples}/pom.xml (85%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload => drools-quarkus-extension/drools-quarkus-integration-test-hotreload}/pom.xml (92%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload => drools-quarkus-extension/drools-quarkus-integration-test-hotreload}/src/main/java/org/drools/quarkus/test/hotreload/FindAdultEndpoint.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload => drools-quarkus-extension/drools-quarkus-integration-test-hotreload}/src/main/java/org/drools/quarkus/test/hotreload/Person.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload => drools-quarkus-extension/drools-quarkus-integration-test-hotreload}/src/main/resources/META-INF/kmodule.xml (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload => drools-quarkus-extension/drools-quarkus-integration-test-hotreload}/src/main/resources/application.properties (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload => drools-quarkus-extension/drools-quarkus-integration-test-hotreload}/src/main/resources/org/drools/hotreload/adult.txt (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload => drools-quarkus-extension/drools-quarkus-integration-test-hotreload}/src/test/java/org/drools/quarkus/test/hotreload/HotReloadIT.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/pom.xml (94%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/src/main/java/org/drools/quarkus/test/Person.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/src/main/java/org/drools/quarkus/test/ProbeCounter.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/src/main/java/org/drools/quarkus/test/ProbeEvent.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/src/main/java/org/drools/quarkus/test/Result.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/src/main/java/org/drools/quarkus/test/StockTick.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/src/main/java/org/drools/quarkus/test/TestableResource.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/src/main/resources/META-INF/kmodule.xml (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/src/main/resources/org/drools/cep/cep.drl (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/src/main/resources/org/drools/drl/CanDrink.drl (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/src/main/resources/org/drools/dtable/CanDrink.drl.xls (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/src/main/resources/org/drools/probe/probe.drl (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/src/main/resources/org/drools/tms/tms.drl (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/src/test/java/org/drools/quarkus/test/RuntimeTest.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-integration-test => drools-quarkus-extension/drools-quarkus-integration-test}/src/test/java/org/drools/quarkus/test/TestableIT.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test => drools-quarkus-extension/drools-quarkus-quickstart-test}/guide.adoc (98%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test => drools-quarkus-extension/drools-quarkus-quickstart-test}/pom.xml (95%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test => drools-quarkus-extension/drools-quarkus-quickstart-test}/src/main/java/org/drools/quarkus/quickstart/test/HomeAlertsBean.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test => drools-quarkus-extension/drools-quarkus-quickstart-test}/src/main/java/org/drools/quarkus/quickstart/test/HomeRuleUnitData.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test => drools-quarkus-extension/drools-quarkus-quickstart-test}/src/main/java/org/drools/quarkus/quickstart/test/model/Alert.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test => drools-quarkus-extension/drools-quarkus-quickstart-test}/src/main/java/org/drools/quarkus/quickstart/test/model/CCTV.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test => drools-quarkus-extension/drools-quarkus-quickstart-test}/src/main/java/org/drools/quarkus/quickstart/test/model/Light.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test => drools-quarkus-extension/drools-quarkus-quickstart-test}/src/main/java/org/drools/quarkus/quickstart/test/model/Smartphone.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test => drools-quarkus-extension/drools-quarkus-quickstart-test}/src/main/resources/org/drools/quarkus/quickstart/test/rules.drl (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test => drools-quarkus-extension/drools-quarkus-quickstart-test}/src/test/java/org/drools/quarkus/quickstart/test/BeanTest.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test => drools-quarkus-extension/drools-quarkus-quickstart-test}/src/test/java/org/drools/quarkus/quickstart/test/RuntimeIT.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test => drools-quarkus-extension/drools-quarkus-ruleunit-integration-test}/pom.xml (95%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test => drools-quarkus-extension/drools-quarkus-ruleunit-integration-test}/src/main/java/org/drools/quarkus/ruleunit/test/HelloWorldUnit.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test => drools-quarkus-extension/drools-quarkus-ruleunit-integration-test}/src/main/java/org/drools/quarkus/ruleunit/test/SimpleDTUnit.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test => drools-quarkus-extension/drools-quarkus-ruleunit-integration-test}/src/main/java/org/drools/quarkus/ruleunit/test/TestableResource.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test => drools-quarkus-extension/drools-quarkus-ruleunit-integration-test}/src/main/resources/org/drools/quarkus/ruleunit/test/AlertingService.drl (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test => drools-quarkus-extension/drools-quarkus-ruleunit-integration-test}/src/main/resources/org/drools/quarkus/ruleunit/test/rules.drl (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test => drools-quarkus-extension/drools-quarkus-ruleunit-integration-test}/src/test/java/org/drools/quarkus/ruleunit/test/AutomaticRestEndpointIT.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test => drools-quarkus-extension/drools-quarkus-ruleunit-integration-test}/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeDslRuleUnitTest.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test => drools-quarkus-extension/drools-quarkus-ruleunit-integration-test}/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeTest.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test => drools-quarkus-extension/drools-quarkus-ruleunit-integration-test}/src/test/java/org/drools/quarkus/ruleunit/test/TestableIT.java (100%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment => drools-quarkus-extension/drools-quarkus-util-deployment}/pom.xml (92%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl => drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools}/quarkus/util/deployment/DroolsQuarkusResourceUtils.java (99%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl => drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools}/quarkus/util/deployment/GeneratedFileWriter.java (99%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl => drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools}/quarkus/util/deployment/GlobalsBuildItem.java (96%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl => drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools}/quarkus/util/deployment/KmoduleKieBaseModelsBuiltItem.java (96%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl => drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools}/quarkus/util/deployment/PatternsTypesBuildItem.java (96%) rename {drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl => drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools}/quarkus/util/deployment/QuarkusAppPaths.java (98%) rename {drools-drl-quarkus-extension/drools-drl-quarkus => drools-quarkus-extension/drools-quarkus}/pom.xml (96%) rename {drools-drl-quarkus-extension/drools-drl-quarkus => drools-quarkus-extension/drools-quarkus}/src/main/resources/META-INF/quarkus-extension.yaml (100%) rename {drools-drl-quarkus-extension => drools-quarkus-extension}/pom.xml (79%) diff --git a/.ci/environments/quarkus-3/patches/0001_before_sh.patch b/.ci/environments/quarkus-3/patches/0001_before_sh.patch index 0408ca69a82..9d5f496ae3d 100644 --- a/.ci/environments/quarkus-3/patches/0001_before_sh.patch +++ b/.ci/environments/quarkus-3/patches/0001_before_sh.patch @@ -1309,22 +1309,22 @@ index bc4545d39b..d4fb71df07 100644 --- a/drools-commands/src/main/java/org/drools/commands/runtime/rule/FireUntilHaltCommand.java +++ b/drools-commands/src/main/java/org/drools/commands/runtime/rule/FireUntilHaltCommand.java @@ -18,11 +18,11 @@ - */ - package org.drools.commands.runtime.rule; - --import javax.xml.bind.annotation.XmlAccessType; --import javax.xml.bind.annotation.XmlAccessorType; --import javax.xml.bind.annotation.XmlAnyElement; --import javax.xml.bind.annotation.XmlRootElement; --import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -+import jakarta.xml.bind.annotation.XmlAccessType; -+import jakarta.xml.bind.annotation.XmlAccessorType; -+import jakarta.xml.bind.annotation.XmlAnyElement; -+import jakarta.xml.bind.annotation.XmlRootElement; -+import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - import org.drools.core.common.InternalWorkingMemory; - import org.drools.commands.jaxb.JaxbUnknownAdapter; + */ + package org.drools.commands.runtime.rule; + +-import javax.xml.bind.annotation.XmlAccessType; +-import javax.xml.bind.annotation.XmlAccessorType; +-import javax.xml.bind.annotation.XmlAnyElement; +-import javax.xml.bind.annotation.XmlRootElement; +-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; ++import jakarta.xml.bind.annotation.XmlAccessType; ++import jakarta.xml.bind.annotation.XmlAccessorType; ++import jakarta.xml.bind.annotation.XmlAnyElement; ++import jakarta.xml.bind.annotation.XmlRootElement; ++import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + import org.drools.core.common.InternalWorkingMemory; + import org.drools.commands.jaxb.JaxbUnknownAdapter; diff --git a/drools-commands/src/main/java/org/drools/commands/runtime/rule/GetAgendaEventListenersCommand.java b/drools-commands/src/main/java/org/drools/commands/runtime/rule/GetAgendaEventListenersCommand.java index d138313dcb..787878bf6d 100644 --- a/drools-commands/src/main/java/org/drools/commands/runtime/rule/GetAgendaEventListenersCommand.java @@ -1893,10 +1893,10 @@ index e37c37fc31..a9aec456b6 100644 /** * Provides a abstract base implementation that an object can extend so that it can be used in a LinkedList. -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java b/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java +diff --git a/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java b/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java index c679cb7bcd..5a19341206 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java +--- a/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java ++++ b/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java @@ -26,7 +26,7 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -1906,10 +1906,10 @@ index c679cb7bcd..5a19341206 100644 import io.quarkus.arc.deployment.GeneratedBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/test/java/org/drools/quarkus/ruleunit/examples/multiunit/RuntimeTest.java b/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/test/java/org/drools/quarkus/ruleunit/examples/multiunit/RuntimeTest.java +diff --git a/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/test/java/org/drools/quarkus/ruleunit/examples/multiunit/RuntimeTest.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/test/java/org/drools/quarkus/ruleunit/examples/multiunit/RuntimeTest.java index 532ee58bf1..4122df9325 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/test/java/org/drools/quarkus/ruleunit/examples/multiunit/RuntimeTest.java -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/test/java/org/drools/quarkus/ruleunit/examples/multiunit/RuntimeTest.java +--- a/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/test/java/org/drools/quarkus/ruleunit/examples/multiunit/RuntimeTest.java ++++ b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/test/java/org/drools/quarkus/ruleunit/examples/multiunit/RuntimeTest.java @@ -19,7 +19,7 @@ package org.drools.quarkus.ruleunit.examples.multiunit; @@ -1919,10 +1919,10 @@ index 532ee58bf1..4122df9325 100644 import io.quarkus.test.junit.QuarkusTest; import org.drools.ruleunits.api.DataHandle; -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Adaptor.java b/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Adaptor.java +diff --git a/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Adaptor.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Adaptor.java index ff8e3f9091..799f21622a 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Adaptor.java -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Adaptor.java +--- a/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Adaptor.java ++++ b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Adaptor.java @@ -18,10 +18,10 @@ */ package org.drools.quarkus.ruleunit.examples.reactive; @@ -1937,10 +1937,10 @@ index ff8e3f9091..799f21622a 100644 import org.eclipse.microprofile.reactive.messaging.Channel; import org.eclipse.microprofile.reactive.messaging.Emitter; import org.eclipse.microprofile.reactive.messaging.Incoming; -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/KafkaTestResourceLifecycleManager.java b/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/KafkaTestResourceLifecycleManager.java +diff --git a/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/KafkaTestResourceLifecycleManager.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/KafkaTestResourceLifecycleManager.java index bbed58452e..da927c5ab0 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/KafkaTestResourceLifecycleManager.java -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/KafkaTestResourceLifecycleManager.java +--- a/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/KafkaTestResourceLifecycleManager.java ++++ b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/KafkaTestResourceLifecycleManager.java @@ -22,7 +22,7 @@ import java.util.HashMap; import java.util.Map; @@ -1950,10 +1950,10 @@ index bbed58452e..da927c5ab0 100644 public class KafkaTestResourceLifecycleManager implements QuarkusTestResourceLifecycleManager { -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/RuntimeTest.java b/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/RuntimeTest.java +diff --git a/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/RuntimeTest.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/RuntimeTest.java index 52f998f55f..9771b03d80 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/RuntimeTest.java -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/RuntimeTest.java +--- a/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/RuntimeTest.java ++++ b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/RuntimeTest.java @@ -18,13 +18,13 @@ */ package org.drools.quarkus.ruleunit.examples.reactive; @@ -1972,10 +1972,10 @@ index 52f998f55f..9771b03d80 100644 import org.eclipse.microprofile.reactive.messaging.spi.Connector; import org.junit.jupiter.api.Test; -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/FindAdultEndpoint.java b/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/FindAdultEndpoint.java +diff --git a/drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/FindAdultEndpoint.java b/drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/FindAdultEndpoint.java index 28cd4eb6d1..8cea5670cf 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/FindAdultEndpoint.java -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/FindAdultEndpoint.java +--- a/drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/FindAdultEndpoint.java ++++ b/drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/FindAdultEndpoint.java @@ -20,12 +20,12 @@ package org.drools.quarkus.test.hotreload; import java.util.ArrayList; @@ -1995,10 +1995,10 @@ index 28cd4eb6d1..8cea5670cf 100644 import org.kie.api.runtime.KieRuntimeBuilder; import org.kie.api.runtime.KieSession; -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java b/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java +diff --git a/drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java index cc47c1a1e3..cd52e85e0f 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java +--- a/drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java ++++ b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java @@ -25,10 +25,10 @@ import org.kie.api.runtime.KieSession; import org.kie.api.runtime.rule.FactHandle; import org.kie.api.time.SessionPseudoClock; @@ -2014,10 +2014,10 @@ index cc47c1a1e3..cd52e85e0f 100644 import java.util.Collection; import java.util.List; import java.util.concurrent.TimeUnit; -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java b/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java +diff --git a/drools-quarkus-extension/drools-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java b/drools-quarkus-extension/drools-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java index 76cedc9fb6..203de60e6b 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java +--- a/drools-quarkus-extension/drools-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java ++++ b/drools-quarkus-extension/drools-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java @@ -24,7 +24,7 @@ import org.kie.api.definition.KiePackage; import org.kie.api.runtime.KieRuntimeBuilder; import org.kie.api.runtime.KieSession; @@ -2027,10 +2027,10 @@ index 76cedc9fb6..203de60e6b 100644 import java.util.List; import java.util.stream.Collectors; -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeAlertsBean.java b/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeAlertsBean.java +diff --git a/drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeAlertsBean.java b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeAlertsBean.java index a58bbabd5c..8f8ecf910c 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeAlertsBean.java -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeAlertsBean.java +--- a/drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeAlertsBean.java ++++ b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeAlertsBean.java @@ -21,8 +21,8 @@ package org.drools.quarkus.quickstart.test; import java.util.Collection; import java.util.stream.Collectors; @@ -2042,10 +2042,10 @@ index a58bbabd5c..8f8ecf910c 100644 import org.drools.quarkus.quickstart.test.model.Alert; import org.drools.quarkus.quickstart.test.model.CCTV; -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/BeanTest.java b/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/BeanTest.java +diff --git a/drools-quarkus-extension/drools-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/BeanTest.java b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/BeanTest.java index 4896b42524..0aa6285eb0 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/BeanTest.java -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/BeanTest.java +--- a/drools-quarkus-extension/drools-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/BeanTest.java ++++ b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/BeanTest.java @@ -18,7 +18,7 @@ */ package org.drools.quarkus.quickstart.test; @@ -2055,10 +2055,10 @@ index 4896b42524..0aa6285eb0 100644 import io.quarkus.test.junit.QuarkusTest; -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/RuntimeIT.java b/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/RuntimeIT.java +diff --git a/drools-quarkus-extension/drools-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/RuntimeIT.java b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/RuntimeIT.java index 6bcc7afc17..21ce175faa 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/RuntimeIT.java -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/RuntimeIT.java +--- a/drools-quarkus-extension/drools-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/RuntimeIT.java ++++ b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/RuntimeIT.java @@ -18,7 +18,7 @@ */ package org.drools.quarkus.quickstart.test; @@ -2068,10 +2068,10 @@ index 6bcc7afc17..21ce175faa 100644 import io.quarkus.test.junit.QuarkusTest; import org.drools.quarkus.quickstart.test.model.Alert; -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/TestableResource.java b/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/TestableResource.java +diff --git a/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/TestableResource.java b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/TestableResource.java index 471c3c33a9..99e2c9da1b 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/TestableResource.java -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/TestableResource.java +--- a/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/TestableResource.java ++++ b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/TestableResource.java @@ -20,10 +20,10 @@ package org.drools.quarkus.ruleunit.test; import static org.assertj.core.api.Assertions.assertThat; @@ -2087,10 +2087,10 @@ index 471c3c33a9..99e2c9da1b 100644 import org.drools.ruleunits.api.RuleUnit; import org.drools.ruleunits.api.RuleUnitInstance; -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeDslRuleUnitTest.java b/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeDslRuleUnitTest.java +diff --git a/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeDslRuleUnitTest.java b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeDslRuleUnitTest.java index e3b9d48e5a..ba13c358f3 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeDslRuleUnitTest.java -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeDslRuleUnitTest.java +--- a/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeDslRuleUnitTest.java ++++ b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeDslRuleUnitTest.java @@ -23,7 +23,7 @@ import org.drools.ruleunits.api.RuleUnit; import org.drools.ruleunits.api.RuleUnitInstance; import org.junit.jupiter.api.Test; @@ -2100,10 +2100,10 @@ index e3b9d48e5a..ba13c358f3 100644 import static org.assertj.core.api.Assertions.assertThat; -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeTest.java b/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeTest.java +diff --git a/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeTest.java b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeTest.java index 48aaf17201..873e112e29 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeTest.java -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeTest.java +--- a/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeTest.java ++++ b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeTest.java @@ -23,7 +23,7 @@ import org.drools.ruleunits.api.RuleUnit; import org.drools.ruleunits.api.RuleUnitInstance; import org.junit.jupiter.api.Test; @@ -2113,10 +2113,10 @@ index 48aaf17201..873e112e29 100644 import static org.junit.jupiter.api.Assertions.assertEquals; -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus/pom.xml b/drools-drl-quarkus-extension/drools-drl-quarkus/pom.xml +diff --git a/drools-quarkus-extension/drools-quarkus/pom.xml b/drools-quarkus-extension/drools-quarkus/pom.xml index 8205e8d898..84c941d52b 100644 ---- a/drools-drl-quarkus-extension/drools-drl-quarkus/pom.xml -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus/pom.xml +--- a/drools-quarkus-extension/drools-quarkus/pom.xml ++++ b/drools-quarkus-extension/drools-quarkus/pom.xml @@ -103,7 +103,7 @@ diff --git a/.ci/environments/quarkus-3/patches/0004_hardcoded-javax-string.patch b/.ci/environments/quarkus-3/patches/0004_hardcoded-javax-string.patch index 10332806ff9..aef3a0cfa4e 100644 --- a/.ci/environments/quarkus-3/patches/0004_hardcoded-javax-string.patch +++ b/.ci/environments/quarkus-3/patches/0004_hardcoded-javax-string.patch @@ -1,13 +1,13 @@ Subject: [PATCH] [quarkus_patch_javax_string] Replacing javax -> jakarta --- -Index: drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java +Index: drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== -diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java b/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java ---- a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java (revision 4eb6d59aefa1df16a286666f75ead10d8b77746f) -+++ b/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java (date 1677837541284) +diff --git a/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java +--- a/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java (revision 4eb6d59aefa1df16a286666f75ead10d8b77746f) ++++ b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java (date 1677837541284) @@ -222,8 +222,8 @@ } diff --git a/bom/drools-bom/pom.xml b/bom/drools-bom/pom.xml index 19e29a05651..4219a530d3b 100644 --- a/bom/drools-bom/pom.xml +++ b/bom/drools-bom/pom.xml @@ -634,60 +634,60 @@ org.drools - drools-drl-quarkus + drools-quarkus ${project.version} org.drools - drools-drl-quarkus + drools-quarkus ${project.version} sources org.drools - drools-drl-quarkus + drools-quarkus ${project.version} test-jar test org.drools - drools-drl-quarkus-deployment + drools-quarkus-deployment ${project.version} org.drools - drools-drl-quarkus-deployment + drools-quarkus-deployment ${project.version} sources org.drools - drools-drl-quarkus-deployment + drools-quarkus-deployment ${project.version} pom org.drools - drools-drl-quarkus-deployment + drools-quarkus-deployment ${project.version} test-jar test org.drools - drools-drl-quarkus-util-deployment + drools-quarkus-util-deployment ${project.version} org.drools - drools-drl-quarkus-util-deployment + drools-quarkus-util-deployment ${project.version} sources org.drools - drools-drl-quarkus-util-deployment + drools-quarkus-util-deployment ${project.version} test-jar test diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/resources/META-INF/services/io.quarkus.deployment.dev.CompilationProvider b/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/resources/META-INF/services/io.quarkus.deployment.dev.CompilationProvider deleted file mode 100644 index d79031f3052..00000000000 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/resources/META-INF/services/io.quarkus.deployment.dev.CompilationProvider +++ /dev/null @@ -1 +0,0 @@ -org.drools.drl.quarkus.deployment.DroolsCompilationProvider \ No newline at end of file diff --git a/drools-drl-ast/pom.xml b/drools-drl/drools-drl-ast/pom.xml similarity index 94% rename from drools-drl-ast/pom.xml rename to drools-drl/drools-drl-ast/pom.xml index cfa059489c2..d57333c2b26 100644 --- a/drools-drl-ast/pom.xml +++ b/drools-drl/drools-drl-ast/pom.xml @@ -24,10 +24,9 @@ 4.0.0 - org.kie - drools-build-parent + org.drools + drools-drl 8.45.0-SNAPSHOT - ../build-parent/pom.xml org.drools diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AbstractClassTypeDeclarationDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AbstractClassTypeDeclarationDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AbstractClassTypeDeclarationDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AbstractClassTypeDeclarationDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AccessorDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AccessorDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AccessorDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AccessorDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AccumulateDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AccumulateDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AccumulateDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AccumulateDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AccumulateImportDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AccumulateImportDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AccumulateImportDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AccumulateImportDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ActionDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ActionDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ActionDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ActionDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AndDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AndDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AndDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AndDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AnnotatedBaseDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AnnotatedBaseDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AnnotatedBaseDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AnnotatedBaseDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AnnotationDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AnnotationDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AnnotationDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AnnotationDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AtomicExprDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AtomicExprDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AtomicExprDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AtomicExprDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AttributeDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AttributeDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AttributeDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/AttributeDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/BaseDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/BaseDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/BaseDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/BaseDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/BehaviorDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/BehaviorDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/BehaviorDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/BehaviorDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/BindingDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/BindingDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/BindingDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/BindingDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/CollectDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/CollectDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/CollectDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/CollectDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConditionalBranchDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConditionalBranchDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConditionalBranchDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConditionalBranchDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConditionalElementDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConditionalElementDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConditionalElementDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConditionalElementDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConnectiveDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConnectiveDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConnectiveDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConnectiveDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConnectiveType.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConnectiveType.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConnectiveType.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConnectiveType.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConstraintConnectiveDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConstraintConnectiveDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConstraintConnectiveDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ConstraintConnectiveDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/DeclarativeInvokerDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/DeclarativeInvokerDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/DeclarativeInvokerDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/DeclarativeInvokerDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/DescrVisitor.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/DescrVisitor.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/DescrVisitor.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/DescrVisitor.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EntryPointDeclarationDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EntryPointDeclarationDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EntryPointDeclarationDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EntryPointDeclarationDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EntryPointDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EntryPointDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EntryPointDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EntryPointDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EnumDeclarationDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EnumDeclarationDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EnumDeclarationDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EnumDeclarationDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EnumLiteralDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EnumLiteralDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EnumLiteralDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EnumLiteralDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EvalDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EvalDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EvalDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EvalDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EvaluatorBasedRestrictionDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EvaluatorBasedRestrictionDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EvaluatorBasedRestrictionDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/EvaluatorBasedRestrictionDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ExistsDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ExistsDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ExistsDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ExistsDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ExprConstraintDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ExprConstraintDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ExprConstraintDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ExprConstraintDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ExpressionDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ExpressionDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ExpressionDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ExpressionDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FactTemplateDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FactTemplateDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FactTemplateDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FactTemplateDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FieldConstraintDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FieldConstraintDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FieldConstraintDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FieldConstraintDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FieldTemplateDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FieldTemplateDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FieldTemplateDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FieldTemplateDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ForFunctionDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ForFunctionDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ForFunctionDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ForFunctionDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ForallDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ForallDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ForallDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ForallDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FromDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FromDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FromDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FromDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FunctionDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FunctionDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FunctionDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FunctionDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FunctionImportDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FunctionImportDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FunctionImportDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/FunctionImportDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/GlobalDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/GlobalDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/GlobalDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/GlobalDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/GroupByDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/GroupByDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/GroupByDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/GroupByDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ImportDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ImportDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ImportDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ImportDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/LiteralDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/LiteralDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/LiteralDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/LiteralDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/LiteralRestrictionDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/LiteralRestrictionDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/LiteralRestrictionDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/LiteralRestrictionDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/MVELExprDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/MVELExprDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/MVELExprDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/MVELExprDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/MultiPatternDestinationDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/MultiPatternDestinationDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/MultiPatternDestinationDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/MultiPatternDestinationDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/NamedConsequenceDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/NamedConsequenceDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/NamedConsequenceDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/NamedConsequenceDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/Namespaceable.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/Namespaceable.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/Namespaceable.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/Namespaceable.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/NotDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/NotDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/NotDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/NotDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/OperatorDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/OperatorDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/OperatorDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/OperatorDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/OrDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/OrDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/OrDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/OrDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PackageDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PackageDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PackageDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PackageDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PackageDescrDumper.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PackageDescrDumper.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PackageDescrDumper.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PackageDescrDumper.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PatternDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PatternDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PatternDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PatternDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PatternDestinationDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PatternDestinationDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PatternDestinationDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PatternDestinationDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PatternSourceDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PatternSourceDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PatternSourceDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PatternSourceDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PredicateDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PredicateDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PredicateDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/PredicateDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ProcessDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ProcessDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ProcessDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ProcessDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/QualifiedIdentifierRestrictionDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/QualifiedIdentifierRestrictionDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/QualifiedIdentifierRestrictionDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/QualifiedIdentifierRestrictionDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/QualifiedName.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/QualifiedName.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/QualifiedName.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/QualifiedName.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/QueryDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/QueryDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/QueryDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/QueryDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RelationalExprDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RelationalExprDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RelationalExprDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RelationalExprDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/Restriction.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/Restriction.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/Restriction.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/Restriction.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RestrictionConnectiveDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RestrictionConnectiveDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RestrictionConnectiveDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RestrictionConnectiveDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RestrictionDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RestrictionDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RestrictionDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RestrictionDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ReturnValueDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ReturnValueDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ReturnValueDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ReturnValueDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ReturnValueRestrictionDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ReturnValueRestrictionDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ReturnValueRestrictionDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/ReturnValueRestrictionDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RuleDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RuleDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RuleDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/RuleDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/TypeDeclarationDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/TypeDeclarationDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/TypeDeclarationDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/TypeDeclarationDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/TypeFieldDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/TypeFieldDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/TypeFieldDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/TypeFieldDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/UnitDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/UnitDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/UnitDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/UnitDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/VariableRestrictionDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/VariableRestrictionDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/VariableRestrictionDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/VariableRestrictionDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/WindowDeclarationDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/WindowDeclarationDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/WindowDeclarationDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/WindowDeclarationDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/WindowReferenceDescr.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/WindowReferenceDescr.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/descr/WindowReferenceDescr.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/descr/WindowReferenceDescr.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AbstractClassTypeDeclarationBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AbstractClassTypeDeclarationBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AbstractClassTypeDeclarationBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AbstractClassTypeDeclarationBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AccumulateDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AccumulateDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AccumulateDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AccumulateDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AccumulateImportDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AccumulateImportDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AccumulateImportDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AccumulateImportDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AnnotatedDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AnnotatedDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AnnotatedDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AnnotatedDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AnnotationDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AnnotationDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AnnotationDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AnnotationDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AttributeDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AttributeDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AttributeDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AttributeDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AttributeSupportBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AttributeSupportBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AttributeSupportBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/AttributeSupportBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/BehaviorDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/BehaviorDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/BehaviorDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/BehaviorDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/CEDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/CEDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/CEDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/CEDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/CollectDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/CollectDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/CollectDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/CollectDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ConditionalBranchDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ConditionalBranchDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ConditionalBranchDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ConditionalBranchDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/DeclareDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/DeclareDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/DeclareDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/DeclareDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/DescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/DescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/DescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/DescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/DescrFactory.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/DescrFactory.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/DescrFactory.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/DescrFactory.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EntryPointDeclarationDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EntryPointDeclarationDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EntryPointDeclarationDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EntryPointDeclarationDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EnumDeclarationDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EnumDeclarationDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EnumDeclarationDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EnumDeclarationDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EnumLiteralDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EnumLiteralDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EnumLiteralDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EnumLiteralDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EvalDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EvalDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EvalDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/EvalDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/FieldDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/FieldDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/FieldDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/FieldDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ForallDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ForallDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ForallDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ForallDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/FunctionDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/FunctionDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/FunctionDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/FunctionDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/GlobalDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/GlobalDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/GlobalDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/GlobalDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/GroupByDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/GroupByDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/GroupByDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/GroupByDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ImportDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ImportDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ImportDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ImportDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/NamedConsequenceDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/NamedConsequenceDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/NamedConsequenceDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/NamedConsequenceDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/PackageDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/PackageDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/PackageDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/PackageDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ParameterSupportBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ParameterSupportBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ParameterSupportBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/ParameterSupportBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/PatternContainerDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/PatternContainerDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/PatternContainerDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/PatternContainerDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/PatternDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/PatternDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/PatternDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/PatternDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/QueryDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/QueryDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/QueryDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/QueryDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/RuleDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/RuleDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/RuleDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/RuleDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/SourceDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/SourceDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/SourceDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/SourceDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/TypeDeclarationDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/TypeDeclarationDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/TypeDeclarationDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/TypeDeclarationDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/UnitDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/UnitDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/UnitDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/UnitDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/WindowDeclarationDescrBuilder.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/WindowDeclarationDescrBuilder.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/WindowDeclarationDescrBuilder.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/WindowDeclarationDescrBuilder.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AccumulateDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AccumulateDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AccumulateDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AccumulateDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AccumulateImportDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AccumulateImportDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AccumulateImportDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AccumulateImportDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AnnotationDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AnnotationDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AnnotationDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AnnotationDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AttributeDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AttributeDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AttributeDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/AttributeDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/BaseDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/BaseDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/BaseDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/BaseDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/BehaviorDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/BehaviorDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/BehaviorDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/BehaviorDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/CEDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/CEDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/CEDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/CEDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/CollectDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/CollectDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/CollectDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/CollectDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/ConditionalBranchDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/ConditionalBranchDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/ConditionalBranchDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/ConditionalBranchDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/DeclareDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/DeclareDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/DeclareDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/DeclareDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EntryPointDeclarationDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EntryPointDeclarationDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EntryPointDeclarationDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EntryPointDeclarationDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EnumDeclarationDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EnumDeclarationDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EnumDeclarationDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EnumDeclarationDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EnumLiteralDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EnumLiteralDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EnumLiteralDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EnumLiteralDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EvalDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EvalDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EvalDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/EvalDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/FieldDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/FieldDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/FieldDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/FieldDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/ForallDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/ForallDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/ForallDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/ForallDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/FunctionDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/FunctionDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/FunctionDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/FunctionDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/GlobalDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/GlobalDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/GlobalDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/GlobalDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/GroupByDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/GroupByDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/GroupByDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/GroupByDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/ImportDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/ImportDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/ImportDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/ImportDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/NamedConsequenceDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/NamedConsequenceDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/NamedConsequenceDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/NamedConsequenceDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/PackageDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/PackageDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/PackageDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/PackageDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/PatternDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/PatternDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/PatternDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/PatternDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/QueryDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/QueryDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/QueryDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/QueryDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/RuleDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/RuleDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/RuleDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/RuleDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/SourceDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/SourceDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/SourceDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/SourceDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/TypeDeclarationDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/TypeDeclarationDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/TypeDeclarationDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/TypeDeclarationDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/UnitDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/UnitDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/UnitDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/UnitDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/WindowDeclarationDescrBuilderImpl.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/WindowDeclarationDescrBuilderImpl.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/WindowDeclarationDescrBuilderImpl.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/dsl/impl/WindowDeclarationDescrBuilderImpl.java diff --git a/drools-drl-ast/src/main/java/org/drools/drl/ast/util/AstUtil.java b/drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/util/AstUtil.java similarity index 100% rename from drools-drl-ast/src/main/java/org/drools/drl/ast/util/AstUtil.java rename to drools-drl/drools-drl-ast/src/main/java/org/drools/drl/ast/util/AstUtil.java diff --git a/drools-drl-extensions/pom.xml b/drools-drl/drools-drl-extensions/pom.xml similarity index 92% rename from drools-drl-extensions/pom.xml rename to drools-drl/drools-drl-extensions/pom.xml index cdde4c2f8f7..8a14241f9d8 100644 --- a/drools-drl-extensions/pom.xml +++ b/drools-drl/drools-drl-extensions/pom.xml @@ -24,10 +24,9 @@ 4.0.0 - org.kie - drools-build-parent + org.drools + drools-drl 8.45.0-SNAPSHOT - ../build-parent/pom.xml org.drools diff --git a/drools-drl-extensions/src/main/java/org/drools/drl/extensions/DecisionTableFactory.java b/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/DecisionTableFactory.java similarity index 100% rename from drools-drl-extensions/src/main/java/org/drools/drl/extensions/DecisionTableFactory.java rename to drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/DecisionTableFactory.java diff --git a/drools-drl-extensions/src/main/java/org/drools/drl/extensions/DecisionTableProvider.java b/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/DecisionTableProvider.java similarity index 100% rename from drools-drl-extensions/src/main/java/org/drools/drl/extensions/DecisionTableProvider.java rename to drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/DecisionTableProvider.java diff --git a/drools-drl-extensions/src/main/java/org/drools/drl/extensions/GuidedRuleTemplateFactory.java b/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/GuidedRuleTemplateFactory.java similarity index 100% rename from drools-drl-extensions/src/main/java/org/drools/drl/extensions/GuidedRuleTemplateFactory.java rename to drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/GuidedRuleTemplateFactory.java diff --git a/drools-drl-extensions/src/main/java/org/drools/drl/extensions/GuidedRuleTemplateProvider.java b/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/GuidedRuleTemplateProvider.java similarity index 100% rename from drools-drl-extensions/src/main/java/org/drools/drl/extensions/GuidedRuleTemplateProvider.java rename to drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/GuidedRuleTemplateProvider.java diff --git a/drools-drl-extensions/src/main/java/org/drools/drl/extensions/ResourceConversionResult.java b/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/ResourceConversionResult.java similarity index 100% rename from drools-drl-extensions/src/main/java/org/drools/drl/extensions/ResourceConversionResult.java rename to drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/ResourceConversionResult.java diff --git a/drools-drl-parser/pom.xml b/drools-drl/drools-drl-parser/pom.xml similarity index 98% rename from drools-drl-parser/pom.xml rename to drools-drl/drools-drl-parser/pom.xml index c9b978fe208..922a78b4f34 100644 --- a/drools-drl-parser/pom.xml +++ b/drools-drl/drools-drl-parser/pom.xml @@ -24,10 +24,9 @@ 4.0.0 - org.kie - drools-build-parent + org.drools + drools-drl 8.45.0-SNAPSHOT - ../build-parent/pom.xml org.drools diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/BaseKnowledgeBuilderResultImpl.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/BaseKnowledgeBuilderResultImpl.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/BaseKnowledgeBuilderResultImpl.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/BaseKnowledgeBuilderResultImpl.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/DRLFactory.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/DRLFactory.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/DRLFactory.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/DRLFactory.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/DrlExprParser.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/DrlExprParser.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/DrlExprParser.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/DrlExprParser.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/DrlParser.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/DrlParser.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/DrlParser.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/DrlParser.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/DroolsError.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/DroolsError.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/DroolsError.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/DroolsError.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/DroolsParserException.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/DroolsParserException.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/DroolsParserException.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/DroolsParserException.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/MessageImpl.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/MessageImpl.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/MessageImpl.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/MessageImpl.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/ParserError.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/ParserError.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/ParserError.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/ParserError.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/impl/Operator.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/impl/Operator.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/impl/Operator.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/impl/Operator.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/AbstractDRLLexer.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/AbstractDRLLexer.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/AbstractDRLLexer.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/AbstractDRLLexer.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/AbstractDRLParser.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/AbstractDRLParser.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/AbstractDRLParser.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/AbstractDRLParser.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL5Expressions.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL5Expressions.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL5Expressions.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL5Expressions.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL5Lexer.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL5Lexer.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL5Lexer.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL5Lexer.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL5Parser.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL5Parser.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL5Parser.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL5Parser.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Expressions.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Expressions.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Expressions.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Expressions.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Lexer.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Lexer.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Lexer.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Lexer.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Parser.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Parser.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Parser.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Parser.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6StrictParser.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6StrictParser.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6StrictParser.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6StrictParser.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRLExpressions.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRLExpressions.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRLExpressions.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRLExpressions.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRLLexer.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRLLexer.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRLLexer.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRLLexer.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRLParser.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRLParser.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRLParser.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRLParser.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsEditorType.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsEditorType.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsEditorType.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsEditorType.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsMismatchedSetException.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsMismatchedSetException.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsMismatchedSetException.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsMismatchedSetException.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsMismatchedTokenException.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsMismatchedTokenException.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsMismatchedTokenException.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsMismatchedTokenException.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsMissingTokenException.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsMissingTokenException.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsMissingTokenException.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsMissingTokenException.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsParaphraseTypes.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsParaphraseTypes.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsParaphraseTypes.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsParaphraseTypes.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsParserExceptionFactory.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsParserExceptionFactory.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsParserExceptionFactory.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsParserExceptionFactory.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsSentence.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsSentence.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsSentence.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsSentence.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsSentenceType.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsSentenceType.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsSentenceType.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsSentenceType.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsSoftKeywords.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsSoftKeywords.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsSoftKeywords.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsSoftKeywords.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsToken.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsToken.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsToken.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsToken.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsTree.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsTree.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsTree.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsTree.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsUnexpectedAnnotationException.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsUnexpectedAnnotationException.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsUnexpectedAnnotationException.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DroolsUnexpectedAnnotationException.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/Expander.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/Expander.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/Expander.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/Expander.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ExpanderException.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ExpanderException.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ExpanderException.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ExpanderException.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ExpanderResolver.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ExpanderResolver.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ExpanderResolver.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ExpanderResolver.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/GeneralParseException.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/GeneralParseException.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/GeneralParseException.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/GeneralParseException.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/Location.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/Location.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/Location.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/Location.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ParseException.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ParseException.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ParseException.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ParseException.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ParserHelper.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ParserHelper.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ParserHelper.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ParserHelper.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/AbstractDSLMappingEntry.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/AbstractDSLMappingEntry.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/AbstractDSLMappingEntry.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/AbstractDSLMappingEntry.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/AntlrDSLMappingEntry.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/AntlrDSLMappingEntry.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/AntlrDSLMappingEntry.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/AntlrDSLMappingEntry.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapLexer.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapLexer.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapLexer.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapLexer.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapParser.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapParser.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapParser.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapParser.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapWalker.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapWalker.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapWalker.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapWalker.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapping.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapping.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapping.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMapping.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingEntry.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingEntry.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingEntry.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingEntry.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingFile.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingFile.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingFile.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingFile.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingParseException.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingParseException.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingParseException.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLMappingParseException.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLTokenizedMappingFile.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLTokenizedMappingFile.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLTokenizedMappingFile.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DSLTokenizedMappingFile.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DefaultDSLMapping.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DefaultDSLMapping.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DefaultDSLMapping.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DefaultDSLMapping.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DefaultExpander.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DefaultExpander.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DefaultExpander.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DefaultExpander.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DefaultExpanderResolver.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DefaultExpanderResolver.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DefaultExpanderResolver.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/DefaultExpanderResolver.java diff --git a/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/MappingError.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/MappingError.java similarity index 100% rename from drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/MappingError.java rename to drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/dsl/MappingError.java diff --git a/drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL5Expressions.g b/drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL5Expressions.g similarity index 100% rename from drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL5Expressions.g rename to drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL5Expressions.g diff --git a/drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL5Lexer.g b/drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL5Lexer.g similarity index 100% rename from drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL5Lexer.g rename to drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL5Lexer.g diff --git a/drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL6Expressions.g b/drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL6Expressions.g similarity index 100% rename from drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL6Expressions.g rename to drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL6Expressions.g diff --git a/drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL6Lexer.g b/drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL6Lexer.g similarity index 100% rename from drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL6Lexer.g rename to drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL6Lexer.g diff --git a/drools-drl-parser/src/main/resources/org/drools/drl/parser/dsl/DSLMap.g b/drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/dsl/DSLMap.g similarity index 100% rename from drools-drl-parser/src/main/resources/org/drools/drl/parser/dsl/DSLMap.g rename to drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/dsl/DSLMap.g diff --git a/drools-drl-parser/src/main/resources/org/drools/drl/parser/dsl/DSLMapWalker.g b/drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/dsl/DSLMapWalker.g similarity index 100% rename from drools-drl-parser/src/main/resources/org/drools/drl/parser/dsl/DSLMapWalker.g rename to drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/dsl/DSLMapWalker.g diff --git a/drools-drl-parser/src/main/resources/org/drools/drl/parser/package.html b/drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/package.html similarity index 100% rename from drools-drl-parser/src/main/resources/org/drools/drl/parser/package.html rename to drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/package.html diff --git a/drools-drl/pom.xml b/drools-drl/pom.xml new file mode 100644 index 00000000000..8b13481d07f --- /dev/null +++ b/drools-drl/pom.xml @@ -0,0 +1,57 @@ + + + + 4.0.0 + + org.kie + drools-build-parent + 8.45.0-SNAPSHOT + ../build-parent/pom.xml + + + Drools :: DRL :: Parent + org.drools + drools-drl + pom + + + drools-drl-ast + drools-drl-extensions + drools-drl-parser + + + + + + + org.slf4j + slf4j-api + + + ch.qos.logback + logback-classic + test + + + \ No newline at end of file diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/KieModuleModelWrapper.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/KieModuleModelWrapper.java index 3904773cd9b..9731c26dc70 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/KieModuleModelWrapper.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/KieModuleModelWrapper.java @@ -74,7 +74,7 @@ private static KieModuleModel lookupKieModuleModel(Path[] resourcePaths) { } /* - * This is really a modified duplicate of org.drools.drl.quarkus.deployment.ResourceCollector#fromJarFile(java.nio.file.Path). + * This is really a modified duplicate of org.drools.quarkus.deployment.ResourceCollector#fromJarFile(java.nio.file.Path). * TODO: Refactor https://issues.redhat.com/browse/DROOLS-7254 */ public static InputStream fromJarFile(Path jarPath) { diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/pom.xml b/drools-quarkus-extension/drools-quarkus-deployment/pom.xml similarity index 95% rename from drools-drl-quarkus-extension/drools-drl-quarkus-deployment/pom.xml rename to drools-quarkus-extension/drools-quarkus-deployment/pom.xml index 38c4ffeba49..423625403da 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/pom.xml +++ b/drools-quarkus-extension/drools-quarkus-deployment/pom.xml @@ -25,15 +25,15 @@ 4.0.0 org.drools - drools-drl-quarkus-extension + drools-quarkus-extension 8.45.0-SNAPSHOT Drools :: Quarkus Extension :: Deployment - drools-drl-quarkus-deployment + drools-quarkus-deployment - org.drools.drl.quarkus.deployment + org.drools.quarkus.deployment @@ -50,11 +50,11 @@ org.drools - drools-drl-quarkus + drools-quarkus org.drools - drools-drl-quarkus-util-deployment + drools-quarkus-util-deployment org.drools diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/AbstractCompilationProvider.java b/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/AbstractCompilationProvider.java similarity index 89% rename from drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/AbstractCompilationProvider.java rename to drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/AbstractCompilationProvider.java index 964ec26a872..a854acde130 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/AbstractCompilationProvider.java +++ b/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/AbstractCompilationProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.drools.drl.quarkus.deployment; +package org.drools.quarkus.deployment; import java.io.File; import java.io.IOException; @@ -31,8 +31,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.HOT_RELOAD_SUPPORT_PATH; -import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.getHotReloadSupportSource; +import static org.drools.quarkus.util.deployment.DroolsQuarkusResourceUtils.HOT_RELOAD_SUPPORT_PATH; +import static org.drools.quarkus.util.deployment.DroolsQuarkusResourceUtils.getHotReloadSupportSource; public abstract class AbstractCompilationProvider extends JavaCompilationProvider { diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java b/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/DroolsAssetsProcessor.java similarity index 84% rename from drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java rename to drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/DroolsAssetsProcessor.java index ee5021f590b..1ac349f63e5 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsAssetsProcessor.java +++ b/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/DroolsAssetsProcessor.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.drools.drl.quarkus.deployment; +package org.drools.quarkus.deployment; import io.quarkus.arc.deployment.GeneratedBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -35,9 +35,9 @@ import org.drools.codegen.common.DroolsModelBuildContext; import org.drools.codegen.common.GeneratedFile; import org.drools.codegen.common.GeneratedFileType; -import org.drools.drl.quarkus.util.deployment.GlobalsBuildItem; -import org.drools.drl.quarkus.util.deployment.KmoduleKieBaseModelsBuiltItem; -import org.drools.drl.quarkus.util.deployment.PatternsTypesBuildItem; +import org.drools.quarkus.util.deployment.GlobalsBuildItem; +import org.drools.quarkus.util.deployment.KmoduleKieBaseModelsBuiltItem; +import org.drools.quarkus.util.deployment.PatternsTypesBuildItem; import org.drools.model.codegen.execmodel.PackageModel; import org.drools.model.codegen.project.RuleCodegen; import org.kie.api.io.Resource; @@ -49,14 +49,14 @@ import java.util.Set; import java.util.stream.Collectors; -import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.HOT_RELOAD_SUPPORT_PATH; -import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.compileGeneratedSources; -import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.createDroolsBuildContext; -import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.dumpFilesToDisk; -import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.getHotReloadSupportSource; -import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.getRuleUnitDefProducerSource; -import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.registerResources; -import static org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.toClassName; +import static org.drools.quarkus.util.deployment.DroolsQuarkusResourceUtils.HOT_RELOAD_SUPPORT_PATH; +import static org.drools.quarkus.util.deployment.DroolsQuarkusResourceUtils.compileGeneratedSources; +import static org.drools.quarkus.util.deployment.DroolsQuarkusResourceUtils.createDroolsBuildContext; +import static org.drools.quarkus.util.deployment.DroolsQuarkusResourceUtils.dumpFilesToDisk; +import static org.drools.quarkus.util.deployment.DroolsQuarkusResourceUtils.getHotReloadSupportSource; +import static org.drools.quarkus.util.deployment.DroolsQuarkusResourceUtils.getRuleUnitDefProducerSource; +import static org.drools.quarkus.util.deployment.DroolsQuarkusResourceUtils.registerResources; +import static org.drools.quarkus.util.deployment.DroolsQuarkusResourceUtils.toClassName; import static org.drools.model.codegen.project.RuleCodegen.ofResources; public class DroolsAssetsProcessor { @@ -74,7 +74,7 @@ public class DroolsAssetsProcessor { @Inject OutputTargetBuildItem outputTargetBuildItem; - private static final String FEATURE = "drools-drl-quarkus-extension"; + private static final String FEATURE = "drools-quarkus-extension"; @BuildStep public FeatureBuildItem feature() { diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsCompilationProvider.java b/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/DroolsCompilationProvider.java similarity index 97% rename from drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsCompilationProvider.java rename to drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/DroolsCompilationProvider.java index b543613689d..bf4829fd6c5 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/DroolsCompilationProvider.java +++ b/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/DroolsCompilationProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.drools.drl.quarkus.deployment; +package org.drools.quarkus.deployment; import java.util.Collections; import java.util.HashSet; diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/ResourceCollector.java b/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/ResourceCollector.java similarity index 99% rename from drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/ResourceCollector.java rename to drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/ResourceCollector.java index c9e018b00d5..d60b9b7199e 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/main/java/org/drools/drl/quarkus/deployment/ResourceCollector.java +++ b/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/ResourceCollector.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.drools.drl.quarkus.deployment; +package org.drools.quarkus.deployment; import java.io.File; import java.io.IOException; diff --git a/drools-quarkus-extension/drools-quarkus-deployment/src/main/resources/META-INF/services/io.quarkus.deployment.dev.CompilationProvider b/drools-quarkus-extension/drools-quarkus-deployment/src/main/resources/META-INF/services/io.quarkus.deployment.dev.CompilationProvider new file mode 100644 index 00000000000..34d53275de2 --- /dev/null +++ b/drools-quarkus-extension/drools-quarkus-deployment/src/main/resources/META-INF/services/io.quarkus.deployment.dev.CompilationProvider @@ -0,0 +1 @@ +org.drools.quarkus.deployment.DroolsCompilationProvider \ No newline at end of file diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/java/org/drools/drl/quarkus/deployment/BuildItemsTest.java b/drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/deployment/BuildItemsTest.java similarity index 96% rename from drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/java/org/drools/drl/quarkus/deployment/BuildItemsTest.java rename to drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/deployment/BuildItemsTest.java index 8fb53238ef5..043aad820f5 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/java/org/drools/drl/quarkus/deployment/BuildItemsTest.java +++ b/drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/deployment/BuildItemsTest.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.drools.drl.quarkus.deployment; +package org.drools.quarkus.deployment; import static org.assertj.core.api.Assertions.as; import static org.assertj.core.api.Assertions.assertThat; @@ -29,8 +29,8 @@ import java.util.stream.Collectors; import org.assertj.core.api.InstanceOfAssertFactories; -import org.drools.drl.quarkus.util.deployment.GlobalsBuildItem; -import org.drools.drl.quarkus.util.deployment.PatternsTypesBuildItem; +import org.drools.quarkus.util.deployment.GlobalsBuildItem; +import org.drools.quarkus.util.deployment.PatternsTypesBuildItem; import org.drools.quarkus.examples.otn.model.ASubclassOfMeasurement; import org.drools.quarkus.examples.otn.model.Measurement; import org.drools.quarkus.examples.otn.model.MyImplementation; @@ -50,7 +50,7 @@ import io.quarkus.test.QuarkusUnitTest; /* - * The scope of these tests is to check the resulting BuildItems as produced by this drools-drl-quarkus-extension. + * The scope of these tests is to check the resulting BuildItems as produced by this drools-quarkus-extension. */ public class BuildItemsTest { diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/ASubclassOfMeasurement.java b/drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/ASubclassOfMeasurement.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/ASubclassOfMeasurement.java rename to drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/ASubclassOfMeasurement.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/Measurement.java b/drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/Measurement.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/Measurement.java rename to drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/Measurement.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/MyImplementation.java b/drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/MyImplementation.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/MyImplementation.java rename to drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/MyImplementation.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/MyInterface.java b/drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/MyInterface.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/MyInterface.java rename to drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/MyInterface.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/MyUnusedClass.java b/drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/MyUnusedClass.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/MyUnusedClass.java rename to drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/examples/otn/model/MyUnusedClass.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/resources/rules.txt b/drools-quarkus-extension/drools-quarkus-deployment/src/test/resources/rules.txt similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-deployment/src/test/resources/rules.txt rename to drools-quarkus-extension/drools-quarkus-deployment/src/test/resources/rules.txt diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/pom.xml b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/pom.xml similarity index 93% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/pom.xml rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/pom.xml index 9d0a5db76a8..2eb787ebc6b 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/pom.xml +++ b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/pom.xml @@ -25,21 +25,21 @@ 4.0.0 org.drools - drools-drl-quarkus-examples + drools-quarkus-examples 8.45.0-SNAPSHOT Drools :: Quarkus Extension :: Examples :: Reactive - drools-drl-quarkus-examples-multiunit + drools-quarkus-examples-multiunit - org.drools.drl.quarkus.examples.multiunit + org.drools.quarkus.examples.multiunit org.drools - drools-drl-quarkus + drools-quarkus org.drools @@ -63,7 +63,7 @@ of it --> org.drools - drools-drl-quarkus-deployment + drools-quarkus-deployment test diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/FirstUnit.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/FirstUnit.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/FirstUnit.java rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/FirstUnit.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleInput.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleInput.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleInput.java rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleInput.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleOutput1.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleOutput1.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleOutput1.java rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleOutput1.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleOutput2.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleOutput2.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleOutput2.java rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/RuleOutput2.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/SecondUnit.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/SecondUnit.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/SecondUnit.java rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/main/java/org/drools/quarkus/ruleunit/examples/multiunit/SecondUnit.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/main/resources/org/drools/quarkus/ruleunit/examples/multiunit/First.drl b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/main/resources/org/drools/quarkus/ruleunit/examples/multiunit/First.drl similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/main/resources/org/drools/quarkus/ruleunit/examples/multiunit/First.drl rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/main/resources/org/drools/quarkus/ruleunit/examples/multiunit/First.drl diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/main/resources/org/drools/quarkus/ruleunit/examples/multiunit/Second.drl b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/main/resources/org/drools/quarkus/ruleunit/examples/multiunit/Second.drl similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/main/resources/org/drools/quarkus/ruleunit/examples/multiunit/Second.drl rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/main/resources/org/drools/quarkus/ruleunit/examples/multiunit/Second.drl diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/test/java/org/drools/quarkus/ruleunit/examples/multiunit/RuntimeTest.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/test/java/org/drools/quarkus/ruleunit/examples/multiunit/RuntimeTest.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-multiunit/src/test/java/org/drools/quarkus/ruleunit/examples/multiunit/RuntimeTest.java rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-multiunit/src/test/java/org/drools/quarkus/ruleunit/examples/multiunit/RuntimeTest.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/README.md b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/README.md similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/README.md rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/README.md diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/docker-compose.yml b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/docker-compose.yml similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/docker-compose.yml rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/docker-compose.yml diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/pom.xml b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/pom.xml similarity index 94% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/pom.xml rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/pom.xml index a2bb7002d96..afae02b4aa9 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/pom.xml +++ b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/pom.xml @@ -25,21 +25,21 @@ 4.0.0 org.drools - drools-drl-quarkus-examples + drools-quarkus-examples 8.45.0-SNAPSHOT Drools :: Quarkus Extension :: Examples :: Reactive - drools-drl-quarkus-examples-reactive + drools-quarkus-examples-reactive - org.drools.drl.quarkus.examples.reactive + org.drools.quarkus.examples.reactive org.drools - drools-drl-quarkus + drools-quarkus org.drools @@ -72,7 +72,7 @@ of it --> org.drools - drools-drl-quarkus-deployment + drools-quarkus-deployment test diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Adaptor.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Adaptor.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Adaptor.java rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Adaptor.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Alert.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Alert.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Alert.java rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Alert.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/AlertingUnit.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/AlertingUnit.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/AlertingUnit.java rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/AlertingUnit.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Event.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Event.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Event.java rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/Event.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/EventDeserializer.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/EventDeserializer.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/EventDeserializer.java rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/java/org/drools/quarkus/ruleunit/examples/reactive/EventDeserializer.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/resources/application.properties b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/resources/application.properties similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/resources/application.properties rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/resources/application.properties diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/resources/org/drools/quarkus/ruleunit/examples/reactive/AlertingRules.drl b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/resources/org/drools/quarkus/ruleunit/examples/reactive/AlertingRules.drl similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/main/resources/org/drools/quarkus/ruleunit/examples/reactive/AlertingRules.drl rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/main/resources/org/drools/quarkus/ruleunit/examples/reactive/AlertingRules.drl diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/KafkaTestResourceLifecycleManager.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/KafkaTestResourceLifecycleManager.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/KafkaTestResourceLifecycleManager.java rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/KafkaTestResourceLifecycleManager.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/RuntimeTest.java b/drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/RuntimeTest.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/drools-drl-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/RuntimeTest.java rename to drools-quarkus-extension/drools-quarkus-examples/drools-quarkus-examples-reactive/src/test/java/org/drools/quarkus/ruleunit/examples/reactive/RuntimeTest.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/pom.xml b/drools-quarkus-extension/drools-quarkus-examples/pom.xml similarity index 85% rename from drools-drl-quarkus-extension/drools-drl-quarkus-examples/pom.xml rename to drools-quarkus-extension/drools-quarkus-examples/pom.xml index a5075c2e717..22470a5c070 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-examples/pom.xml +++ b/drools-quarkus-extension/drools-quarkus-examples/pom.xml @@ -25,16 +25,16 @@ 4.0.0 org.drools - drools-drl-quarkus-extension + drools-quarkus-extension 8.45.0-SNAPSHOT Drools :: Quarkus Extension :: Examples - drools-drl-quarkus-examples + drools-quarkus-examples pom - drools-drl-quarkus-examples-reactive - drools-drl-quarkus-examples-multiunit + drools-quarkus-examples-reactive + drools-quarkus-examples-multiunit diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/pom.xml b/drools-quarkus-extension/drools-quarkus-integration-test-hotreload/pom.xml similarity index 92% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/pom.xml rename to drools-quarkus-extension/drools-quarkus-integration-test-hotreload/pom.xml index 60d0b3e4368..472853de637 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/pom.xml +++ b/drools-quarkus-extension/drools-quarkus-integration-test-hotreload/pom.xml @@ -25,21 +25,21 @@ 4.0.0 org.drools - drools-drl-quarkus-extension + drools-quarkus-extension 8.45.0-SNAPSHOT Drools :: Quarkus Extension :: Integration Test :: Hotreload - drools-drl-quarkus-integration-test-hotreload + drools-quarkus-integration-test-hotreload - org.drools.drl.quarkus.integrationtest.hotreload + org.drools.quarkus.integrationtest.hotreload org.drools - drools-drl-quarkus + drools-quarkus io.quarkus @@ -74,7 +74,7 @@ org.drools - drools-drl-quarkus-deployment + drools-quarkus-deployment pom test diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/FindAdultEndpoint.java b/drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/FindAdultEndpoint.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/FindAdultEndpoint.java rename to drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/FindAdultEndpoint.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/Person.java b/drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/Person.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/Person.java rename to drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/main/java/org/drools/quarkus/test/hotreload/Person.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/main/resources/META-INF/kmodule.xml b/drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/main/resources/META-INF/kmodule.xml similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/main/resources/META-INF/kmodule.xml rename to drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/main/resources/META-INF/kmodule.xml diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/main/resources/application.properties b/drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/main/resources/application.properties similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/main/resources/application.properties rename to drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/main/resources/application.properties diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/main/resources/org/drools/hotreload/adult.txt b/drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/main/resources/org/drools/hotreload/adult.txt similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/main/resources/org/drools/hotreload/adult.txt rename to drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/main/resources/org/drools/hotreload/adult.txt diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/test/java/org/drools/quarkus/test/hotreload/HotReloadIT.java b/drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/test/java/org/drools/quarkus/test/hotreload/HotReloadIT.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test-hotreload/src/test/java/org/drools/quarkus/test/hotreload/HotReloadIT.java rename to drools-quarkus-extension/drools-quarkus-integration-test-hotreload/src/test/java/org/drools/quarkus/test/hotreload/HotReloadIT.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/pom.xml b/drools-quarkus-extension/drools-quarkus-integration-test/pom.xml similarity index 94% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/pom.xml rename to drools-quarkus-extension/drools-quarkus-integration-test/pom.xml index de787a40af8..ad4c2de0ab0 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/pom.xml +++ b/drools-quarkus-extension/drools-quarkus-integration-test/pom.xml @@ -25,21 +25,21 @@ 4.0.0 org.drools - drools-drl-quarkus-extension + drools-quarkus-extension 8.45.0-SNAPSHOT Drools :: Quarkus Extension :: Integration Test - drools-drl-quarkus-integration-test + drools-quarkus-integration-test - org.drools.drl.quarkus.integrationtest + org.drools.quarkus.integrationtest org.drools - drools-drl-quarkus + drools-quarkus org.drools @@ -73,7 +73,7 @@ org.drools - drools-drl-quarkus-deployment + drools-quarkus-deployment pom test diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/Person.java b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/Person.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/Person.java rename to drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/Person.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/ProbeCounter.java b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/ProbeCounter.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/ProbeCounter.java rename to drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/ProbeCounter.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/ProbeEvent.java b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/ProbeEvent.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/ProbeEvent.java rename to drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/ProbeEvent.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/Result.java b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/Result.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/Result.java rename to drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/Result.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/StockTick.java b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/StockTick.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/StockTick.java rename to drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/StockTick.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java rename to drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/resources/META-INF/kmodule.xml b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/META-INF/kmodule.xml similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/resources/META-INF/kmodule.xml rename to drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/META-INF/kmodule.xml diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/resources/org/drools/cep/cep.drl b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/org/drools/cep/cep.drl similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/resources/org/drools/cep/cep.drl rename to drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/org/drools/cep/cep.drl diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/resources/org/drools/drl/CanDrink.drl b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/org/drools/drl/CanDrink.drl similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/resources/org/drools/drl/CanDrink.drl rename to drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/org/drools/drl/CanDrink.drl diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/resources/org/drools/dtable/CanDrink.drl.xls b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/org/drools/dtable/CanDrink.drl.xls similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/resources/org/drools/dtable/CanDrink.drl.xls rename to drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/org/drools/dtable/CanDrink.drl.xls diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/resources/org/drools/probe/probe.drl b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/org/drools/probe/probe.drl similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/resources/org/drools/probe/probe.drl rename to drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/org/drools/probe/probe.drl diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/resources/org/drools/tms/tms.drl b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/org/drools/tms/tms.drl similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/main/resources/org/drools/tms/tms.drl rename to drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/org/drools/tms/tms.drl diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java b/drools-quarkus-extension/drools-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java rename to drools-quarkus-extension/drools-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/test/java/org/drools/quarkus/test/TestableIT.java b/drools-quarkus-extension/drools-quarkus-integration-test/src/test/java/org/drools/quarkus/test/TestableIT.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-integration-test/src/test/java/org/drools/quarkus/test/TestableIT.java rename to drools-quarkus-extension/drools-quarkus-integration-test/src/test/java/org/drools/quarkus/test/TestableIT.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/guide.adoc b/drools-quarkus-extension/drools-quarkus-quickstart-test/guide.adoc similarity index 98% rename from drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/guide.adoc rename to drools-quarkus-extension/drools-quarkus-quickstart-test/guide.adoc index 9a087ad79ab..3ce852d4a17 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/guide.adoc +++ b/drools-quarkus-extension/drools-quarkus-quickstart-test/guide.adoc @@ -34,7 +34,7 @@ We will wire the Rule Unit into a standard Quarkus CDI bean, for use in the Quar We recommend that you follow the instructions in the next sections and create the application step by step. -However, you can go explore the original example at the following link: https://github.com/kiegroup/drools/tree/main/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test +However, you can go explore the original example at the following link: https://github.com/kiegroup/drools/tree/main/drools-quarkus-extension/drools-quarkus-quickstart-test == Creating the Maven Project @@ -47,7 +47,7 @@ When you have your Quarkus project configured, you can add the Drools Quarkus ex ---- org.drools - drools-drl-quarkus + drools-quarkus org.drools diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/pom.xml b/drools-quarkus-extension/drools-quarkus-quickstart-test/pom.xml similarity index 95% rename from drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/pom.xml rename to drools-quarkus-extension/drools-quarkus-quickstart-test/pom.xml index 783c8e9f52b..b5a5eb028dd 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/pom.xml +++ b/drools-quarkus-extension/drools-quarkus-quickstart-test/pom.xml @@ -25,21 +25,21 @@ 4.0.0 org.drools - drools-drl-quarkus-extension + drools-quarkus-extension 8.45.0-SNAPSHOT Drools :: Quarkus Extension :: Quickstart Integration Test - drools-drl-quarkus-quickstart-test + drools-quarkus-quickstart-test - org.drools.drl.quarkus.quickstart.test + org.drools.quarkus.quickstart.test org.drools - drools-drl-quarkus + drools-quarkus org.drools @@ -69,7 +69,7 @@ org.drools - drools-drl-quarkus-deployment + drools-quarkus-deployment pom test diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeAlertsBean.java b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeAlertsBean.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeAlertsBean.java rename to drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeAlertsBean.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeRuleUnitData.java b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeRuleUnitData.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeRuleUnitData.java rename to drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/HomeRuleUnitData.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/Alert.java b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/Alert.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/Alert.java rename to drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/Alert.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/CCTV.java b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/CCTV.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/CCTV.java rename to drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/CCTV.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/Light.java b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/Light.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/Light.java rename to drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/Light.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/Smartphone.java b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/Smartphone.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/Smartphone.java rename to drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/java/org/drools/quarkus/quickstart/test/model/Smartphone.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/resources/org/drools/quarkus/quickstart/test/rules.drl b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/resources/org/drools/quarkus/quickstart/test/rules.drl similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/main/resources/org/drools/quarkus/quickstart/test/rules.drl rename to drools-quarkus-extension/drools-quarkus-quickstart-test/src/main/resources/org/drools/quarkus/quickstart/test/rules.drl diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/BeanTest.java b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/BeanTest.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/BeanTest.java rename to drools-quarkus-extension/drools-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/BeanTest.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/RuntimeIT.java b/drools-quarkus-extension/drools-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/RuntimeIT.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/RuntimeIT.java rename to drools-quarkus-extension/drools-quarkus-quickstart-test/src/test/java/org/drools/quarkus/quickstart/test/RuntimeIT.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/pom.xml b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/pom.xml similarity index 95% rename from drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/pom.xml rename to drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/pom.xml index 37a6d04fb5e..5eace980cfe 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/pom.xml +++ b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/pom.xml @@ -25,21 +25,21 @@ 4.0.0 org.drools - drools-drl-quarkus-extension + drools-quarkus-extension 8.45.0-SNAPSHOT Drools :: Quarkus Extension :: Integration Test with Rule Unit - drools-drl-quarkus-ruleunit-integration-test + drools-quarkus-ruleunit-integration-test - org.drools.drl.quarkus.ruleunit.integrationtest + org.drools.quarkus.ruleunit.integrationtest org.drools - drools-drl-quarkus + drools-quarkus org.drools @@ -76,7 +76,7 @@ org.drools - drools-drl-quarkus-deployment + drools-quarkus-deployment pom test diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/HelloWorldUnit.java b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/HelloWorldUnit.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/HelloWorldUnit.java rename to drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/HelloWorldUnit.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/SimpleDTUnit.java b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/SimpleDTUnit.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/SimpleDTUnit.java rename to drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/SimpleDTUnit.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/TestableResource.java b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/TestableResource.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/TestableResource.java rename to drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/main/java/org/drools/quarkus/ruleunit/test/TestableResource.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/resources/org/drools/quarkus/ruleunit/test/AlertingService.drl b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/main/resources/org/drools/quarkus/ruleunit/test/AlertingService.drl similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/resources/org/drools/quarkus/ruleunit/test/AlertingService.drl rename to drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/main/resources/org/drools/quarkus/ruleunit/test/AlertingService.drl diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/resources/org/drools/quarkus/ruleunit/test/rules.drl b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/main/resources/org/drools/quarkus/ruleunit/test/rules.drl similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/main/resources/org/drools/quarkus/ruleunit/test/rules.drl rename to drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/main/resources/org/drools/quarkus/ruleunit/test/rules.drl diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/AutomaticRestEndpointIT.java b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/AutomaticRestEndpointIT.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/AutomaticRestEndpointIT.java rename to drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/AutomaticRestEndpointIT.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeDslRuleUnitTest.java b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeDslRuleUnitTest.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeDslRuleUnitTest.java rename to drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeDslRuleUnitTest.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeTest.java b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeTest.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeTest.java rename to drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/RuntimeTest.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/TestableIT.java b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/TestableIT.java similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/TestableIT.java rename to drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/src/test/java/org/drools/quarkus/ruleunit/test/TestableIT.java diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/pom.xml b/drools-quarkus-extension/drools-quarkus-util-deployment/pom.xml similarity index 92% rename from drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/pom.xml rename to drools-quarkus-extension/drools-quarkus-util-deployment/pom.xml index f1f135cbe63..8d48b47cfe4 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/pom.xml +++ b/drools-quarkus-extension/drools-quarkus-util-deployment/pom.xml @@ -25,15 +25,15 @@ 4.0.0 org.drools - drools-drl-quarkus-extension + drools-quarkus-extension 8.45.0-SNAPSHOT Drools :: Quarkus Extension :: Util :: Deployment - drools-drl-quarkus-util-deployment + drools-quarkus-util-deployment - org.drools.drl.quarkus.util + org.drools.quarkus.util diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/DroolsQuarkusResourceUtils.java similarity index 99% rename from drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java rename to drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/DroolsQuarkusResourceUtils.java index 6e39dd215d6..9ebcb26c6de 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/DroolsQuarkusResourceUtils.java +++ b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/DroolsQuarkusResourceUtils.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.drools.drl.quarkus.util.deployment; +package org.drools.quarkus.util.deployment; import io.quarkus.arc.deployment.GeneratedBeanBuildItem; import io.quarkus.bootstrap.classloading.QuarkusClassLoader; diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/GeneratedFileWriter.java b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/GeneratedFileWriter.java similarity index 99% rename from drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/GeneratedFileWriter.java rename to drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/GeneratedFileWriter.java index c21cb41d2b2..e3c62e60eab 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/GeneratedFileWriter.java +++ b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/GeneratedFileWriter.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.drools.drl.quarkus.util.deployment; +package org.drools.quarkus.util.deployment; import java.io.IOException; import java.io.UncheckedIOException; diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/GlobalsBuildItem.java b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/GlobalsBuildItem.java similarity index 96% rename from drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/GlobalsBuildItem.java rename to drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/GlobalsBuildItem.java index e01a7556a89..fd3a2ab0b04 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/GlobalsBuildItem.java +++ b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/GlobalsBuildItem.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.drools.drl.quarkus.util.deployment; +package org.drools.quarkus.util.deployment; import java.util.Map; diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/KmoduleKieBaseModelsBuiltItem.java b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/KmoduleKieBaseModelsBuiltItem.java similarity index 96% rename from drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/KmoduleKieBaseModelsBuiltItem.java rename to drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/KmoduleKieBaseModelsBuiltItem.java index 6795134dec2..d437bc3dc8a 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/KmoduleKieBaseModelsBuiltItem.java +++ b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/KmoduleKieBaseModelsBuiltItem.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.drools.drl.quarkus.util.deployment; +package org.drools.quarkus.util.deployment; import java.util.Collection; import java.util.Map; diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/PatternsTypesBuildItem.java b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/PatternsTypesBuildItem.java similarity index 96% rename from drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/PatternsTypesBuildItem.java rename to drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/PatternsTypesBuildItem.java index 85a9994a097..bc584ec18dc 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/PatternsTypesBuildItem.java +++ b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/PatternsTypesBuildItem.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.drools.drl.quarkus.util.deployment; +package org.drools.quarkus.util.deployment; import java.util.Map; import java.util.Set; diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/QuarkusAppPaths.java b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/QuarkusAppPaths.java similarity index 98% rename from drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/QuarkusAppPaths.java rename to drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/QuarkusAppPaths.java index 9979b2ba90a..47abd3ae151 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus-util-deployment/src/main/java/org/drools/drl/quarkus/util/deployment/QuarkusAppPaths.java +++ b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/QuarkusAppPaths.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.drools.drl.quarkus.util.deployment; +package org.drools.quarkus.util.deployment; import java.nio.file.Path; import java.nio.file.Paths; diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus/pom.xml b/drools-quarkus-extension/drools-quarkus/pom.xml similarity index 96% rename from drools-drl-quarkus-extension/drools-drl-quarkus/pom.xml rename to drools-quarkus-extension/drools-quarkus/pom.xml index 8205e8d898c..a7691b98b52 100644 --- a/drools-drl-quarkus-extension/drools-drl-quarkus/pom.xml +++ b/drools-quarkus-extension/drools-quarkus/pom.xml @@ -25,15 +25,15 @@ 4.0.0 org.drools - drools-drl-quarkus-extension + drools-quarkus-extension 8.45.0-SNAPSHOT Drools :: Quarkus Extension :: Runtime - drools-drl-quarkus + drools-quarkus - org.drools.drl.quarkus.runtime + org.drools.quarkus.runtime diff --git a/drools-drl-quarkus-extension/drools-drl-quarkus/src/main/resources/META-INF/quarkus-extension.yaml b/drools-quarkus-extension/drools-quarkus/src/main/resources/META-INF/quarkus-extension.yaml similarity index 100% rename from drools-drl-quarkus-extension/drools-drl-quarkus/src/main/resources/META-INF/quarkus-extension.yaml rename to drools-quarkus-extension/drools-quarkus/src/main/resources/META-INF/quarkus-extension.yaml diff --git a/drools-drl-quarkus-extension/pom.xml b/drools-quarkus-extension/pom.xml similarity index 79% rename from drools-drl-quarkus-extension/pom.xml rename to drools-quarkus-extension/pom.xml index 40894b6cd0a..7cf6b3e871f 100644 --- a/drools-drl-quarkus-extension/pom.xml +++ b/drools-quarkus-extension/pom.xml @@ -32,11 +32,11 @@ Drools :: Quarkus Extension org.drools - drools-drl-quarkus-extension + drools-quarkus-extension pom - drools-drl-quarkus-util-deployment + drools-quarkus-util-deployment @@ -60,13 +60,13 @@ - drools-drl-quarkus - drools-drl-quarkus-deployment - drools-drl-quarkus-integration-test - drools-drl-quarkus-integration-test-hotreload - drools-drl-quarkus-ruleunit-integration-test - drools-drl-quarkus-quickstart-test - drools-drl-quarkus-examples + drools-quarkus + drools-quarkus-deployment + drools-quarkus-integration-test + drools-quarkus-integration-test-hotreload + drools-quarkus-ruleunit-integration-test + drools-quarkus-quickstart-test + drools-quarkus-examples diff --git a/pom.xml b/pom.xml index d2863b62236..f32a88e1dcd 100644 --- a/pom.xml +++ b/pom.xml @@ -165,9 +165,7 @@ drools-commands drools-kiesession drools-ecj - drools-drl-ast - drools-drl-parser - drools-drl-extensions + drools-drl drools-compiler drools-mvel drools-xml-support @@ -199,7 +197,7 @@ kie-pmml-trusty kie-maven-plugin kie-archetypes - drools-drl-quarkus-extension + drools-quarkus-extension jpmml-migration-recipe drools-reliability drools-drlonyaml-parent @@ -293,7 +291,7 @@ kie-pmml-trusty kie-internal kie-test-util - drools-drl-quarkus-extension + drools-quarkus-extension drools-reliability From a179bb9ebbf6b6d3d1047731055f2fcb6c618585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Fri, 27 Oct 2023 13:44:29 +0200 Subject: [PATCH 18/41] [kie-issues#653] Don't use System.out and logger debug mode in test output in drools-traits (#5565) --- .../src/test/resources/logback-test.xml | 4 +- .../src/main/resources/logback.xml | 2 +- .../src/test/resources/logback-test.xml | 2 +- .../src/test/resources/logback-test.xml | 2 +- .../core/reteoo/TraitObjectTypeNode.java | 5 - .../util/AbstractBitwiseHierarchyImpl.java | 12 - .../core/util/AbstractCodedHierarchyImpl.java | 3 - .../core/util/HierarchyEncoderImpl.java | 30 -- .../UseOfRuleFlowGroupPlusLockOnTest.java | 10 +- .../compiler/factmodel/traits/Imp2.java | 7 +- .../factmodel/traits/LegacyTraitTest.java | 6 +- .../factmodel/traits/LogicalTraitTest.java | 112 ++--- .../factmodel/traits/SomethingImpl.java | 7 +- .../factmodel/traits/StandaloneTest.java | 14 +- .../factmodel/traits/StudentProxyImpl3.java | 7 +- .../traits/StudentProxyWrapper2.java | 10 - .../factmodel/traits/TraitMapCoreTest.java | 63 +-- .../compiler/factmodel/traits/TraitTest.java | 395 +++++------------- .../TraitTypeGenerationTest.java | 23 +- .../factmodel/InstancesHashcodedTest.java | 8 - .../traits/core/factmodel/JeneratorTest.java | 13 +- .../traits/core/meta/org/MetadataTest.java | 5 +- .../traits/core/util/HierarchyTest.java | 130 +++--- .../src/test/resources/logback-test.xml | 6 +- .../traits/testDeclaredFactTrait.drl | 1 - .../factmodel/traits/testPojoFactTrait.drl | 1 - .../factmodel/traits/testTraitCollections.drl | 2 - .../factmodel/traits/testTraitDon.drl | 2 - .../factmodel/traits/testTraitDonMultiple.drl | 3 - .../factmodel/traits/testTraitIsA2.drl | 2 - .../factmodel/traits/testTraitIsAWithBC.drl | 1 - .../factmodel/traits/testTraitLegacyCore.drl | 8 - .../factmodel/traits/testTraitLegacyTrait.drl | 13 - .../factmodel/traits/testTraitOverride.drl | 1 - .../factmodel/traits/testTraitShed.drl | 6 - .../traits/testTraitWithEquality.drl | 2 - .../factmodel/traits/testTraitWrapping.drl | 1 - .../src/test/resources/logback.xml | 4 +- .../src/test/resources/logback.xml | 2 +- .../src/test/resources/logback.xml | 2 +- .../src/test/resources/logback-test.xml | 2 +- .../src/test/resources/logback-test.xml | 2 +- 42 files changed, 299 insertions(+), 632 deletions(-) diff --git a/drools-compiler/src/test/resources/logback-test.xml b/drools-compiler/src/test/resources/logback-test.xml index 475fe3be351..f83d0fe7f39 100644 --- a/drools-compiler/src/test/resources/logback-test.xml +++ b/drools-compiler/src/test/resources/logback-test.xml @@ -30,10 +30,10 @@ - + - + diff --git a/drools-examples-api/kie-module-from-multiple-files/src/main/resources/logback.xml b/drools-examples-api/kie-module-from-multiple-files/src/main/resources/logback.xml index dd53cf7d9f7..4ef4861ad83 100644 --- a/drools-examples-api/kie-module-from-multiple-files/src/main/resources/logback.xml +++ b/drools-examples-api/kie-module-from-multiple-files/src/main/resources/logback.xml @@ -28,7 +28,7 @@ - + diff --git a/drools-mvel/src/test/resources/logback-test.xml b/drools-mvel/src/test/resources/logback-test.xml index 6f99a4f0d2a..cc8bcf9a586 100644 --- a/drools-mvel/src/test/resources/logback-test.xml +++ b/drools-mvel/src/test/resources/logback-test.xml @@ -30,7 +30,7 @@ - + diff --git a/drools-ruleunits/drools-ruleunits-impl/src/test/resources/logback-test.xml b/drools-ruleunits/drools-ruleunits-impl/src/test/resources/logback-test.xml index 1b28764a217..271d3edb382 100644 --- a/drools-ruleunits/drools-ruleunits-impl/src/test/resources/logback-test.xml +++ b/drools-ruleunits/drools-ruleunits-impl/src/test/resources/logback-test.xml @@ -31,7 +31,7 @@ - + diff --git a/drools-traits/src/main/java/org/drools/traits/core/reteoo/TraitObjectTypeNode.java b/drools-traits/src/main/java/org/drools/traits/core/reteoo/TraitObjectTypeNode.java index 8b3901cbb30..0a68d191ed6 100644 --- a/drools-traits/src/main/java/org/drools/traits/core/reteoo/TraitObjectTypeNode.java +++ b/drools-traits/src/main/java/org/drools/traits/core/reteoo/TraitObjectTypeNode.java @@ -68,10 +68,7 @@ private boolean isAssertAllowed( InternalFactHandle factHandle ) { boolean allowed = ! vetoed || sameAndNotCoveredByDescendants((TraitProxyImpl) factHandle.getObject(), typeMask ); if ( allowed ) { - //System.err.println(" INSERT PASS !! " + factHandle.getObject() + " " + ( (TraitProxy) factHandle.getObject() )._getTypeCode() + " >> " + vetoMask + " checks in " + typeMask ); proxy.assignOtn( this.typeMask ); - } else { - //System.err.println(" INSERT BLOCK !! " + factHandle.getObject() + " " + ( (TraitProxy) factHandle.getObject() )._getTypeCode() + " >> " + vetoMask + " checks in " + typeMask ); } return allowed; } @@ -134,8 +131,6 @@ public void modifyObject( InternalFactHandle factHandle, modifyPreviousTuples, context.adaptModificationMaskForObjectType(objectType, reteEvaluator), reteEvaluator); - } else { - //System.err.println( ((ClassObjectType) this.getObjectType()).getClassName() + " : MODIFY BLOCK !! " + ( (TraitProxy) factHandle.getObject() ).getTraitName() + " " + ( (TraitProxy) factHandle.getObject() )._getTypeCode() + " >> " + " checks in " + typeMask ); } } else { this.sink.propagateModifyObject(factHandle, diff --git a/drools-traits/src/main/java/org/drools/traits/core/util/AbstractBitwiseHierarchyImpl.java b/drools-traits/src/main/java/org/drools/traits/core/util/AbstractBitwiseHierarchyImpl.java index cf147d1d0f4..8185a1bf5c7 100644 --- a/drools-traits/src/main/java/org/drools/traits/core/util/AbstractBitwiseHierarchyImpl.java +++ b/drools-traits/src/main/java/org/drools/traits/core/util/AbstractBitwiseHierarchyImpl.java @@ -130,7 +130,6 @@ public List getSortedMembers() { public Collection upperAncestors( BitSet key ) { List vals = new LinkedList<>(); int l = key.length(); - //System.out.println( key ); BitSet start = new BitSet( l ); BitSet end = new BitSet( l ); @@ -150,13 +149,8 @@ public Collection upperAncestors( BitSet key ) { start.set( s, true ); end.set( s, t, true ); -// System.out.println( "X >> " + s + " << " + t ); -// System.out.println( "S >> " + start ); -// System.out.println( "E >> " + end ); -// System.out.println( "E+1>> " + nextKey( end ) ); if ( t > 0 ) { for ( J val : line.subMap( start, nextKey( end ) ).values() ) { -// System.out.println( "\t " + val.getValue() ); vals.add( val.getValue() ); } } @@ -230,11 +224,9 @@ List gcsBorderNodes( BitSet key, boolean includeEquals ) { J ex = border.get( k ); if ( ex != null ) { if ( superset( candidate, ex.getBitMask() ) >= 0 ) { -// System.out.println( "Skipping " + val + " due to " + ex ); minimal = false; break; } else if ( superset( ex.getBitMask(), candidate ) > 0 ) { -// System.out.println( "Clearing " + ex + " due to " + val ); border.set( k, null ); } @@ -276,8 +268,6 @@ Collection lcs( BitSet key, boolean includeEquals ) { List lcsBorderNodes( BitSet key, boolean includeEquals ) { List border = new ArrayList<>(); if ( key == null ) { return border; } -// System.out.println( key ); - int l = key.length(); BitSet start = new BitSet( l + 1 ); BitSet end = new BitSet( l + 1 ); @@ -308,13 +298,11 @@ List lcsBorderNodes( BitSet key, boolean includeEquals ) { if ( ex != null ) { if ( superset( candidate, ex.getBitMask() ) > 0 ) { -// System.out.println( "Clearing " + ex + " due to " + val ); border.set( j, null ); } } } } -// System.out.println( "\t\t " + border ); } index = key.nextSetBit( t ); diff --git a/drools-traits/src/main/java/org/drools/traits/core/util/AbstractCodedHierarchyImpl.java b/drools-traits/src/main/java/org/drools/traits/core/util/AbstractCodedHierarchyImpl.java index 1312e30a87a..993bdfebb56 100644 --- a/drools-traits/src/main/java/org/drools/traits/core/util/AbstractCodedHierarchyImpl.java +++ b/drools-traits/src/main/java/org/drools/traits/core/util/AbstractCodedHierarchyImpl.java @@ -58,9 +58,6 @@ public void addMember( T val, BitSet key ) { } } add( node ); -// System.out.println( " Added inst node " + node ); -// System.out.println( " \t parents " + parents( key ) ); -// System.out.println( " \t children " + children( key ) ); } } diff --git a/drools-traits/src/main/java/org/drools/traits/core/util/HierarchyEncoderImpl.java b/drools-traits/src/main/java/org/drools/traits/core/util/HierarchyEncoderImpl.java index 690aea529ec..aa980713e4b 100644 --- a/drools-traits/src/main/java/org/drools/traits/core/util/HierarchyEncoderImpl.java +++ b/drools-traits/src/main/java/org/drools/traits/core/util/HierarchyEncoderImpl.java @@ -109,7 +109,6 @@ List ancestorValues( T name ) { protected void encode( HierNode node ) { Collection> parents = node.getParents(); - //System.out.println( "Trying to encode " + node ); switch ( parents.size() ) { case 0 : BitSet zero = new BitSet(); @@ -143,7 +142,6 @@ protected void encode( HierNode node ) { break; default: inheritMerged( node ); - //System.out.println( " ----------------------------------------------------------------------------------------- " ); resolveConflicts( node ); break; } @@ -155,21 +153,17 @@ protected void resolveConflicts( HierNode x ) { Collection> nodes = new ArrayList<>( getNodes() ); for ( HierNode y : nodes ) { if ( incomparable( x, y ) ) { -// System.out.println( " \t\tIncomparability between " + x + " and " + y ); int sup = superset( y, x ); if ( sup == 0 ) { - //System.out.println( " \t\tIncomparable, with same mask " + y ); // can't use update mask here, or the already existing node would be removed x.setBitMask( increment( x.getBitMask(), freeBit( x ) ) ); propagate( y, freeBit( x, y ) ); } if ( sup > 0 ) { -// System.out.println( " \t\tIncomparable, but as parent " + y ); updateMask( x, increment( x.getBitMask(), freeBit( x ) ) ); } int sub = superset( x, y ); if ( sub > 0 ) { -// System.out.println( " \t\tIncomparable, but as child " + y ); modify( x, y ); conflicted = true; } @@ -184,12 +178,9 @@ protected void resolveConflicts( HierNode x ) { } protected void modify( HierNode x, HierNode y ) { - //System.out.println( "Modifying on a inc between " + x + " and " + y ); int i = freeBit( x, y ); - //System.out.println( "I " + i ); - //System.out.println( "Getting parents of " + y + " >> " + y.getParents() ); Collection> py = y.getParents(); BitSet t = new BitSet( y.getBitMask().length() ); for ( HierNode parent : py ) { @@ -202,10 +193,6 @@ protected void modify( HierNode x, HierNode y ) { if ( inDex < 0 ) { propagate( y, i ); } else { - - //System.out.println( "D " + toBinaryString( d ) ); - - Set> ancestors = ancestorNodes( x ); Set> affectedAncestors = new HashSet<>(); @@ -214,16 +201,11 @@ protected void modify( HierNode x, HierNode y ) { affectedAncestors.add( anc ); } } - //System.out.println( "Ancestors of " + x + " >> " + ancestors ); - //System.out.println( "Affected " + x + " >> " + affectedAncestors ); - if ( affectedAncestors.size() == 0 ) { return; } Set> gcs = gcs( affectedAncestors ); - //System.out.println( "GCS of Affected " + gcs ); - Set> affectedDescendants = new HashSet<>(); for ( HierNode g : gcs ) { affectedDescendants.addAll( descendantNodes( g ) ); @@ -251,8 +233,6 @@ protected void modify( HierNode x, HierNode y ) { subMask = increment( subMask, i ); updateMask( sub, subMask ); - - //System.out.println( "\tModified Desc" + sub ); } inDex = d.nextSetBit( inDex + 1 ); @@ -286,7 +266,6 @@ protected Set> gcs( Set> set ) { while ( iter.hasNext() ) { a.and( iter.next().getBitMask() ); } - //System.out.println( "Root mask for ceil " + toBinaryString( a ) ); for ( HierNode node : getNodes() ) { if ( superset( node.getBitMask(), a ) >= 0 ) { s.add( node ); @@ -298,7 +277,6 @@ protected Set> gcs( Set> set ) { } protected Set> ceil( Set> s ) { - //System.out.println( "Looking for the ceiling of " + s); if ( s.size() <= 1 ) { return s; } Set> ceil = new HashSet<>( s ); for ( HierNode x : s ) { @@ -309,12 +287,10 @@ protected Set> ceil( Set> s ) { } } } - //System.out.println("Found ceiling " + ceil); return ceil; } protected Set> floor( Set> s ) { - //System.out.println( "Looking for the floor of " + s); if ( s.size() <= 1 ) { return s; } Set> ceil = new HashSet<>( s ); for ( HierNode x : s ) { @@ -325,7 +301,6 @@ protected Set> floor( Set> s ) { } } } - //System.out.println("Found ceiling " + ceil); return ceil; } @@ -370,30 +345,25 @@ protected int freeBit( HierNode x ) { } protected int freeBit( HierNode x, HierNode z ) { - //System.out.println( "Looking for a free bit in node " + x ); BitSet forbid = new BitSet( this.size() ); forbid.or( x.getBitMask() ); for ( HierNode y : getNodes() ) { if ( superset( y, x ) > 0 ) { - //System.out.println( "\t\t Subtype " + y + " contributes " + toBinaryString( y.getBitMask() ) ); forbid.or( y.getBitMask() ); } if ( z != null ) { if ( superset( y, z ) > 0 ) { -// System.out.println( "\t\t Subtype " + y + " contributes " + toBinaryString( y.getBitMask() ) ); forbid.or( y.getBitMask() ); } } if ( superset( x, y ) < 0 ) { BitSet diff = singleBitDiff( x.getBitMask(), y.getBitMask() ); - //System.out.println( "\t\t Incomparable " + y + " contributes " + toBinaryString( diff ) ); forbid.or(diff); } } - //System.out.println( "\t Forbidden mask " + toBinaryString( forbid ) ); return firstZero( forbid ); } diff --git a/drools-traits/src/test/java/org/drools/traits/UseOfRuleFlowGroupPlusLockOnTest.java b/drools-traits/src/test/java/org/drools/traits/UseOfRuleFlowGroupPlusLockOnTest.java index b094472c511..76a68c0a133 100644 --- a/drools-traits/src/test/java/org/drools/traits/UseOfRuleFlowGroupPlusLockOnTest.java +++ b/drools-traits/src/test/java/org/drools/traits/UseOfRuleFlowGroupPlusLockOnTest.java @@ -26,11 +26,15 @@ import org.kie.api.io.ResourceType; import org.kie.api.runtime.KieSession; import org.kie.internal.utils.KieHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.assertj.core.api.Assertions.assertThat; public class UseOfRuleFlowGroupPlusLockOnTest { + private static final Logger LOGGER = LoggerFactory.getLogger(UseOfRuleFlowGroupPlusLockOnTest.class); + private static final String drl = "package com.sample\n" + "import " + Person.class.getCanonicalName() + " ;\n" + "import " + Cheese.class.getCanonicalName() + " ;\n" @@ -57,7 +61,9 @@ public void test() { KieHelper kieHelper = new KieHelper().addContent(drl, ResourceType.DRL); KieBase kbase = kieHelper.build(); KieSession ksession = kbase.newKieSession(); - ReteDumper.dumpRete(ksession); + if (LOGGER.isDebugEnabled()) { + ReteDumper.dumpRete(ksession); + } ksession.addEventListener( new DebugAgendaEventListener() ); try { ksession.insert(new Person()); @@ -65,8 +71,6 @@ public void test() { ((DefaultAgenda) ksession.getAgenda()).activateRuleFlowGroup("group1"); int rulesFired = ksession.fireAllRules(); assertThat(rulesFired).isEqualTo(1); - - } finally { ksession.dispose(); } diff --git a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/Imp2.java b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/Imp2.java index 80f7e6216eb..5f42c7e9eed 100644 --- a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/Imp2.java +++ b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/Imp2.java @@ -22,6 +22,8 @@ import org.drools.base.factmodel.traits.TraitFieldTMS; import org.drools.traits.core.factmodel.TraitFieldTMSImpl; import org.drools.base.factmodel.traits.TraitableBean; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.BitSet; import java.util.Collection; @@ -33,6 +35,8 @@ public class Imp2 implements TraitableBean { + private static final Logger LOGGER = LoggerFactory.getLogger(Imp2.class); + private String name; private String school; @@ -137,8 +141,7 @@ public int hashCode() { public void foo() { Object f = __$$dynamic_properties_map$$.get( "goo" ); - System.out.println( f ); - + LOGGER.debug( f.toString() ); } private TraitFieldTMS tms; diff --git a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/LegacyTraitTest.java b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/LegacyTraitTest.java index 50e8a6b9218..6b54b117bfa 100644 --- a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/LegacyTraitTest.java +++ b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/LegacyTraitTest.java @@ -43,6 +43,8 @@ import org.kie.internal.builder.KnowledgeBuilderFactory; import org.kie.internal.io.ResourceFactory; import org.kie.internal.utils.KieHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; @@ -51,6 +53,8 @@ @RunWith(Parameterized.class) public class LegacyTraitTest extends CommonTraitTest { + private static final Logger LOGGER = LoggerFactory.getLogger(LegacyTraitTest.class); + public VirtualPropertyMode mode; @Parameterized.Parameters @@ -290,7 +294,7 @@ public void traitWithMixedInterfacesExtendingEachOther() { int n = ks.fireAllRules(); - System.out.println( list ); + LOGGER.debug( list.toString() ); assertThat(list).isEqualTo(Arrays.asList(1, 2, 3)); assertThat(n).isEqualTo(3); } diff --git a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/LogicalTraitTest.java b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/LogicalTraitTest.java index 8c7cee12196..f9217d22ac3 100644 --- a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/LogicalTraitTest.java +++ b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/LogicalTraitTest.java @@ -52,6 +52,8 @@ import org.kie.internal.builder.conf.PropertySpecificOption; import org.kie.internal.io.ResourceFactory; import org.kie.internal.utils.KieHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; @@ -59,6 +61,7 @@ @RunWith(Parameterized.class) public class LogicalTraitTest extends CommonTraitTest { + private static final Logger LOGGER = LoggerFactory.getLogger(LogicalTraitTest.class); public VirtualPropertyMode mode; @@ -97,18 +100,16 @@ public void testShadowAlias() { ks.fireAllRules(); for ( Object o : ks.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } - try { ks = SerializationHelper.getSerialisedStatefulKnowledgeSession(ks, true ); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } - System.out.println( list ); + LOGGER.debug( list.toString() ); assertThat(list.contains(false)).isFalse(); assertThat(list.size()).isEqualTo(8); } @@ -169,15 +170,14 @@ public void testShadowAliasTraitOnClass() { ks.fireAllRules(); for ( Object o : ks.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } assertThat(list).isEqualTo(List.of("ok")); try { ks = SerializationHelper.getSerialisedStatefulKnowledgeSession( ks, true ); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } } @@ -218,7 +218,6 @@ public void testShadowAliasClassOnTrait() { "when \n" + " $x : Y( fld isA T ) \n" + "then \n" + - " System.err.println( $x.getFld() ); \n" + " list.add( \"ok1\" );" + "end \n" + "" + @@ -226,7 +225,6 @@ public void testShadowAliasClassOnTrait() { "when \n" + " $x : X( fld isA T ) \n" + "then \n" + - " System.err.println( $x.getFld() ); \n" + " list.add( \"ok2\" );" + "end \n" + "" + @@ -248,15 +246,14 @@ public void testShadowAliasClassOnTrait() { ks.fireAllRules(); for ( Object o : ks.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } assertThat(list).isEqualTo(Arrays.asList("ok1", "ok2")); try { ks = SerializationHelper.getSerialisedStatefulKnowledgeSession( ks, true ); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } } @@ -322,15 +319,14 @@ public void testShadowAliasTraitOnTrait() { ks.fireAllRules(); for ( Object o : ks.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } assertThat(list).isEqualTo(List.of("ok")); try { ks = SerializationHelper.getSerialisedStatefulKnowledgeSession( ks, true ); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } } @@ -403,19 +399,18 @@ public void initializationConflictManagement() { knowledgeSession.fireAllRules(); for ( Object o : knowledgeSession.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString()); } - System.out.println( list ); - System.out.println( list2 ); + LOGGER.debug( list.toString() ); + LOGGER.debug( list2.toString() ); assertThat(list).isEqualTo(Arrays.asList("1", null, "xyz", "xyz", "7", "aaa")); assertThat(list2).isEqualTo(Arrays.asList(18, null, 37, 99, 37)); try { knowledgeSession = SerializationHelper.getSerialisedStatefulKnowledgeSession( knowledgeSession, true ); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } } @@ -486,19 +481,18 @@ public void testInitializationConflictManagementPrimitiveTypes() { knowledgeSession.fireAllRules(); for ( Object o : knowledgeSession.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } - System.out.println( list ); - System.out.println( list2 ); + LOGGER.debug( list.toString() ); + LOGGER.debug( list2.toString() ); assertThat(list).isEqualTo(Arrays.asList(1.0, 0.0, 16.3, 16.3, 0.0, -0.72)); assertThat(list2).isEqualTo(Arrays.asList(18, 0, 37, 99, 0)); try { knowledgeSession = SerializationHelper.getSerialisedStatefulKnowledgeSession( knowledgeSession, true ); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } knowledgeSession.dispose(); @@ -643,14 +637,13 @@ public void testFieldTypeDonMap() { knowledgeSession.fireAllRules(); for ( Object o : knowledgeSession.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } try { knowledgeSession = SerializationHelper.getSerialisedStatefulKnowledgeSession( knowledgeSession, true ); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } @@ -726,14 +719,13 @@ public void testDataStructs() { fail( "Unexpected id " ); } } - System.out.println( o ); + LOGGER.debug( o.toString() ); } try { knowledgeSession = SerializationHelper.getSerialisedStatefulKnowledgeSession( knowledgeSession, true ); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } @@ -800,8 +792,7 @@ public void shadowAliasSelf() { try { ks = SerializationHelper.getSerialisedStatefulKnowledgeSession( ks, true ); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } } @@ -844,7 +835,6 @@ public void traitOnSet() { "rule Don \n" + "when \n" + "then \n" + - " System.out.println( \"Create K !\" ); \n" + " K k = new K(1); " + " don( k, T.class ); \n" + " modify ( k ) { \n" + @@ -857,7 +847,6 @@ public void traitOnSet() { "when \n" + " $x : K( fld isA S, fld not isA R ) \n" + "then \n" + - " System.out.println( \"K detected\" + $x );" + " list.add( \"ok1\" );" + "end \n" + "" + @@ -867,7 +856,6 @@ public void traitOnSet() { " String() \n" + " $x : K( fld isA S ) \n" + "then \n" + - " System.out.println( \"Add U - R\" );" + " don( $x, U.class ); \n" + "end \n" + "" + @@ -889,24 +877,19 @@ public void traitOnSet() { ks.setGlobal( "list", list ); int n = ks.fireAllRules(); - System.out.println( "Rules fired " + n ); + LOGGER.debug( "Rules fired " + n ); - System.out.println( "------------- ROUND TRIP -------------" ); + LOGGER.debug( "------------- ROUND TRIP -------------" ); try { ks = SerializationHelper.getSerialisedStatefulKnowledgeSession( ks, true ); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } ks.insert( "go" ); ks.fireAllRules(); -// for ( Object o : ks.getObjects() ) { -// System.out.println( o ); -// } - assertThat(list).isEqualTo(List.of("ok1")); } @@ -1011,7 +994,7 @@ public void testShadowAliasTraitOnClassLogicalRetract() { assertThat(list).isEqualTo(List.of("ok")); for ( Object o : ks.getObjects() ) { - System.out.println( o + " >> " + ((InternalFactHandle)ks.getFactHandle( o )).getEqualityKey() ); + LOGGER.debug( o + " >> " + ((InternalFactHandle)ks.getFactHandle( o )).getEqualityKey() ); } ks.retract( handle ); @@ -1033,8 +1016,7 @@ public void testShadowAliasTraitOnClassLogicalRetract() { try { ks = SerializationHelper.getSerialisedStatefulKnowledgeSession( ks, true ); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } ks.setGlobal( "list", list ); @@ -1042,7 +1024,7 @@ public void testShadowAliasTraitOnClassLogicalRetract() { ks.insert( "go2" ); ks.fireAllRules(); - System.out.println( list ); + LOGGER.debug( list.toString() ); assertThat(list).isEqualTo(Arrays.asList("ok", "ok2", "ok3")); @@ -1103,11 +1085,6 @@ public void testShadowAliasClassOnTraitLogicalRetract() { " String( this == \"go\" ) \n" + " $x : X( $f1 : fld, $f2 : fld2 ) \n" + "then \n" + - " System.out.println(\"inizio check\");" + - " System.out.println(list);" + - " System.out.println($f1);" + - " System.out.println($f1.getId());" + - " System.out.println(\"fine check\");" + " list.add( $f1.getId() );" + " list.add( $f2.getId() );" + "end \n" + @@ -1117,15 +1094,9 @@ public void testShadowAliasClassOnTraitLogicalRetract() { " not String( this == \"go\" ) \n" + " $x : Y( $f1 : fld, $f2 : fld2 ) \n" + "then \n" + - " System.out.println(\"inizio check2\");" + - " System.out.println(list);" + - " System.out.println($f1);" + - " System.out.println($f1.getId());" + - " System.out.println(\"fine check2\");" + - " list.add( $f1.getId() );" + + " list.add( $f1.getId() );" + " list.add( $f2.getId() );" + - "end \n" + - ""; + "end \n"; KnowledgeBuilder kbuilderImpl = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilderImpl.add( ResourceFactory.newByteArrayResource( drl.getBytes() ), ResourceType.DRL ); @@ -1156,11 +1127,10 @@ public void testShadowAliasClassOnTraitLogicalRetract() { try { ks = SerializationHelper.getSerialisedStatefulKnowledgeSession( ks, true ); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } - System.out.println( list ); + LOGGER.debug( list.toString() ); assertThat(list).isEqualTo(Arrays.asList(1, 2, 1, 2)); } @@ -1212,24 +1182,20 @@ public void testSerial() { ks.fireAllRules(); for ( Object o : ks.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } try { ks = SerializationHelper.getSerialisedStatefulKnowledgeSession( ks, true ); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } for ( Object o : ks.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } - - } - @Test public void testTraitMismatchTypes() { @@ -1387,7 +1353,7 @@ public void testTraitMismatchTypes3() ksession.setGlobal("list",list); ksession.fireAllRules(); - System.out.println( "list" + list ); + LOGGER.debug( "list" + list ); assertThat(list.size()).isEqualTo(1); assertThat(list.get(0).getClass().getName()).isEqualTo("org.drools.base.factmodel.traits.test.Bar"); diff --git a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/SomethingImpl.java b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/SomethingImpl.java index 0ecae441112..128b1e98d22 100644 --- a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/SomethingImpl.java +++ b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/SomethingImpl.java @@ -18,9 +18,12 @@ */ package org.drools.traits.compiler.factmodel.traits; -public class SomethingImpl implements IDoSomething { +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +public class SomethingImpl implements IDoSomething { + private static final Logger LOGGER = LoggerFactory.getLogger(SomethingImpl.class); private ISomethingWithBehaviour arg; @@ -44,6 +47,6 @@ public String doSomething( int x ) { } public void doAnotherTask() { - System.out.println("X"); + LOGGER.debug("X"); } } diff --git a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/StandaloneTest.java b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/StandaloneTest.java index 2b820bfacbb..992ccdb8907 100644 --- a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/StandaloneTest.java +++ b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/StandaloneTest.java @@ -27,12 +27,16 @@ import org.drools.wiring.api.classloader.ProjectClassLoader; import org.junit.Before; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.assertj.core.api.Assertions.assertThat; import static org.drools.traits.compiler.factmodel.traits.TraitTestUtils.createStandaloneTraitFactory; public class StandaloneTest { + private static final Logger LOGGER = LoggerFactory.getLogger(StandaloneTest.class); + private StandaloneTraitFactory factory; @Before @@ -62,8 +66,8 @@ public void testHierarchy() throws LogicalTypeInconsistencyException { CoreWrapper core = factory.makeTraitable(imp, Imp.class ); IStudent student = (IStudent) factory.don( core, IStudent.class ); - System.out.println( student.getName() ); - System.out.println( student.getSchool() ); + LOGGER.debug( student.getName() ); + LOGGER.debug( student.getSchool() ); assertThat(student.getName()).isEqualTo("john doe"); assertThat(student.getSchool()).isNull(); @@ -71,7 +75,7 @@ public void testHierarchy() throws LogicalTypeInconsistencyException { student.setName( "alan ford" ); - System.out.println( p.getName() ); + LOGGER.debug( p.getName() ); assertThat(p.getName()).isEqualTo("alan ford"); } @@ -92,8 +96,8 @@ public void testLegacy() throws LogicalTypeInconsistencyException { CoreWrapper core = factory.makeTraitable( imp, Imp.class ); IFoo foo = (IFoo) factory.don( core, IFoo.class ); - System.out.println( foo.getName() ); - System.out.println( foo instanceof Thing ); + LOGGER.debug( foo.getName() ); + LOGGER.debug( "Is foo instance of Thing? : " + (foo instanceof Thing) ); assertThat(foo.getName()).isEqualTo("john doe"); assertThat(foo instanceof Thing).isTrue(); diff --git a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/StudentProxyImpl3.java b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/StudentProxyImpl3.java index fa93b2b0e2a..8fdc5409649 100644 --- a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/StudentProxyImpl3.java +++ b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/StudentProxyImpl3.java @@ -33,10 +33,13 @@ import org.drools.traits.core.factmodel.TripleFactoryImpl; import org.drools.traits.core.factmodel.TripleStore; import org.kie.api.runtime.rule.Variable; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class StudentProxyImpl3 extends TraitProxyImpl implements IStudent { + private static final Logger LOGGER = LoggerFactory.getLogger(StudentProxyImpl3.class); + private static final String traitType = IStudent.class.getName(); private TripleFactory tripleFactory = new TripleFactoryImpl(); @@ -54,7 +57,7 @@ public class StudentProxyImpl3 extends TraitProxyImpl implements IStudent { public StudentProxyImpl3(Imp2 obj, final TripleStore m, TripleFactory factory) { - System.out.println( "ABSCS" ); + LOGGER.debug( "ABSCS" ); this.object = obj; diff --git a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/StudentProxyWrapper2.java b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/StudentProxyWrapper2.java index a33761dbab7..7814cf72d10 100644 --- a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/StudentProxyWrapper2.java +++ b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/StudentProxyWrapper2.java @@ -45,21 +45,11 @@ public StudentProxyWrapper2( Imp2 object, Map map ) { this.object = object; this.map = map; -// System.out.println( map ); -// System.out.println( object ); object._setDynamicProperties( map ); - -// map.put( "age", 0 ); -// map.put( "xcsvf" , 0.0 ); -// map.put( "name" , null ); -// map.put( "csdfsd", 0L ); -// map.put( "school" , null ); - } public int size() { return map.size() -// + ( object.getName() != null ? 1 : 0 ) + ( object.getSchool() != null ? 1 : 0 ) + 1 + ( object.getName() != null ? 1 : 0 ) diff --git a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/TraitMapCoreTest.java b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/TraitMapCoreTest.java index 6d5699e2b74..5987d7fd98d 100644 --- a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/TraitMapCoreTest.java +++ b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/TraitMapCoreTest.java @@ -31,11 +31,15 @@ import org.drools.traits.core.factmodel.VirtualPropertyMode; import org.junit.Test; import org.kie.api.runtime.KieSession; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.assertj.core.api.Assertions.assertThat; public class TraitMapCoreTest extends CommonTraitTest { + private static final Logger LOGGER = LoggerFactory.getLogger(TraitMapCoreTest.class); + @Test(timeout=10000) public void testMapCoreManyTraits( ) { String source = "package org.drools.test;\n" + @@ -70,7 +74,6 @@ public void testMapCoreManyTraits( ) { "then \n" + " Object obj1 = don( $m, PersonMap.class );\n" + " Object obj2 = don( obj1, StudentMap.class );\n" + - " System.out.println( \"done: PersonMap\" );\n" + "\n" + "end\n" + "\n"; @@ -89,7 +92,7 @@ public void testMapCoreManyTraits( ) { ks.fireAllRules(); for ( Object o : ks.getObjects() ) { - System.err.println( o ); + LOGGER.debug( o.toString() ); } assertThat(map.get("GPA")).isEqualTo(3.0); @@ -124,11 +127,9 @@ public void donMapTest() { "when \n" + " $p : PersonMap( name == \"john\", age > 10 ) \n" + "then \n" + - " System.out.println( $p ); \n" + " modify ( $p ) { \n" + " setHeight( 184.0 ); \n" + " }" + - " System.out.println( $p ); " + "end \n"; KieSession ksession = loadKnowledgeBaseFromString( source ).newKieSession(); @@ -181,7 +182,6 @@ public void testMapCore2( ) { " $m : Map( this[ \"age\"] == 18, this[ \"ID\" ] != \"100\" )\n" + "then \n" + " don( $m, PersonMap.class );\n" + - " System.out.println( \"done: PersonMap\" );\n" + "\n" + "end\n" + "\n" + @@ -192,20 +192,14 @@ public void testMapCore2( ) { " modify ( $p ) { \n" + " setHeight( 184.0 ); \n" + " }\n" + - " System.out.println(\"Log: \" + $p );\n" + "end\n" + - "" + - "" + "rule Don2\n" + "salience -1\n" + "when\n" + " $m : Map( this[ \"age\"] == 18, this[ \"ID\" ] != \"100\" ) " + "then\n" + " don( $m, StudentMap.class );\n" + - " System.out.println( \"done2: StudentMap\" );\n" + "end\n" + - "" + - "" + "rule Log2\n" + "salience -2\n" + "no-loop\n" + @@ -216,10 +210,7 @@ public void testMapCore2( ) { " setGPA( 4.0 ),\n" + " setID( \"100\" );\n" + " }\n" + - " System.out.println(\"Log2: \" + $p );\n" + "end\n" + - "" + - "" + "\n" + "rule Shed1\n" + "salience -5// it seams that the order of shed must be the same as applying don\n" + @@ -227,7 +218,6 @@ public void testMapCore2( ) { " $m : PersonMap()\n" + "then\n" + " shed( $m, PersonMap.class );\n" + - " System.out.println( \"shed: PersonMap\" );\n" + "end\n" + "\n" + "rule Shed2\n" + @@ -236,7 +226,6 @@ public void testMapCore2( ) { " $m : StudentMap()\n" + "then\n" + " shed( $m, StudentMap.class );\n" + - " System.out.println( \"shed: StudentMap\" );\n" + "end\n" + "" + "rule Last \n" + @@ -244,12 +233,9 @@ public void testMapCore2( ) { "when \n" + " $m : Map( this not isA StudentMap.class )\n" + "then \n" + - " System.out.println( \"Final\" );\n" + " $m.put( \"final\", true );" + "\n" + - "end\n" + - "\n" + - "\n"; + "end\n"; KieSession ks = loadKnowledgeBaseFromString( source ).newKieSession(); TraitFactoryImpl.setMode(VirtualPropertyMode.MAP, ks.getKieBase() ); @@ -266,7 +252,7 @@ public void testMapCore2( ) { for ( Object o : ks.getObjects() ) { - System.err.println( o ); + LOGGER.debug( o.toString() ); } assertThat(map.get("ID")).isEqualTo("100"); @@ -314,10 +300,7 @@ public void testMapCoreAliasing( ) { " setHeight( 184.0 ), \n" + " setEta( 42 ); \n" + " }\n" + - " System.out.println(\"Log: \" + $p );\n" + - "end\n" + - "" + - "\n"; + "end\n"; KieSession ks = loadKnowledgeBaseFromString( source ).newKieSession(); TraitFactoryImpl.setMode(VirtualPropertyMode.MAP, ks.getKieBase() ); @@ -334,7 +317,7 @@ public void testMapCoreAliasing( ) { for ( Object o : ks.getObjects() ) { - System.err.println( o ); + LOGGER.debug( o.toString() ); } assertThat(map.get("years")).isEqualTo(42); @@ -455,7 +438,6 @@ public void testDrools216(){ " $map.put(\"worker\" , s);\n" + " $map.put(\"isEmpty\" , false);\n" + " update($map);\n" + - " System.out.println(\"don: Person -> Student \");\n" + " list.add(\"student is donned\");\n" + "end\n" + "\n" + @@ -466,7 +448,6 @@ public void testDrools216(){ " $map : Map($stu : this[\"worker\"] isA Student.class)\n" + "then\n" + " Object obj = don( $map , Worker.class );\n" + - " System.out.println(\"don: Map -> Worker : \"+obj);\n" + " list.add(\"worker is donned\");\n" + "end\n"; @@ -544,7 +525,6 @@ public void testDrools217(){ " $map.put(\"worker\" , s);\n" + " $map.put(\"isEmpty\" , false);\n" + " update($map);\n" + - " System.out.println(\"don: Person -> Student \");\n" + " list.add(\"student is donned\");\n" + "end\n" + "\n" + @@ -555,7 +535,6 @@ public void testDrools217(){ " $map : Map($stu : this[\"worker\"], $stu isA Student.class)\n" + "then\n" + " Object obj = don( $map , Worker.class );\n" + - " System.out.println(\"don: Map -> Worker : \"+obj);\n" + " list.add(\"worker is donned\");\n" + "end\n"; @@ -640,7 +619,6 @@ public void testDrools218(){ " $map.put(\"isEmpty\" , false);\n" + " $map.put(\"hasBenefits\",null);\n" + " update($map);\n" + - " System.out.println(\"don: Person -> Student \");\n" + " list.add(\"student is donned\");\n" + "end\n" + "\n" + @@ -652,7 +630,6 @@ public void testDrools218(){ " Map($stu isA Student.class, this == $map)\n" + "then\n" + " Object obj = don( $map , Worker.class );\n" + - " System.out.println(\"don: Map -> Worker : \"+obj);\n" + " list.add(\"worker is donned\");\n" + "end\n" + "\n" + @@ -663,7 +640,6 @@ public void testDrools218(){ " $stu : Student()\n" + "then\n" + " Object obj = don( $stu , StudentWorker.class );\n" + - " System.out.println(\"don: Map -> StudentWorker : \"+obj);\n" + " list.add(\"studentworker is donned\");\n" + "end\n" + "\n" + @@ -673,7 +649,6 @@ public void testDrools218(){ "when\n" + " StudentWorker(tuitionWaiver == true)\n" + "then\n" + - " System.out.println(\"tuitionWaiver == true\");\n" + " list.add(\"tuitionWaiver is true\");\n" + "end\n" + "\n"; @@ -741,7 +716,6 @@ public void testDrools219(){ " $stu : Person(isStudent == true)\n" + "then\n" + " Student s = don( $stu , Student.class );\n" + - " System.out.println(\"don: Person -> Student \" + s);\n" + " list.add(\"student is donned\");\n" + "end\n" + "\n" + @@ -838,7 +812,6 @@ public void testMapTraitsMismatchTypes() // success " ChildTrait ct = don( $map , ChildTrait.class );\n" + "" + - " System.out.println( $map ); \n" + " list.add( pt );\n" + " list.add( ct );\n" + "end"; @@ -895,8 +868,6 @@ public void testMapTraitNoType() " $c : ChildTrait($n : naam == \"kudak\", id == 1020 )\n" + " $p : Map( this[\"naam\"] == $n )\n" + "then\n" + - " System.out.println($p);\n" + - " System.out.println($c);\n" + " list.add(\"correct2\");\n" + "end"; @@ -1013,7 +984,6 @@ public void testMapTraitPossibilities1() "then\n" + " ChildTrait ct = don( $map , ChildTrait.class );\n" + " list.add( ct );\n" + - " System.out.println(ct);\n" + "end\n" + "\n" + ""; @@ -1085,10 +1055,7 @@ public void testMapTraitPossibilities2() "then\n" + " ChildTrait ct = don( $map , ChildTrait.class );\n" + " list.add( ct );\n" + - " System.out.println(ct);\n" + - "end\n" + - "\n" + - ""; + "end\n"; KieSession ksession = loadKnowledgeBaseFromString(drl).newKieSession(); TraitFactoryImpl.setMode(VirtualPropertyMode.MAP, ksession.getKieBase()); @@ -1157,10 +1124,7 @@ public void testMapTraitPossibilities3() "then\n" + " ChildTrait ct = don( $map , ChildTrait.class );\n" + " list.add( ct );\n" + - " System.out.println(ct);\n" + - "end\n" + - "\n" + - ""; + "end\n"; KieSession ksession = loadKnowledgeBaseFromString(drl).newKieSession(); TraitFactoryImpl.setMode(VirtualPropertyMode.MAP, ksession.getKieBase()); @@ -1232,10 +1196,7 @@ public void testMapTraitPossibilities4() "then\n" + " ChildTrait ct = don( $map , ChildTrait.class );\n" + " list.add( ct );\n" + - " System.out.println(ct);\n" + - "end\n" + - "\n" + - ""; + "end\n"; KieSession ksession = loadKnowledgeBaseFromString(drl).newKieSession(); TraitFactoryImpl.setMode(VirtualPropertyMode.MAP, ksession.getKieBase()); diff --git a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/TraitTest.java b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/TraitTest.java index 63b1a6cb1e3..6e34907148b 100644 --- a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/TraitTest.java +++ b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/TraitTest.java @@ -84,6 +84,8 @@ import org.kie.internal.io.ResourceFactory; import org.kie.internal.utils.KieHelper; import org.mockito.ArgumentCaptor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Arrays; @@ -110,6 +112,8 @@ @RunWith(Parameterized.class) public class TraitTest extends CommonTraitTest { + private static final Logger LOGGER = LoggerFactory.getLogger(TraitTest.class); + private static long t0; @@ -144,7 +148,6 @@ private KieBase getKieBaseFromString( String drl, KieBaseOption... options ) { return new KieHelper().addContent( drl, ResourceType.DRL ).build(options); } - @Test public void testRetract( ) { String drl = "package org.drools.compiler.trait.test; \n" + @@ -169,14 +172,13 @@ public void testRetract( ) { assertThat(ks.fireAllRules()).isEqualTo(2); - for(Object o : ks.getObjects()) { - System.out.println(o); + for (Object o : ks.getObjects()) { + LOGGER.debug(o.toString()); } assertThat(ks.getObjects().size()).isEqualTo(0); } - @Test public void testTraitWrapGetAndSet() { String source = "org/drools/compiler/factmodel/traits/testTraitDon.drl"; @@ -225,14 +227,11 @@ public void testTraitWrapGetAndSet() { "name")).isEqualTo("john"); } catch (Exception e) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } } - - @Test public void testTraitShed() { String source = "org/drools/compiler/factmodel/traits/testTraitShed.drl"; @@ -269,8 +268,6 @@ public void testTraitShed() { } - - @Test public void testTraitDon() { String source = "org/drools/compiler/factmodel/traits/testTraitDon.drl"; @@ -298,15 +295,10 @@ public void testTraitDon() { x = it.next(); } - System.out.println( x.getClass() ); - System.out.println( x.getClass().getSuperclass() ); - System.out.println( Arrays.asList( x.getClass().getInterfaces() )); + LOGGER.debug(x.getClass().toString()); + LOGGER.debug(x.getClass().getSuperclass().toString()); + LOGGER.debug(Arrays.asList(x.getClass().getInterfaces()).toString()); } - - - - - @Test public void testMixin() { String source = "org/drools/compiler/factmodel/traits/testTraitMixin.drl"; @@ -338,7 +330,7 @@ public void traitMethodsWithObjects() { ks.fireAllRules(); if (!errors.isEmpty()) { - System.err.println( errors.toString() ); + LOGGER.error(errors.toString()); } assertThat(errors.isEmpty()).isTrue(); @@ -359,7 +351,7 @@ public void traitMethodsWithPrimitives() { ks.fireAllRules(); if (!errors.isEmpty()) { - System.err.println( errors ); + LOGGER.error(errors.toString()); } assertThat(errors.isEmpty()).isTrue(); @@ -428,15 +420,8 @@ public void testTraitProxy() { assertThat(proxy4).isEqualTo(proxy2); - } catch (InstantiationException e) { - e.printStackTrace(); - fail( e.getMessage() ); - } catch (IllegalAccessException e) { - e.printStackTrace(); - fail( e.getMessage() ); - } catch ( LogicalTypeInconsistencyException e ) { - e.printStackTrace(); - fail( e.getMessage() ); + } catch (InstantiationException | IllegalAccessException | LogicalTypeInconsistencyException e) { + fail( e.getMessage(), e ); } } @@ -543,14 +528,11 @@ public void testWrapperSize() { assertThat(proxy100.getFields().size()).isEqualTo(4); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } } - - @Test public void testWrapperEmpty() { String source = "org/drools/compiler/factmodel/traits/testTraitDon.drl"; @@ -624,14 +606,11 @@ public void testWrapperEmpty() { assertThat(wrapper2.isEmpty()).isFalse(); } catch (Exception e) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } } - - @Test public void testWrapperContainsKey() { String source = "org/drools/compiler/factmodel/traits/testTraitDon.drl"; @@ -748,13 +727,11 @@ public void testWrapperContainsKey() { assertThat(wrapper100.containsKey("surname")).isFalse(); } catch (Exception e) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } } - @Test public void testInternalComponents1( ) { String source = "org/drools/compiler/factmodel/traits/testTraitDon.drl"; @@ -807,11 +784,10 @@ public void testInternalComponents1( ) { StudentProxyImpl2 sp2 = new StudentProxyImpl2(new Imp2(), null ); - System.out.println( sp2.toString() ); + LOGGER.debug(sp2.toString()); } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } } @@ -905,14 +881,11 @@ public int compare( Object o1, Object o2 ) { assertThat(proxy.getFields().containsValue(-96)).isFalse(); } catch (Exception e) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } } - - @Test public void testWrapperClearAndRemove() { String source = "org/drools/compiler/factmodel/traits/testTraitDon.drl"; @@ -1010,16 +983,11 @@ public void testWrapperClearAndRemove() { assertThat(proxy.getFields().containsKey("surname")).isFalse(); } catch (Exception e) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } } - - - - @Test public void testIsAEvaluator( ) { String source = "package org.drools.compiler.trait.test;\n" + @@ -1086,8 +1054,7 @@ public void testIsAEvaluator( ) { info ); ks.fireAllRules(); - - System.out.println( info ); + LOGGER.debug(info.toString()); assertThat(info.contains("ok")).isTrue(); } @@ -1109,7 +1076,7 @@ public void testIsA() { int num = 10; - System.out.println( info ); + LOGGER.debug(info.toString()); assertThat(info.size()).isEqualTo(num); for (int j = 0; j < num; j++) { assertThat(info.contains("" + j)).isTrue(); @@ -1212,13 +1179,7 @@ public void testTraitLegacy() { ks.fireAllRules(); - System.err.println( " -------------- " + ks.getObjects().size() + " ---------------- " ); - for (Object o : ks.getObjects()) { - System.err.println( "\t\t" + o ); - } - System.err.println( " -------------- ---------------- " ); - System.err.println( info ); - System.err.println( " -------------- ---------------- " ); + printDebugInfoSessionObjects(ks.getObjects(), info); assertThat(info.size()).isEqualTo(5); assertThat(info.contains("OK")).isTrue(); @@ -1229,8 +1190,15 @@ public void testTraitLegacy() { } - - + private void printDebugInfoSessionObjects(final Collection facts, final List globalList) { + LOGGER.debug( " -------------- " + facts.size() + " ---------------- " ); + for (Object o : facts) { + LOGGER.debug( "\t\t" + o ); + } + LOGGER.debug( " -------------- ---------------- " ); + LOGGER.debug( globalList.toString() ); + LOGGER.debug( " -------------- ---------------- " ); + } @Test public void testTraitCollections() { @@ -1246,22 +1214,13 @@ public void testTraitCollections() { ks.fireAllRules(); - System.err.println( " -------------- " + ks.getObjects().size() + " ---------------- " ); - for (Object o : ks.getObjects()) { - System.err.println( "\t\t" + o ); - } - System.err.println( " -------------- ---------------- " ); - System.err.println( info ); - System.err.println( " -------------- ---------------- " ); + printDebugInfoSessionObjects(ks.getObjects(), info); assertThat(info.size()).isEqualTo(1); assertThat(info.contains("OK")).isTrue(); } - - - @Test public void testTraitCore() { String source = "org/drools/compiler/factmodel/traits/testTraitLegacyCore.drl"; @@ -1275,13 +1234,7 @@ public void testTraitCore() { ks.fireAllRules(); - System.err.println( " -------------- " + ks.getObjects().size() + " ---------------- " ); - for (Object o : ks.getObjects()) { - System.err.println( "\t\t" + o ); - } - System.err.println( " -------------- ---------------- " ); - System.err.println( info ); - System.err.println( " -------------- ---------------- " ); + printDebugInfoSessionObjects(ks.getObjects(), info); assertThat(info.contains("OK")).isTrue(); assertThat(info.contains("OK2")).isTrue(); @@ -1289,9 +1242,6 @@ public void testTraitCore() { } - - - @Test public void traitWithEquality() { String source = "org/drools/compiler/factmodel/traits/testTraitWithEquality.drl"; @@ -1310,8 +1260,6 @@ public void traitWithEquality() { } - - @Test public void traitDeclared() { @@ -1335,8 +1283,6 @@ public void traitDeclared() { assertThat(untrueTraits.contains(1)).isFalse(); } - - @Test public void traitPojo() { @@ -1360,9 +1306,6 @@ public void traitPojo() { assertThat(untrueTraits.contains(1)).isFalse(); } - - - @Test public void testIsAOperator() { String source = "org/drools/compiler/factmodel/traits/testTraitIsA2.drl"; @@ -1390,8 +1333,6 @@ public void testIsAOperator() { } - - @Test public void testManyTraits() { String source = "" + @@ -1411,7 +1352,6 @@ public void testManyTraits() { "when\n" + " $n : NiceMessage( $m : message )\n" + "then\n" + - " System.out.println( $m );\n" + "end" + "\n" + " rule load\n" + @@ -1452,7 +1392,6 @@ public void testManyTraits() { } - @Test public void traitManyTimes() { @@ -1464,7 +1403,7 @@ public void traitManyTimes() { ksession.fireAllRules(); for ( Object o : ksession.getObjects() ) { - System.err.println( o ); + LOGGER.debug(o.toString()); } Collection x = ksession.getObjects(); assertThat(ksession.getObjects().size()).isEqualTo(2); @@ -1475,12 +1414,8 @@ public void traitManyTimes() { assertThat(list.contains(2)).isTrue(); assertThat(list.contains(3)).isTrue(); assertThat(list.contains(4)).isTrue(); - - } - - // BZ #748752 @Test public void traitsInBatchExecution() { @@ -1511,7 +1446,6 @@ public void traitsInBatchExecution() { " student : Person( this isA Student )\n" + " then" + " list.add( 1 );\n" + - " System.out.println(\"Person is a student: \" + student);\n" + "end\n" + "\n" + "rule \"print school\"\n" + @@ -1519,7 +1453,6 @@ public void traitsInBatchExecution() { " Student( $school : school )\n" + " then\n" + " list.add( 2 );\n" + - " System.out.println(\"Student is attending \" + $school);\n" + "end"; KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); @@ -1543,21 +1476,16 @@ public void traitsInBatchExecution() { Person student = new Person("student", 18); commands.add( CommandFactory.newInsert( student )); - System.out.println("Starting execution..."); + LOGGER.debug("Starting execution..."); commands.add(CommandFactory.newFireAllRules()); ksession.execute(CommandFactory.newBatchExecution(commands)); - - System.out.println("Finished..."); + LOGGER.debug("Finished..."); assertThat(list.size()).isEqualTo(2); assertThat(list.contains(1)).isTrue(); assertThat(list.contains(2)).isTrue(); } - - - - @Test(timeout=10000) public void testManyTraitsStateless() { String source = "" + @@ -1577,7 +1505,6 @@ public void testManyTraitsStateless() { "when\n" + " $n : NiceMessage( $m : message )\n" + "then\n" + - " System.out.println( $m );\n" + "end" + "\n" + " rule load\n" + @@ -1657,7 +1584,6 @@ public void testAliasing() { " $student : Student( $school : school == \"UniBoh\", $f : fields, fields[ \"workPlace\" ] == \"UniBoh\" )\n" + " then \n " + " $student.setRank( 99 ); \n" + - " System.out.println( $student ); \n" + " $f.put( \"school\", \"Skool\" ); \n" + " list.add( $school );\n" + @@ -1861,10 +1787,7 @@ public void testTraitsLegacyWrapperCoherence() { " Mask m = don( $b, Mask.class ); \n" + " modify (m) { setXyz( 10 ); } \n" + " list.add( m ); \n" + - " System.out.println( \"Don result : \" + m ); \n " + - "end \n" + - "\n" + - ""; + "end \n"; KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newByteArrayResource( str.getBytes() ), @@ -1951,16 +1874,10 @@ public void testHasTypes() { } catch ( Exception e ) { - e.printStackTrace(); - fail( e.getMessage() ); + fail( e.getMessage(), e ); } } - - - - - @Test public void testTraitRedundancy() { String str = "package org.drools.traits.compiler.factmodel.traits; \n" + @@ -1975,7 +1892,6 @@ public void testTraitRedundancy() { "when \n" + " $s : IStudent() \n" + "then \n" + - " System.out.println( \"Student in \" + $s ); \n" + "end \n" + "" + "rule \"Don\" \n" + @@ -1983,7 +1899,6 @@ public void testTraitRedundancy() { "when \n" + " $p : IPerson( age < 30 ) \n" + "then \n" + - " System.out.println( \"Candidate student \" + $p ); \n" + " don( $p, IStudent.class );\n" + "end \n" + "" + @@ -1992,7 +1907,6 @@ public void testTraitRedundancy() { "when \n" + " $p : IPerson( this isA IStudent ) \n" + "then \n" + - " System.out.println( \"Known student \" + $p ); " + " modify ($p) { setAge( 37 ); } \n" + " shed( $p, IStudent.class );\n" + "end \n"; @@ -2021,12 +1935,11 @@ public void testTraitRedundancy() { assertThat(ksession.fireAllRules()).isEqualTo(3); for ( Object o : ksession.getObjects() ) { - System.err.println( o ); + LOGGER.debug(o.toString()); } } - @Test public void traitSimpleTypes() { @@ -2141,8 +2054,7 @@ public void testTraitEncoding() { kbase.addPackages( kbuilder.getKnowledgePackages() ); TraitRegistryImpl tr = (TraitRegistryImpl) ((TraitRuntimeComponentFactory) RuntimeComponentFactory.get()).getTraitRegistry(kbase); - System.out.println( tr.getHierarchy() ); - + LOGGER.debug( tr.getHierarchy().toString() ); Entity ent = new Entity( "x" ); KieSession ksession = kbase.newKieSession(); @@ -2154,7 +2066,7 @@ public void testTraitEncoding() { ksession.insert( "y" ); ksession.fireAllRules(); - System.out.println( ent.getMostSpecificTraits() ); + LOGGER.debug( ent.getMostSpecificTraits().toString() ); assertThat(ent.getMostSpecificTraits().size()).isEqualTo(2); } @@ -2244,15 +2156,9 @@ public void testTraitModifyCore() { "when " + " $p : Person( name == \"john\" ) " + "then " + - " System.out.println( $p ); " + - "" + - " System.out.println( \" ----------------------------------------------------------------------------------- Don student\" ); " + " don( $p, Student.class ); " + - " System.out.println( \" ----------------------------------------------------------------------------------- Don worker\" ); " + " don( $p, Worker.class ); " + - " System.out.println( \" ----------------------------------------------------------------------------------- Don studentworker\" ); " + " don( $p, StudentWorker.class ); " + - " System.out.println( \" ----------------------------------------------------------------------------------- Don assistant\" ); " + " don( $p, Assistant.class ); " + "end " + "" + @@ -2260,28 +2166,24 @@ public void testTraitModifyCore() { "when " + " $t : Student() @Watch( name ) " + "then " + - " System.out.println( \"Student >> \" + $t ); " + " list.add( $t.getName() ); " + "end " + "rule \"Log W\" " + "when " + " $t : Worker() @Watch( name ) " + "then " + - " System.out.println( \"Worker >> \" + $t ); " + " list.add( $t.getName() ); " + "end " + "rule \"Log SW\" " + "when " + " $t : StudentWorker() @Watch( name ) " + "then " + - " System.out.println( \"StudentWorker >> \" + $t ); " + " list.add( $t.getName() ); " + "end " + "rule \"Log RA\" " + "when " + " $t : Assistant() @Watch( name ) " + "then " + - " System.out.println( \"Assistant >> \" + $t ); " + " list.add( $t.getName() ); " + "end " + "" + @@ -2290,7 +2192,6 @@ public void testTraitModifyCore() { "when " + " $p : Person( name == \"john\" ) " + "then " + - " System.out.println( \"-----------------------------\" ); " + " modify ( $p ) { setName( \"alan\" ); } " + "end " + ""; @@ -2343,11 +2244,8 @@ public void testTraitModifyCore2() { "when " + " $p : Person( name == \"john\" ) " + "then " + - " System.out.println( \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DON WORKER \" + $p ); " + " don( $p, Worker.class ); " + - " System.out.println( \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DON STUDWORKER-2 \" + $p ); " + " don( $p, StudentWorker2.class ); " + - " System.out.println( \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DON ASSISTANT \" + $p ); " + " don( $p, Assistant.class ); " + "end " + "" + @@ -2355,32 +2253,27 @@ public void testTraitModifyCore2() { "when " + " $t : Student() @watch( name ) " + "then " + - " System.err.println( \"@@Student >> \" + $t ); " + "end " + "rule \"Log W\" " + "when " + " $t : Worker() @watch( name ) " + "then " + - " System.err.println( \"@@Worker >> \" + $t ); " + "end " + "rule \"Log SW\" " + "when " + " $t : StudentWorker() @watch( name ) " + "then " + - " System.err.println( \"@@StudentWorker >> \" + $t ); " + "end " + "rule \"Log RA\" " + "when " + " $t : Assistant() @watch( name ) " + "then " + - " System.err.println( \"@@Assistant >> \" + $t ); " + "end " + "rule \"Log Px\" " + "salience -1 " + "when " + " $p : Person() @watch( name ) " + "then " + - " System.err.println( \"Poor Core Person >> \" + $p ); " + "end " + "" + "rule \"Mod\" " + @@ -2389,10 +2282,8 @@ public void testTraitModifyCore2() { " String( this == \"go\" ) " + " $p : Student( name == \"john\" ) " + "then " + - " System.out.println( \" ------------------------------------------------------------------------------ \" + $p ); " + " modify ( $p ) { setName( \"alan\" ); } " + - "end " + - ""; + "end "; KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( new ByteArrayResource( s1.getBytes() ), ResourceType.DRL ); @@ -2440,9 +2331,7 @@ public void testTraitModifyCore2a() { "when \n" + " $p : Person( name == \"john\" ) \n" + "then \n" + - " System.out.println( \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DON WORKER \" + $p ); \n" + " don( $p, Worker.class ); \n" + - " System.out.println( \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DON STUDWORKER \" + $p ); \n" + " don( $p, StudentWorker.class ); \n" + "end \n" + "" + @@ -2450,16 +2339,14 @@ public void testTraitModifyCore2a() { "when \n" + " $t : Worker( this isA StudentWorker ) @watch( name ) \n" + "then \n" + - " System.out.println( \"@@Worker >> \" + $t ); \n" + " list.add( true ); \n" + "end \n" + "rule \"Log SW\" \n" + "when \n" + " $t : StudentWorker() @watch( name ) \n" + "then \n" + - " System.out.println( \"@@StudentWorker >> \" + $t ); \n" + - "end \n" + - ""; + "end \n"; + KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( new ByteArrayResource( s1.getBytes() ), ResourceType.DRL ); if ( kbuilder.hasErrors() ) { @@ -2534,22 +2421,22 @@ public void testTraitModifyCore3() { "\n" + "\n" + "\n" + - "rule \"Log A\" when $x : A( id == 1 ) then System.out.println( \"A >> \" + $x ); list.add( 1 ); end \n" + - "rule \"Log B\" when $x : B( id == 1 ) then System.out.println( \"B >> \" + $x ); list.add( 2 ); end \n" + - "rule \"Log C\" when $x : C( id == 1 ) then System.out.println( \"C >> \" + $x ); list.add( 3 ); end \n" + - "rule \"Log D\" when $x : D( id == 1 ) then System.out.println( \"D >> \" + $x ); list.add( 4 ); end \n" + - "rule \"Log E\" when $x : E( id == 1 ) then System.out.println( \"E >> \" + $x ); list.add( 5 ); end \n" + - "rule \"Log F\" when $x : F( id == 1 ) then System.out.println( \"F >> \" + $x ); list.add( 6 ); end \n" + - "rule \"Log G\" when $x : G( id == 1 ) then System.out.println( \"G >> \" + $x ); list.add( 7 ); end \n" + - "rule \"Log H\" when $x : H( id == 1 ) then System.out.println( \"H >> \" + $x ); list.add( 8 ); end \n" + - "rule \"Log I\" when $x : I( id == 1 ) then System.out.println( \"I >> \" + $x ); list.add( 9 ); end \n" + - "rule \"Log J\" when $x : J( id == 1 ) then System.out.println( \"J >> \" + $x ); list.add( 10 ); end \n" + - "rule \"Log K\" when $x : K( id == 1 ) then System.out.println( \"K >> \" + $x ); list.add( 11 ); end \n" + - "rule \"Log L\" when $x : L( id == 1 ) then System.out.println( \"L >> \" + $x ); list.add( 12 ); end \n" + - "rule \"Log M\" when $x : M( id == 1 ) then System.out.println( \"M >> \" + $x ); list.add( 13 ); end \n" + - "rule \"Log N\" when $x : N( id == 1 ) then System.out.println( \"N >> \" + $x ); list.add( 14 ); end \n" + + "rule \"Log A\" when $x : A( id == 1 ) then list.add( 1 ); end \n" + + "rule \"Log B\" when $x : B( id == 1 ) then list.add( 2 ); end \n" + + "rule \"Log C\" when $x : C( id == 1 ) then list.add( 3 ); end \n" + + "rule \"Log D\" when $x : D( id == 1 ) then list.add( 4 ); end \n" + + "rule \"Log E\" when $x : E( id == 1 ) then list.add( 5 ); end \n" + + "rule \"Log F\" when $x : F( id == 1 ) then list.add( 6 ); end \n" + + "rule \"Log G\" when $x : G( id == 1 ) then list.add( 7 ); end \n" + + "rule \"Log H\" when $x : H( id == 1 ) then list.add( 8 ); end \n" + + "rule \"Log I\" when $x : I( id == 1 ) then list.add( 9 ); end \n" + + "rule \"Log J\" when $x : J( id == 1 ) then list.add( 10 ); end \n" + + "rule \"Log K\" when $x : K( id == 1 ) then list.add( 11 ); end \n" + + "rule \"Log L\" when $x : L( id == 1 ) then list.add( 12 ); end \n" + + "rule \"Log M\" when $x : M( id == 1 ) then list.add( 13 ); end \n" + + "rule \"Log N\" when $x : N( id == 1 ) then list.add( 14 ); end \n" + "" + - "rule \"Log Core\" when $x : Core( $id : id ) then System.out.println( \"Core >>>>>> \" + $x ); end \n" + + "rule \"Log Core\" when $x : Core( $id : id ) then end \n" + "" + "rule \"Mod\" \n" + "salience -10 \n" + @@ -2557,7 +2444,6 @@ public void testTraitModifyCore3() { " String( this == \"go\" ) \n" + " $x : Core( id == 0 ) \n" + "then \n" + - " System.out.println( \" ------------------------------------------------------------------------------ \" ); \n" + " modify ( $x ) { setId( 1 ); }" + "end \n" + ""; @@ -2636,7 +2522,6 @@ public void testTraitModifyCoreWithPropertyReactivity() { "when \n" + " $p : Person( name == \"john\" ) \n" + "then \n" + - " System.out.println( $p ); \n" + " don( $p, StudentWorker.class ); \n" + " don( $p, Assistant.class ); \n" + "end \n" + @@ -2646,28 +2531,24 @@ public void testTraitModifyCoreWithPropertyReactivity() { " $t : Student( age == 44 ) \n" + "then \n" + " list.add( 1 );\n " + - " System.out.println( \"Student >> \" + $t ); \n" + "end \n" + "rule \"Log W\" \n" + "when \n" + " $t : Worker( name == \"alan\" ) \n" + "then \n" + " list.add( 2 );\n " + - " System.out.println( \"Worker >> \" + $t ); \n" + "end \n" + "rule \"Log SW\" \n" + "when \n" + " $t : StudentWorker( age == 44 ) \n" + "then \n" + " list.add( 3 );\n " + - " System.out.println( \"StudentWorker >> \" + $t ); \n" + "end \n" + "rule \"Log Pers\" \n" + "when \n" + " $t : Person( age == 44 ) \n" + "then \n" + " list.add( 4 );\n " + - " System.out.println( \"Person >> \" + $t ); \n" + "end \n" + "" + "rule \"Mod\" \n" + @@ -2676,10 +2557,8 @@ public void testTraitModifyCoreWithPropertyReactivity() { " String( this == \"go\" ) \n" + " $p : Student( name == \"john\" ) \n" + "then \n" + - " System.out.println( \" ------------------------------------------------------------------------------ \" + $p ); \n" + " modify ( $p ) { setSchool( \"myschool\" ), setAge( 44 ), setName( \"alan\" ); } " + - "end \n" + - ""; + "end \n"; KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( new ByteArrayResource( s1.getBytes() ), ResourceType.DRL ); @@ -2867,7 +2746,6 @@ public void testShedWithTMS( ) { " $t : org.drools.base.factmodel.traits.Thing( $c : core, _isTop(), this not isA t.x.E.class, this isA t.x.D.class ) " + "then\n" + " list.add( \"E\" ); \n" + - " System.out.println( \"E due to \" + $t); \n" + " don( $t, E.class ); \n" + "end\n" + "" + @@ -2894,7 +2772,7 @@ public void testShedWithTMS( ) { ks.setGlobal( "list", list ); ks.fireAllRules(); - System.out.println( list ); + LOGGER.debug( list.toString() ); assertThat(list.size()).isEqualTo(2); assertThat(list.contains("E")).isTrue(); assertThat(list.contains("X")).isTrue(); @@ -2903,7 +2781,7 @@ public void testShedWithTMS( ) { ks.fireAllRules(); for ( Object o : ks.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } assertThat(ks.getObjects().size()).isEqualTo(3); @@ -2955,7 +2833,6 @@ public void testTraitInitialization() { " list.add( $m ); \n" + " list.add( $i ); \n" + " list.add( $d ); \n" + - " System.out.println( $x ); \n" + "end\n" + "" ; @@ -3016,12 +2893,10 @@ public void testUnTraitedBean() { "rule Check when\n" + " $x : Bar( this not isA Foo ) \n" + "then \n" + - " System.out.println( $x ); \n" + "end\n" + "rule Check2 when\n" + " $x : Bar2( this not isA Foo ) \n" + "then \n" + - " System.out.println( $x ); \n" + "end\n" + ""; @@ -3121,22 +2996,11 @@ public void testTypeRefractionOnInsert( ) { "rule Init when\n" + "then\n" + " Kore k = new Kore();\n" + - " System.out.println( \"-----------------------------------------------------------------------\" ); \n " + " don( k, B.class ); \n" + - - " System.out.println( \"-----------------------------------------------------------------------\" ); \n " + " don( k, C.class ); \n" + - - " System.out.println( \"-----------------------------------------------------------------------\" ); \n " + " don( k, D.class ); \n" + - - " System.out.println( \"-----------------------------------------------------------------------\" ); \n " + " don( k, E.class ); \n" + - - " System.out.println( \"-----------------------------------------------------------------------\" ); \n " + " don( k, A.class ); \n" + - - " System.out.println( \"-----------------------------------------------------------------------\" ); \n " + " don( k, F.class ); \n" + "end\n" + "" + @@ -3144,7 +3008,6 @@ public void testTypeRefractionOnInsert( ) { " $x : A( ) \n" + "then \n" + " list.add( $x ); \n" + - " System.out.println( \" A by \" + $x ); \n" + "end\n" + ""; @@ -3243,7 +3106,6 @@ public void testTypeRefractionOnQuery2( ) { "when \n" + " $x : A( ) \n" + "then \n" + - " System.out.println( $x ); \n " + "end\n" + " \n" + "query queryA1\n" + @@ -3322,7 +3184,7 @@ public void testNodePartitioningByProxies( ) { ks.setGlobal( "list", list ); ks.fireAllRules(); - System.out.println( list ); + LOGGER.debug( list.toString() ); assertThat(list).isEqualTo(Arrays.asList('A', 'B', 'C', 'D', 'E', 'F', 'G', 'Z')); @@ -3391,7 +3253,7 @@ public void testNodePartitioningByProxiesAfterShed( ) { ks.setGlobal( "list", list ); ks.fireAllRules(); - System.out.println( list ); + LOGGER.debug( list.toString() ); assertThat(list).isEqualTo(Arrays.asList('A', 'D', 'G', 'Z')); @@ -3493,7 +3355,6 @@ public void testCoreUpdate4( ) { "when\n" + " $x : Kore() \n" + "then \n" + - " System.out.println( \"Donning\" ); \n" + " don( $x, A.class ); \n" + "end\n" + "rule React \n" + @@ -3501,7 +3362,6 @@ public void testCoreUpdate4( ) { "when\n" + " $x : Kore( this isA A.class ) \n" + "then \n" + - " System.out.println( \"XXXXXXXXXXXXXXXXXXXXXX \" + $x ); \n" + " list.add( $x ); \n" + "end\n" + ""; @@ -3513,7 +3373,7 @@ public void testCoreUpdate4( ) { ks.fireAllRules(); for ( Object o : ks.getObjects() ) { - System.err.println( o ); + LOGGER.debug( o.toString() ); } assertThat(list.size()).isEqualTo(1); } @@ -3595,9 +3455,9 @@ public void traitLogicalSupportAnddelete() { ksession.fireAllRules(); for ( Object o : ksession.getObjects() ) { - System.err.println( o ); + LOGGER.debug( o.toString() ); } - System.err.println( "---------------------------------" ); + LOGGER.debug( "---------------------------------" ); assertThat(ksession.getObjects().size()).isEqualTo(4); @@ -3605,9 +3465,9 @@ public void traitLogicalSupportAnddelete() { ksession.fireAllRules(); for ( Object o : ksession.getObjects() ) { - System.err.println( o ); + LOGGER.debug( o.toString() ); } - System.err.println( "---------------------------------" ); + LOGGER.debug( "---------------------------------" ); assertThat(ksession.getObjects().size()).isEqualTo(3); @@ -3615,9 +3475,9 @@ public void traitLogicalSupportAnddelete() { ksession.fireAllRules(); for ( Object o : ksession.getObjects() ) { - System.err.println( o ); + LOGGER.debug( o.toString() ); } - System.err.println( "---------------------------------" ); + LOGGER.debug( "---------------------------------" ); assertThat(ksession.getObjects().size()).isEqualTo(1); @@ -3625,9 +3485,9 @@ public void traitLogicalSupportAnddelete() { ksession.fireAllRules(); for ( Object o : ksession.getObjects() ) { - System.err.println( o ); + LOGGER.debug( o.toString()); } - System.err.println( "---------------------------------" ); + LOGGER.debug( "---------------------------------" ); assertThat(ksession.getObjects().size()).isEqualTo(1); @@ -3635,9 +3495,9 @@ public void traitLogicalSupportAnddelete() { ksession.fireAllRules(); for ( Object o : ksession.getObjects() ) { - System.err.println( o ); + LOGGER.debug( o.toString() ); } - System.err.println( "---------------------------------" ); + LOGGER.debug( "---------------------------------" ); assertThat(ksession.getObjects().size()).isEqualTo(3); @@ -3645,15 +3505,13 @@ public void traitLogicalSupportAnddelete() { ksession.fireAllRules(); for ( Object o : ksession.getObjects() ) { - System.err.println( o ); + LOGGER.debug( o.toString() ); } - System.err.println( "---------------------------------" ); + LOGGER.debug( "---------------------------------" ); assertThat(ksession.getObjects().size()).isEqualTo(1); } - - @Test public void testShedThing() { String s1 = "package test;\n" + @@ -3718,7 +3576,7 @@ public void testShedThing() { ksession.fireAllRules(); for ( Object o : ksession.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } assertThat(ksession.getObjects().size()).isEqualTo(1); @@ -3789,7 +3647,7 @@ public void testdeleteThings() { ksession.fireAllRules(); for ( Object o : ksession.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } assertThat(ksession.getObjects().size()).isEqualTo(0); @@ -3847,7 +3705,7 @@ public void traitLogicalRemovalSimple( ) { for ( Object o : ksession.getObjects() ) { // lose the string and the Student proxy - System.out.println( o ); + LOGGER.debug( o.toString() ); } assertThat(ksession.getObjects().size()).isEqualTo(3); @@ -3911,7 +3769,7 @@ public void testTraitDonLegacyClassWithoutEmptyConstructor( ) { ksession.fireAllRules(); for ( Object o : ksession.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } assertThat(ksession.getObjects().size()).isEqualTo(2); @@ -3952,7 +3810,6 @@ public void testdeleteCoreObjectChained( ) { "when\n" + " $x : Kore() \n" + "then \n" + - " System.out.println( \"Donning\" ); \n" + " don( $x, A.class ); \n" + "end\n" + "" + @@ -3962,7 +3819,6 @@ public void testdeleteCoreObjectChained( ) { "when \n" + " $x : String() \n" + "then \n" + - " System.out.println( \"deleteing\" ); \n" + " delete( $x ); \n" + "end \n" + "\n"; @@ -3978,7 +3834,7 @@ public void testdeleteCoreObjectChained( ) { ks.fireAllRules(); for ( Object o : ks.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } assertThat(ks.getObjects().size()).isEqualTo(0); @@ -4007,7 +3863,6 @@ public void testUpdateLegacyClass( ) { "when\n" + " $p : Person( this not isA Student )\n" + "then\n" + - " System.out.println( \"Don person\" ); \n" + " don( $p, Student.class );\n" + "end\n" + "\n" + @@ -4016,7 +3871,6 @@ public void testUpdateLegacyClass( ) { " $s : String( this == \"X\" )\n" + " $p : Person()\n" + "then\n" + - " System.out.println( \"Change name\" ); \n" + " delete( $s ); \n" + " modify( $p ) { setName( $s ); }\n" + "end\n" + @@ -4025,7 +3879,6 @@ public void testUpdateLegacyClass( ) { "when\n" + " Student( name == \"X\" )\n" + "then\n" + - " System.out.println( \"Update detected\" );\n" + " list.add( 0 );\n" + "end"; @@ -4086,8 +3939,6 @@ public void testSoftPropertyClash() { "when\n" + " $p : Person() \n" + "then\n" + - " System.out.println( \"Don person\" ); \n" - + " Student $s = (Student) don( $p, Student.class );\n" + " modify ( $s ) { setId( \"xyz\" ); } " + " " + @@ -4099,7 +3950,6 @@ public void testSoftPropertyClash() { "when\n" + " $s : Student( $sid : id == \"xyz\", $f2 : fld2, $f3 : fld3, $f4 : fld4, $f5 : fldZ )\n" + "then\n" + - " System.out.println( \">>>>>>>>>> Student\" + $s ); \n" + " list.add( $sid ); \n" + " list.add( $f2 ); \n" + " list.add( $f3 ); \n" + @@ -4111,7 +3961,6 @@ public void testSoftPropertyClash() { "when\n" + " $w : Worker( $wid : id == 99, $f2 : fld2, $f3 : fld3, $f4 : fld4, $f5 : fldY )\n" + "then\n" + - " System.out.println( \">>>>>>>>>> Worker\" + $w );\n" + " list.add( $wid ); \n" + " list.add( $f2 ); \n" + " list.add( $f3 ); \n" + @@ -4275,11 +4124,11 @@ public void testPropagation() { for ( int j = 'A'; j <= 'J'; j ++ ) { String x = "" + (char) j; - drl += "rule \"Log " + x + "\" when " + x + "() then System.out.println( \"@@ " + x + " detected \" ); list.add( \"" + x + "\" ); end \n"; + drl += "rule \"Log " + x + "\" when " + x + "() then list.add( \"" + x + "\" ); end \n"; drl += "rule \"Log II" + x + "\" salience -1 when " + x + "( "; drl += "this isA H"; - drl += " ) then System.out.println( \"@@ as H >> " + x + " detected \" ); list.add( \"H" + x + "\" ); end \n"; + drl += " ) then list.add( \"H" + x + "\" ); end \n"; } KieSession ks = new KieHelper().addContent( drl, ResourceType.DRL ).build().newKieSession(); @@ -4299,7 +4148,7 @@ public void testPropagation() { list.clear(); - System.out.println( "---------------------------------------" ); + LOGGER.debug( "---------------------------------------" ); ks.insert( "go" ); ks.fireAllRules(); @@ -4313,11 +4162,11 @@ public void testPropagation() { assertThat(list.contains("HF")).isTrue(); assertThat(list.contains("HG")).isTrue(); assertThat(list.contains("HH")).isTrue(); - System.out.println( list ); + LOGGER.debug( list.toString() ); assertThat(list.size()).isEqualTo(9); list.clear(); - System.out.println( "---------------------------------------" ); + LOGGER.debug( "---------------------------------------" ); ks.insert( "go2" ); ks.fireAllRules(); @@ -4338,8 +4187,6 @@ public void testPropagation() { } - - @Test public void testParentBlockers() { String drl = "package org.drools.test;\n" + @@ -4355,9 +4202,7 @@ public void testParentBlockers() { "" + "rule Init when then X x = new X(); insert( x ); don( x, A.class); don( x, B.class); end \n"+ "rule Go when String( this == \"go\" ) $x : X() then don( $x, C.class); end \n" + - "rule Go2 when String( this == \"go2\" ) $x : C() then System.out.println( 1000 ); end \n" + - ""; - + "rule Go2 when String( this == \"go2\" ) $x : C() then end \n"; KieSession ks = getSessionFromString( drl ); TraitFactoryImpl.setMode(mode, ks.getKieBase() ); @@ -4373,15 +4218,12 @@ public void testParentBlockers() { ks.insert( "go2" ); ks.fireAllRules(); - System.out.println( "---------------------------------------" ); + LOGGER.debug( "---------------------------------------" ); ks.dispose(); } - - - @Test public void testTraitLogicalTMS() { String drl = "package org.drools.test;\n" + @@ -4417,10 +4259,10 @@ public void testTraitLogicalTMS() { ks.delete( handle ); ks.fireAllRules(); - System.out.println( "---------------------------------------" ); + LOGGER.debug( "---------------------------------------" ); for ( Object o : ks.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } ks.insert( "go3" ); @@ -4536,7 +4378,7 @@ public void objectDeleted( org.kie.api.event.rule.ObjectDeletedEvent objectRetra ksession.delete( handle ); ksession.fireAllRules(); - System.out.println( list ); + LOGGER.debug( list.toString() ); assertThat(list).isEqualTo(Arrays.asList("B", "C", "A")); } @@ -4660,7 +4502,6 @@ public void testDonManyTraitsAtOnce() { " $t : TBean() \n" + "then \n" + " list.add( 0 ); \n" + - " System.out.println( \"Call DON MANY \" ); " + " don( $t, Arrays.asList( C.class, D.class, E.class, F.class ), true ); \n" + "end \n" + "" + @@ -4678,21 +4519,18 @@ public void testDonManyTraitsAtOnce() { " B( this isA C ) \n" + "then \n" + " list.add( 1 ); \n" + - " System.err.println( \"C is HERE !! \" ); " + "end \n" + "rule D \n" + "when\n" + " D( this isA A, this isA C ) \n" + "then \n" + " list.add( 2 ); \n" + - " System.err.println( \"D is HERE TOO !! \" ); " + "end \n"+ "rule E \n" + "when\n" + " D( this isA A, this isA E ) \n" + "then \n" + " list.add( 3 ); \n" + - " System.err.println( \"AND E JOINS THE COMPANY !! \" ); " + "end \n"; KieSession ksession = loadKnowledgeBaseFromString(drl).newKieSession(); @@ -4733,7 +4571,7 @@ public void testDonManyTraitsAtOnce() { cwm.reset(); for ( Object o : ksession.getObjects() ) { - System.out.println( o ); + LOGGER.debug( o.toString() ); } ksession.insert( "undo" ); @@ -4780,10 +4618,7 @@ public void testDonManyTraitsAtOnce2() { " A(this isA B) \n" + "then \n" + " list.add( 0 ); \n" + - " System.out.println( \"Call DON MANY (A isA B) \" ); " + - "end \n" + - "" + - "" ; + "end \n"; KieSession ksession = loadKnowledgeBaseFromString(drl).newKieSession(); TraitFactoryImpl.setMode(mode, ksession.getKieBase() ); @@ -4923,10 +4758,8 @@ public void testShedOneLastTrait() throws InterruptedException { "when \n" + " $t : Thing() \n" + "then \n" + - " System.out.println( \"Thing detected \" + $t ); \n" + " list.add( $t.getClass().getName() ); \n" + - "end \n" + - ""; + "end \n"; KieBase kbase = getKieBaseFromString(s1); TraitFactoryImpl.setMode(mode, kbase ); @@ -5000,10 +4833,8 @@ public void testShedThingCompletelyThenDonAgain() throws InterruptedException { "when \n" + " $t : Thing() \n" + "then \n" + - " System.out.println( \"Thing detected \" + $t ); \n" + " list.add( $t.getClass().getName() ); \n" + - "end \n" + - ""; + "end \n"; KieBase kbase = getKieBaseFromString(s1); TraitFactoryImpl.setMode(mode, kbase ); @@ -5027,7 +4858,7 @@ public void testShedThingCompletelyThenDonAgain() throws InterruptedException { knowledgeSession.insert( "don2" ); knowledgeSession.fireAllRules(); - System.out.println( list ); + LOGGER.debug( list.toString() ); assertThat(list.size()).isEqualTo(2); assertThat(list).isEqualTo(Arrays.asList("test.Mask.test.Core_Proxy", "test.Mask2.test.Core_Proxy")); @@ -5297,7 +5128,7 @@ public void testHierarchyEncodeOnPackageMerge() { KnowledgeBuilder kb2 = KnowledgeBuilderFactory.newKnowledgeBuilder(); kb2.add( new ByteArrayResource( drl1.getBytes() ), ResourceType.DRL ); - System.out.print( kb2.getErrors() ); + LOGGER.debug( kb2.getErrors().toString() ); assertThat(kb2.hasErrors()).isFalse(); knowledgeBase.addPackages( kb2.getKnowledgePackages() ); @@ -5334,7 +5165,6 @@ public void testDonThenReinsert() throws InterruptedException { " when\n" + " $e : TBean( ) " + " then " + - " System.out.println( 'Don' ); " + " don( $e, Mask.class );\n" + "end\n" + "" + @@ -5342,10 +5172,9 @@ public void testDonThenReinsert() throws InterruptedException { " when \n" + " $m : Mask() \n" + "then \n" + - " System.out.println( $m ); \n" + "end\n" + "" + - "rule Zero when not Object() then System.out.println( 'Clean' ); end "; + "rule Zero when not Object() then end "; KieBase kbase = getKieBaseFromString(s1, EqualityBehaviorOption.IDENTITY); @@ -5458,15 +5287,12 @@ public void testDonModify() { " IPerson x = don( $core, IPerson.class, true );\n" + " IStudent s = don( $core, IStudent.class, true );\n" + " Person p = don( $core, Person.class, true );\n" + - " System.err.println( \" Done donning \" );\n " + "end\n" + "rule R2 when\n" + " $p: IPerson( name == null )\n" + "then\n" + - " System.out.println(\"IPerson: \" + $p);\n" + - "end\n" + - "\n"; + "end\n"; KieBase kbase = getKieBaseFromString( drl ); TraitFactoryImpl.setMode(mode, kbase ); @@ -5579,7 +5405,6 @@ public void testTupleIntegrityOnModification() { " $core: Entity( ) " + "then " + " A o = don( $core, A.class ); " + - " System.out.println( 'Found ! ' + o ); " + "end " + "rule Test when " + @@ -5640,7 +5465,6 @@ public void testShedVacancy() { "rule Mood when " + " $x : B() " + "then " + - " System.out.println( 'Found B' ); " + "end " + "rule Shed when " + @@ -5667,7 +5491,7 @@ public void testShedVacancy() { int n = ksession.fireAllRules(); assertThat(n).isEqualTo(2); - System.err.print( "---------------------------------------------------------------\n\n\n " ); + LOGGER.debug( "---------------------------------------------------------------\n\n\n " ); int counter = 0; for ( Object o : ksession.getObjects() ) { @@ -5683,7 +5507,7 @@ public void testShedVacancy() { } } else if ( o instanceof TraitableBean ) { TraitableBean tb = (TraitableBean) o; - System.out.println( tb.getCurrentTypeCode() ); + LOGGER.debug( tb.getCurrentTypeCode().toString() ); counter++; } } @@ -5693,7 +5517,7 @@ public void testShedVacancy() { ksession.insert( "go" ); ksession.fireAllRules(); - System.err.print( "---------------------------------------------------------------\n\n\n " ); + LOGGER.debug( "---------------------------------------------------------------\n\n\n " ); int counter2 = 0; for ( Object o : ksession.getObjects() ) { @@ -5936,6 +5760,9 @@ public interface Scholar { } public static class ScholarImpl implements Scholar { + + private static final Logger LOGGER = LoggerFactory.getLogger(ScholarImpl.class); + private Thing core; public ScholarImpl() { } @@ -5945,7 +5772,7 @@ public ScholarImpl( Thing arg ) { } public void learn( String subject ) { - System.out.println( "I " + core.getFields().get( "name" ) + ", now know everything about " + subject ); + LOGGER.debug( "I " + core.getFields().get( "name" ) + ", now know everything about " + subject ); } } @@ -6031,7 +5858,7 @@ private void checkMixinResolutionUsesOrder(String interfaces, String first) { ks.fireAllRules(); - System.out.println(list); + LOGGER.debug(list.toString()); assertThat(list.get(0)).isEqualTo("Y"); assertThat(list.get(1)).isEqualTo("Z"); assertThat(list.get(2)).isEqualTo(first); @@ -6118,7 +5945,6 @@ public void testPreserveAllSetBitMask() { " MyThing( $x_0 := core, this isA D.class, $p : this#RootThing.objProp ) " + " exists MyThing( $x_1 := core , core memberOf $p, this isA F.class ) " + "then " + - " System.out.println( \"Recognized \" + $x_0 + \" as an instance of E by rule \" + drools.getRule().getName() ); " + " don( $x_0, E.class, true ); " + "end " + "" + @@ -6128,7 +5954,6 @@ public void testPreserveAllSetBitMask() { " $y : F( $z : core memberOf $objs ) " + "then " + " retract( $s ); " + - " System.out.println( \"SUCCESS : E has been recognized, removing Y \" ); " + " modify ( $x ) { getObjProp().remove( $z ); } " + " modify ( $y ) {} " + "end "; diff --git a/drools-traits/src/test/java/org/drools/traits/compiler/integrationtests/TraitTypeGenerationTest.java b/drools-traits/src/test/java/org/drools/traits/compiler/integrationtests/TraitTypeGenerationTest.java index 086d3b86fb5..b4f647b526c 100644 --- a/drools-traits/src/test/java/org/drools/traits/compiler/integrationtests/TraitTypeGenerationTest.java +++ b/drools-traits/src/test/java/org/drools/traits/compiler/integrationtests/TraitTypeGenerationTest.java @@ -43,11 +43,15 @@ import org.kie.internal.builder.KnowledgeBuilder; import org.kie.internal.builder.KnowledgeBuilderFactory; import org.kie.internal.utils.KieHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.assertj.core.api.Assertions.assertThat; public class TraitTypeGenerationTest extends CommonTraitTest { + private static final Logger LOGGER = LoggerFactory.getLogger(TraitTypeGenerationTest.class); + @PropertyReactive @Traitable public static class Bean { @@ -292,7 +296,6 @@ public void testNeeds() { "when " + " $g : Goal( $m : entity, $prop : property, $val : value ) " + "then " + - " System.out.println( 'Satisfy ' + $g ); \n" + " modify ( $m ) { getFields().put( $prop, $val ); } \n" + "end " + @@ -303,7 +306,6 @@ public void testNeeds() { "rule Main\n" + "when \n" + "then \n" + - " System.out.println( 'Don MONKEY ' ); " + " Entity e = new Entity(); \n" + " Monkey monkey = don( e, Monkey.class );" + "end \n" + @@ -313,7 +315,6 @@ public void testNeeds() { " $m : Monkey( $pos : position ) " + " ?check( $m, \"position\", 4 ; ) " + "then " + - " System.out.println( 'Monkey madness' + $m ); " + " list.add( $m.getPosition() ); " + "end " + @@ -328,7 +329,7 @@ public void testNeeds() { session.fireAllRules(); for ( Object o : session.getObjects() ) { - System.out.println( ">>> " + o ); + LOGGER.debug( ">>> " + o ); } assertThat(list).isEqualTo(List.of(4)); @@ -372,7 +373,7 @@ public void testMultipleInheritanceWithPosition1() throws Exception { KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kBuilder.add(new ByteArrayResource(drl.getBytes()), ResourceType.DRL); if (kBuilder.hasErrors()) { - System.err.println(kBuilder.getErrors()); + LOGGER.error(kBuilder.getErrors().toString()); } assertThat(kBuilder.hasErrors()).isFalse(); @@ -408,7 +409,7 @@ public void testMultipleInheritanceWithPosition2() throws Exception { KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kBuilder.add(new ByteArrayResource(drl.getBytes()), ResourceType.DRL); if (kBuilder.hasErrors()) { - System.err.println(kBuilder.getErrors()); + LOGGER.error(kBuilder.getErrors().toString()); } assertThat(kBuilder.hasErrors()).isFalse(); @@ -444,7 +445,7 @@ public void testMultipleInheritanceWithPosition3() throws Exception { KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kBuilder.add(new ByteArrayResource(drl.getBytes()), ResourceType.DRL); if (kBuilder.hasErrors()) { - System.err.println(kBuilder.getErrors()); + LOGGER.error(kBuilder.getErrors().toString()); } assertThat(kBuilder.hasErrors()).isFalse(); @@ -480,7 +481,7 @@ public void testMultipleInheritanceWithPosition4() throws Exception { KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kBuilder.add(new ByteArrayResource(drl.getBytes()), ResourceType.DRL); if (kBuilder.hasErrors()) { - System.err.println(kBuilder.getErrors()); + LOGGER.error(kBuilder.getErrors().toString()); } assertThat(kBuilder.hasErrors()).isFalse(); @@ -516,7 +517,7 @@ public void testMultipleInheritanceWithPosition5() throws Exception { KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kBuilder.add(new ByteArrayResource(drl.getBytes()), ResourceType.DRL); if (kBuilder.hasErrors()) { - System.err.println(kBuilder.getErrors()); + LOGGER.error(kBuilder.getErrors().toString()); } assertThat(kBuilder.hasErrors()).isFalse(); @@ -558,7 +559,7 @@ public void testMultipleInheritanceWithPosition6() throws Exception { KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kBuilder.add(new ByteArrayResource(drl.getBytes()), ResourceType.DRL); if (kBuilder.hasErrors()) { - System.err.println(kBuilder.getErrors()); + LOGGER.error(kBuilder.getErrors().toString()); } assertThat(kBuilder.hasErrors()).isFalse(); @@ -601,7 +602,7 @@ public void testMultipleInheritanceWithPosition7() throws Exception { KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kBuilder.add(new ByteArrayResource(drl.getBytes()), ResourceType.DRL); if (kBuilder.hasErrors()) { - System.err.println(kBuilder.getErrors()); + LOGGER.error(kBuilder.getErrors().toString()); } assertThat(kBuilder.hasErrors()).isFalse(); diff --git a/drools-traits/src/test/java/org/drools/traits/core/factmodel/InstancesHashcodedTest.java b/drools-traits/src/test/java/org/drools/traits/core/factmodel/InstancesHashcodedTest.java index f8ec51d3295..7e04e9e46a4 100755 --- a/drools-traits/src/test/java/org/drools/traits/core/factmodel/InstancesHashcodedTest.java +++ b/drools-traits/src/test/java/org/drools/traits/core/factmodel/InstancesHashcodedTest.java @@ -101,14 +101,6 @@ public void testInstanceHashcodes() { Object o2 = klass.newInstance(); cd.getField("cutDate").getFieldAccessor().setValue(o2, cut); cd.getField("dueDate").getFieldAccessor().setValue(o2, d2); - -// System.out.println(o1); -// System.out.println(o1.hashCode()); -// System.out.println(o2); -// System.out.println(o2.hashCode()); -// -// System.out.println(o1.equals(o2)); - } catch (Exception e) { // e.printStackTrace(); } diff --git a/drools-traits/src/test/java/org/drools/traits/core/factmodel/JeneratorTest.java b/drools-traits/src/test/java/org/drools/traits/core/factmodel/JeneratorTest.java index ce55ff44ffb..fd656cfb569 100644 --- a/drools-traits/src/test/java/org/drools/traits/core/factmodel/JeneratorTest.java +++ b/drools-traits/src/test/java/org/drools/traits/core/factmodel/JeneratorTest.java @@ -23,6 +23,8 @@ import java.util.jar.JarInputStream; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.assertj.core.api.Assertions.assertThat; @@ -32,6 +34,7 @@ */ public class JeneratorTest { + private static final Logger LOGGER = LoggerFactory.getLogger(JeneratorTest.class); @Test public void testRoundTrip() throws Exception { @@ -62,25 +65,21 @@ public void testRoundTrip() throws Exception { JarEntry je = jis.getNextJarEntry(); assertThat(je).isNotNull(); - System.err.println(je.getName()); + LOGGER.debug(je.getName()); assertThat(je.getName()).isEqualTo("factmodel.xml"); - je = jis.getNextJarEntry(); assertThat(je).isNotNull(); - System.err.println(je.getName()); + LOGGER.debug(je.getName()); assertThat(je.getName()).isEqualTo("whee/waa/Foobar.class"); - je = jis.getNextJarEntry(); assertThat(je).isNotNull(); - System.err.println(je.getName()); + LOGGER.debug(je.getName()); assertThat(je.getName()).isEqualTo("whee/waa/Baz.class"); - - Fact[] facts = jen.loadMetaModel(new JarInputStream(new ByteArrayInputStream(data))); assertThat(facts.length).isEqualTo(2); assertThat(facts[0].name).isEqualTo("Foobar"); diff --git a/drools-traits/src/test/java/org/drools/traits/core/meta/org/MetadataTest.java b/drools-traits/src/test/java/org/drools/traits/core/meta/org/MetadataTest.java index c613b3083a9..6a40cc460c5 100644 --- a/drools-traits/src/test/java/org/drools/traits/core/meta/org/MetadataTest.java +++ b/drools-traits/src/test/java/org/drools/traits/core/meta/org/MetadataTest.java @@ -41,12 +41,15 @@ import org.drools.traits.core.metadata.MetadataContainer; import org.drools.traits.core.metadata.With; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.drools.traits.compiler.factmodel.traits.TraitTestUtils.createStandaloneTraitFactory; import static org.assertj.core.api.Assertions.assertThat; public class MetadataTest { + private static final Logger LOGGER = LoggerFactory.getLogger(MetadataTest.class); @Test public void testKlassAndSubKlassWithImpl() { @@ -99,7 +102,7 @@ public void testKlassAndSubKlassWithInterfaces() { assertThat((int) sk.subProp.get(ski)).isEqualTo(-99); assertThat(sk.prop.get(ski)).isEqualTo("bye"); - System.out.println( ski.map); + LOGGER.debug( ski.map.toString()); Map tgt = new HashMap(); tgt.put( "prop", "bye" ); tgt.put( "subProp", -99 ); diff --git a/drools-traits/src/test/java/org/drools/traits/core/util/HierarchyTest.java b/drools-traits/src/test/java/org/drools/traits/core/util/HierarchyTest.java index 83faf912b0d..d460cfd45d5 100644 --- a/drools-traits/src/test/java/org/drools/traits/core/util/HierarchyTest.java +++ b/drools-traits/src/test/java/org/drools/traits/core/util/HierarchyTest.java @@ -22,6 +22,8 @@ import org.drools.traits.core.factmodel.HierarchyEncoder; import org.drools.traits.core.factmodel.IndexedTypeHierarchy; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Arrays; @@ -35,7 +37,7 @@ public class HierarchyTest { - + private static final Logger LOGGER = LoggerFactory.getLogger(HierarchyTest.class); @Test public void testHierEncoderTrivial() { @@ -46,7 +48,7 @@ public void testHierEncoderTrivial() { encoder.encode("C", List.of("B")); encoder.encode( "D", Arrays.asList( "B", "C" ) ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); assertThat(encoder.getCode("A")).isEqualTo(parseBitSet("0")); assertThat(encoder.getCode("B")).isEqualTo(parseBitSet("1")); @@ -64,7 +66,7 @@ public void testHierManyRoots() { encoder.encode( "D", Collections.EMPTY_LIST ); encoder.encode( "E", Collections.EMPTY_LIST ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); assertThat(encoder.getCode("A")).isEqualTo(parseBitSet("1")); assertThat(encoder.getCode("B")).isEqualTo(parseBitSet("10")); @@ -89,7 +91,7 @@ public void testHierManyRootsPropagation() { encoder.encode( "D", Arrays.asList( "B", "C" ) ); encoder.encode( "E", Collections.EMPTY_LIST ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); BitSet a = encoder.getCode( "A" ); BitSet b = encoder.getCode( "B" ); @@ -142,7 +144,7 @@ public void testHierEncoderSimpleInheritance() { encoder.encode("F", List.of("C")); encoder.encode("G", List.of("C")); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); assertThat(encoder.getCode("A")).isEqualTo(parseBitSet("0")); assertThat(encoder.getCode("B")).isEqualTo(parseBitSet("1")); @@ -172,7 +174,7 @@ public void testHierEncoderAnotherSimpleInheritance() { encoder.encode( "B6", Arrays.asList( "B2", "B3" ) ); encoder.encode( "B7", Arrays.asList( "B4", "B5", "B6" ) ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); assertThat(encoder.getCode("R")).isEqualTo(parseBitSet("0")); assertThat(encoder.getCode("A1")).isEqualTo(parseBitSet("1")); @@ -207,7 +209,7 @@ public void testHierEncoderAnotherSimpleInheritanceChangeOrder() { encoder.encode("A2", List.of("R")); encoder.encode("A3", List.of("R")); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); assertThat(encoder.getCode("R")).isEqualTo(parseBitSet("0")); assertThat(encoder.getCode("B1")).isEqualTo(parseBitSet("1")); @@ -244,7 +246,7 @@ public void testHierEncoderBipartiteInheritance() { encoder.encode( "B5", Arrays.asList( "B1", "B2", "B3" ) ); encoder.encode( "B6", Arrays.asList( "B1", "B2", "B3" ) ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); assertThat(encoder.getCode("R")).isEqualTo(parseBitSet("0")); assertThat(encoder.getCode("A1")).isEqualTo(parseBitSet("1")); @@ -276,7 +278,7 @@ public void testHierEncoderBipartiteInheritanceDiffOrder() { encoder.encode("A2", List.of("R")); encoder.encode("A3", List.of("R")); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); assertThat(encoder.getCode("R")).isEqualTo(parseBitSet("0")); assertThat(encoder.getCode("B1")).isEqualTo(parseBitSet("1")); @@ -302,7 +304,7 @@ public void testSquare() { encoder.encode( "C", Arrays.asList( "A", "B" ) ); encoder.encode( "D", Arrays.asList( "A", "B" ) ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); assertThat(encoder.getCode("T")).isEqualTo(parseBitSet("0")); assertThat(encoder.getCode("A")).isEqualTo(parseBitSet("1")); @@ -329,7 +331,7 @@ public void testConflictArising() { encoder.encode("H", List.of("E")); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); assertThat(encoder.getCode("A")).isEqualTo(parseBitSet("0")); assertThat(encoder.getCode("B")).isEqualTo(parseBitSet("1")); @@ -342,7 +344,7 @@ public void testConflictArising() { encoder.encode( "I", Arrays.asList( "E", "F" ) ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); assertThat(encoder.getCode("A")).isEqualTo(parseBitSet("0")); assertThat(encoder.getCode("B")).isEqualTo(parseBitSet("1")); @@ -374,11 +376,11 @@ public void testConflictArising2() { encoder.encode("K", List.of("J")); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); encoder.encode( "I", Arrays.asList( "E", "F" ) ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); checkHier( encoder, 'K' ); @@ -410,7 +412,7 @@ public void testHierEncoderBipartiteStarInheritance() { encoder.encode("A7", List.of("A4")); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); assertThat(encoder.getCode("R")).isEqualTo(parseBitSet("0")); assertThat(encoder.getCode("B1")).isEqualTo(parseBitSet("1")); @@ -454,7 +456,7 @@ public void testHierEncoderBipartiteStarInheritanceDiffOrder() { - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); assertThat(encoder.getCode("R")).isEqualTo(parseBitSet("0")); @@ -536,7 +538,7 @@ public void testHierEncoderComplexInheritance() { encoder.encode( "O", Arrays.asList( "H", "M" ) ); checkHier( encoder, 'O' ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); Collection codes = encoder.getSortedMap().values(); Iterator iter = codes.iterator(); @@ -544,7 +546,7 @@ public void testHierEncoderComplexInheritance() { for ( int j = 0; j < codes.size() -1; j++ ) { BitSet ns = iter.next(); Long next = toLong( ns ); - System.out.println( next ); + LOGGER.debug( next.toString() ); assertThat(next > last).isTrue(); last = next; } @@ -664,11 +666,11 @@ public void testSecondOrderInheritance() { encoder.encode( "F", Arrays.asList( "B", "C" ) ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); encoder.encode( "Z", Arrays.asList( "A", "B", "D" ) ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); assertThat(((HierarchyEncoderImpl) encoder).superset(encoder.getCode("Z"), encoder.getCode("F")) < 0).isTrue() ; assertThat(((HierarchyEncoderImpl) encoder).superset(encoder.getCode("F"), encoder.getCode("Z")) < 0).isTrue() ; @@ -696,14 +698,14 @@ public void testDecoderAncestors() { encoder.encode( "M", Arrays.asList( "R", "Q" ) ); encoder.encode( "O", Arrays.asList( "M", "P" ) ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); BitSet b; Collection x; b = parseBitSet( "1100111" ); x = encoder.upperAncestors(b); - System.out.println( "ANC " + x ); + LOGGER.debug( "ANC " + x ); assertThat(x.contains("A")).isTrue(); assertThat(x.contains("Z")).isTrue(); @@ -719,7 +721,7 @@ public void testDecoderAncestors() { b = parseBitSet( "100000" ); x = encoder.upperAncestors(b); - System.out.println( "ANC " + x ); + LOGGER.debug( "ANC " + x ); assertThat(x.size()).isEqualTo(2); assertThat(x.contains("Q")).isTrue(); @@ -727,7 +729,7 @@ public void testDecoderAncestors() { b = parseBitSet( "1111" ); x = encoder.upperAncestors(b); - System.out.println( "ANC " + x ); + LOGGER.debug( "ANC " + x ); assertThat(x.size()).isEqualTo(6); assertThat(x.contains("A")).isTrue(); @@ -739,7 +741,7 @@ public void testDecoderAncestors() { b = parseBitSet( "111" ); x = encoder.upperAncestors(b); - System.out.println( "ANC " + x ); + LOGGER.debug( "ANC " + x ); assertThat(x.size()).isEqualTo(4); assertThat(x.contains("A")).isTrue(); @@ -749,7 +751,7 @@ public void testDecoderAncestors() { b = parseBitSet( "1" ); x = encoder.upperAncestors(b); - System.out.println( "ANC " + x ); + LOGGER.debug( "ANC " + x ); assertThat(x.size()).isEqualTo(2); assertThat(x.contains("A")).isTrue(); @@ -757,7 +759,7 @@ public void testDecoderAncestors() { b = parseBitSet( "10" ); x = encoder.upperAncestors(b); - System.out.println( "ANC " + x ); + LOGGER.debug( "ANC " + x ); assertThat(x.size()).isEqualTo(2); assertThat(x.contains("Z")).isTrue(); @@ -765,7 +767,7 @@ public void testDecoderAncestors() { b = parseBitSet( "0" ); x = encoder.upperAncestors(b); - System.out.println( "ANC " + x ); + LOGGER.debug( "ANC " + x ); assertThat(x.size()).isEqualTo(1); assertThat(x.contains("Thing")).isTrue(); @@ -773,7 +775,7 @@ public void testDecoderAncestors() { b = parseBitSet( "1011" ); x = encoder.upperAncestors(b); - System.out.println( "ANC " + x ); + LOGGER.debug( "ANC " + x ); assertThat(x.size()).isEqualTo(4); assertThat(x.contains("Thing")).isTrue(); @@ -802,14 +804,14 @@ public void testDecoderDescendants() { encoder.encode( "M", Arrays.asList( "R", "Q" ) ); encoder.encode( "O", Arrays.asList( "M", "P" ) ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); BitSet b; Collection x; b = parseBitSet( "111" ); x = encoder.lowerDescendants(b); - System.out.println( "DESC " + x ); + LOGGER.debug( "DESC " + x ); assertThat(x.size()).isEqualTo(3); assertThat(x.contains("C")).isTrue(); @@ -819,7 +821,7 @@ public void testDecoderDescendants() { b = parseBitSet( "10" ); x = encoder.lowerDescendants(b); - System.out.println( "DESC " + x ); + LOGGER.debug( "DESC " + x ); assertThat(x.size()).isEqualTo(5); assertThat(x.contains("C")).isTrue(); @@ -831,7 +833,7 @@ public void testDecoderDescendants() { b = parseBitSet( "100000" ); x = encoder.lowerDescendants(b); - System.out.println( "DESC " + x ); + LOGGER.debug( "DESC " + x ); assertThat(x.size()).isEqualTo(4); assertThat(x.contains("Q")).isTrue(); @@ -844,14 +846,14 @@ public void testDecoderDescendants() { b = parseBitSet( "100010" ); x = encoder.lowerDescendants(b); - System.out.println( "DESC " + x ); + LOGGER.debug( "DESC " + x ); assertThat(x.size()).isEqualTo(1); assertThat(x.contains("T")).isTrue(); b = parseBitSet( "1111" ); x = encoder.lowerDescendants(b); - System.out.println( "DESC " + x ); + LOGGER.debug( "DESC " + x ); assertThat(x.size()).isEqualTo(1); assertThat(x.contains("N")).isTrue(); @@ -859,7 +861,7 @@ public void testDecoderDescendants() { b = parseBitSet( "1" ); x = encoder.lowerDescendants(b); - System.out.println( "DESC " + x ); + LOGGER.debug( "DESC " + x ); assertThat(x.size()).isEqualTo(5); assertThat(x.contains("A")).isTrue(); @@ -868,10 +870,10 @@ public void testDecoderDescendants() { assertThat(x.contains("N")).isTrue(); assertThat(x.contains("T")).isTrue(); - System.out.println(" +*******************************+ "); + LOGGER.debug(" +*******************************+ "); x = encoder.lowerDescendants(new BitSet()); - System.out.println( "DESC " + x ); + LOGGER.debug( "DESC " + x ); assertThat(x.size()).isEqualTo(13); assertThat(x.contains("Z")).isTrue(); @@ -898,30 +900,30 @@ public void testHierEncoderDecoderLower() { encoder.encode( "M", Arrays.asList( "R", "Q" ) ); encoder.encode( "O", Arrays.asList( "M", "P" ) ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); Collection x; x = encoder.lowerBorder( encoder.metMembersCode(List.of("B"))); - System.out.println( "GCS " + x ); + LOGGER.debug( "GCS " + x ); assertThat(x.size()).isEqualTo(1); assertThat(x.contains("B")).isTrue(); x = encoder.immediateChildren( encoder.metMembersCode(List.of("B"))); - System.out.println( "GCS " + x ); + LOGGER.debug( "GCS " + x ); assertThat(x.size()).isEqualTo(1); assertThat(x.contains("N")).isTrue(); x = encoder.lowerBorder( encoder.metMembersCode( Arrays.asList( "Z", "Q" ) ) ); - System.out.println( "GCS " + x ); + LOGGER.debug( "GCS " + x ); assertThat(x.size()).isEqualTo(1); assertThat(x.contains("T")).isTrue(); x = encoder.immediateChildren( encoder.metMembersCode( Arrays.asList( "Z", "Q" ) ) ); - System.out.println( "GCS " + x ); + LOGGER.debug( "GCS " + x ); assertThat(x.size()).isEqualTo(1); assertThat(x.contains("T")).isTrue(); @@ -930,14 +932,14 @@ public void testHierEncoderDecoderLower() { x = encoder.lowerBorder( encoder.metMembersCode( Arrays.asList( "A", "Z" ) ) ); - System.out.println( "GCS " + x ); + LOGGER.debug( "GCS " + x ); assertThat(x.size()).isEqualTo(2); assertThat(x.contains("B")).isTrue(); assertThat(x.contains("C")).isTrue(); x = encoder.immediateChildren( encoder.metMembersCode( Arrays.asList( "A", "Z" ) ) ); - System.out.println( "GCS " + x ); + LOGGER.debug( "GCS " + x ); assertThat(x.size()).isEqualTo(2); assertThat(x.contains("B")).isTrue(); @@ -947,13 +949,13 @@ public void testHierEncoderDecoderLower() { x = encoder.lowerBorder( encoder.metMembersCode(List.of("Thing"))); - System.out.println( "GCS " + x ); + LOGGER.debug( "GCS " + x ); assertThat(x.size()).isEqualTo(1); assertThat(x.contains("Thing")).isTrue(); x = encoder.immediateChildren( encoder.metMembersCode(List.of("Thing"))); - System.out.println( "GCS " + x ); + LOGGER.debug( "GCS " + x ); assertThat(x.size()).isEqualTo(5); assertThat(x.contains("A")).isTrue(); @@ -984,17 +986,17 @@ public void testHierEncoderDecoderUpper() { encoder.encode( "M", Arrays.asList( "R", "Q" ) ); encoder.encode( "O", Arrays.asList( "M", "P" ) ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); Collection x; x = encoder.upperBorder( encoder.metMembersCode(List.of("B"))); - System.out.println( "LCS " + x ); + LOGGER.debug( "LCS " + x ); assertThat(x.size()).isEqualTo(1); assertThat(x.contains("B")).isTrue(); x = encoder.immediateParents( encoder.metMembersCode(List.of("B"))); - System.out.println( "LCS " + x ); + LOGGER.debug( "LCS " + x ); assertThat(x.size()).isEqualTo(2); assertThat(x.contains("A")).isTrue(); assertThat(x.contains("Z")).isTrue(); @@ -1002,13 +1004,13 @@ public void testHierEncoderDecoderUpper() { x = encoder.upperBorder( encoder.jointMembersCode( Arrays.asList( "Z", "Q" ) ) ); - System.out.println( "LCS " + x ); + LOGGER.debug( "LCS " + x ); assertThat(x.size()).isEqualTo(1); assertThat(x.contains("Thing")).isTrue(); x = encoder.immediateParents( encoder.jointMembersCode( Arrays.asList( "Z", "Q" ) ) ); - System.out.println( "LCS " + x ); + LOGGER.debug( "LCS " + x ); assertThat(x.size()).isEqualTo(1); assertThat(x.contains("Thing")).isTrue(); @@ -1016,14 +1018,14 @@ public void testHierEncoderDecoderUpper() { x = encoder.upperBorder( encoder.jointMembersCode( Arrays.asList( "B", "C" ) ) ); - System.out.println( "LCS " + x ); + LOGGER.debug( "LCS " + x ); assertThat(x.size()).isEqualTo(2); assertThat(x.contains("A")).isTrue(); assertThat(x.contains("Z")).isTrue(); x = encoder.immediateParents( encoder.jointMembersCode( Arrays.asList( "B", "C" ) ) ); - System.out.println( "LCS " + x ); + LOGGER.debug( "LCS " + x ); assertThat(x.size()).isEqualTo(2); assertThat(x.contains("A")).isTrue(); @@ -1031,13 +1033,13 @@ public void testHierEncoderDecoderUpper() { x = encoder.upperBorder( encoder.jointMembersCode(List.of("T"))); - System.out.println( "LCS " + x ); + LOGGER.debug( "LCS " + x ); assertThat(x.size()).isEqualTo(1); assertThat(x.contains("T")).isTrue(); x = encoder.immediateParents( encoder.jointMembersCode(List.of("T"))); - System.out.println( "LCS " + x ); + LOGGER.debug( "LCS " + x ); assertThat(x.size()).isEqualTo(2); assertThat(x.contains("C")).isTrue(); @@ -1071,7 +1073,7 @@ public void testClassInstanceHierarchies() { BitSet nk = encoder.encode( "N", Arrays.asList( "I", "L" ) ); BitSet ok = encoder.encode( "O", Arrays.asList( "H", "M" ) ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); CodedHierarchy types = new IndexedTypeHierarchy("A", new BitSet(), "ZZZZ", encoder.getBottom() ); @@ -1085,7 +1087,7 @@ public void testClassInstanceHierarchies() { types.addMember( "h", hk ); - System.out.println( types ); + LOGGER.debug( types.toString() ); assertThat(types.children("A")).isEqualTo(Arrays.asList("c", "h")); assertThat(types.children("c")).isEqualTo(Arrays.asList("f", "n", "o")); @@ -1111,7 +1113,7 @@ public void testClassInstanceHierarchies() { BitSet pk = encoder.encode("P", List.of("O")); types.addMember( "p", pk ); - System.out.println( types ); + LOGGER.debug( types.toString() ); assertThat(types.parents("p")).isEqualTo(List.of("o")); assertThat(types.parents("ZZZZ")).isEqualTo(Arrays.asList("j", "k", "n", "p")); @@ -1120,7 +1122,7 @@ public void testClassInstanceHierarchies() { types.removeMember( "o" ); - System.out.println( types ); + LOGGER.debug( types.toString() ); assertThat(types.parents("p")).isEqualTo(Arrays.asList("c", "h")); assertThat(types.children("c")).isEqualTo(Arrays.asList("f", "n", "p")); @@ -1174,7 +1176,7 @@ public void testUnwantedCodeOverriding() { assertThat(encoder.getCode("L")).isNotNull(); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); assertThat(encoder.size()).isEqualTo(16); } @@ -1206,7 +1208,7 @@ public void testDeepTree() { - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); checkHier( encoder, 'O' ); } @@ -1242,11 +1244,11 @@ public void testNestedTree() { encoder.encode("W", List.of("V")); encoder.encode("X", List.of("W")); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); encoder.encode( "Y", Arrays.asList( "F", "W") ); - System.out.println( encoder ); + LOGGER.debug( encoder.toString() ); checkHier( encoder, (char) ( 'A' + encoder.size() - 1 ) ); diff --git a/drools-traits/src/test/resources/logback-test.xml b/drools-traits/src/test/resources/logback-test.xml index 7b96df4c187..e5cd63021d0 100644 --- a/drools-traits/src/test/resources/logback-test.xml +++ b/drools-traits/src/test/resources/logback-test.xml @@ -30,9 +30,9 @@ - - - + + + diff --git a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testDeclaredFactTrait.drl b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testDeclaredFactTrait.drl index f97c34c7955..d6e22af6c91 100644 --- a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testDeclaredFactTrait.drl +++ b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testDeclaredFactTrait.drl @@ -69,5 +69,4 @@ rule "Log" when $o : Object() then - System.out.println(" Log " + $o ); end \ No newline at end of file diff --git a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testPojoFactTrait.drl b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testPojoFactTrait.drl index 07089372f5a..6d48d33fb86 100644 --- a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testPojoFactTrait.drl +++ b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testPojoFactTrait.drl @@ -69,5 +69,4 @@ rule "By thing" $d : PojoFact() exists Thing( core == $d ) then - System.out.println(" !!QQE!"); end \ No newline at end of file diff --git a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitCollections.drl b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitCollections.drl index 7224a641193..7de1e6b5693 100644 --- a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitCollections.drl +++ b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitCollections.drl @@ -91,8 +91,6 @@ then setNested( st ), setNest2( at ); } - - System.out.println( complex ); end diff --git a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitDon.drl b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitDon.drl index 7cf0762a04f..1775b05dd3e 100644 --- a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitDon.drl +++ b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitDon.drl @@ -101,7 +101,6 @@ rule "Check" when $z: Student( $s : school == "skl", fields[ "name" ] == "xx", $a : age == 88 ) then - System.out.println( "DON" ); list.add( "DON" ); end @@ -112,6 +111,5 @@ salience -100 when not Student( ) then - System.out.println( "SHED" ); list.add( "SHED" ); end; \ No newline at end of file diff --git a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitDonMultiple.drl b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitDonMultiple.drl index aa5746ed689..c9cd59c5a0d 100644 --- a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitDonMultiple.drl +++ b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitDonMultiple.drl @@ -43,7 +43,6 @@ rule "React" when $x : SeniorStudent( $y : year ) @watch( year ) then - System.out.println( " SeniorStudent Updated " ); list.add( $y ); end @@ -54,7 +53,6 @@ no-loop when $s : Student( grad == false ) @watch( year ) then - System.out.println( " Don SeniorStudent " ); SeniorStudent sen = don( $s, SeniorStudent.class ); end @@ -64,6 +62,5 @@ salience -5 when $s : Student( grad == false, $y : year < 4 ) then - System.out.println( " One year passes " + $y ); modify( $s ) { setYear( $y + 1 ); } end \ No newline at end of file diff --git a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitIsA2.drl b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitIsA2.drl index f5a4a09b2e9..a15755c1495 100644 --- a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitIsA2.drl +++ b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitIsA2.drl @@ -35,12 +35,10 @@ rule "print student" when student : Person( this isA Student ) then - // System.out.println("Person is a student: " + student); end rule "print school" when Student( $school : school ) then - // System.out.println("Student is attending " + $school); end \ No newline at end of file diff --git a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitIsAWithBC.drl b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitIsAWithBC.drl index 40270035415..dbf640f30b7 100644 --- a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitIsAWithBC.drl +++ b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitIsAWithBC.drl @@ -90,6 +90,5 @@ when $q := Country( $name : name == "Italy" ) then - System.out.println( "Checking " + $p + " in " + $q ); list.add( $name ); end diff --git a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitLegacyCore.drl b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitLegacyCore.drl index ca0e579c69f..0cfad977431 100644 --- a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitLegacyCore.drl +++ b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitLegacyCore.drl @@ -60,16 +60,12 @@ when $core: Imp() not Person( age == 30 ) then - System.out.println( " Rule trait is firing " ); - Person p = don( $core, Person.class ); modify( p ) { setName( "john" ), setAge( 30 ); } - - System.out.println( " Done firing Rule trait " ); end rule "Cloak" @@ -77,7 +73,6 @@ no-loop when $p : Person( $core : core, name == "john" ) then - System.out.println( "John the Person is here >>> " + $p ); list.add("OK"); IRole role = don( $core, IRole.class ); @@ -85,8 +80,6 @@ then modify( role ) { setRoleName("myRole"); } - - System.out.println( "John the Role is here >>> " + role.getRoleName() ); end @@ -94,6 +87,5 @@ rule "Role" when $role : IRole( roleName == "myRole" ) then - System.out.println( "John the Role is here >>> " + $role ); list.add("OK2"); end diff --git a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitLegacyTrait.drl b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitLegacyTrait.drl index d7c6752cca2..7b49dfe4ed5 100644 --- a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitLegacyTrait.drl +++ b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitLegacyTrait.drl @@ -95,14 +95,6 @@ then modify( s ) { setSchool( "skol" ); } modify( w ) { setAge( 30 ); } modify( r ) { setRoleName( "john" ); } - - - System.out.println(s); - System.out.println(p); - System.out.println(w); - System.out.println(x); - System.out.println(r); - end @@ -110,7 +102,6 @@ rule "Cloak" when $p : Person( name == "john" ) then - System.out.println( "John the Person is here" ); list.add( "OK" ); end @@ -118,7 +109,6 @@ rule "Cloak 2" when $p : Worker( name == "john", age == 30 ) then - System.out.println( "John the Worker is here" ); list.add( "OK2" ); end @@ -126,7 +116,6 @@ rule "Cloak 3" when $p : IPerson( name == "john" ) then - System.out.println( "John the IPerson is here" ); list.add( "OK3" ); end @@ -134,7 +123,6 @@ rule "Cloak 4" when $p : IStudent( name == "john", school == "skol" ) then - System.out.println( "John the IStudent is here" ); list.add( "OK4" ); end @@ -143,6 +131,5 @@ rule "Cloak 5" when $p : IRole( roleName == "john" ) then - System.out.println( "John the IRole is here" ); list.add( "OK5" ); end \ No newline at end of file diff --git a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitOverride.drl b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitOverride.drl index b0ee202c275..c8b24e00355 100644 --- a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitOverride.drl +++ b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitOverride.drl @@ -57,7 +57,6 @@ when then Person s = drools.don( $core, Person.class, true ); s.setCode( 456 ); - System.out.println(s); update(s); end diff --git a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitShed.drl b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitShed.drl index b1fe811b1cf..224ef441f97 100644 --- a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitShed.drl +++ b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitShed.drl @@ -41,7 +41,6 @@ end rule "Init" when then - System.out.println( "Init" ); Imp core = new Imp( ); insert( core ); end @@ -52,7 +51,6 @@ no-loop when $core: Imp( this not isA Thing ) then - System.out.println( "Don student" ); Student s = don( $core, Student.class ); list.add( "Student" ); end @@ -64,7 +62,6 @@ when $s : Student( this not isA Worker ) String( this == "hire" ) then - System.out.println( "Don worker" ); don( $s, Worker.class ); list.add( "Worker" ); end @@ -75,7 +72,6 @@ when $w : Worker( this isA Student ) String( this == "check" ) then - System.out.println( "Shed student" ); shed( $w, Student.class ); end @@ -84,7 +80,6 @@ rule "Conflict resolved" when $w : Worker( this not isA Student ) then - System.out.println( "Shed worker too" ); list.add( "Conflict" ); shed( $w, Worker.class ); end @@ -94,6 +89,5 @@ rule "Nothing Left" when $t : Thing( this not isA Student, this not isA Worker ) then - System.out.println( "Bare Thing" ); list.add( "Nothing" ); end diff --git a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitWithEquality.drl b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitWithEquality.drl index 0bbef37b629..631dd591305 100644 --- a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitWithEquality.drl +++ b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitWithEquality.drl @@ -88,8 +88,6 @@ when $s: Student( name == "alan", fields[ "school" ] == "zkl" ) $z: Student( name == "alan", fields[ "school" ] == "squola" ) then - System.out.println( "Compare " + $s + " vs " + $z ); - $z.setDcode(3.47); if ( $s.equals( $z ) ) { list.add( "EQUAL" ); diff --git a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitWrapping.drl b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitWrapping.drl index bb893fcdbb6..1b7fb4ed21b 100644 --- a/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitWrapping.drl +++ b/drools-traits/src/test/resources/org/drools/compiler/factmodel/traits/testTraitWrapping.drl @@ -75,7 +75,6 @@ then Trait t = (Trait) drools.don( $core, Trait.class, true ); Byte b0 = t.getByteh(); - System.out.println( ">>> " + b0); if ( b0 != 0 ) list.add( " hard byte default value != 0 " + b0 ); t.setByteh( Byte.valueOf("1") ); if ( $core.getByteh() != 1 ) list.add( " hard byte setter on trait failed, core reports " + $core.getByteh() ); diff --git a/jpmml-migration-recipe/src/test/resources/logback.xml b/jpmml-migration-recipe/src/test/resources/logback.xml index 53d915bf497..fb76bdf46bc 100644 --- a/jpmml-migration-recipe/src/test/resources/logback.xml +++ b/jpmml-migration-recipe/src/test/resources/logback.xml @@ -27,8 +27,8 @@ - - + + diff --git a/kie-dmn/kie-dmn-core-jsr223-jq/src/test/resources/logback.xml b/kie-dmn/kie-dmn-core-jsr223-jq/src/test/resources/logback.xml index 9d4a1022220..7fc4f5450d5 100644 --- a/kie-dmn/kie-dmn-core-jsr223-jq/src/test/resources/logback.xml +++ b/kie-dmn/kie-dmn-core-jsr223-jq/src/test/resources/logback.xml @@ -28,7 +28,7 @@ - + diff --git a/kie-dmn/kie-dmn-core-jsr223/src/test/resources/logback.xml b/kie-dmn/kie-dmn-core-jsr223/src/test/resources/logback.xml index 9d4a1022220..7fc4f5450d5 100644 --- a/kie-dmn/kie-dmn-core-jsr223/src/test/resources/logback.xml +++ b/kie-dmn/kie-dmn-core-jsr223/src/test/resources/logback.xml @@ -28,7 +28,7 @@ - + diff --git a/kie-internal/src/test/resources/logback-test.xml b/kie-internal/src/test/resources/logback-test.xml index 2b64eeeb2d1..e91262f8ae2 100644 --- a/kie-internal/src/test/resources/logback-test.xml +++ b/kie-internal/src/test/resources/logback-test.xml @@ -30,7 +30,7 @@ - + diff --git a/kie-test-util/src/test/resources/logback-test.xml b/kie-test-util/src/test/resources/logback-test.xml index dd53cf7d9f7..4ef4861ad83 100644 --- a/kie-test-util/src/test/resources/logback-test.xml +++ b/kie-test-util/src/test/resources/logback-test.xml @@ -28,7 +28,7 @@ - + From 8738e1135012536b522eeb4bb546fcab0c889dc4 Mon Sep 17 00:00:00 2001 From: Luca Molteni Date: Fri, 27 Oct 2023 14:49:41 +0200 Subject: [PATCH 19/41] [kie-issues#649] Use appropriate BigDecimal method to convert to primitive type (#5567) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Tests * All tests passing * Add integration tests. * Revert "Add integration tests." This reverts commit 98b9637069e6cd28e33149a3aa32af89cc34c425. --------- Co-authored-by: Tibor Zimányi Co-authored-by: Mario Fusco --- .../ast/FieldToAccessorTExpr.java | 14 ++- .../src/test/java/org/drools/Person.java | 82 +++++++++++++ .../drools/mvelcompiler/MvelCompilerTest.java | 110 ++++++++++++++++++ 3 files changed, 205 insertions(+), 1 deletion(-) diff --git a/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/ast/FieldToAccessorTExpr.java b/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/ast/FieldToAccessorTExpr.java index d1f04a2bb85..fb4047e7804 100644 --- a/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/ast/FieldToAccessorTExpr.java +++ b/drools-model/drools-mvel-compiler/src/main/java/org/drools/mvelcompiler/ast/FieldToAccessorTExpr.java @@ -21,6 +21,7 @@ import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; +import java.math.BigDecimal; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -30,6 +31,7 @@ import com.github.javaparser.ast.expr.EnclosedExpr; import com.github.javaparser.ast.expr.Expression; import com.github.javaparser.ast.expr.MethodCallExpr; +import org.drools.mvelcompiler.util.BigDecimalArgumentCoercion; import org.drools.util.MethodUtils; import static com.github.javaparser.ast.NodeList.nodeList; @@ -72,7 +74,17 @@ public Node toJavaExpression() { .map(this::convertToStringIfNeeded) .collect(Collectors.toList()); - return new MethodCallExpr((Expression) scope.toJavaExpression(), accessor.getName(), nodeList(expressionArguments)); + Optional rhsType = this.arguments.stream() + .findFirst() + .flatMap(TypedExpression::getType); + + // Right is BigDecimal, left is other, coerce + if(rhsType.isPresent() && rhsType.get().equals(BigDecimal.class) && !type.equals(BigDecimal.class)) { + Expression coercedExpression = new BigDecimalArgumentCoercion().coercedArgument(BigDecimal.class, (Class)type, expressionArguments.get(0)); + return new MethodCallExpr((Expression) scope.toJavaExpression(), accessor.getName(), nodeList(coercedExpression)); + } else { + return new MethodCallExpr((Expression) scope.toJavaExpression(), accessor.getName(), nodeList(expressionArguments)); + } } private Expression convertToStringIfNeeded(TypedExpression argumentExpression) { diff --git a/drools-model/drools-mvel-compiler/src/test/java/org/drools/Person.java b/drools-model/drools-mvel-compiler/src/test/java/org/drools/Person.java index 53c4a508f6e..e99d6887c16 100644 --- a/drools-model/drools-mvel-compiler/src/test/java/org/drools/Person.java +++ b/drools-model/drools-mvel-compiler/src/test/java/org/drools/Person.java @@ -28,6 +28,16 @@ public class Person { private String name; private int age; + private long longValue; + private short shortValue; + private double doubleValue; + private float floatValue; + + private Integer integerBoxed; + private Long longBoxed; + private Short shortBoxed; + private Double doubleBoxed; + private Float floatBoxed; private Person parent; private Address address; @@ -122,4 +132,76 @@ public void setAddresses(List
addresses) { public boolean isEven(int value) { return true; } + + public long getLongValue() { + return longValue; + } + + public void setLongValue(long longValue) { + this.longValue = longValue; + } + + public short getShortValue() { + return shortValue; + } + + public void setShortValue(short shortValue) { + this.shortValue = shortValue; + } + + public double getDoubleValue() { + return doubleValue; + } + + public void setDoubleValue(double doubleValue) { + this.doubleValue = doubleValue; + } + + public float getFloatValue() { + return floatValue; + } + + public void setFloatValue(float floatValue) { + this.floatValue = floatValue; + } + + public Integer getIntegerBoxed() { + return integerBoxed; + } + + public void setIntegerBoxed(Integer integerBoxed) { + this.integerBoxed = integerBoxed; + } + + public Long getLongBoxed() { + return longBoxed; + } + + public void setLongBoxed(Long longBoxed) { + this.longBoxed = longBoxed; + } + + public Short getShortBoxed() { + return shortBoxed; + } + + public void setShortBoxed(Short shortBoxed) { + this.shortBoxed = shortBoxed; + } + + public Double getDoubleBoxed() { + return doubleBoxed; + } + + public void setDoubleBoxed(Double doubleBoxed) { + this.doubleBoxed = doubleBoxed; + } + + public Float getFloatBoxed() { + return floatBoxed; + } + + public void setFloatBoxed(Float floatBoxed) { + this.floatBoxed = floatBoxed; + } } diff --git a/drools-model/drools-mvel-compiler/src/test/java/org/drools/mvelcompiler/MvelCompilerTest.java b/drools-model/drools-mvel-compiler/src/test/java/org/drools/mvelcompiler/MvelCompilerTest.java index 4db881fb600..7de5965da1e 100644 --- a/drools-model/drools-mvel-compiler/src/test/java/org/drools/mvelcompiler/MvelCompilerTest.java +++ b/drools-model/drools-mvel-compiler/src/test/java/org/drools/mvelcompiler/MvelCompilerTest.java @@ -834,6 +834,116 @@ public void testBigDecimalArithmeticWithConversionFromInteger() { "}"); } + @Test + public void testBigDecimalAssignmentToInt() { + test(ctx -> ctx.addDeclaration("$p", Person.class), + "{ " + + " $p.age = $p.salary;\n" + + "}", + "{ " + + " $p.setAge($p.getSalary().intValue());\n" + + "}"); + } + + @Test + public void testBigDecimalAssignmentToIntegerBoxed() { + test(ctx -> ctx.addDeclaration("$p", Person.class), + "{ " + + " $p.integerBoxed = $p.salary;\n" + + "}", + "{ " + + " $p.setIntegerBoxed($p.getSalary().intValue());\n" + + "}"); + } + + @Test + public void testBigDecimalAssignmentToLong() { + test(ctx -> ctx.addDeclaration("$p", Person.class), + "{ " + + " $p.longValue = $p.salary;\n" + + "}", + "{ " + + " $p.setLongValue($p.getSalary().longValue());\n" + + "}"); + } + + @Test + public void testBigDecimalAssignmentToLongBoxed() { + test(ctx -> ctx.addDeclaration("$p", Person.class), + "{ " + + " $p.longBoxed = $p.salary;\n" + + "}", + "{ " + + " $p.setLongBoxed($p.getSalary().longValue());\n" + + "}"); + } + + @Test + public void testBigDecimalAssignmentToShort() { + test(ctx -> ctx.addDeclaration("$p", Person.class), + "{ " + + " $p.shortValue = $p.salary;\n" + + "}", + "{ " + + " $p.setShortValue($p.getSalary().shortValue());\n" + + "}"); + } + + @Test + public void testBigDecimalAssignmentToShortBoxed() { + test(ctx -> ctx.addDeclaration("$p", Person.class), + "{ " + + " $p.shortBoxed = $p.salary;\n" + + "}", + "{ " + + " $p.setShortBoxed($p.getSalary().shortValue());\n" + + "}"); + } + + @Test + public void testBigDecimalAssignmentToDouble() { + test(ctx -> ctx.addDeclaration("$p", Person.class), + "{ " + + " $p.doubleValue = $p.salary;\n" + + "}", + "{ " + + " $p.setDoubleValue($p.getSalary().doubleValue());\n" + + "}"); + } + + @Test + public void testBigDecimalAssignmentToDoubleBoxed() { + test(ctx -> ctx.addDeclaration("$p", Person.class), + "{ " + + " $p.doubleBoxed = $p.salary;\n" + + "}", + "{ " + + " $p.setDoubleBoxed($p.getSalary().doubleValue());\n" + + "}"); + } + + @Test + public void testBigDecimalAssignmentToFloat() { + test(ctx -> ctx.addDeclaration("$p", Person.class), + "{ " + + " $p.floatValue = $p.salary;\n" + + "}", + "{ " + + " $p.setFloatValue($p.getSalary().floatValue());\n" + + "}"); + } + + @Test + public void testBigDecimalAssignmentToFloatBoxed() { + test(ctx -> ctx.addDeclaration("$p", Person.class), + "{ " + + " $p.floatBoxed = $p.salary;\n" + + "}", + "{ " + + " $p.setFloatBoxed($p.getSalary().floatValue());\n" + + "}"); + } + @Test public void testBigDecimalPromotionAllFourOperations() { test(ctx -> ctx.addDeclaration("$p", Person.class), From 9ec59aae0b10cff6aa035c9a4a9f2ade2104fadc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Mon, 30 Oct 2023 08:39:38 +0100 Subject: [PATCH 20/41] Change Overpass font to more widely used Arial in ReteDiagram generator. (#5568) --- .../src/main/java/org/drools/retediagram/ReteDiagram.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drools-retediagram/src/main/java/org/drools/retediagram/ReteDiagram.java b/drools-retediagram/src/main/java/org/drools/retediagram/ReteDiagram.java index fb72d30283c..7c4fd922589 100644 --- a/drools-retediagram/src/main/java/org/drools/retediagram/ReteDiagram.java +++ b/drools-retediagram/src/main/java/org/drools/retediagram/ReteDiagram.java @@ -164,9 +164,9 @@ public void diagramRete(Rete rete) { File pngFile = new File(outputPath, pngFileName); try (PrintStream out = new PrintStream(new FileOutputStream(gvFile));) { out.println("digraph g {\n" + - "graph [fontname = \"Overpass\" fontsize=11];\n" + - " node [fontname = \"Overpass\" fontsize=11];\n" + - " edge [fontname = \"Overpass\" fontsize=11];"); + "graph [fontname = \"Arial\" fontsize=11];\n" + + " node [fontname = \"Arial\" fontsize=11];\n" + + " edge [fontname = \"Arial\" fontsize=11];"); HashMap, Set> levelMap = new HashMap<>(); HashMap, List> nodeMap = new HashMap<>(); List> vertexes = new ArrayList<>(); From 8c4965c4c6c1c71fa038634b934968b189b74d50 Mon Sep 17 00:00:00 2001 From: Paolo Bizzarri Date: Tue, 31 Oct 2023 08:29:00 +0100 Subject: [PATCH 21/41] Removed checkstyle warnings from drools-codebase (#5566) --- .../org/drools/base/base/AccessorKey.java | 36 ++++++++--- .../base/base/BaseClassFieldReader.java | 8 +-- .../org/drools/base/base/EnabledBoolean.java | 2 +- .../base/extractors/ArrayElementReader.java | 28 ++++++--- .../BaseObjectClassFieldReader.java | 2 +- .../drools/base/common/DroolsObjectInput.java | 4 +- .../base/common/DroolsObjectInputStream.java | 4 +- .../drools/base/common/PartitionsManager.java | 6 +- .../definitions/InternalKnowledgePackage.java | 14 ++--- .../impl/KnowledgePackageImpl.java | 20 +++--- .../definitions/rule/impl/GlobalImpl.java | 20 ++++-- .../base/definitions/rule/impl/QueryImpl.java | 2 +- .../base/definitions/rule/impl/RuleImpl.java | 62 +++++++++++-------- .../base/factmodel/AnnotationDefinition.java | 12 +++- .../base/factmodel/FieldDefinition.java | 38 ++++++------ .../base/factmodel/traits/TraitFieldTMS.java | 4 +- .../drools/base/facttemplates/FactImpl.java | 8 ++- .../FactTemplateFieldExtractor.java | 18 ++++-- .../base/facttemplates/FactTemplateImpl.java | 8 ++- .../facttemplates/FactTemplateObjectType.java | 2 +- .../base/facttemplates/FieldTemplateImpl.java | 3 +- .../drools/base/phreak/ReactiveObject.java | 4 +- .../base/reteoo/PropertySpecificUtil.java | 6 +- .../drools/base/reteoo/SortDeclarations.java | 4 +- .../java/org/drools/base/rule/Collect.java | 6 +- .../drools/base/rule/ConditionalBranch.java | 12 +++- .../org/drools/base/rule/Declaration.java | 15 +++-- .../org/drools/base/rule/EntryPointId.java | 20 ++++-- .../org/drools/base/rule/EvalCondition.java | 4 +- .../main/java/org/drools/base/rule/From.java | 4 +- .../java/org/drools/base/rule/Function.java | 2 +- .../drools/base/rule/ImportDeclaration.java | 20 ++++-- .../drools/base/rule/LogicTransformer.java | 4 +- .../org/drools/base/rule/MultiAccumulate.java | 24 ++++--- .../drools/base/rule/NamedConsequence.java | 20 ++++-- .../java/org/drools/base/rule/Pattern.java | 23 +++---- .../org/drools/base/rule/QueryElement.java | 44 +++++++++---- .../drools/base/rule/SingleAccumulate.java | 24 +++++-- .../org/drools/base/rule/TypeDeclaration.java | 22 +++++-- .../org/drools/base/rule/TypeMetaInfo.java | 4 +- .../drools/base/rule/WindowDeclaration.java | 25 +++++--- .../org/drools/base/rule/WindowReference.java | 20 ++++-- .../drools/base/rule/XpathBackReference.java | 2 +- .../base/rule/accessor/GlobalExtractor.java | 12 ++-- .../base/rule/accessor/PatternExtractor.java | 2 +- .../base/rule/accessor/ReadAccessor.java | 4 +- .../rule/consequence/ConsequenceContext.java | 6 +- .../constraint/BetaNodeFieldConstraint.java | 2 +- .../base/rule/constraint/Constraint.java | 8 +-- .../rule/constraint/QueryNameConstraint.java | 4 +- .../base/rule/constraint/XpathConstraint.java | 14 ++--- .../ruleunit/RuleUnitDescriptionLoader.java | 2 +- .../java/org/drools/base/time/Interval.java | 20 ++++-- .../java/org/drools/base/time/impl/Timer.java | 2 +- .../java/org/drools/base/util/FieldIndex.java | 10 +-- .../org/drools/base/util/index/IndexUtil.java | 2 +- 56 files changed, 444 insertions(+), 254 deletions(-) diff --git a/drools-base/src/main/java/org/drools/base/base/AccessorKey.java b/drools-base/src/main/java/org/drools/base/base/AccessorKey.java index e7c33be0153..c6cf4a3db1d 100644 --- a/drools-base/src/main/java/org/drools/base/base/AccessorKey.java +++ b/drools-base/src/main/java/org/drools/base/base/AccessorKey.java @@ -86,22 +86,40 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } AccessorKey other = (AccessorKey) obj; if ( className == null ) { - if ( other.className != null ) return false; - } else if ( !className.equals( other.className ) ) return false; + if ( other.className != null ) { + return false; + } + } else if ( !className.equals( other.className ) ) { + return false; + } if ( fieldName == null ) { - if ( other.fieldName != null ) return false; - } else if ( !fieldName.equals( other.fieldName ) ) return false; + if ( other.fieldName != null ) { + return false; + } + } else if ( !fieldName.equals( other.fieldName ) ) { + return false; + } if ( type == null ) { - if ( other.type != null ) return false; - } else if ( !type.equals( other.type ) ) return false; + if ( other.type != null ) { + return false; + } + } else if ( !type.equals( other.type ) ) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/base/BaseClassFieldReader.java b/drools-base/src/main/java/org/drools/base/base/BaseClassFieldReader.java index c765c5a8308..f5bd9010a32 100644 --- a/drools-base/src/main/java/org/drools/base/base/BaseClassFieldReader.java +++ b/drools-base/src/main/java/org/drools/base/base/BaseClassFieldReader.java @@ -18,15 +18,15 @@ */ package org.drools.base.base; -import org.drools.base.common.DroolsObjectInput; -import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.util.ClassUtils; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import org.drools.base.common.DroolsObjectInput; +import org.drools.base.rule.accessor.ReadAccessor; +import org.drools.util.ClassUtils; + /** * This is the supertype for the ASM generated classes for accessing a field. */ diff --git a/drools-base/src/main/java/org/drools/base/base/EnabledBoolean.java b/drools-base/src/main/java/org/drools/base/base/EnabledBoolean.java index 312dee062cf..7394e7a1429 100644 --- a/drools-base/src/main/java/org/drools/base/base/EnabledBoolean.java +++ b/drools-base/src/main/java/org/drools/base/base/EnabledBoolean.java @@ -25,8 +25,8 @@ import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.reteoo.BaseTuple; -import org.drools.base.rule.accessor.Enabled; import org.drools.base.rule.Declaration; +import org.drools.base.rule.accessor.Enabled; public class EnabledBoolean implements diff --git a/drools-base/src/main/java/org/drools/base/base/extractors/ArrayElementReader.java b/drools-base/src/main/java/org/drools/base/base/extractors/ArrayElementReader.java index 0ca90a40ca9..b3bb7ace8a4 100644 --- a/drools-base/src/main/java/org/drools/base/base/extractors/ArrayElementReader.java +++ b/drools-base/src/main/java/org/drools/base/base/extractors/ArrayElementReader.java @@ -24,11 +24,11 @@ import java.io.ObjectOutput; import java.lang.reflect.Method; +import org.drools.base.base.ClassWireable; import org.drools.base.base.ValueResolver; +import org.drools.base.base.ValueType; import org.drools.base.rule.accessor.AcceptsReadAccessor; import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.base.base.ValueType; -import org.drools.base.base.ClassWireable; import org.drools.util.ClassUtils; import org.drools.util.StringUtils; @@ -192,14 +192,26 @@ public int hashCode() { } public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } final ArrayElementReader other = (ArrayElementReader) obj; if ( arrayReadAccessor == null ) { - if ( other.arrayReadAccessor != null ) return false; - } else if ( !arrayReadAccessor.equals( other.arrayReadAccessor ) ) return false; - if ( index != other.index ) return false; + if ( other.arrayReadAccessor != null ) { + return false; + } + } else if ( !arrayReadAccessor.equals( other.arrayReadAccessor ) ) { + return false; + } + if ( index != other.index ) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/base/extractors/BaseObjectClassFieldReader.java b/drools-base/src/main/java/org/drools/base/base/extractors/BaseObjectClassFieldReader.java index 5635a53e03d..a57546787d3 100755 --- a/drools-base/src/main/java/org/drools/base/base/extractors/BaseObjectClassFieldReader.java +++ b/drools-base/src/main/java/org/drools/base/base/extractors/BaseObjectClassFieldReader.java @@ -21,8 +21,8 @@ import java.lang.reflect.Method; import java.util.Date; -import org.drools.base.base.ValueResolver; import org.drools.base.base.BaseClassFieldReader; +import org.drools.base.base.ValueResolver; import org.drools.base.base.ValueType; public abstract class BaseObjectClassFieldReader extends BaseClassFieldReader { diff --git a/drools-base/src/main/java/org/drools/base/common/DroolsObjectInput.java b/drools-base/src/main/java/org/drools/base/common/DroolsObjectInput.java index 648a513196c..12e24a4694c 100644 --- a/drools-base/src/main/java/org/drools/base/common/DroolsObjectInput.java +++ b/drools-base/src/main/java/org/drools/base/common/DroolsObjectInput.java @@ -18,10 +18,10 @@ */ package org.drools.base.common; -import org.drools.base.RuleBase; - import java.io.ObjectInput; +import org.drools.base.RuleBase; + public interface DroolsObjectInput extends ObjectInput { ClassLoader getParentClassLoader(); ClassLoader getClassLoader(); diff --git a/drools-base/src/main/java/org/drools/base/common/DroolsObjectInputStream.java b/drools-base/src/main/java/org/drools/base/common/DroolsObjectInputStream.java index d37fe74401d..dbadff5b4fb 100644 --- a/drools-base/src/main/java/org/drools/base/common/DroolsObjectInputStream.java +++ b/drools-base/src/main/java/org/drools/base/common/DroolsObjectInputStream.java @@ -29,11 +29,11 @@ import java.util.Map; import java.util.function.Consumer; -import org.drools.base.rule.accessor.ReadAccessor; +import org.drools.base.RuleBase; import org.drools.base.base.AccessorKey; import org.drools.base.base.ReadAccessorSupplier; +import org.drools.base.rule.accessor.ReadAccessor; import org.drools.util.ClassUtils; -import org.drools.base.RuleBase; public class DroolsObjectInputStream extends ObjectInputStream implements diff --git a/drools-base/src/main/java/org/drools/base/common/PartitionsManager.java b/drools-base/src/main/java/org/drools/base/common/PartitionsManager.java index 79777ae52f2..5becb3f8005 100644 --- a/drools-base/src/main/java/org/drools/base/common/PartitionsManager.java +++ b/drools-base/src/main/java/org/drools/base/common/PartitionsManager.java @@ -18,13 +18,13 @@ */ package org.drools.base.common; -import org.drools.util.ObjectPool; -import org.kie.internal.concurrent.ExecutorProviderFactory; - import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.ForkJoinPool; +import org.drools.util.ObjectPool; +import org.kie.internal.concurrent.ExecutorProviderFactory; + public class PartitionsManager { public static final int MIN_PARALLEL_THRESHOLD = 8; diff --git a/drools-base/src/main/java/org/drools/base/definitions/InternalKnowledgePackage.java b/drools-base/src/main/java/org/drools/base/definitions/InternalKnowledgePackage.java index d1839f1e1a5..19cd8c5ce50 100644 --- a/drools-base/src/main/java/org/drools/base/definitions/InternalKnowledgePackage.java +++ b/drools-base/src/main/java/org/drools/base/definitions/InternalKnowledgePackage.java @@ -26,22 +26,22 @@ import java.util.Map; import java.util.Set; -import org.drools.base.definitions.rule.impl.RuleImpl; -import org.drools.base.facttemplates.FactTemplate; -import org.drools.base.rule.ImportDeclaration; -import org.drools.base.rule.TypeDeclaration; -import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.base.ruleunit.RuleUnitDescriptionLoader; +import org.drools.base.RuleBase; import org.drools.base.base.AcceptsClassObjectType; import org.drools.base.base.ObjectType; +import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.facttemplates.FactTemplate; import org.drools.base.rule.DialectRuntimeRegistry; import org.drools.base.rule.Function; +import org.drools.base.rule.ImportDeclaration; +import org.drools.base.rule.TypeDeclaration; import org.drools.base.rule.WindowDeclaration; import org.drools.base.rule.accessor.AcceptsReadAccessor; +import org.drools.base.rule.accessor.ReadAccessor; +import org.drools.base.ruleunit.RuleUnitDescriptionLoader; import org.drools.util.TypeResolver; import org.kie.api.definition.KiePackage; import org.kie.api.definition.process.Process; -import org.drools.base.RuleBase; import org.kie.api.definition.type.FactType; import org.kie.api.io.Resource; import org.kie.api.runtime.rule.AccumulateFunction; diff --git a/drools-base/src/main/java/org/drools/base/definitions/impl/KnowledgePackageImpl.java b/drools-base/src/main/java/org/drools/base/definitions/impl/KnowledgePackageImpl.java index d23dacb4ce3..e8b9004e0bc 100644 --- a/drools-base/src/main/java/org/drools/base/definitions/impl/KnowledgePackageImpl.java +++ b/drools-base/src/main/java/org/drools/base/definitions/impl/KnowledgePackageImpl.java @@ -37,13 +37,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; -import org.drools.base.rule.DialectRuntimeData; -import org.drools.base.rule.DuplicateRuleNameException; -import org.drools.base.rule.ImportDeclaration; -import org.drools.base.rule.InvalidRuleException; -import org.drools.base.rule.InvalidRulePackage; -import org.drools.base.rule.TypeDeclaration; -import org.drools.base.util.CloneUtil; +import org.drools.base.RuleBase; import org.drools.base.common.DroolsObjectInputStream; import org.drools.base.common.DroolsObjectOutputStream; import org.drools.base.definitions.InternalKnowledgePackage; @@ -52,10 +46,17 @@ import org.drools.base.definitions.rule.impl.GlobalImpl; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.facttemplates.FactTemplate; +import org.drools.base.rule.DialectRuntimeData; import org.drools.base.rule.DialectRuntimeRegistry; +import org.drools.base.rule.DuplicateRuleNameException; import org.drools.base.rule.Function; +import org.drools.base.rule.ImportDeclaration; +import org.drools.base.rule.InvalidRuleException; +import org.drools.base.rule.InvalidRulePackage; +import org.drools.base.rule.TypeDeclaration; import org.drools.base.rule.WindowDeclaration; import org.drools.base.ruleunit.RuleUnitDescriptionLoader; +import org.drools.base.util.CloneUtil; import org.drools.util.ClassTypeResolver; import org.drools.util.ClassUtils; import org.drools.util.TypeResolver; @@ -64,7 +65,6 @@ import org.kie.api.definition.rule.Global; import org.kie.api.definition.rule.Query; import org.kie.api.definition.rule.Rule; -import org.drools.base.RuleBase; import org.kie.api.definition.type.FactType; import org.kie.api.io.Resource; import org.kie.api.io.ResourceType; @@ -766,7 +766,9 @@ public List removeProcessesGeneratedFromResource(Resource resource) { private void removeProcess(Process process) { ProcessPackage rtp = (ProcessPackage) getResourceTypePackages().get(ResourceType.BPMN2); - if (rtp != null) rtp.remove(process.getId()); + if (rtp != null) { + rtp.remove(process.getId()); + } } private List getProcessesGeneratedFromResource(Resource resource) { diff --git a/drools-base/src/main/java/org/drools/base/definitions/rule/impl/GlobalImpl.java b/drools-base/src/main/java/org/drools/base/definitions/rule/impl/GlobalImpl.java index 7f0a1aa7195..df5976612dd 100644 --- a/drools-base/src/main/java/org/drools/base/definitions/rule/impl/GlobalImpl.java +++ b/drools-base/src/main/java/org/drools/base/definitions/rule/impl/GlobalImpl.java @@ -18,13 +18,13 @@ */ package org.drools.base.definitions.rule.impl; -import org.kie.api.definition.rule.Global; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import org.kie.api.definition.rule.Global; + public class GlobalImpl implements Global, Externalizable { private String name; @@ -64,13 +64,21 @@ public void setType(String type) { } public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } GlobalImpl global = (GlobalImpl) o; - if (name != null ? !name.equals(global.name) : global.name != null) return false; - if (type != null ? !type.equals(global.type) : global.type != null) return false; + if (name != null ? !name.equals(global.name) : global.name != null) { + return false; + } + if (type != null ? !type.equals(global.type) : global.type != null) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/definitions/rule/impl/QueryImpl.java b/drools-base/src/main/java/org/drools/base/definitions/rule/impl/QueryImpl.java index 316b7343ea1..3001dbc7ef6 100644 --- a/drools-base/src/main/java/org/drools/base/definitions/rule/impl/QueryImpl.java +++ b/drools-base/src/main/java/org/drools/base/definitions/rule/impl/QueryImpl.java @@ -25,9 +25,9 @@ import java.util.function.Function; import org.drools.base.base.DroolsQuery; +import org.drools.base.base.ObjectType; import org.drools.base.base.ValueResolver; import org.drools.base.rule.Declaration; -import org.drools.base.base.ObjectType; import org.kie.api.definition.rule.Query; import org.kie.api.runtime.rule.Match; diff --git a/drools-base/src/main/java/org/drools/base/definitions/rule/impl/RuleImpl.java b/drools-base/src/main/java/org/drools/base/definitions/rule/impl/RuleImpl.java index 93b1e600976..4cef19022b5 100644 --- a/drools-base/src/main/java/org/drools/base/definitions/rule/impl/RuleImpl.java +++ b/drools-base/src/main/java/org/drools/base/definitions/rule/impl/RuleImpl.java @@ -18,6 +18,21 @@ */ package org.drools.base.definitions.rule.impl; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.lang.reflect.Type; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Collections; +import java.util.Deque; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.drools.base.base.EnabledBoolean; import org.drools.base.base.SalienceInteger; import org.drools.base.base.ValueResolver; @@ -43,21 +58,6 @@ import org.kie.api.runtime.rule.AgendaGroup; import org.kie.internal.definition.rule.InternalRule; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.reflect.Type; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collection; -import java.util.Collections; -import java.util.Deque; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class RuleImpl implements Externalizable, Wireable, Dialectable, @@ -355,16 +355,16 @@ public Salience getSalience() { * @return The salience value. */ public int getSalienceValue() { - return getSalience().getValue(); + return getSalience().getValue(); } /** - * Returns true if the rule uses dynamic salience, false otherwise. - * - * @return true if the rule uses dynamic salience, else false. - */ + * Returns true if the rule uses dynamic salience, false otherwise. + * + * @return true if the rule uses dynamic salience, else false. + */ public boolean isSalienceDynamic() { - return getSalience().isDynamic(); + return getSalience().isDynamic(); } /** @@ -698,15 +698,25 @@ public int hashCode() { } public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null || getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null || getClass() != obj.getClass() ) { + return false; + } final RuleImpl other = (RuleImpl) obj; if ( name == null ) { - if ( other.name != null ) return false; - } else if ( !name.equals( other.name ) ) return false; + if ( other.name != null ) { + return false; + } + } else if ( !name.equals( other.name ) ) { + return false; + } if ( pkg == null ) { return other.pkg == null; - } else return pkg.equals(other.pkg); + } else{ + return pkg.equals(other.pkg); + } } public void setSemanticallyValid(final boolean valid) { diff --git a/drools-base/src/main/java/org/drools/base/factmodel/AnnotationDefinition.java b/drools-base/src/main/java/org/drools/base/factmodel/AnnotationDefinition.java index fbd5fb48ba4..ae13c0272d4 100644 --- a/drools-base/src/main/java/org/drools/base/factmodel/AnnotationDefinition.java +++ b/drools-base/src/main/java/org/drools/base/factmodel/AnnotationDefinition.java @@ -68,12 +68,18 @@ public void writeExternal(ObjectOutput out) throws IOException { } public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } AnnotationDefinition that = (AnnotationDefinition) o; - if (name != null ? !name.equals(that.name) : that.name != null) return false; + if (name != null ? !name.equals(that.name) : that.name != null) { + return false; + } return values != null ? values.equals(that.values) : that.values == null; } diff --git a/drools-base/src/main/java/org/drools/base/factmodel/FieldDefinition.java b/drools-base/src/main/java/org/drools/base/factmodel/FieldDefinition.java index ba5d3b7d9f9..a050f61fc42 100755 --- a/drools-base/src/main/java/org/drools/base/factmodel/FieldDefinition.java +++ b/drools-base/src/main/java/org/drools/base/factmodel/FieldDefinition.java @@ -27,9 +27,9 @@ import java.util.List; import java.util.Map; -import org.drools.base.factmodel.traits.Alias; import org.drools.base.base.CoreComponentsBuilder; import org.drools.base.base.FieldAccessor; +import org.drools.base.factmodel.traits.Alias; import org.drools.util.StringUtils; import org.kie.api.definition.type.Annotation; import org.kie.api.definition.type.FactField; @@ -54,8 +54,8 @@ public class FieldDefinition private String initExpr = null; private boolean recursive = false; private Map metaData; - private String getterName = null; - private String setterName = null; + private String getterName = null; + private String setterName = null; private List annotations; @@ -176,9 +176,9 @@ public void setKey(boolean key) { * @return */ public String getReadMethod() { - if ( getterName != null ) { - return getterName; - } + if ( getterName != null ) { + return getterName; + } String prefix; if ( "boolean".equals( this.type.getRawType() ) ) { prefix = "is"; @@ -196,7 +196,7 @@ public String getReadMethod() { */ public String getWriteMethod() { return setterName != null ? setterName : - "set" + this.name.substring( 0, 1 ).toUpperCase() + this.name.substring( 1 ); + "set" + this.name.substring( 0, 1 ).toUpperCase() + this.name.substring( 1 ); } /** @@ -534,19 +534,19 @@ public void setOverriding( String overriding ) { this.overriding = overriding; } - public String getGetterName() { - return getterName; - } + public String getGetterName() { + return getterName; + } - public void setGetterName( String getterName ) { - this.getterName = getterName; - } + public void setGetterName( String getterName ) { + this.getterName = getterName; + } - public String getSetterName() { - return setterName; - } + public String getSetterName() { + return setterName; + } - public void setSetterName( String setterName ) { - this.setterName = setterName; - } + public void setSetterName( String setterName ) { + this.setterName = setterName; + } } diff --git a/drools-base/src/main/java/org/drools/base/factmodel/traits/TraitFieldTMS.java b/drools-base/src/main/java/org/drools/base/factmodel/traits/TraitFieldTMS.java index 7b5f62e41fc..6a475ed2728 100644 --- a/drools-base/src/main/java/org/drools/base/factmodel/traits/TraitFieldTMS.java +++ b/drools-base/src/main/java/org/drools/base/factmodel/traits/TraitFieldTMS.java @@ -18,10 +18,10 @@ */ package org.drools.base.factmodel.traits; -import org.drools.util.bitmask.BitMask; - import java.io.Externalizable; +import org.drools.util.bitmask.BitMask; + public interface TraitFieldTMS extends Externalizable { // Most of the code generation for traits is still in drools-core DefaultBeanClassBuilder so this module needs to know the name of the impl class for traits diff --git a/drools-base/src/main/java/org/drools/base/facttemplates/FactImpl.java b/drools-base/src/main/java/org/drools/base/facttemplates/FactImpl.java index a50ff6a0de7..b081e5817ab 100644 --- a/drools-base/src/main/java/org/drools/base/facttemplates/FactImpl.java +++ b/drools-base/src/main/java/org/drools/base/facttemplates/FactImpl.java @@ -72,8 +72,12 @@ public Map asMap() { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } FactImpl fact = (FactImpl) o; return factTemplate.equals(fact.factTemplate) && values.equals(fact.values); } diff --git a/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateFieldExtractor.java b/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateFieldExtractor.java index 09aa3afe529..bbf498076d0 100644 --- a/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateFieldExtractor.java +++ b/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateFieldExtractor.java @@ -25,8 +25,8 @@ import java.lang.reflect.Method; import org.drools.base.base.ValueResolver; -import org.drools.base.rule.accessor.ReadAccessor; import org.drools.base.base.ValueType; +import org.drools.base.rule.accessor.ReadAccessor; import org.drools.util.ClassUtils; public class FactTemplateFieldExtractor @@ -176,13 +176,21 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } FactTemplateFieldExtractor other = (FactTemplateFieldExtractor) obj; if ( factTemplate == null ) { - if ( other.factTemplate != null ) return false; + if ( other.factTemplate != null ) { + return false; + } } else if ( !factTemplate.equals( other.factTemplate ) ) { return false; } diff --git a/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateImpl.java b/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateImpl.java index 9172fd90987..07622df7cfd 100644 --- a/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateImpl.java +++ b/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateImpl.java @@ -133,8 +133,12 @@ public String toString() { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } FactTemplateImpl that = (FactTemplateImpl) o; return pkg.getName().equals(that.pkg.getName()) && name.equals(that.name) && fields.equals(that.fields); } diff --git a/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateObjectType.java b/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateObjectType.java index 3c8c94453e2..1ba86748546 100644 --- a/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateObjectType.java +++ b/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateObjectType.java @@ -23,8 +23,8 @@ import java.io.ObjectOutput; import java.util.Collection; -import org.drools.base.base.ValueType; import org.drools.base.base.ObjectType; +import org.drools.base.base.ValueType; public class FactTemplateObjectType implements diff --git a/drools-base/src/main/java/org/drools/base/facttemplates/FieldTemplateImpl.java b/drools-base/src/main/java/org/drools/base/facttemplates/FieldTemplateImpl.java index 9a2e63b84d1..e0de97e9bf8 100644 --- a/drools-base/src/main/java/org/drools/base/facttemplates/FieldTemplateImpl.java +++ b/drools-base/src/main/java/org/drools/base/facttemplates/FieldTemplateImpl.java @@ -44,8 +44,9 @@ public FieldTemplateImpl(String name, Class clazz) { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { name = (String)in.readObject(); valueType = (ValueType)in.readObject(); - if (valueType != null) + if (valueType != null) { valueType = ValueType.determineValueType(valueType.getClassType()); + } } public void writeExternal(ObjectOutput out) throws IOException { diff --git a/drools-base/src/main/java/org/drools/base/phreak/ReactiveObject.java b/drools-base/src/main/java/org/drools/base/phreak/ReactiveObject.java index 3b30d2fb64c..c583868b1e4 100644 --- a/drools-base/src/main/java/org/drools/base/phreak/ReactiveObject.java +++ b/drools-base/src/main/java/org/drools/base/phreak/ReactiveObject.java @@ -18,10 +18,10 @@ */ package org.drools.base.phreak; -import org.drools.base.reteoo.BaseTuple; - import java.util.Collection; +import org.drools.base.reteoo.BaseTuple; + public interface ReactiveObject { void addTuple(BaseTuple tuple); void removeTuple(BaseTuple tuple); diff --git a/drools-base/src/main/java/org/drools/base/reteoo/PropertySpecificUtil.java b/drools-base/src/main/java/org/drools/base/reteoo/PropertySpecificUtil.java index f10e75f509c..aa634c35c85 100644 --- a/drools-base/src/main/java/org/drools/base/reteoo/PropertySpecificUtil.java +++ b/drools-base/src/main/java/org/drools/base/reteoo/PropertySpecificUtil.java @@ -22,17 +22,17 @@ import java.util.Collection; import java.util.List; -import org.drools.base.rule.TypeDeclaration; +import org.drools.base.RuleBase; import org.drools.base.base.ClassObjectType; +import org.drools.base.base.ObjectType; import org.drools.base.factmodel.traits.TraitConstants; import org.drools.base.facttemplates.FactTemplateObjectType; -import org.drools.base.base.ObjectType; +import org.drools.base.rule.TypeDeclaration; import org.drools.util.bitmask.AllSetBitMask; import org.drools.util.bitmask.AllSetButLastBitMask; import org.drools.util.bitmask.BitMask; import org.drools.util.bitmask.EmptyBitMask; import org.drools.util.bitmask.EmptyButLastBitMask; -import org.drools.base.RuleBase; public class PropertySpecificUtil { diff --git a/drools-base/src/main/java/org/drools/base/reteoo/SortDeclarations.java b/drools-base/src/main/java/org/drools/base/reteoo/SortDeclarations.java index 2df32bacdac..f1a2d4d84c3 100644 --- a/drools-base/src/main/java/org/drools/base/reteoo/SortDeclarations.java +++ b/drools-base/src/main/java/org/drools/base/reteoo/SortDeclarations.java @@ -18,10 +18,10 @@ */ package org.drools.base.reteoo; -import org.drools.base.rule.Declaration; - import java.util.Comparator; +import org.drools.base.rule.Declaration; + public class SortDeclarations implements Comparator { diff --git a/drools-base/src/main/java/org/drools/base/rule/Collect.java b/drools-base/src/main/java/org/drools/base/rule/Collect.java index 6e665063191..aec86cc46ee 100755 --- a/drools-base/src/main/java/org/drools/base/rule/Collect.java +++ b/drools-base/src/main/java/org/drools/base/rule/Collect.java @@ -18,9 +18,6 @@ */ package org.drools.base.rule; -import org.drools.base.base.ValueResolver; -import org.drools.base.base.ClassObjectType; - import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; @@ -33,6 +30,9 @@ import java.util.Objects; import java.util.Set; +import org.drools.base.base.ClassObjectType; +import org.drools.base.base.ValueResolver; + public class Collect extends ConditionalElement implements PatternSource { diff --git a/drools-base/src/main/java/org/drools/base/rule/ConditionalBranch.java b/drools-base/src/main/java/org/drools/base/rule/ConditionalBranch.java index a7b19154e92..1da1773d8d8 100644 --- a/drools-base/src/main/java/org/drools/base/rule/ConditionalBranch.java +++ b/drools-base/src/main/java/org/drools/base/rule/ConditionalBranch.java @@ -112,9 +112,15 @@ public int hashCode() { */ @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } final ConditionalBranch other = (ConditionalBranch) obj; return condition.equals( other.condition ) && consequence.equals( other.consequence ); } diff --git a/drools-base/src/main/java/org/drools/base/rule/Declaration.java b/drools-base/src/main/java/org/drools/base/rule/Declaration.java index d9f995c648f..12dfa34ba74 100644 --- a/drools-base/src/main/java/org/drools/base/rule/Declaration.java +++ b/drools-base/src/main/java/org/drools/base/rule/Declaration.java @@ -18,21 +18,20 @@ */ package org.drools.base.rule; -import org.drools.base.base.AccessorKeySupplier; -import org.drools.base.base.ValueType; -import org.drools.base.common.DroolsObjectInputStream; -import org.drools.base.reteoo.BaseTuple; -import org.drools.base.rule.accessor.AcceptsReadAccessor; -import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.base.rule.accessor.TupleValueExtractor; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.lang.reflect.Method; +import org.drools.base.base.AccessorKeySupplier; import org.drools.base.base.ValueResolver; +import org.drools.base.base.ValueType; +import org.drools.base.common.DroolsObjectInputStream; +import org.drools.base.reteoo.BaseTuple; +import org.drools.base.rule.accessor.AcceptsReadAccessor; +import org.drools.base.rule.accessor.ReadAccessor; +import org.drools.base.rule.accessor.TupleValueExtractor; import org.kie.api.runtime.rule.FactHandle; import static org.drools.util.ClassUtils.canonicalName; diff --git a/drools-base/src/main/java/org/drools/base/rule/EntryPointId.java b/drools-base/src/main/java/org/drools/base/rule/EntryPointId.java index a1f913fb41b..641f9fe8aed 100644 --- a/drools-base/src/main/java/org/drools/base/rule/EntryPointId.java +++ b/drools-base/src/main/java/org/drools/base/rule/EntryPointId.java @@ -127,13 +127,23 @@ public int hashCode() { */ @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } final EntryPointId other = (EntryPointId) obj; if ( entryPointId == null ) { - if ( other.entryPointId != null ) return false; - } else if ( !entryPointId.equals( other.entryPointId ) ) return false; + if ( other.entryPointId != null ) { + return false; + } + } else if ( !entryPointId.equals( other.entryPointId ) ) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/rule/EvalCondition.java b/drools-base/src/main/java/org/drools/base/rule/EvalCondition.java index 3072e52c924..aca624bb86b 100644 --- a/drools-base/src/main/java/org/drools/base/rule/EvalCondition.java +++ b/drools-base/src/main/java/org/drools/base/rule/EvalCondition.java @@ -28,10 +28,10 @@ import java.util.Map; import org.drools.base.base.ValueResolver; -import org.drools.base.rule.accessor.CompiledInvoker; -import org.drools.base.rule.accessor.Wireable; import org.drools.base.reteoo.BaseTuple; +import org.drools.base.rule.accessor.CompiledInvoker; import org.drools.base.rule.accessor.EvalExpression; +import org.drools.base.rule.accessor.Wireable; public class EvalCondition extends ConditionalElement implements diff --git a/drools-base/src/main/java/org/drools/base/rule/From.java b/drools-base/src/main/java/org/drools/base/rule/From.java index 5f261982025..37e6371d5c9 100644 --- a/drools-base/src/main/java/org/drools/base/rule/From.java +++ b/drools-base/src/main/java/org/drools/base/rule/From.java @@ -26,10 +26,10 @@ import java.util.List; import java.util.Map; -import org.drools.base.rule.accessor.DataProvider; -import org.drools.base.rule.accessor.Wireable; import org.drools.base.base.ClassObjectType; import org.drools.base.facttemplates.Fact; +import org.drools.base.rule.accessor.DataProvider; +import org.drools.base.rule.accessor.Wireable; public class From extends ConditionalElement implements diff --git a/drools-base/src/main/java/org/drools/base/rule/Function.java b/drools-base/src/main/java/org/drools/base/rule/Function.java index ca014a3f82a..4858d4746aa 100644 --- a/drools-base/src/main/java/org/drools/base/rule/Function.java +++ b/drools-base/src/main/java/org/drools/base/rule/Function.java @@ -23,8 +23,8 @@ import java.io.ObjectInput; import java.io.ObjectOutput; -import org.kie.internal.definition.KnowledgeDefinition; import org.kie.api.io.Resource; +import org.kie.internal.definition.KnowledgeDefinition; public class Function implements KnowledgeDefinition, Dialectable, Externalizable { private String name; diff --git a/drools-base/src/main/java/org/drools/base/rule/ImportDeclaration.java b/drools-base/src/main/java/org/drools/base/rule/ImportDeclaration.java index e8d34ab1388..ae544283c26 100644 --- a/drools-base/src/main/java/org/drools/base/rule/ImportDeclaration.java +++ b/drools-base/src/main/java/org/drools/base/rule/ImportDeclaration.java @@ -72,13 +72,23 @@ public int hashCode() { } public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } final ImportDeclaration other = (ImportDeclaration) obj; if ( target == null ) { - if ( other.target != null ) return false; - } else if ( !target.equals( other.target ) ) return false; + if ( other.target != null ) { + return false; + } + } else if ( !target.equals( other.target ) ) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/rule/LogicTransformer.java b/drools-base/src/main/java/org/drools/base/rule/LogicTransformer.java index 1e6e01fb1fa..86607a8ca30 100644 --- a/drools-base/src/main/java/org/drools/base/rule/LogicTransformer.java +++ b/drools-base/src/main/java/org/drools/base/rule/LogicTransformer.java @@ -27,11 +27,11 @@ import java.util.Map; import java.util.Map.Entry; -import org.drools.base.rule.accessor.DataProvider; -import org.drools.base.rule.accessor.DeclarationScopeResolver; import org.drools.base.base.ClassObjectType; import org.drools.base.base.extractors.ArrayElementReader; import org.drools.base.base.extractors.SelfReferenceClassFieldReader; +import org.drools.base.rule.accessor.DataProvider; +import org.drools.base.rule.accessor.DeclarationScopeResolver; import org.drools.base.rule.constraint.Constraint; /** diff --git a/drools-base/src/main/java/org/drools/base/rule/MultiAccumulate.java b/drools-base/src/main/java/org/drools/base/rule/MultiAccumulate.java index 6e47441c85d..b750dabf545 100644 --- a/drools-base/src/main/java/org/drools/base/rule/MultiAccumulate.java +++ b/drools-base/src/main/java/org/drools/base/rule/MultiAccumulate.java @@ -25,11 +25,11 @@ import java.util.Arrays; import org.drools.base.base.ValueResolver; +import org.drools.base.reteoo.AccumulateContextEntry; +import org.drools.base.reteoo.BaseTuple; import org.drools.base.rule.accessor.Accumulator; import org.drools.base.rule.accessor.CompiledInvoker; import org.drools.base.rule.accessor.Wireable; -import org.drools.base.reteoo.AccumulateContextEntry; -import org.drools.base.reteoo.BaseTuple; import org.kie.api.runtime.rule.FactHandle; public class MultiAccumulate extends Accumulate { @@ -239,12 +239,22 @@ public int hashCode() { } public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } MultiAccumulate other = (MultiAccumulate) obj; - if ( !Arrays.equals( accumulators, other.accumulators ) ) return false; - if ( !Arrays.equals( requiredDeclarations, other.requiredDeclarations ) ) return false; + if ( !Arrays.equals( accumulators, other.accumulators ) ) { + return false; + } + if ( !Arrays.equals( requiredDeclarations, other.requiredDeclarations ) ) { + return false; + } if ( source == null ) { return other.source == null; } else { diff --git a/drools-base/src/main/java/org/drools/base/rule/NamedConsequence.java b/drools-base/src/main/java/org/drools/base/rule/NamedConsequence.java index f07becdf525..21cdde73c0b 100644 --- a/drools-base/src/main/java/org/drools/base/rule/NamedConsequence.java +++ b/drools-base/src/main/java/org/drools/base/rule/NamedConsequence.java @@ -137,13 +137,23 @@ public int hashCode() { */ @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } final NamedConsequence other = (NamedConsequence) obj; if ( name == null ) { - if ( other.name != null ) return false; - } else if ( !name.equals( other.name ) ) return false; + if ( other.name != null ) { + return false; + } + } else if ( !name.equals( other.name ) ) { + return false; + } return breaking == other.breaking; } diff --git a/drools-base/src/main/java/org/drools/base/rule/Pattern.java b/drools-base/src/main/java/org/drools/base/rule/Pattern.java index 6c7fc648968..4425cc29ba9 100644 --- a/drools-base/src/main/java/org/drools/base/rule/Pattern.java +++ b/drools-base/src/main/java/org/drools/base/rule/Pattern.java @@ -18,16 +18,6 @@ */ package org.drools.base.rule; -import org.drools.base.rule.accessor.PatternExtractor; -import org.drools.base.rule.constraint.Constraint; -import org.drools.base.base.AcceptsClassObjectType; -import org.drools.base.base.ClassObjectType; -import org.drools.base.base.ObjectType; -import org.drools.base.factmodel.AnnotationDefinition; -import org.drools.base.reteoo.PropertySpecificUtil; -import org.drools.base.rule.constraint.XpathConstraint; -import org.drools.util.bitmask.BitMask; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; @@ -41,8 +31,19 @@ import java.util.Map; import java.util.Objects; import java.util.Set; -import org.drools.wiring.api.util.ClassUtils; + import org.drools.base.RuleBase; +import org.drools.base.base.AcceptsClassObjectType; +import org.drools.base.base.ClassObjectType; +import org.drools.base.base.ObjectType; +import org.drools.base.factmodel.AnnotationDefinition; +import org.drools.base.reteoo.PropertySpecificUtil; +import org.drools.base.rule.accessor.PatternExtractor; +import org.drools.base.rule.constraint.Constraint; +import org.drools.base.rule.constraint.XpathConstraint; +import org.drools.util.bitmask.BitMask; +import org.drools.wiring.api.util.ClassUtils; + import static org.kie.internal.ruleunit.RuleUnitUtil.isDataSource; public class Pattern implements RuleConditionElement, AcceptsClassObjectType, Externalizable { diff --git a/drools-base/src/main/java/org/drools/base/rule/QueryElement.java b/drools-base/src/main/java/org/drools/base/rule/QueryElement.java index ad5ad3b5e80..064df253600 100644 --- a/drools-base/src/main/java/org/drools/base/rule/QueryElement.java +++ b/drools-base/src/main/java/org/drools/base/rule/QueryElement.java @@ -165,22 +165,44 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } QueryElement other = (QueryElement) obj; if ( !Arrays.equals( arguments, - other.arguments ) ) return false; - if ( openQuery != other.openQuery ) return false; - if ( abductive != other.abductive ) return false; + other.arguments ) ) { + return false; + } + if ( openQuery != other.openQuery ) { + return false; + } + if ( abductive != other.abductive ) { + return false; + } if ( queryName == null ) { - if ( other.queryName != null ) return false; - } else if ( !queryName.equals( other.queryName ) ) return false; + if ( other.queryName != null ) { + return false; + } + } else if ( !queryName.equals( other.queryName ) ) { + return false; + } if ( !Arrays.equals( requiredDeclarations, - other.requiredDeclarations ) ) return false; + other.requiredDeclarations ) ) { + return false; + } if ( resultPattern == null ) { - if ( other.resultPattern != null ) return false; - } else if ( !resultPattern.equals( other.resultPattern ) ) return false; + if ( other.resultPattern != null ) { + return false; + } + } else if ( !resultPattern.equals( other.resultPattern ) ) { + return false; + } return true; } } diff --git a/drools-base/src/main/java/org/drools/base/rule/SingleAccumulate.java b/drools-base/src/main/java/org/drools/base/rule/SingleAccumulate.java index 248d53f2450..26c67aee8c9 100644 --- a/drools-base/src/main/java/org/drools/base/rule/SingleAccumulate.java +++ b/drools-base/src/main/java/org/drools/base/rule/SingleAccumulate.java @@ -186,13 +186,25 @@ public int hashCode() { } public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } SingleAccumulate other = (SingleAccumulate) obj; - if ( !accumulator.equals( other.accumulator ) ) return false; - if ( !Arrays.equals( requiredDeclarations, other.requiredDeclarations ) ) return false; - if ( !Arrays.equals( innerDeclarationCache, other.innerDeclarationCache ) ) return false; + if ( !accumulator.equals( other.accumulator ) ) { + return false; + } + if ( !Arrays.equals( requiredDeclarations, other.requiredDeclarations ) ) { + return false; + } + if ( !Arrays.equals( innerDeclarationCache, other.innerDeclarationCache ) ) { + return false; + } if ( source == null ) { return other.source == null; } else { diff --git a/drools-base/src/main/java/org/drools/base/rule/TypeDeclaration.java b/drools-base/src/main/java/org/drools/base/rule/TypeDeclaration.java index 9eb169bb758..78b014161c1 100644 --- a/drools-base/src/main/java/org/drools/base/rule/TypeDeclaration.java +++ b/drools-base/src/main/java/org/drools/base/rule/TypeDeclaration.java @@ -26,12 +26,12 @@ import java.util.List; import org.drools.base.base.ClassObjectType; +import org.drools.base.base.ObjectType; import org.drools.base.factmodel.ClassDefinition; import org.drools.base.factmodel.GeneratedFact; import org.drools.base.facttemplates.FactTemplate; import org.drools.base.facttemplates.FactTemplateObjectType; import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.base.base.ObjectType; import org.drools.base.util.PropertyReactivityUtil; import org.drools.base.util.TimeIntervalParser; import org.drools.util.ClassUtils; @@ -381,13 +381,23 @@ public int hashCode() { */ @Override public boolean equals( Object obj ) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } TypeDeclaration other = (TypeDeclaration) obj; if ( typeName == null ) { - if ( other.typeName != null ) return false; - } else if ( !typeName.equals( other.typeName ) ) return false; + if ( other.typeName != null ) { + return false; + } + } else if ( !typeName.equals( other.typeName ) ) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/rule/TypeMetaInfo.java b/drools-base/src/main/java/org/drools/base/rule/TypeMetaInfo.java index 7b6fe7fdf82..f73e8ef5067 100644 --- a/drools-base/src/main/java/org/drools/base/rule/TypeMetaInfo.java +++ b/drools-base/src/main/java/org/drools/base/rule/TypeMetaInfo.java @@ -18,10 +18,10 @@ */ package org.drools.base.rule; -import org.kie.api.definition.type.Role; - import java.io.Serializable; +import org.kie.api.definition.type.Role; + public class TypeMetaInfo implements Serializable{ private TypeDeclaration.Kind kind; private Role.Type role; diff --git a/drools-base/src/main/java/org/drools/base/rule/WindowDeclaration.java b/drools-base/src/main/java/org/drools/base/rule/WindowDeclaration.java index 656e5d0846e..b132a42cddc 100644 --- a/drools-base/src/main/java/org/drools/base/rule/WindowDeclaration.java +++ b/drools-base/src/main/java/org/drools/base/rule/WindowDeclaration.java @@ -85,23 +85,30 @@ public int hashCode() { @Override public boolean equals( Object obj ) { - if (this == obj) + if (this == obj) { return true; - if (!super.equals( obj )) + } + if (!super.equals( obj )) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } WindowDeclaration other = (WindowDeclaration) obj; if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals( other.name )) + if (other.name != null) { return false; + } + } else if (!name.equals( other.name )) { + return false; + } if (pattern == null) { - if (other.pattern != null) - return false; - } else if (!pattern.equals( other.pattern )) + if (other.pattern != null) { + return false; + } + } else if (!pattern.equals( other.pattern )) { return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/rule/WindowReference.java b/drools-base/src/main/java/org/drools/base/rule/WindowReference.java index f73ed21e7dd..adf63bc85af 100644 --- a/drools-base/src/main/java/org/drools/base/rule/WindowReference.java +++ b/drools-base/src/main/java/org/drools/base/rule/WindowReference.java @@ -115,13 +115,23 @@ public int hashCode() { */ @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } final WindowReference other = (WindowReference) obj; if ( name == null ) { - if ( other.name != null ) return false; - } else if ( !name.equals( other.name ) ) return false; + if ( other.name != null ) { + return false; + } + } else if ( !name.equals( other.name ) ) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/rule/XpathBackReference.java b/drools-base/src/main/java/org/drools/base/rule/XpathBackReference.java index cdc60f456b5..95f1ecc457b 100644 --- a/drools-base/src/main/java/org/drools/base/rule/XpathBackReference.java +++ b/drools-base/src/main/java/org/drools/base/rule/XpathBackReference.java @@ -25,8 +25,8 @@ import java.util.Map; import java.util.Set; -import org.drools.base.rule.accessor.PatternExtractor; import org.drools.base.base.ClassObjectType; +import org.drools.base.rule.accessor.PatternExtractor; public class XpathBackReference { public static final String BACK_REFERENCE_HEAD = "$back$ref$"; diff --git a/drools-base/src/main/java/org/drools/base/rule/accessor/GlobalExtractor.java b/drools-base/src/main/java/org/drools/base/rule/accessor/GlobalExtractor.java index 81a692e782c..58005d255bb 100755 --- a/drools-base/src/main/java/org/drools/base/rule/accessor/GlobalExtractor.java +++ b/drools-base/src/main/java/org/drools/base/rule/accessor/GlobalExtractor.java @@ -18,6 +18,12 @@ */ package org.drools.base.rule.accessor; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.lang.reflect.Method; + import org.drools.base.base.AcceptsClassObjectType; import org.drools.base.base.ClassObjectType; import org.drools.base.base.ObjectType; @@ -26,12 +32,6 @@ import org.drools.base.facttemplates.Fact; import org.drools.util.ClassUtils; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.reflect.Method; - /** * This is a global variable extractor used to get a global variable value */ diff --git a/drools-base/src/main/java/org/drools/base/rule/accessor/PatternExtractor.java b/drools-base/src/main/java/org/drools/base/rule/accessor/PatternExtractor.java index a7b3d64cb70..e6f07b3a614 100644 --- a/drools-base/src/main/java/org/drools/base/rule/accessor/PatternExtractor.java +++ b/drools-base/src/main/java/org/drools/base/rule/accessor/PatternExtractor.java @@ -24,10 +24,10 @@ import java.io.ObjectOutput; import java.lang.reflect.Method; -import org.drools.base.base.ValueResolver; import org.drools.base.base.AcceptsClassObjectType; import org.drools.base.base.ClassObjectType; import org.drools.base.base.ObjectType; +import org.drools.base.base.ValueResolver; import org.drools.base.base.extractors.BaseObjectClassFieldReader; import org.drools.base.facttemplates.Fact; import org.drools.util.ClassUtils; diff --git a/drools-base/src/main/java/org/drools/base/rule/accessor/ReadAccessor.java b/drools-base/src/main/java/org/drools/base/rule/accessor/ReadAccessor.java index b5e42660f00..3576a06dd60 100644 --- a/drools-base/src/main/java/org/drools/base/rule/accessor/ReadAccessor.java +++ b/drools-base/src/main/java/org/drools/base/rule/accessor/ReadAccessor.java @@ -18,11 +18,11 @@ */ package org.drools.base.rule.accessor; +import java.lang.reflect.Method; + import org.drools.base.base.ValueResolver; import org.drools.base.base.ValueType; -import java.lang.reflect.Method; - /** * A public interface for Read accessors */ diff --git a/drools-base/src/main/java/org/drools/base/rule/consequence/ConsequenceContext.java b/drools-base/src/main/java/org/drools/base/rule/consequence/ConsequenceContext.java index 90e0cb7234d..8d830c39bcb 100644 --- a/drools-base/src/main/java/org/drools/base/rule/consequence/ConsequenceContext.java +++ b/drools-base/src/main/java/org/drools/base/rule/consequence/ConsequenceContext.java @@ -18,6 +18,9 @@ */ package org.drools.base.rule.consequence; +import java.util.Collection; +import java.util.Map; + import org.drools.base.beliefsystem.Mode; import org.drools.base.factmodel.traits.Thing; import org.drools.base.factmodel.traits.TraitableBean; @@ -31,9 +34,6 @@ import org.kie.api.runtime.rule.Match; import org.kie.api.runtime.rule.RuleContext; -import java.util.Collection; -import java.util.Map; - public interface ConsequenceContext extends RuleContext { void reset(); diff --git a/drools-base/src/main/java/org/drools/base/rule/constraint/BetaNodeFieldConstraint.java b/drools-base/src/main/java/org/drools/base/rule/constraint/BetaNodeFieldConstraint.java index 55ba7e3c26c..103da6ae55e 100644 --- a/drools-base/src/main/java/org/drools/base/rule/constraint/BetaNodeFieldConstraint.java +++ b/drools-base/src/main/java/org/drools/base/rule/constraint/BetaNodeFieldConstraint.java @@ -18,8 +18,8 @@ */ package org.drools.base.rule.constraint; -import org.drools.base.rule.ContextEntry; import org.drools.base.reteoo.BaseTuple; +import org.drools.base.rule.ContextEntry; import org.kie.api.runtime.rule.FactHandle; public interface BetaNodeFieldConstraint diff --git a/drools-base/src/main/java/org/drools/base/rule/constraint/Constraint.java b/drools-base/src/main/java/org/drools/base/rule/constraint/Constraint.java index 8665c314fcc..55975e16d52 100644 --- a/drools-base/src/main/java/org/drools/base/rule/constraint/Constraint.java +++ b/drools-base/src/main/java/org/drools/base/rule/constraint/Constraint.java @@ -24,14 +24,14 @@ import java.util.List; import java.util.Optional; +import org.drools.base.RuleBase; +import org.drools.base.RuleBuildContext; +import org.drools.base.base.ObjectType; +import org.drools.base.rule.Declaration; import org.drools.base.rule.Pattern; import org.drools.base.rule.RuleComponent; -import org.drools.base.rule.Declaration; -import org.drools.base.base.ObjectType; import org.drools.util.bitmask.AllSetButLastBitMask; import org.drools.util.bitmask.BitMask; -import org.drools.base.RuleBase; -import org.drools.base.RuleBuildContext; //import static org.drools.core.reteoo.PropertySpecificUtil.allSetButTraitBitMask; diff --git a/drools-base/src/main/java/org/drools/base/rule/constraint/QueryNameConstraint.java b/drools-base/src/main/java/org/drools/base/rule/constraint/QueryNameConstraint.java index 577b48f3e46..0d48a352387 100644 --- a/drools-base/src/main/java/org/drools/base/rule/constraint/QueryNameConstraint.java +++ b/drools-base/src/main/java/org/drools/base/rule/constraint/QueryNameConstraint.java @@ -25,14 +25,14 @@ import org.drools.base.base.DroolsQuery; import org.drools.base.base.ValueResolver; -import org.drools.base.rule.accessor.FieldValue; -import org.drools.base.util.index.ConstraintTypeOperator; import org.drools.base.base.field.ObjectFieldImpl; import org.drools.base.rule.Declaration; import org.drools.base.rule.IndexableConstraint; import org.drools.base.rule.accessor.AcceptsReadAccessor; +import org.drools.base.rule.accessor.FieldValue; import org.drools.base.rule.accessor.ReadAccessor; import org.drools.base.util.FieldIndex; +import org.drools.base.util.index.ConstraintTypeOperator; import org.kie.api.KieBaseConfiguration; import org.kie.api.runtime.rule.FactHandle; diff --git a/drools-base/src/main/java/org/drools/base/rule/constraint/XpathConstraint.java b/drools-base/src/main/java/org/drools/base/rule/constraint/XpathConstraint.java index 6f15fb1e0d8..585658ccedf 100644 --- a/drools-base/src/main/java/org/drools/base/rule/constraint/XpathConstraint.java +++ b/drools-base/src/main/java/org/drools/base/rule/constraint/XpathConstraint.java @@ -33,20 +33,20 @@ import java.util.List; import java.util.Objects; +import org.drools.base.base.AcceptsClassObjectType; +import org.drools.base.base.ClassObjectType; import org.drools.base.base.DroolsQuery; +import org.drools.base.base.ObjectType; import org.drools.base.base.ValueResolver; +import org.drools.base.phreak.ReactiveObject; +import org.drools.base.reteoo.BaseTuple; import org.drools.base.rule.ContextEntry; +import org.drools.base.rule.Declaration; import org.drools.base.rule.From; +import org.drools.base.rule.MutableTypeConstraint; import org.drools.base.rule.accessor.DataProvider; import org.drools.base.rule.accessor.PatternExtractor; import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.base.base.ClassObjectType; -import org.drools.base.phreak.ReactiveObject; -import org.drools.base.reteoo.BaseTuple; -import org.drools.base.rule.Declaration; -import org.drools.base.rule.MutableTypeConstraint; -import org.drools.base.base.AcceptsClassObjectType; -import org.drools.base.base.ObjectType; import org.drools.util.ClassUtils; import org.kie.api.runtime.rule.FactHandle; diff --git a/drools-base/src/main/java/org/drools/base/ruleunit/RuleUnitDescriptionLoader.java b/drools-base/src/main/java/org/drools/base/ruleunit/RuleUnitDescriptionLoader.java index 2ccc28e846f..ab55b525f41 100644 --- a/drools-base/src/main/java/org/drools/base/ruleunit/RuleUnitDescriptionLoader.java +++ b/drools-base/src/main/java/org/drools/base/ruleunit/RuleUnitDescriptionLoader.java @@ -24,8 +24,8 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.base.definitions.rule.impl.RuleImpl; import org.kie.internal.ruleunit.RuleUnitComponentFactory; import org.kie.internal.ruleunit.RuleUnitDescription; diff --git a/drools-base/src/main/java/org/drools/base/time/Interval.java b/drools-base/src/main/java/org/drools/base/time/Interval.java index 61b62f28441..85a8db207fa 100644 --- a/drools-base/src/main/java/org/drools/base/time/Interval.java +++ b/drools-base/src/main/java/org/drools/base/time/Interval.java @@ -113,12 +113,22 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } Interval other = (Interval) obj; - if ( lowerBound != other.lowerBound ) return false; - if ( upperBound != other.upperBound ) return false; + if ( lowerBound != other.lowerBound ) { + return false; + } + if ( upperBound != other.upperBound ) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/time/impl/Timer.java b/drools-base/src/main/java/org/drools/base/time/impl/Timer.java index 13bf753bd37..429dade8776 100644 --- a/drools-base/src/main/java/org/drools/base/time/impl/Timer.java +++ b/drools-base/src/main/java/org/drools/base/time/impl/Timer.java @@ -21,9 +21,9 @@ import java.io.Serializable; import org.drools.base.base.ValueResolver; -import org.drools.base.rule.RuleComponent; import org.drools.base.reteoo.BaseTuple; import org.drools.base.rule.Declaration; +import org.drools.base.rule.RuleComponent; import org.drools.base.rule.RuleConditionElement; import org.drools.base.time.JobHandle; import org.drools.base.time.Trigger; diff --git a/drools-base/src/main/java/org/drools/base/util/FieldIndex.java b/drools-base/src/main/java/org/drools/base/util/FieldIndex.java index 4b9cfedf3d4..011eb240ee8 100644 --- a/drools-base/src/main/java/org/drools/base/util/FieldIndex.java +++ b/drools-base/src/main/java/org/drools/base/util/FieldIndex.java @@ -18,16 +18,16 @@ */ package org.drools.base.util; -import org.drools.base.reteoo.BaseTuple; -import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.base.rule.accessor.TupleValueExtractor; -import org.drools.base.rule.Declaration; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import org.drools.base.reteoo.BaseTuple; +import org.drools.base.rule.Declaration; +import org.drools.base.rule.accessor.ReadAccessor; +import org.drools.base.rule.accessor.TupleValueExtractor; + public class FieldIndex implements Externalizable { private static final long serialVersionUID = 510l; diff --git a/drools-base/src/main/java/org/drools/base/util/index/IndexUtil.java b/drools-base/src/main/java/org/drools/base/util/index/IndexUtil.java index eb09a4ce81b..a867f9f7693 100644 --- a/drools-base/src/main/java/org/drools/base/util/index/IndexUtil.java +++ b/drools-base/src/main/java/org/drools/base/util/index/IndexUtil.java @@ -18,11 +18,11 @@ */ package org.drools.base.util.index; -import org.drools.base.rule.accessor.TupleValueExtractor; import org.drools.base.base.ValueType; import org.drools.base.reteoo.NodeTypeEnums; import org.drools.base.rule.IndexableConstraint; import org.drools.base.rule.accessor.ReadAccessor; +import org.drools.base.rule.accessor.TupleValueExtractor; import org.drools.base.rule.constraint.BetaNodeFieldConstraint; import org.kie.api.KieBaseConfiguration; import org.kie.api.conf.BetaRangeIndexOption; From 40d726e9045cd64ef0fdd86b7312843ac67963a7 Mon Sep 17 00:00:00 2001 From: Paolo Bizzarri Date: Tue, 31 Oct 2023 10:07:38 +0100 Subject: [PATCH 22/41] [kie-issues #658] Remove checkstyle warnings from drools core module (#5569) * Fixed order of imports * Fixed more checkstyle issues --- .../core/ActivationListenerFactory.java | 2 +- .../drools/core/FlowSessionConfiguration.java | 8 +- .../core/QueryActivationListenerFactory.java | 2 +- .../org/drools/core/QueryResultsImpl.java | 2 +- .../org/drools/core/QueryResultsRowImpl.java | 2 +- .../core/RuleActivationListenerFactory.java | 2 +- .../drools/core/RuleBaseConfiguration.java | 18 +++-- .../drools/core/RuleSessionConfiguration.java | 8 +- .../org/drools/core/SessionConfiguration.java | 8 +- .../org/drools/core/TimerJobFactoryType.java | 16 ++-- .../java/org/drools/core/WorkingMemory.java | 2 +- .../drools/core/WorkingMemoryEntryPoint.java | 7 +- .../core/base/AbstractQueryViewListener.java | 2 +- .../org/drools/core/base/ArrayElements.java | 17 +++- .../core/base/ClassFieldAccessorCache.java | 20 +++-- .../org/drools/core/base/DroolsQueryImpl.java | 2 +- .../InternalViewChangedEventListener.java | 2 +- .../base/NonCloningQueryViewListener.java | 1 - .../core/base/QueryRowWithSubruleIndex.java | 1 - .../base/RuleNameEndsWithAgendaFilter.java | 1 + .../core/base/RuleNameEqualsAgendaFilter.java | 1 + .../base/RuleNameMatchesAgendaFilter.java | 1 + .../base/RuleNameStartsWithAgendaFilter.java | 1 + .../org/drools/core/base/TraitHelper.java | 4 +- .../base/accumulators/CollectAccumulator.java | 9 +-- .../JavaAccumulatorFunctionExecutor.java | 8 +- .../core/common/AgendaGroupQueueImpl.java | 12 +-- .../core/common/AgendaGroupsManager.java | 10 +-- .../java/org/drools/core/common/BaseNode.java | 12 +-- .../core/common/ClassAwareObjectStore.java | 8 +- .../core/common/ConcurrentNodeMemories.java | 8 +- .../core/common/DefaultBetaConstraints.java | 2 +- .../drools/core/common/DefaultFactHandle.java | 19 ++--- .../core/common/DisconnectedFactHandle.java | 29 +++---- .../core/common/EmptyBetaConstraints.java | 2 +- .../drools/core/common/EntryPointFactory.java | 2 +- .../drools/core/common/InternalAgenda.java | 6 +- .../core/common/InternalAgendaGroup.java | 4 +- .../core/common/InternalFactHandle.java | 8 +- .../core/common/InternalWorkingMemory.java | 2 +- .../common/InternalWorkingMemoryActions.java | 4 +- .../InternalWorkingMemoryEntryPoint.java | 2 +- .../core/common/MultipleBetaConstraint.java | 6 +- .../org/drools/core/common/ObjectStore.java | 4 +- .../core/common/ObjectStoreWrapper.java | 2 - .../ObjectTypeConfigurationRegistry.java | 4 +- .../core/common/PhreakPropagationContext.java | 12 +-- .../PhreakPropagationContextFactory.java | 2 +- .../core/common/PropagationContext.java | 4 +- .../common/PropagationContextFactory.java | 2 +- .../core/common/QueryElementFactHandle.java | 15 ++-- .../org/drools/core/common/ReteEvaluator.java | 8 +- .../core/common/SingleBetaConstraints.java | 2 +- .../common/TupleStartEqualsConstraint.java | 2 +- .../core/concurrent/ExecutorProviderImpl.java | 1 + .../concurrent/ParallelGroupEvaluator.java | 10 +-- .../conflict/RuleAgendaConflictResolver.java | 2 +- .../drools/core/event/AgendaEventSupport.java | 2 +- .../event/DefaultAgendaEventListener.java | 6 +- .../core/event/RuleRuntimeEventSupport.java | 2 +- .../rule/impl/SerializableActivation.java | 6 +- .../core/impl/ActivationsManagerImpl.java | 14 ++-- .../core/impl/InternalKieContainer.java | 26 +++--- .../drools/core/impl/InternalRuleBase.java | 16 ++-- .../drools/core/impl/KnowledgeBaseImpl.java | 42 +++++----- .../impl/WorkingMemoryReteExpireAction.java | 10 +-- .../management/DroolsManagementAgent.java | 66 ++++++++------- .../management/KnowledgeBaseMonitoring.java | 5 +- .../marshalling/MarshallerReaderContext.java | 4 +- .../org/drools/core/marshalling/TupleKey.java | 16 +++- .../core/phreak/AbstractReactiveObject.java | 6 +- .../phreak/BuildtimeSegmentUtilities.java | 2 +- .../core/phreak/EagerPhreakBuilder.java | 20 ++--- .../drools/core/phreak/LazyPhreakBuilder.java | 20 ++--- .../drools/core/phreak/LeftTupleEntry.java | 2 +- .../core/phreak/PhreakAccumulateNode.java | 12 +-- .../core/phreak/PhreakAsyncReceiveNode.java | 2 +- .../core/phreak/PhreakAsyncSendNode.java | 8 +- .../drools/core/phreak/PhreakEvalNode.java | 2 +- .../drools/core/phreak/PhreakExistsNode.java | 4 +- .../drools/core/phreak/PhreakFromNode.java | 10 +-- .../drools/core/phreak/PhreakGroupByNode.java | 6 +- .../drools/core/phreak/PhreakJoinNode.java | 2 +- .../org/drools/core/phreak/PhreakNotNode.java | 4 +- .../drools/core/phreak/PhreakQueryNode.java | 2 +- .../core/phreak/PhreakRuleTerminalNode.java | 6 +- .../phreak/PhreakSubnetworkNotExistsNode.java | 4 +- .../drools/core/phreak/PhreakTimerNode.java | 6 +- .../drools/core/phreak/PropagationEntry.java | 12 +-- .../core/phreak/ReactiveCollection.java | 2 +- .../org/drools/core/phreak/ReactiveList.java | 2 +- .../core/phreak/ReactiveObjectUtil.java | 6 +- .../drools/core/phreak/RightTupleEntry.java | 2 +- .../drools/core/phreak/RuleAgendaItem.java | 2 +- .../core/phreak/RuleNetworkEvaluator.java | 7 +- .../drools/core/phreak/SegmentPropagator.java | 2 +- .../org/drools/core/phreak/StackEntry.java | 2 +- .../phreak/SynchronizedPropagationList.java | 16 ++-- .../org/drools/core/phreak/TupleEntry.java | 2 +- .../core/phreak/TupleEvaluationUtil.java | 2 +- .../process/impl/DefaultWorkItemManager.java | 17 ++-- .../core/reteoo/AbstractTerminalNode.java | 10 +-- .../org/drools/core/reteoo/AbstractTuple.java | 2 +- .../drools/core/reteoo/AccumulateNode.java | 22 ++--- .../core/reteoo/AgendaComponentFactory.java | 2 +- .../org/drools/core/reteoo/AlphaNode.java | 4 +- .../drools/core/reteoo/AlphaTerminalNode.java | 4 +- .../drools/core/reteoo/AsyncReceiveNode.java | 8 +- .../org/drools/core/reteoo/AsyncSendNode.java | 8 +- .../org/drools/core/reteoo/BetaMemory.java | 2 +- .../java/org/drools/core/reteoo/BetaNode.java | 14 ++-- .../core/reteoo/ClassObjectTypeConf.java | 19 ++--- .../reteoo/CompositeLeftTupleSinkAdapter.java | 6 +- .../reteoo/CompositeObjectSinkAdapter.java | 24 +++--- ...positePartitionAwareObjectSinkAdapter.java | 16 ++-- .../reteoo/ConditionalBranchEvaluator.java | 2 +- .../core/reteoo/ConditionalBranchNode.java | 2 +- .../reteoo/EmptyLeftTupleSinkAdapter.java | 6 +- .../core/reteoo/EmptyObjectSinkAdapter.java | 8 +- .../drools/core/reteoo/EntryPointNode.java | 12 +-- .../drools/core/reteoo/EvalConditionNode.java | 6 +- .../org/drools/core/reteoo/ExistsNode.java | 2 +- .../core/reteoo/FactTemplateTypeConf.java | 10 +-- .../java/org/drools/core/reteoo/FromNode.java | 14 ++-- .../java/org/drools/core/reteoo/JoinNode.java | 2 +- .../core/reteoo/LeftInputAdapterNode.java | 12 +-- .../org/drools/core/reteoo/LeftTuple.java | 10 +-- .../org/drools/core/reteoo/LeftTupleSink.java | 2 +- .../core/reteoo/LeftTupleSinkPropagator.java | 4 +- .../drools/core/reteoo/LeftTupleSource.java | 6 +- .../core/reteoo/ModifyPreviousTuples.java | 4 +- .../java/org/drools/core/reteoo/NodeSet.java | 4 +- .../drools/core/reteoo/NotNodeLeftTuple.java | 4 +- .../org/drools/core/reteoo/ObjectSink.java | 2 +- .../core/reteoo/ObjectSinkPropagator.java | 4 +- .../org/drools/core/reteoo/ObjectSource.java | 4 +- .../drools/core/reteoo/ObjectTypeConf.java | 6 +- .../drools/core/reteoo/ObjectTypeNode.java | 26 +++--- .../org/drools/core/reteoo/PathMemory.java | 4 +- .../drools/core/reteoo/QueryElementNode.java | 24 ++++-- .../drools/core/reteoo/QueryTerminalNode.java | 4 +- .../drools/core/reteoo/ReactiveFromNode.java | 8 +- .../java/org/drools/core/reteoo/Rete.java | 12 +-- .../org/drools/core/reteoo/ReteDumper.java | 2 +- .../core/reteoo/ReteObjectTypeNode.java | 4 +- .../org/drools/core/reteoo/ReteooBuilder.java | 12 +-- .../core/reteoo/RightInputAdapterNode.java | 10 +-- .../org/drools/core/reteoo/RightTuple.java | 2 +- .../drools/core/reteoo/RightTupleImpl.java | 2 +- .../drools/core/reteoo/RightTupleSink.java | 2 +- .../org/drools/core/reteoo/RuleBuilder.java | 4 +- .../drools/core/reteoo/RuleTerminalNode.java | 6 +- .../reteoo/RuleTerminalNodeLeftTuple.java | 22 +++-- .../core/reteoo/RuntimeComponentFactory.java | 6 +- .../org/drools/core/reteoo/SegmentMemory.java | 12 +-- .../reteoo/SingleLeftTupleSinkAdapter.java | 2 +- .../core/reteoo/SingleObjectSinkAdapter.java | 2 +- .../drools/core/reteoo/SubnetworkTuple.java | 4 +- .../org/drools/core/reteoo/TimerNode.java | 10 +-- .../java/org/drools/core/reteoo/Tuple.java | 6 +- .../org/drools/core/reteoo/WindowNode.java | 10 +-- .../reteoo/builder/AccumulateBuilder.java | 10 +-- .../reteoo/builder/AsyncReceiveBuilder.java | 4 +- .../core/reteoo/builder/AsyncSendBuilder.java | 6 +- .../builder/BetaNodeConstraintFactory.java | 2 +- .../BetaNodeConstraintFactoryImpl.java | 2 +- .../core/reteoo/builder/BuildContext.java | 14 ++-- .../core/reteoo/builder/BuildUtils.java | 18 ++--- .../core/reteoo/builder/CollectBuilder.java | 14 ++-- .../builder/ConditionalBranchBuilder.java | 6 +- .../reteoo/builder/EntryPointBuilder.java | 4 +- .../core/reteoo/builder/EvalBuilder.java | 2 +- .../core/reteoo/builder/FromBuilder.java | 6 +- .../reteoo/builder/GroupElementBuilder.java | 12 +-- .../core/reteoo/builder/NodeFactory.java | 4 +- .../core/reteoo/builder/PatternBuilder.java | 8 +- .../reteoo/builder/PhreakNodeFactory.java | 6 +- .../reteoo/builder/QueryElementBuilder.java | 2 +- .../reteoo/builder/ReactiveFromBuilder.java | 8 +- .../reteoo/builder/ReteooRuleBuilder.java | 8 +- .../core/reteoo/builder/TimerBuilder.java | 4 +- .../builder/WindowReferenceBuilder.java | 2 +- .../org/drools/core/rule/BehaviorContext.java | 6 +- .../org/drools/core/rule/BehaviorManager.java | 2 +- .../core/rule/JavaDialectRuntimeData.java | 36 ++++----- .../drools/core/rule/SlidingTimeWindow.java | 4 +- .../core/rule/accessor/FactHandleFactory.java | 2 +- .../core/rule/consequence/InternalMatch.java | 4 +- .../core/runtime/rule/impl/LiveQueryImpl.java | 2 +- ...nQueryViewChangedEventListenerAdapter.java | 2 +- .../core/runtime/rule/impl/RowAdapter.java | 15 ++-- .../drools/core/time/TimerExpressionUtil.java | 4 +- .../org/drools/core/time/impl/BaseTimer.java | 10 +-- .../time/impl/CompositeMaxDurationTimer.java | 6 +- .../impl/CompositeMaxDurationTrigger.java | 4 +- .../drools/core/time/impl/CronExpression.java | 3 +- .../org/drools/core/time/impl/CronTimer.java | 44 +++++++--- .../drools/core/time/impl/CronTrigger.java | 6 +- .../core/time/impl/DefaultJobHandle.java | 20 +++-- .../impl/DefaultTimerJobFactoryManager.java | 4 +- .../time/impl/DefaultTimerJobInstance.java | 12 +-- .../drools/core/time/impl/DurationTimer.java | 26 +++--- .../time/impl/ExpressionIntervalTimer.java | 44 +++++++--- .../drools/core/time/impl/IntervalTimer.java | 42 +++++++--- .../core/time/impl/JDKTimerService.java | 16 ++-- .../core/time/impl/PseudoClockScheduler.java | 20 ++--- ...eadSafeTrackableTimeJobFactoryManager.java | 4 +- .../time/impl/TimerJobFactoryManager.java | 8 +- .../core/time/impl/TimerJobInstance.java | 4 +- .../impl/TrackableTimeJobFactoryManager.java | 12 +-- .../drools/core/util/AbstractHashTable.java | 24 ++++-- .../java/org/drools/core/util/ArrayQueue.java | 1 - .../org/drools/core/util/BinaryHeapQueue.java | 3 +- .../org/drools/core/util/KieFunctions.java | 80 ++++++++++++++----- .../java/org/drools/core/util/LinkedList.java | 7 +- .../org/drools/core/util/TupleRBTree.java | 76 ++++++++++++------ .../util/index/AbstractTupleIndexTree.java | 2 +- .../core/util/index/AlphaRangeIndex.java | 4 +- .../drools/core/util/index/IndexFactory.java | 4 +- .../org/drools/core/util/index/IndexSpec.java | 6 +- .../drools/core/util/index/RangeIndex.java | 18 +++-- .../core/util/index/TupleIndexHashTable.java | 9 +-- .../org/drools/core/util/index/TupleList.java | 3 +- .../core/base/ClassTypeResolverTest.java | 4 +- .../base/accumulators/VarianceNaNTest.java | 8 +- .../core/common/DroolsObjectIOTest.java | 2 +- .../FactTemplateFieldExtractorTest.java | 2 +- .../ByteArrayResourceSerializationTest.java | 38 ++++----- .../impl/ByteArrayResourceToStringTest.java | 10 +-- .../org/drools/core/reteoo/BaseNodeTest.java | 4 +- .../reteoo/DefaultFactHandleFactoryTest.java | 2 +- .../drools/core/reteoo/MockLeftTupleSink.java | 2 +- .../drools/core/reteoo/MockObjectSink.java | 4 +- .../drools/core/reteoo/MockObjectSource.java | 8 +- .../core/reteoo/MockRightTupleSink.java | 2 +- .../drools/core/reteoo/NodeTypeEnumTest.java | 6 +- .../drools/core/reteoo/ReteComparator.java | 2 +- .../drools/core/reteoo/ReteMemoryChecker.java | 2 +- .../core/reteoo/TupleIterationTest.java | 3 +- .../reteoo/builder/ReteooRuleBuilderTest.java | 8 +- .../org/drools/core/test/model/Address.java | 36 ++++++--- .../org/drools/core/test/model/Person.java | 76 +++++++++++++----- .../impl/CompositeMaxDurationTimerTest.java | 4 +- .../core/time/impl/JDKTimerServiceTest.java | 4 +- .../time/impl/PseudoClockSchedulerTest.java | 4 +- .../drools/core/util/BinaryHeapQueueTest.java | 12 +-- .../drools/core/util/DroolsStreamUtils.java | 3 +- .../java/org/drools/core/util/HeapDump.java | 3 +- .../util/IndexedHashtableIteratorTest.java | 6 +- .../org/drools/core/util/IoUtilsTest.java | 10 +-- .../drools/core/util/KeyStoreHelperTest.java | 1 + .../drools/core/util/KieFunctionsTest.java | 3 +- .../drools/core/util/LeftTupleRBTreeTest.java | 4 +- .../drools/core/util/index/IndexUtilTest.java | 10 +-- 254 files changed, 1280 insertions(+), 967 deletions(-) diff --git a/drools-core/src/main/java/org/drools/core/ActivationListenerFactory.java b/drools-core/src/main/java/org/drools/core/ActivationListenerFactory.java index 78c62a7e2a9..8fff8bf89eb 100644 --- a/drools-core/src/main/java/org/drools/core/ActivationListenerFactory.java +++ b/drools-core/src/main/java/org/drools/core/ActivationListenerFactory.java @@ -19,10 +19,10 @@ package org.drools.core; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.GroupElement; import org.drools.core.reteoo.LeftTupleSource; import org.drools.core.reteoo.TerminalNode; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.rule.GroupElement; public interface ActivationListenerFactory { TerminalNode createActivationListener(int id, diff --git a/drools-core/src/main/java/org/drools/core/FlowSessionConfiguration.java b/drools-core/src/main/java/org/drools/core/FlowSessionConfiguration.java index 51499fc5b56..3716b5f1a52 100644 --- a/drools-core/src/main/java/org/drools/core/FlowSessionConfiguration.java +++ b/drools-core/src/main/java/org/drools/core/FlowSessionConfiguration.java @@ -198,8 +198,12 @@ public final String getInternalProperty(String name) { @Override public final boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } FlowSessionConfiguration that = (FlowSessionConfiguration) o; diff --git a/drools-core/src/main/java/org/drools/core/QueryActivationListenerFactory.java b/drools-core/src/main/java/org/drools/core/QueryActivationListenerFactory.java index 5d35b854829..a302c678ddc 100644 --- a/drools-core/src/main/java/org/drools/core/QueryActivationListenerFactory.java +++ b/drools-core/src/main/java/org/drools/core/QueryActivationListenerFactory.java @@ -19,11 +19,11 @@ package org.drools.core; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.GroupElement; import org.drools.core.reteoo.CoreComponentFactory; import org.drools.core.reteoo.LeftTupleSource; import org.drools.core.reteoo.TerminalNode; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.rule.GroupElement; public class QueryActivationListenerFactory implements ActivationListenerFactory { public static final QueryActivationListenerFactory INSTANCE = new QueryActivationListenerFactory(); diff --git a/drools-core/src/main/java/org/drools/core/QueryResultsImpl.java b/drools-core/src/main/java/org/drools/core/QueryResultsImpl.java index fd2cf7a6cf7..3c0e2a7551c 100644 --- a/drools-core/src/main/java/org/drools/core/QueryResultsImpl.java +++ b/drools-core/src/main/java/org/drools/core/QueryResultsImpl.java @@ -26,9 +26,9 @@ import java.util.NoSuchElementException; import java.util.Set; +import org.drools.base.rule.Declaration; import org.drools.core.base.QueryRowWithSubruleIndex; import org.drools.core.common.ReteEvaluator; -import org.drools.base.rule.Declaration; import org.kie.api.runtime.rule.QueryResults; import org.kie.api.runtime.rule.QueryResultsRow; diff --git a/drools-core/src/main/java/org/drools/core/QueryResultsRowImpl.java b/drools-core/src/main/java/org/drools/core/QueryResultsRowImpl.java index 53d599f8e89..ef82c7dcb3e 100644 --- a/drools-core/src/main/java/org/drools/core/QueryResultsRowImpl.java +++ b/drools-core/src/main/java/org/drools/core/QueryResultsRowImpl.java @@ -20,10 +20,10 @@ import java.util.Map; +import org.drools.base.rule.Declaration; import org.drools.core.base.QueryRowWithSubruleIndex; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.ReteEvaluator; -import org.drools.base.rule.Declaration; import org.kie.api.runtime.rule.FactHandle; import org.kie.api.runtime.rule.QueryResultsRow; diff --git a/drools-core/src/main/java/org/drools/core/RuleActivationListenerFactory.java b/drools-core/src/main/java/org/drools/core/RuleActivationListenerFactory.java index 2e5193fdb31..2c688146cec 100644 --- a/drools-core/src/main/java/org/drools/core/RuleActivationListenerFactory.java +++ b/drools-core/src/main/java/org/drools/core/RuleActivationListenerFactory.java @@ -19,11 +19,11 @@ package org.drools.core; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.GroupElement; import org.drools.core.reteoo.CoreComponentFactory; import org.drools.core.reteoo.LeftTupleSource; import org.drools.core.reteoo.TerminalNode; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.rule.GroupElement; public class RuleActivationListenerFactory implements ActivationListenerFactory { diff --git a/drools-core/src/main/java/org/drools/core/RuleBaseConfiguration.java b/drools-core/src/main/java/org/drools/core/RuleBaseConfiguration.java index 0f4d0bde74d..214e8ea8ceb 100755 --- a/drools-core/src/main/java/org/drools/core/RuleBaseConfiguration.java +++ b/drools-core/src/main/java/org/drools/core/RuleBaseConfiguration.java @@ -18,6 +18,13 @@ */ package org.drools.core; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.util.HashMap; +import java.util.Map; + import org.drools.base.rule.consequence.ConflictResolver; import org.drools.core.runtime.rule.impl.DefaultConsequenceExceptionHandler; import org.drools.util.StringUtils; @@ -52,13 +59,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.HashMap; -import java.util.Map; - /** * RuleBaseConfiguration * @@ -878,7 +878,9 @@ private AssertBehaviour(final int value) { } public boolean equals(Object obj) { - if (obj == this) return true; + if (obj == this) { + return true; + } else if (obj instanceof AssertBehaviour) { AssertBehaviour that = (AssertBehaviour) obj; diff --git a/drools-core/src/main/java/org/drools/core/RuleSessionConfiguration.java b/drools-core/src/main/java/org/drools/core/RuleSessionConfiguration.java index b03f4d5212d..b0713b20c6a 100644 --- a/drools-core/src/main/java/org/drools/core/RuleSessionConfiguration.java +++ b/drools-core/src/main/java/org/drools/core/RuleSessionConfiguration.java @@ -293,8 +293,12 @@ public String getInternalProperty(String name) { @Override public final boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } RuleSessionConfiguration that = (RuleSessionConfiguration) o; diff --git a/drools-core/src/main/java/org/drools/core/SessionConfiguration.java b/drools-core/src/main/java/org/drools/core/SessionConfiguration.java index a087e43644b..38f5ce77346 100644 --- a/drools-core/src/main/java/org/drools/core/SessionConfiguration.java +++ b/drools-core/src/main/java/org/drools/core/SessionConfiguration.java @@ -283,8 +283,12 @@ public TimerService createTimerService() { @Override public final boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } SessionConfiguration that = (SessionConfiguration) o; diff --git a/drools-core/src/main/java/org/drools/core/TimerJobFactoryType.java b/drools-core/src/main/java/org/drools/core/TimerJobFactoryType.java index ebba16257a4..0ff7a94061c 100644 --- a/drools-core/src/main/java/org/drools/core/TimerJobFactoryType.java +++ b/drools-core/src/main/java/org/drools/core/TimerJobFactoryType.java @@ -60,16 +60,16 @@ public TimerJobFactoryManager createInstance() { private static final Map registry = new HashMap<>(); static { - register(DEFAULT); - register(TRACKABLE); - register(THREAD_SAFE_TRACKABLE); - register(JPA); + register(DEFAULT); + register(TRACKABLE); + register(THREAD_SAFE_TRACKABLE); + register(JPA); } public static void register(TimerJobFactoryType type) { - if (type != null && type.getId() != null) { - registry.put(type.getId(), type); - } + if (type != null && type.getId() != null) { + registry.put(type.getId(), type); + } } public abstract TimerJobFactoryManager createInstance(); @@ -95,7 +95,7 @@ public String getId() { public static TimerJobFactoryType resolveTimerJobFactoryType( String id ) { TimerJobFactoryType type = registry.get(id); if (type != null) { - return type; + return type; } throw new IllegalArgumentException( "Illegal enum value '" + id + "' for TimerJobFactoryType" ); } diff --git a/drools-core/src/main/java/org/drools/core/WorkingMemory.java b/drools-core/src/main/java/org/drools/core/WorkingMemory.java index 5991a5dac57..8460485386a 100644 --- a/drools-core/src/main/java/org/drools/core/WorkingMemory.java +++ b/drools-core/src/main/java/org/drools/core/WorkingMemory.java @@ -22,9 +22,9 @@ import java.util.Iterator; import java.util.Map; +import org.drools.base.rule.accessor.GlobalResolver; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.ReteEvaluator; -import org.drools.base.rule.accessor.GlobalResolver; import org.kie.api.runtime.Environment; import org.kie.api.runtime.process.ProcessInstance; import org.kie.api.runtime.process.WorkItemManager; diff --git a/drools-core/src/main/java/org/drools/core/WorkingMemoryEntryPoint.java b/drools-core/src/main/java/org/drools/core/WorkingMemoryEntryPoint.java index 982ce46fd3d..0c23b6e4bd6 100644 --- a/drools-core/src/main/java/org/drools/core/WorkingMemoryEntryPoint.java +++ b/drools-core/src/main/java/org/drools/core/WorkingMemoryEntryPoint.java @@ -18,17 +18,16 @@ */ package org.drools.core; - +import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.EntryPointId; import org.drools.core.common.ObjectStore; import org.drools.core.common.ObjectTypeConfigurationRegistry; import org.drools.core.common.ReteEvaluator; -import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.core.impl.InternalRuleBase; import org.drools.core.reteoo.EntryPointNode; import org.drools.core.reteoo.TerminalNode; -import org.drools.base.rule.EntryPointId; -import org.drools.core.rule.consequence.InternalMatch; import org.drools.core.rule.accessor.FactHandleFactory; +import org.drools.core.rule.consequence.InternalMatch; import org.drools.util.bitmask.BitMask; import org.kie.api.runtime.rule.EntryPoint; import org.kie.api.runtime.rule.FactHandle; diff --git a/drools-core/src/main/java/org/drools/core/base/AbstractQueryViewListener.java b/drools-core/src/main/java/org/drools/core/base/AbstractQueryViewListener.java index 1ad3b510187..d22b3345579 100644 --- a/drools-core/src/main/java/org/drools/core/base/AbstractQueryViewListener.java +++ b/drools-core/src/main/java/org/drools/core/base/AbstractQueryViewListener.java @@ -21,8 +21,8 @@ import java.util.ArrayList; import java.util.List; -import org.drools.core.common.ReteEvaluator; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.core.common.ReteEvaluator; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.LeftTupleNode; import org.drools.core.reteoo.QueryTerminalNode; diff --git a/drools-core/src/main/java/org/drools/core/base/ArrayElements.java b/drools-core/src/main/java/org/drools/core/base/ArrayElements.java index 6c17e910f7e..9301d93da1a 100644 --- a/drools-core/src/main/java/org/drools/core/base/ArrayElements.java +++ b/drools-core/src/main/java/org/drools/core/base/ArrayElements.java @@ -19,6 +19,7 @@ package org.drools.core.base; import java.util.Arrays; + import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -59,12 +60,20 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } ArrayElements other = (ArrayElements) obj; if ( !Arrays.equals( elements, - other.elements ) ) return false; + other.elements ) ) { + return false; + } return true; } diff --git a/drools-core/src/main/java/org/drools/core/base/ClassFieldAccessorCache.java b/drools-core/src/main/java/org/drools/core/base/ClassFieldAccessorCache.java index ca875d550e9..4c53370b1c0 100644 --- a/drools-core/src/main/java/org/drools/core/base/ClassFieldAccessorCache.java +++ b/drools-core/src/main/java/org/drools/core/base/ClassFieldAccessorCache.java @@ -84,13 +84,23 @@ public int hashCode() { } public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( !(obj instanceof ClassObjectTypeKey) ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( !(obj instanceof ClassObjectTypeKey) ) { + return false; + } ClassObjectTypeKey other = (ClassObjectTypeKey) obj; if ( cls == null ) { - if ( other.cls != null ) return false; - } else if ( !cls.equals( other.cls ) ) return false; + if ( other.cls != null ) { + return false; + } + } else if ( !cls.equals( other.cls ) ) { + return false; + } return event == other.event; } diff --git a/drools-core/src/main/java/org/drools/core/base/DroolsQueryImpl.java b/drools-core/src/main/java/org/drools/core/base/DroolsQueryImpl.java index a86713ad743..29346afad93 100644 --- a/drools-core/src/main/java/org/drools/core/base/DroolsQueryImpl.java +++ b/drools-core/src/main/java/org/drools/core/base/DroolsQueryImpl.java @@ -22,6 +22,7 @@ import java.util.List; import org.drools.base.base.DroolsQuery; +import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.core.common.TupleSets; import org.drools.core.common.WorkingMemoryAction; import org.drools.core.phreak.StackEntry; @@ -29,7 +30,6 @@ import org.drools.core.reteoo.LeftTupleSink; import org.drools.core.reteoo.PathMemory; import org.drools.core.reteoo.QueryElementNode.QueryElementNodeMemory; -import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.core.util.index.TupleList; import org.kie.api.runtime.rule.Variable; diff --git a/drools-core/src/main/java/org/drools/core/base/InternalViewChangedEventListener.java b/drools-core/src/main/java/org/drools/core/base/InternalViewChangedEventListener.java index 4fbd73e2cd4..53e4627de1d 100644 --- a/drools-core/src/main/java/org/drools/core/base/InternalViewChangedEventListener.java +++ b/drools-core/src/main/java/org/drools/core/base/InternalViewChangedEventListener.java @@ -20,8 +20,8 @@ import java.util.List; -import org.drools.core.common.ReteEvaluator; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.core.common.ReteEvaluator; import org.drools.core.reteoo.LeftTuple; public interface InternalViewChangedEventListener { diff --git a/drools-core/src/main/java/org/drools/core/base/NonCloningQueryViewListener.java b/drools-core/src/main/java/org/drools/core/base/NonCloningQueryViewListener.java index 65f3eaacc35..3f431fdbf34 100644 --- a/drools-core/src/main/java/org/drools/core/base/NonCloningQueryViewListener.java +++ b/drools-core/src/main/java/org/drools/core/base/NonCloningQueryViewListener.java @@ -18,7 +18,6 @@ */ package org.drools.core.base; -import org.drools.core.common.InternalFactHandle; import org.kie.api.runtime.rule.FactHandle; public class NonCloningQueryViewListener diff --git a/drools-core/src/main/java/org/drools/core/base/QueryRowWithSubruleIndex.java b/drools-core/src/main/java/org/drools/core/base/QueryRowWithSubruleIndex.java index c68b169e55b..c7c0cb480fc 100644 --- a/drools-core/src/main/java/org/drools/core/base/QueryRowWithSubruleIndex.java +++ b/drools-core/src/main/java/org/drools/core/base/QueryRowWithSubruleIndex.java @@ -18,7 +18,6 @@ */ package org.drools.core.base; -import org.drools.core.common.InternalFactHandle; import org.kie.api.runtime.rule.FactHandle; diff --git a/drools-core/src/main/java/org/drools/core/base/RuleNameEndsWithAgendaFilter.java b/drools-core/src/main/java/org/drools/core/base/RuleNameEndsWithAgendaFilter.java index 6b5556a52c4..50ea110d72a 100644 --- a/drools-core/src/main/java/org/drools/core/base/RuleNameEndsWithAgendaFilter.java +++ b/drools-core/src/main/java/org/drools/core/base/RuleNameEndsWithAgendaFilter.java @@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; + import org.kie.api.runtime.rule.AgendaFilter; import org.kie.api.runtime.rule.Match; diff --git a/drools-core/src/main/java/org/drools/core/base/RuleNameEqualsAgendaFilter.java b/drools-core/src/main/java/org/drools/core/base/RuleNameEqualsAgendaFilter.java index 3401e228162..398651d8249 100644 --- a/drools-core/src/main/java/org/drools/core/base/RuleNameEqualsAgendaFilter.java +++ b/drools-core/src/main/java/org/drools/core/base/RuleNameEqualsAgendaFilter.java @@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; + import org.kie.api.runtime.rule.AgendaFilter; import org.kie.api.runtime.rule.Match; diff --git a/drools-core/src/main/java/org/drools/core/base/RuleNameMatchesAgendaFilter.java b/drools-core/src/main/java/org/drools/core/base/RuleNameMatchesAgendaFilter.java index d535a3be948..55a226bd99e 100644 --- a/drools-core/src/main/java/org/drools/core/base/RuleNameMatchesAgendaFilter.java +++ b/drools-core/src/main/java/org/drools/core/base/RuleNameMatchesAgendaFilter.java @@ -26,6 +26,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; + import org.kie.api.runtime.rule.AgendaFilter; import org.kie.api.runtime.rule.Match; diff --git a/drools-core/src/main/java/org/drools/core/base/RuleNameStartsWithAgendaFilter.java b/drools-core/src/main/java/org/drools/core/base/RuleNameStartsWithAgendaFilter.java index 53047b62f34..285b2602674 100644 --- a/drools-core/src/main/java/org/drools/core/base/RuleNameStartsWithAgendaFilter.java +++ b/drools-core/src/main/java/org/drools/core/base/RuleNameStartsWithAgendaFilter.java @@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; + import org.kie.api.runtime.rule.AgendaFilter; import org.kie.api.runtime.rule.Match; diff --git a/drools-core/src/main/java/org/drools/core/base/TraitHelper.java b/drools-core/src/main/java/org/drools/core/base/TraitHelper.java index a91aa7df474..9e86e1e3a21 100644 --- a/drools-core/src/main/java/org/drools/core/base/TraitHelper.java +++ b/drools-core/src/main/java/org/drools/core/base/TraitHelper.java @@ -20,14 +20,14 @@ import java.util.Collection; -import org.drools.core.common.InternalFactHandle; +import org.drools.base.beliefsystem.Mode; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.factmodel.traits.Thing; import org.drools.base.factmodel.traits.TraitableBean; +import org.drools.core.common.InternalFactHandle; import org.drools.core.reteoo.TerminalNode; import org.drools.core.rule.consequence.InternalMatch; import org.drools.util.bitmask.BitMask; -import org.drools.base.beliefsystem.Mode; public interface TraitHelper { diff --git a/drools-core/src/main/java/org/drools/core/base/accumulators/CollectAccumulator.java b/drools-core/src/main/java/org/drools/core/base/accumulators/CollectAccumulator.java index 78b864cc513..80a19d19a1e 100644 --- a/drools-core/src/main/java/org/drools/core/base/accumulators/CollectAccumulator.java +++ b/drools-core/src/main/java/org/drools/core/base/accumulators/CollectAccumulator.java @@ -18,11 +18,6 @@ */ package org.drools.core.base.accumulators; -import org.drools.core.reteoo.LeftTuple; -import org.drools.base.rule.Collect; -import org.drools.base.rule.Declaration; -import org.drools.base.rule.accessor.Accumulator; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; @@ -32,6 +27,10 @@ import org.drools.base.base.ValueResolver; import org.drools.base.reteoo.BaseTuple; +import org.drools.base.rule.Collect; +import org.drools.base.rule.Declaration; +import org.drools.base.rule.accessor.Accumulator; +import org.drools.core.reteoo.LeftTuple; import org.kie.api.runtime.rule.FactHandle; /** diff --git a/drools-core/src/main/java/org/drools/core/base/accumulators/JavaAccumulatorFunctionExecutor.java b/drools-core/src/main/java/org/drools/core/base/accumulators/JavaAccumulatorFunctionExecutor.java index 5fd28ac8eb1..0044a97189b 100644 --- a/drools-core/src/main/java/org/drools/core/base/accumulators/JavaAccumulatorFunctionExecutor.java +++ b/drools-core/src/main/java/org/drools/core/base/accumulators/JavaAccumulatorFunctionExecutor.java @@ -161,8 +161,12 @@ public Object createWorkingMemoryContext() { @Override public boolean equals( Object o ) { - if ( this == o ) return true; - if ( o == null || getClass() != o.getClass() ) return false; + if ( this == o ) { + return true; + } + if ( o == null || getClass() != o.getClass() ) { + return false; + } JavaAccumulatorFunctionExecutor that = (JavaAccumulatorFunctionExecutor) o; diff --git a/drools-core/src/main/java/org/drools/core/common/AgendaGroupQueueImpl.java b/drools-core/src/main/java/org/drools/core/common/AgendaGroupQueueImpl.java index 4c2df781496..985d42b237b 100644 --- a/drools-core/src/main/java/org/drools/core/common/AgendaGroupQueueImpl.java +++ b/drools-core/src/main/java/org/drools/core/common/AgendaGroupQueueImpl.java @@ -18,6 +18,12 @@ */ package org.drools.core.common; +import java.io.IOException; +import java.util.Collection; +import java.util.Map; +import java.util.PriorityQueue; +import java.util.concurrent.ConcurrentHashMap; + import org.drools.core.conflict.RuleAgendaConflictResolver; import org.drools.core.impl.InternalRuleBase; import org.drools.core.marshalling.MarshallerReaderContext; @@ -27,12 +33,6 @@ import org.drools.core.util.Queue; import org.drools.core.util.QueueFactory; -import java.io.IOException; -import java.util.Collection; -import java.util.Map; -import java.util.PriorityQueue; -import java.util.concurrent.ConcurrentHashMap; - /** * AgendaGroup implementation that uses a PriorityQueue to prioritise the evaluation of added * ActivationQueues. The AgendaGroup also maintains a Map of ActivationQueues 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 dc5d8225265..84f5a354eb5 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 @@ -18,10 +18,6 @@ */ package org.drools.core.common; -import org.drools.core.impl.InternalRuleBase; -import org.drools.core.phreak.RuleAgendaItem; -import org.drools.core.reteoo.RuntimeComponentFactory; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; @@ -36,6 +32,10 @@ import java.util.Map; import java.util.stream.Collectors; +import org.drools.core.impl.InternalRuleBase; +import org.drools.core.phreak.RuleAgendaItem; +import org.drools.core.reteoo.RuntimeComponentFactory; + public interface AgendaGroupsManager extends Externalizable { void reset(boolean clearForRecency); @@ -472,7 +472,7 @@ public void deactivateRuleFlowGroup(final String name) { return; } this.workingMemory.getAgendaEventSupport().fireBeforeRuleFlowGroupDeactivated( group, this.workingMemory ); - while ( removeGroup(group) ); // keep removing while group is on the stack + while ( removeGroup(group) ) {}; // keep removing while group is on the stack group.setActive( false ); innerDeactiveRuleFlowGroup( group ); this.workingMemory.getAgendaEventSupport().fireAfterRuleFlowGroupDeactivated( group, this.workingMemory ); diff --git a/drools-core/src/main/java/org/drools/core/common/BaseNode.java b/drools-core/src/main/java/org/drools/core/common/BaseNode.java index 08f5375e1b8..b966c33a4ab 100644 --- a/drools-core/src/main/java/org/drools/core/common/BaseNode.java +++ b/drools-core/src/main/java/org/drools/core/common/BaseNode.java @@ -18,6 +18,12 @@ */ package org.drools.core.common; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + import org.drools.base.common.NetworkNode; import org.drools.base.common.RuleBasePartitionId; import org.drools.base.reteoo.BaseTerminalNode; @@ -32,12 +38,6 @@ import org.drools.core.reteoo.builder.BuildContext; import org.kie.api.definition.rule.Rule; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - /** * The base class for all Rete nodes. */ diff --git a/drools-core/src/main/java/org/drools/core/common/ClassAwareObjectStore.java b/drools-core/src/main/java/org/drools/core/common/ClassAwareObjectStore.java index 99a95e86b07..19eb9b2b03d 100644 --- a/drools-core/src/main/java/org/drools/core/common/ClassAwareObjectStore.java +++ b/drools-core/src/main/java/org/drools/core/common/ClassAwareObjectStore.java @@ -18,10 +18,6 @@ */ package org.drools.core.common; -import org.drools.base.factmodel.traits.CoreWrapper; -import org.kie.api.runtime.ClassObjectFilter; -import org.kie.api.runtime.ObjectFilter; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; @@ -36,6 +32,10 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.locks.Lock; +import org.drools.base.factmodel.traits.CoreWrapper; +import org.kie.api.runtime.ClassObjectFilter; +import org.kie.api.runtime.ObjectFilter; + public class ClassAwareObjectStore implements Externalizable, ObjectStore { private Lock lock; diff --git a/drools-core/src/main/java/org/drools/core/common/ConcurrentNodeMemories.java b/drools-core/src/main/java/org/drools/core/common/ConcurrentNodeMemories.java index b1199fdafd7..da7d6c4886f 100644 --- a/drools-core/src/main/java/org/drools/core/common/ConcurrentNodeMemories.java +++ b/drools-core/src/main/java/org/drools/core/common/ConcurrentNodeMemories.java @@ -18,16 +18,16 @@ */ package org.drools.core.common; -import org.drools.core.impl.InternalRuleBase; -import org.drools.core.reteoo.SegmentMemory; -import org.kie.internal.runtime.StatefulKnowledgeSession; - import java.util.HashSet; import java.util.Set; import java.util.concurrent.atomic.AtomicReferenceArray; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; +import org.drools.core.impl.InternalRuleBase; +import org.drools.core.reteoo.SegmentMemory; +import org.kie.internal.runtime.StatefulKnowledgeSession; + /** * A concurrent implementation for the node memories interface */ diff --git a/drools-core/src/main/java/org/drools/core/common/DefaultBetaConstraints.java b/drools-core/src/main/java/org/drools/core/common/DefaultBetaConstraints.java index e67af52c930..9260152db1c 100644 --- a/drools-core/src/main/java/org/drools/core/common/DefaultBetaConstraints.java +++ b/drools-core/src/main/java/org/drools/core/common/DefaultBetaConstraints.java @@ -35,8 +35,8 @@ import org.drools.core.reteoo.BetaMemory; import org.drools.core.reteoo.Tuple; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.util.bitmask.BitMask; import org.drools.core.util.index.IndexFactory; +import org.drools.util.bitmask.BitMask; import org.kie.api.runtime.rule.FactHandle; import org.kie.internal.conf.IndexPrecedenceOption; diff --git a/drools-core/src/main/java/org/drools/core/common/DefaultFactHandle.java b/drools-core/src/main/java/org/drools/core/common/DefaultFactHandle.java index c3a8820eec1..f78edfeecd1 100644 --- a/drools-core/src/main/java/org/drools/core/common/DefaultFactHandle.java +++ b/drools-core/src/main/java/org/drools/core/common/DefaultFactHandle.java @@ -18,6 +18,16 @@ */ package org.drools.core.common; +import java.util.Objects; +import java.util.function.Consumer; +import java.util.function.Predicate; +import java.util.stream.Stream; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + import org.drools.base.factmodel.traits.TraitTypeEnum; import org.drools.base.rule.EntryPointId; import org.drools.core.WorkingMemoryEntryPoint; @@ -31,15 +41,6 @@ import org.drools.util.StringUtils; import org.kie.api.runtime.rule.FactHandle; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.Objects; -import java.util.function.Consumer; -import java.util.function.Predicate; -import java.util.stream.Stream; - /** * Implementation of FactHandle. */ diff --git a/drools-core/src/main/java/org/drools/core/common/DisconnectedFactHandle.java b/drools-core/src/main/java/org/drools/core/common/DisconnectedFactHandle.java index 2710924f631..f3b76bf1444 100644 --- a/drools-core/src/main/java/org/drools/core/common/DisconnectedFactHandle.java +++ b/drools-core/src/main/java/org/drools/core/common/DisconnectedFactHandle.java @@ -18,6 +18,21 @@ */ package org.drools.core.common; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.util.function.Consumer; +import java.util.function.Predicate; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlSeeAlso; + import org.drools.base.factmodel.traits.TraitTypeEnum; import org.drools.base.rule.EntryPointId; import org.drools.core.WorkingMemoryEntryPoint; @@ -28,20 +43,6 @@ import org.drools.core.reteoo.Tuple; import org.kie.api.runtime.rule.FactHandle; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlSeeAlso; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.function.Consumer; -import java.util.function.Predicate; - @XmlRootElement(name="disconnected-fact-handle") @XmlAccessorType(XmlAccessType.NONE) @XmlSeeAlso({ArrayElements.class}) diff --git a/drools-core/src/main/java/org/drools/core/common/EmptyBetaConstraints.java b/drools-core/src/main/java/org/drools/core/common/EmptyBetaConstraints.java index 4665629fc78..803b64e00a4 100644 --- a/drools-core/src/main/java/org/drools/core/common/EmptyBetaConstraints.java +++ b/drools-core/src/main/java/org/drools/core/common/EmptyBetaConstraints.java @@ -31,8 +31,8 @@ import org.drools.core.reteoo.BetaMemory; import org.drools.core.reteoo.Tuple; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.util.bitmask.BitMask; import org.drools.core.util.index.TupleList; +import org.drools.util.bitmask.BitMask; import org.kie.api.runtime.rule.FactHandle; import static org.drools.base.reteoo.PropertySpecificUtil.getEmptyPropertyReactiveMask; diff --git a/drools-core/src/main/java/org/drools/core/common/EntryPointFactory.java b/drools-core/src/main/java/org/drools/core/common/EntryPointFactory.java index b4a980cfafa..14db19ce5b8 100644 --- a/drools-core/src/main/java/org/drools/core/common/EntryPointFactory.java +++ b/drools-core/src/main/java/org/drools/core/common/EntryPointFactory.java @@ -18,9 +18,9 @@ */ package org.drools.core.common; +import org.drools.base.rule.EntryPointId; import org.drools.core.EntryPointsManager; import org.drools.core.reteoo.EntryPointNode; -import org.drools.base.rule.EntryPointId; public interface EntryPointFactory { diff --git a/drools-core/src/main/java/org/drools/core/common/InternalAgenda.java b/drools-core/src/main/java/org/drools/core/common/InternalAgenda.java index e5b8c8bd621..a7e1755c90d 100644 --- a/drools-core/src/main/java/org/drools/core/common/InternalAgenda.java +++ b/drools-core/src/main/java/org/drools/core/common/InternalAgenda.java @@ -18,13 +18,13 @@ */ package org.drools.core.common; +import java.util.Iterator; +import java.util.Map; + import org.drools.core.phreak.PropagationEntry; import org.kie.api.runtime.rule.Agenda; import org.kie.api.runtime.rule.AgendaFilter; -import java.util.Iterator; -import java.util.Map; - public interface InternalAgenda extends Agenda, ActivationsManager { /** diff --git a/drools-core/src/main/java/org/drools/core/common/InternalAgendaGroup.java b/drools-core/src/main/java/org/drools/core/common/InternalAgendaGroup.java index 8042993155d..5982dbfca08 100644 --- a/drools-core/src/main/java/org/drools/core/common/InternalAgendaGroup.java +++ b/drools-core/src/main/java/org/drools/core/common/InternalAgendaGroup.java @@ -18,11 +18,11 @@ */ package org.drools.core.common; -import org.drools.core.phreak.RuleAgendaItem; - import java.util.Collection; import java.util.Map; +import org.drools.core.phreak.RuleAgendaItem; + public interface InternalAgendaGroup extends org.kie.api.runtime.rule.AgendaGroup { /** diff --git a/drools-core/src/main/java/org/drools/core/common/InternalFactHandle.java b/drools-core/src/main/java/org/drools/core/common/InternalFactHandle.java index ba247a32492..27f7af36c1c 100644 --- a/drools-core/src/main/java/org/drools/core/common/InternalFactHandle.java +++ b/drools-core/src/main/java/org/drools/core/common/InternalFactHandle.java @@ -18,6 +18,10 @@ */ package org.drools.core.common; +import java.io.Serializable; +import java.util.function.Consumer; +import java.util.function.Predicate; + import org.drools.base.common.RuleBasePartitionId; import org.drools.base.factmodel.traits.TraitTypeEnum; import org.drools.base.rule.EntryPointId; @@ -27,10 +31,6 @@ import org.drools.core.reteoo.Tuple; import org.kie.api.runtime.rule.FactHandle; -import java.io.Serializable; -import java.util.function.Consumer; -import java.util.function.Predicate; - public interface InternalFactHandle extends FactHandle, Cloneable, Serializable { diff --git a/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemory.java b/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemory.java index 950a6c7f602..cf4594691b4 100644 --- a/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemory.java +++ b/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemory.java @@ -28,8 +28,8 @@ import org.drools.core.event.AgendaEventSupport; import org.drools.core.event.RuleRuntimeEventSupport; import org.drools.core.phreak.PropagationEntry; -import org.drools.core.runtime.process.InternalProcessRuntime; import org.drools.core.rule.consequence.InternalMatch; +import org.drools.core.runtime.process.InternalProcessRuntime; import org.kie.api.runtime.Channel; import org.kie.api.runtime.rule.EntryPoint; diff --git a/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemoryActions.java b/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemoryActions.java index dfa1f316901..86727367d7d 100644 --- a/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemoryActions.java +++ b/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemoryActions.java @@ -20,15 +20,15 @@ import java.util.Collection; -import org.drools.core.WorkingMemoryEntryPoint; +import org.drools.base.beliefsystem.Mode; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.factmodel.traits.Thing; import org.drools.base.factmodel.traits.TraitableBean; +import org.drools.core.WorkingMemoryEntryPoint; import org.drools.core.reteoo.TerminalNode; import org.drools.core.rule.consequence.InternalMatch; import org.drools.util.bitmask.BitMask; import org.kie.api.runtime.rule.FactHandle; -import org.drools.base.beliefsystem.Mode; public interface InternalWorkingMemoryActions extends diff --git a/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemoryEntryPoint.java b/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemoryEntryPoint.java index ebf3a72985c..9d4164d0244 100644 --- a/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemoryEntryPoint.java +++ b/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemoryEntryPoint.java @@ -18,9 +18,9 @@ */ package org.drools.core.common; +import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.core.WorkingMemoryEntryPoint; import org.drools.core.base.TraitHelper; -import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.core.reteoo.ObjectTypeConf; import org.drools.core.reteoo.TerminalNode; import org.drools.core.rule.consequence.InternalMatch; diff --git a/drools-core/src/main/java/org/drools/core/common/MultipleBetaConstraint.java b/drools-core/src/main/java/org/drools/core/common/MultipleBetaConstraint.java index 99e76625ffb..d082fc12cb0 100644 --- a/drools-core/src/main/java/org/drools/core/common/MultipleBetaConstraint.java +++ b/drools-core/src/main/java/org/drools/core/common/MultipleBetaConstraint.java @@ -22,12 +22,12 @@ import java.io.ObjectInput; import java.io.ObjectOutput; -import org.drools.core.RuleBaseConfiguration; -import org.drools.core.reteoo.BetaMemory; -import org.drools.core.reteoo.builder.BuildContext; import org.drools.base.rule.ContextEntry; import org.drools.base.rule.IndexableConstraint; import org.drools.base.rule.constraint.BetaNodeFieldConstraint; +import org.drools.core.RuleBaseConfiguration; +import org.drools.core.reteoo.BetaMemory; +import org.drools.core.reteoo.builder.BuildContext; import org.drools.core.util.index.IndexFactory; import org.kie.internal.conf.IndexPrecedenceOption; diff --git a/drools-core/src/main/java/org/drools/core/common/ObjectStore.java b/drools-core/src/main/java/org/drools/core/common/ObjectStore.java index 2ea6c0157eb..cd00af5ed43 100644 --- a/drools-core/src/main/java/org/drools/core/common/ObjectStore.java +++ b/drools-core/src/main/java/org/drools/core/common/ObjectStore.java @@ -18,11 +18,11 @@ */ package org.drools.core.common; +import java.util.Iterator; + import org.kie.api.internal.utils.KieService; import org.kie.api.runtime.ObjectFilter; -import java.util.Iterator; - public interface ObjectStore extends KieService { int size(); diff --git a/drools-core/src/main/java/org/drools/core/common/ObjectStoreWrapper.java b/drools-core/src/main/java/org/drools/core/common/ObjectStoreWrapper.java index 42390ff52d1..79237d9f9b7 100644 --- a/drools-core/src/main/java/org/drools/core/common/ObjectStoreWrapper.java +++ b/drools-core/src/main/java/org/drools/core/common/ObjectStoreWrapper.java @@ -19,9 +19,7 @@ package org.drools.core.common; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.Iterator; import java.util.List; diff --git a/drools-core/src/main/java/org/drools/core/common/ObjectTypeConfigurationRegistry.java b/drools-core/src/main/java/org/drools/core/common/ObjectTypeConfigurationRegistry.java index 7bfdc976948..8821488803d 100644 --- a/drools-core/src/main/java/org/drools/core/common/ObjectTypeConfigurationRegistry.java +++ b/drools-core/src/main/java/org/drools/core/common/ObjectTypeConfigurationRegistry.java @@ -24,16 +24,16 @@ import java.util.concurrent.ConcurrentHashMap; import org.drools.base.base.ClassObjectType; +import org.drools.base.base.ObjectType; import org.drools.base.facttemplates.Fact; import org.drools.base.facttemplates.FactImpl; +import org.drools.base.rule.EntryPointId; import org.drools.core.impl.InternalRuleBase; import org.drools.core.reteoo.ClassObjectTypeConf; import org.drools.core.reteoo.FactTemplateTypeConf; import org.drools.core.reteoo.ObjectTypeConf; -import org.drools.base.rule.EntryPointId; import org.drools.core.reteoo.RuleTerminalNodeLeftTuple; import org.drools.core.rule.consequence.InternalMatch; -import org.drools.base.base.ObjectType; public class ObjectTypeConfigurationRegistry implements Serializable { private static final long serialVersionUID = 510l; diff --git a/drools-core/src/main/java/org/drools/core/common/PhreakPropagationContext.java b/drools-core/src/main/java/org/drools/core/common/PhreakPropagationContext.java index 76122e30f60..9ed03254444 100644 --- a/drools-core/src/main/java/org/drools/core/common/PhreakPropagationContext.java +++ b/drools-core/src/main/java/org/drools/core/common/PhreakPropagationContext.java @@ -18,6 +18,12 @@ */ package org.drools.core.common; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.util.Collections; +import java.util.List; + import org.drools.base.base.ClassObjectType; import org.drools.base.base.ObjectType; import org.drools.base.definitions.InternalKnowledgePackage; @@ -30,12 +36,6 @@ import org.drools.util.bitmask.BitMask; import org.kie.api.runtime.rule.FactHandle; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Collections; -import java.util.List; - import static org.drools.base.reteoo.PropertySpecificUtil.allSetBitMask; import static org.drools.base.reteoo.PropertySpecificUtil.getEmptyPropertyReactiveMask; import static org.drools.base.reteoo.PropertySpecificUtil.isAllSetPropertyReactiveMask; diff --git a/drools-core/src/main/java/org/drools/core/common/PhreakPropagationContextFactory.java b/drools-core/src/main/java/org/drools/core/common/PhreakPropagationContextFactory.java index 514bb19edf9..ddaf282802c 100644 --- a/drools-core/src/main/java/org/drools/core/common/PhreakPropagationContextFactory.java +++ b/drools-core/src/main/java/org/drools/core/common/PhreakPropagationContextFactory.java @@ -21,10 +21,10 @@ import java.io.Serializable; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.EntryPointId; import org.drools.core.marshalling.MarshallerReaderContext; import org.drools.core.reteoo.RuntimeComponentFactory; import org.drools.core.reteoo.TerminalNode; -import org.drools.base.rule.EntryPointId; import org.drools.util.bitmask.BitMask; public class PhreakPropagationContextFactory implements PropagationContextFactory, Serializable { diff --git a/drools-core/src/main/java/org/drools/core/common/PropagationContext.java b/drools-core/src/main/java/org/drools/core/common/PropagationContext.java index fa5a672b472..e70c2d050c5 100644 --- a/drools-core/src/main/java/org/drools/core/common/PropagationContext.java +++ b/drools-core/src/main/java/org/drools/core/common/PropagationContext.java @@ -18,6 +18,8 @@ */ package org.drools.core.common; +import java.io.Externalizable; + import org.drools.base.base.ObjectType; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.rule.EntryPointId; @@ -26,8 +28,6 @@ import org.drools.util.bitmask.BitMask; import org.kie.api.runtime.rule.FactHandle; -import java.io.Externalizable; - public interface PropagationContext extends Externalizable { enum Type { diff --git a/drools-core/src/main/java/org/drools/core/common/PropagationContextFactory.java b/drools-core/src/main/java/org/drools/core/common/PropagationContextFactory.java index 3338b93e206..39755a065bf 100644 --- a/drools-core/src/main/java/org/drools/core/common/PropagationContextFactory.java +++ b/drools-core/src/main/java/org/drools/core/common/PropagationContextFactory.java @@ -19,9 +19,9 @@ package org.drools.core.common; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.EntryPointId; import org.drools.core.marshalling.MarshallerReaderContext; import org.drools.core.reteoo.TerminalNode; -import org.drools.base.rule.EntryPointId; import org.drools.util.bitmask.BitMask; public interface PropagationContextFactory { diff --git a/drools-core/src/main/java/org/drools/core/common/QueryElementFactHandle.java b/drools-core/src/main/java/org/drools/core/common/QueryElementFactHandle.java index 7bbb6e16bc7..97be135e6f2 100644 --- a/drools-core/src/main/java/org/drools/core/common/QueryElementFactHandle.java +++ b/drools-core/src/main/java/org/drools/core/common/QueryElementFactHandle.java @@ -18,6 +18,14 @@ */ package org.drools.core.common; +import java.util.Arrays; +import java.util.function.Consumer; +import java.util.function.Predicate; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + import org.drools.base.factmodel.traits.TraitTypeEnum; import org.drools.base.rule.EntryPointId; import org.drools.core.WorkingMemoryEntryPoint; @@ -25,13 +33,6 @@ import org.drools.core.reteoo.RightTuple; import org.drools.core.reteoo.Tuple; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import java.util.Arrays; -import java.util.function.Consumer; -import java.util.function.Predicate; - @XmlAccessorType(XmlAccessType.NONE) public class QueryElementFactHandle implements diff --git a/drools-core/src/main/java/org/drools/core/common/ReteEvaluator.java b/drools-core/src/main/java/org/drools/core/common/ReteEvaluator.java index d7e9f5aec90..49503f63036 100644 --- a/drools-core/src/main/java/org/drools/core/common/ReteEvaluator.java +++ b/drools-core/src/main/java/org/drools/core/common/ReteEvaluator.java @@ -18,6 +18,10 @@ */ package org.drools.core.common; +import java.util.Collection; +import java.util.Collections; +import java.util.function.Consumer; + import org.drools.base.base.ValueResolver; import org.drools.base.rule.EntryPointId; import org.drools.core.RuleSessionConfiguration; @@ -41,10 +45,6 @@ import org.kie.api.runtime.rule.QueryResults; import org.kie.api.time.SessionClock; -import java.util.Collection; -import java.util.Collections; -import java.util.function.Consumer; - public interface ReteEvaluator extends ValueResolver { enum InternalOperationType{ FIRE, INSERT, UPDATE, DELETE, SET_GLOBAL } diff --git a/drools-core/src/main/java/org/drools/core/common/SingleBetaConstraints.java b/drools-core/src/main/java/org/drools/core/common/SingleBetaConstraints.java index 46346e156f8..d4a00df2046 100644 --- a/drools-core/src/main/java/org/drools/core/common/SingleBetaConstraints.java +++ b/drools-core/src/main/java/org/drools/core/common/SingleBetaConstraints.java @@ -34,8 +34,8 @@ import org.drools.core.reteoo.BetaMemory; import org.drools.core.reteoo.Tuple; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.util.bitmask.BitMask; import org.drools.core.util.index.IndexFactory; +import org.drools.util.bitmask.BitMask; import org.kie.api.runtime.rule.FactHandle; public class SingleBetaConstraints diff --git a/drools-core/src/main/java/org/drools/core/common/TupleStartEqualsConstraint.java b/drools-core/src/main/java/org/drools/core/common/TupleStartEqualsConstraint.java index 7ed4fdf16eb..4d2ee359722 100755 --- a/drools-core/src/main/java/org/drools/core/common/TupleStartEqualsConstraint.java +++ b/drools-core/src/main/java/org/drools/core/common/TupleStartEqualsConstraint.java @@ -24,10 +24,10 @@ import org.drools.base.base.ValueResolver; import org.drools.base.reteoo.BaseTuple; -import org.drools.core.reteoo.LeftTuple; import org.drools.base.rule.ContextEntry; import org.drools.base.rule.Declaration; import org.drools.base.rule.constraint.BetaNodeFieldConstraint; +import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.Tuple; import org.kie.api.runtime.rule.FactHandle; diff --git a/drools-core/src/main/java/org/drools/core/concurrent/ExecutorProviderImpl.java b/drools-core/src/main/java/org/drools/core/concurrent/ExecutorProviderImpl.java index 03767e866d3..72f13fe846f 100644 --- a/drools-core/src/main/java/org/drools/core/concurrent/ExecutorProviderImpl.java +++ b/drools-core/src/main/java/org/drools/core/concurrent/ExecutorProviderImpl.java @@ -27,6 +27,7 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; + import javax.naming.InitialContext; import javax.naming.NamingException; diff --git a/drools-core/src/main/java/org/drools/core/concurrent/ParallelGroupEvaluator.java b/drools-core/src/main/java/org/drools/core/concurrent/ParallelGroupEvaluator.java index 78e20bb8121..3621e4978aa 100644 --- a/drools-core/src/main/java/org/drools/core/concurrent/ParallelGroupEvaluator.java +++ b/drools-core/src/main/java/org/drools/core/concurrent/ParallelGroupEvaluator.java @@ -18,16 +18,16 @@ */ package org.drools.core.concurrent; -import org.drools.base.common.RuleBasePartitionId; -import org.drools.core.common.ActivationsManager; -import org.drools.core.common.InternalAgendaGroup; -import org.drools.core.phreak.RuleAgendaItem; - import java.util.Collection; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import org.drools.base.common.RuleBasePartitionId; +import org.drools.core.common.ActivationsManager; +import org.drools.core.common.InternalAgendaGroup; +import org.drools.core.phreak.RuleAgendaItem; + import static org.drools.base.common.PartitionsManager.MIN_PARALLEL_THRESHOLD; import static org.drools.base.common.PartitionsManager.doOnForkJoinPool; diff --git a/drools-core/src/main/java/org/drools/core/conflict/RuleAgendaConflictResolver.java b/drools-core/src/main/java/org/drools/core/conflict/RuleAgendaConflictResolver.java index 46120530241..a13d6d1f440 100644 --- a/drools-core/src/main/java/org/drools/core/conflict/RuleAgendaConflictResolver.java +++ b/drools-core/src/main/java/org/drools/core/conflict/RuleAgendaConflictResolver.java @@ -20,8 +20,8 @@ import java.io.Serializable; -import org.drools.core.phreak.RuleAgendaItem; import org.drools.base.rule.consequence.ConflictResolver; +import org.drools.core.phreak.RuleAgendaItem; import org.kie.api.definition.rule.Rule; public class RuleAgendaConflictResolver implements ConflictResolver, Serializable { diff --git a/drools-core/src/main/java/org/drools/core/event/AgendaEventSupport.java b/drools-core/src/main/java/org/drools/core/event/AgendaEventSupport.java index cfdaef56dc4..9b234a9b4ce 100644 --- a/drools-core/src/main/java/org/drools/core/event/AgendaEventSupport.java +++ b/drools-core/src/main/java/org/drools/core/event/AgendaEventSupport.java @@ -22,6 +22,7 @@ import org.drools.core.common.InternalKnowledgeRuntime; import org.drools.core.common.InternalWorkingMemory; import org.drools.core.common.ReteEvaluator; +import org.drools.core.common.RuleFlowGroup; import org.drools.core.event.rule.impl.ActivationCancelledEventImpl; import org.drools.core.event.rule.impl.ActivationCreatedEventImpl; import org.drools.core.event.rule.impl.AfterActivationFiredEventImpl; @@ -31,7 +32,6 @@ import org.drools.core.event.rule.impl.RuleFlowGroupActivatedEventImpl; import org.drools.core.event.rule.impl.RuleFlowGroupDeactivatedEventImpl; import org.drools.core.rule.consequence.InternalMatch; -import org.drools.core.common.RuleFlowGroup; import org.kie.api.event.rule.AfterMatchFiredEvent; import org.kie.api.event.rule.AgendaEventListener; import org.kie.api.event.rule.BeforeMatchFiredEvent; diff --git a/drools-core/src/main/java/org/drools/core/event/DefaultAgendaEventListener.java b/drools-core/src/main/java/org/drools/core/event/DefaultAgendaEventListener.java index a2576762b70..557b232a3f5 100644 --- a/drools-core/src/main/java/org/drools/core/event/DefaultAgendaEventListener.java +++ b/drools-core/src/main/java/org/drools/core/event/DefaultAgendaEventListener.java @@ -18,9 +18,13 @@ */ package org.drools.core.event; -import org.kie.api.event.rule.*; +import org.kie.api.event.rule.AfterMatchFiredEvent; +import org.kie.api.event.rule.AgendaEventListener; import org.kie.api.event.rule.AgendaGroupPoppedEvent; import org.kie.api.event.rule.AgendaGroupPushedEvent; +import org.kie.api.event.rule.BeforeMatchFiredEvent; +import org.kie.api.event.rule.MatchCancelledEvent; +import org.kie.api.event.rule.MatchCreatedEvent; import org.kie.api.event.rule.RuleFlowGroupActivatedEvent; import org.kie.api.event.rule.RuleFlowGroupDeactivatedEvent; diff --git a/drools-core/src/main/java/org/drools/core/event/RuleRuntimeEventSupport.java b/drools-core/src/main/java/org/drools/core/event/RuleRuntimeEventSupport.java index 853521411fe..39ba201a624 100644 --- a/drools-core/src/main/java/org/drools/core/event/RuleRuntimeEventSupport.java +++ b/drools-core/src/main/java/org/drools/core/event/RuleRuntimeEventSupport.java @@ -19,11 +19,11 @@ package org.drools.core.event; import org.drools.core.common.InternalWorkingMemory; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.event.rule.impl.ObjectDeletedEventImpl; import org.drools.core.event.rule.impl.ObjectInsertedEventImpl; import org.drools.core.event.rule.impl.ObjectUpdatedEventImpl; -import org.drools.core.common.PropagationContext; import org.kie.api.event.rule.RuleRuntimeEventListener; import org.kie.api.runtime.KieRuntime; import org.kie.api.runtime.rule.FactHandle; diff --git a/drools-core/src/main/java/org/drools/core/event/rule/impl/SerializableActivation.java b/drools-core/src/main/java/org/drools/core/event/rule/impl/SerializableActivation.java index 001c4556134..550624af08c 100644 --- a/drools-core/src/main/java/org/drools/core/event/rule/impl/SerializableActivation.java +++ b/drools-core/src/main/java/org/drools/core/event/rule/impl/SerializableActivation.java @@ -26,12 +26,12 @@ import java.util.Collections; import java.util.List; -import org.drools.core.common.InternalFactHandle; import org.drools.base.definitions.rule.impl.RuleImpl; -import org.drools.core.reteoo.RuleTerminalNodeLeftTuple; import org.drools.base.rule.Declaration; -import org.drools.core.rule.consequence.InternalMatch; +import org.drools.core.common.InternalFactHandle; import org.drools.core.common.PropagationContext; +import org.drools.core.reteoo.RuleTerminalNodeLeftTuple; +import org.drools.core.rule.consequence.InternalMatch; import org.kie.api.definition.rule.Rule; import org.kie.api.runtime.rule.FactHandle; import org.kie.api.runtime.rule.Match; diff --git a/drools-core/src/main/java/org/drools/core/impl/ActivationsManagerImpl.java b/drools-core/src/main/java/org/drools/core/impl/ActivationsManagerImpl.java index 328e0e5c4df..ab3d1a3b1bf 100644 --- a/drools-core/src/main/java/org/drools/core/impl/ActivationsManagerImpl.java +++ b/drools-core/src/main/java/org/drools/core/impl/ActivationsManagerImpl.java @@ -18,6 +18,13 @@ */ package org.drools.core.impl; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.core.common.ActivationGroupImpl; @@ -52,13 +59,6 @@ import org.kie.api.event.rule.MatchCancelledCause; import org.kie.api.runtime.rule.AgendaFilter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - public class ActivationsManagerImpl implements ActivationsManager { private final ReteEvaluator reteEvaluator; diff --git a/drools-core/src/main/java/org/drools/core/impl/InternalKieContainer.java b/drools-core/src/main/java/org/drools/core/impl/InternalKieContainer.java index e99b6f8c169..f2c59ed4745 100644 --- a/drools-core/src/main/java/org/drools/core/impl/InternalKieContainer.java +++ b/drools-core/src/main/java/org/drools/core/impl/InternalKieContainer.java @@ -72,19 +72,19 @@ public interface InternalKieContainer extends KieContainer { * Returns the ID assigned to the container. * @return the ID assigned to the container. */ - String getContainerId(); - - /** - * Returns the RelaseId configured while creating the Kiecontainer. - * @return the RelaseId configured while creating the Kiecontainer. - */ - ReleaseId getConfiguredReleaseId(); - - /** - * Returns the actual resolved ReleaseId. - * @return the actual resolved ReleaseId. - */ - ReleaseId getResolvedReleaseId(); + String getContainerId(); + + /** + * Returns the RelaseId configured while creating the Kiecontainer. + * @return the RelaseId configured while creating the Kiecontainer. + */ + ReleaseId getConfiguredReleaseId(); + + /** + * Returns the actual resolved ReleaseId. + * @return the actual resolved ReleaseId. + */ + ReleaseId getResolvedReleaseId(); void disposeSession(KieSession kieSession); diff --git a/drools-core/src/main/java/org/drools/core/impl/InternalRuleBase.java b/drools-core/src/main/java/org/drools/core/impl/InternalRuleBase.java index 92d2dca90ce..f4002ac8a1a 100644 --- a/drools-core/src/main/java/org/drools/core/impl/InternalRuleBase.java +++ b/drools-core/src/main/java/org/drools/core/impl/InternalRuleBase.java @@ -18,6 +18,14 @@ */ package org.drools.core.impl; +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.Future; + import org.drools.base.RuleBase; import org.drools.base.common.RuleBasePartitionId; import org.drools.base.definitions.InternalKnowledgePackage; @@ -49,14 +57,6 @@ import org.kie.api.io.Resource; import org.kie.api.runtime.KieSessionConfiguration; -import java.io.IOException; -import java.lang.reflect.Type; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.Future; - public interface InternalRuleBase extends RuleBase { Collection getKiePackages(); diff --git a/drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java b/drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java index dfd978c3f7c..e14d287f218 100644 --- a/drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java +++ b/drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java @@ -18,6 +18,24 @@ */ package org.drools.core.impl; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Queue; +import java.util.Set; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.Future; +import java.util.concurrent.locks.ReentrantReadWriteLock; + import org.drools.base.base.ClassObjectType; import org.drools.base.common.PartitionsManager; import org.drools.base.common.RuleBasePartitionId; @@ -79,27 +97,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Queue; -import java.util.Set; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.Future; -import java.util.concurrent.locks.ReentrantReadWriteLock; - import static org.drools.core.phreak.PhreakBuilder.isEagerSegmentCreation; -import static org.drools.util.bitmask.BitMaskUtil.isSet; import static org.drools.util.ClassUtils.convertClassToResourcePath; +import static org.drools.util.bitmask.BitMaskUtil.isSet; public class KnowledgeBaseImpl implements InternalRuleBase { @@ -880,7 +880,9 @@ public Set getAddedEntryNodeCache() { } public void registeRremovedEntryNodeCache(EntryPointNode node) { - if (removedEntryNodeCache == null) removedEntryNodeCache = new HashSet<>(); + if (removedEntryNodeCache == null) { + removedEntryNodeCache = new HashSet<>(); + } removedEntryNodeCache.add(node); } diff --git a/drools-core/src/main/java/org/drools/core/impl/WorkingMemoryReteExpireAction.java b/drools-core/src/main/java/org/drools/core/impl/WorkingMemoryReteExpireAction.java index 29949977ac1..3599a81382b 100644 --- a/drools-core/src/main/java/org/drools/core/impl/WorkingMemoryReteExpireAction.java +++ b/drools-core/src/main/java/org/drools/core/impl/WorkingMemoryReteExpireAction.java @@ -18,6 +18,11 @@ */ package org.drools.core.impl; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; + import org.drools.core.common.DefaultEventHandle; import org.drools.core.common.DefaultFactHandle; import org.drools.core.common.PropagationContext; @@ -27,11 +32,6 @@ import org.drools.core.phreak.PropagationEntry; import org.drools.core.reteoo.ObjectTypeNode; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; - import static org.drools.core.common.PhreakPropagationContextFactory.createPropagationContextForFact; public class WorkingMemoryReteExpireAction diff --git a/drools-core/src/main/java/org/drools/core/management/DroolsManagementAgent.java b/drools-core/src/main/java/org/drools/core/management/DroolsManagementAgent.java index 86314c34ae0..5bacd15b864 100644 --- a/drools-core/src/main/java/org/drools/core/management/DroolsManagementAgent.java +++ b/drools-core/src/main/java/org/drools/core/management/DroolsManagementAgent.java @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; + import javax.management.MBeanServer; import javax.management.ObjectName; import javax.management.StandardMBean; @@ -46,8 +47,8 @@ */ public interface DroolsManagementAgent extends KieManagementAgentMBean { - String CONTAINER_NAME_PREFIX = "org.kie"; - + String CONTAINER_NAME_PREFIX = "org.kie"; + Logger logger = LoggerFactory.getLogger(DroolsManagementAgent.class); class DroolsManagementAgentHolder { @@ -58,23 +59,23 @@ static DroolsManagementAgent getInstance() { return DroolsManagementAgentHolder.INSTANCE; } - static ObjectName createObjectNameFor(InternalRuleBase kbase) { - return DroolsManagementAgent.createObjectName( - DroolsManagementAgent.createObjectNameBy(kbase.getContainerId()) - + ",kbaseId=" + ObjectName.quote(kbase.getId()) - ); - } - - static ObjectName createObjectNameFor(InternalWorkingMemory ksession) { - return DroolsManagementAgent.createObjectName( - DroolsManagementAgent.createObjectNameFor(ksession.getKnowledgeBase()) + - ",group=Sessions,ksessionId=Session-"+ksession.getIdentifier()); - } - - static ObjectName createObjectNameBy(String containerId) { - return DroolsManagementAgent.createObjectName(CONTAINER_NAME_PREFIX + ":kcontainerId="+ObjectName.quote(containerId)); - } - + static ObjectName createObjectNameFor(InternalRuleBase kbase) { + return DroolsManagementAgent.createObjectName( + DroolsManagementAgent.createObjectNameBy(kbase.getContainerId()) + + ",kbaseId=" + ObjectName.quote(kbase.getId()) + ); + } + + static ObjectName createObjectNameFor(InternalWorkingMemory ksession) { + return DroolsManagementAgent.createObjectName( + DroolsManagementAgent.createObjectNameFor(ksession.getKnowledgeBase()) + + ",group=Sessions,ksessionId=Session-"+ksession.getIdentifier()); + } + + static ObjectName createObjectNameBy(String containerId) { + return DroolsManagementAgent.createObjectName(CONTAINER_NAME_PREFIX + ":kcontainerId="+ObjectName.quote(containerId)); + } + static ObjectName createObjectNameBy(String containerId, String kbaseId, KieSessionModel.KieSessionType ksessionType, String ksessionName) { return DroolsManagementAgent.createObjectName(CONTAINER_NAME_PREFIX + ":kcontainerId="+ObjectName.quote(containerId) + ",kbaseId=" + ObjectName.quote(kbaseId) @@ -163,28 +164,37 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (!(obj instanceof CBSKey)) + } + if (!(obj instanceof CBSKey)) { return false; + } CBSKey other = (CBSKey) obj; if (kbaseId == null) { - if (other.kbaseId != null) + if (other.kbaseId != null) { return false; - } else if (!kbaseId.equals(other.kbaseId)) + } + } else if (!kbaseId.equals(other.kbaseId)) { return false; + } if (kcontainerId == null) { - if (other.kcontainerId != null) + if (other.kcontainerId != null) { return false; - } else if (!kcontainerId.equals(other.kcontainerId)) + } + } else if (!kcontainerId.equals(other.kcontainerId)) { return false; + } if (ksessionName == null) { - if (other.ksessionName != null) + if (other.ksessionName != null) { return false; - } else if (!ksessionName.equals(other.ksessionName)) + } + } else if (!ksessionName.equals(other.ksessionName)) { return false; + } return true; } diff --git a/drools-core/src/main/java/org/drools/core/management/KnowledgeBaseMonitoring.java b/drools-core/src/main/java/org/drools/core/management/KnowledgeBaseMonitoring.java index 1cf3657fb88..609a89e6706 100644 --- a/drools-core/src/main/java/org/drools/core/management/KnowledgeBaseMonitoring.java +++ b/drools-core/src/main/java/org/drools/core/management/KnowledgeBaseMonitoring.java @@ -20,6 +20,7 @@ import java.lang.reflect.Type; import java.util.Map; + import javax.management.Attribute; import javax.management.AttributeList; import javax.management.AttributeNotFoundException; @@ -283,7 +284,9 @@ public Object getAttribute(String attributeName) throws AttributeNotFoundExcepti public AttributeList getAttributes(String[] attributeNames) { AttributeList resultList = new AttributeList(); - if ( attributeNames.length == 0 ) return resultList; + if ( attributeNames.length == 0 ) { + return resultList; + } for ( int i = 0; i < attributeNames.length; i++ ) { try { Object value = getAttribute( attributeNames[i] ); diff --git a/drools-core/src/main/java/org/drools/core/marshalling/MarshallerReaderContext.java b/drools-core/src/main/java/org/drools/core/marshalling/MarshallerReaderContext.java index edec31bbe66..cdd16f975d4 100644 --- a/drools-core/src/main/java/org/drools/core/marshalling/MarshallerReaderContext.java +++ b/drools-core/src/main/java/org/drools/core/marshalling/MarshallerReaderContext.java @@ -21,18 +21,18 @@ import java.io.ObjectInput; import java.util.Map; +import org.drools.base.rule.EntryPointId; import org.drools.core.common.ActivationsFilter; import org.drools.core.common.BaseNode; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.InternalWorkingMemory; +import org.drools.core.common.PropagationContext; import org.drools.core.common.QueryElementFactHandle; import org.drools.core.common.ReteEvaluator; import org.drools.core.impl.InternalRuleBase; import org.drools.core.phreak.PhreakTimerNode.Scheduler; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.ObjectTypeConf; -import org.drools.base.rule.EntryPointId; -import org.drools.core.common.PropagationContext; import org.drools.core.reteoo.Tuple; import org.kie.api.marshalling.ObjectMarshallingStrategy; import org.kie.api.marshalling.ObjectMarshallingStrategyStore; diff --git a/drools-core/src/main/java/org/drools/core/marshalling/TupleKey.java b/drools-core/src/main/java/org/drools/core/marshalling/TupleKey.java index a46d6e8a030..67728a12121 100644 --- a/drools-core/src/main/java/org/drools/core/marshalling/TupleKey.java +++ b/drools-core/src/main/java/org/drools/core/marshalling/TupleKey.java @@ -42,11 +42,19 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } TupleKey other = (TupleKey) obj; - if ( !Arrays.equals( tuple, other.tuple ) ) return false; + if ( !Arrays.equals( tuple, other.tuple ) ) { + return false; + } return true; } diff --git a/drools-core/src/main/java/org/drools/core/phreak/AbstractReactiveObject.java b/drools-core/src/main/java/org/drools/core/phreak/AbstractReactiveObject.java index 04489697c9f..f803352d46e 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/AbstractReactiveObject.java +++ b/drools-core/src/main/java/org/drools/core/phreak/AbstractReactiveObject.java @@ -18,13 +18,13 @@ */ package org.drools.core.phreak; -import org.drools.base.phreak.ReactiveObject; -import org.drools.base.reteoo.BaseTuple; - import java.util.Collection; import java.util.Collections; import java.util.HashSet; +import org.drools.base.phreak.ReactiveObject; +import org.drools.base.reteoo.BaseTuple; + public class AbstractReactiveObject implements ReactiveObject { private Collection tuples; diff --git a/drools-core/src/main/java/org/drools/core/phreak/BuildtimeSegmentUtilities.java b/drools-core/src/main/java/org/drools/core/phreak/BuildtimeSegmentUtilities.java index ab794a071bc..506d5a3802a 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/BuildtimeSegmentUtilities.java +++ b/drools-core/src/main/java/org/drools/core/phreak/BuildtimeSegmentUtilities.java @@ -22,6 +22,7 @@ import java.util.List; import org.drools.base.common.NetworkNode; +import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.impl.InternalRuleBase; import org.drools.core.reteoo.AsyncReceiveNode; import org.drools.core.reteoo.AsyncSendNode; @@ -35,7 +36,6 @@ import org.drools.core.reteoo.LeftTupleSinkNode; import org.drools.core.reteoo.LeftTupleSinkPropagator; import org.drools.core.reteoo.LeftTupleSource; -import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.reteoo.NotNode; import org.drools.core.reteoo.PathEndNode; import org.drools.core.reteoo.PathEndNode.PathMemSpec; 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 c77f8674551..f3cccaa202e 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 @@ -18,6 +18,16 @@ */ package org.drools.core.phreak; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + import org.drools.base.common.NetworkNode; import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.WorkingMemory; @@ -63,16 +73,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Collectors; - import static org.drools.core.phreak.BuildtimeSegmentUtilities.isAssociatedWith; public class EagerPhreakBuilder implements PhreakBuilder { 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 418dbf4d7fb..7ddbb01eeeb 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 @@ -18,6 +18,16 @@ */ package org.drools.core.phreak; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.common.DefaultEventHandle; @@ -73,16 +83,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - import static org.drools.core.phreak.BuildtimeSegmentUtilities.JOIN_NODE_BIT; import static org.drools.core.phreak.BuildtimeSegmentUtilities.NOT_NODE_BIT; import static org.drools.core.phreak.BuildtimeSegmentUtilities.REACTIVE_EXISTS_NODE_BIT; diff --git a/drools-core/src/main/java/org/drools/core/phreak/LeftTupleEntry.java b/drools-core/src/main/java/org/drools/core/phreak/LeftTupleEntry.java index eecff317b6f..a05a1dabcf0 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/LeftTupleEntry.java +++ b/drools-core/src/main/java/org/drools/core/phreak/LeftTupleEntry.java @@ -20,9 +20,9 @@ import org.drools.core.common.Memory; import org.drools.core.common.PhreakPropagationContext; +import org.drools.core.common.PropagationContext; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.RightTuple; -import org.drools.core.common.PropagationContext; public class LeftTupleEntry implements TupleEntry { private final LeftTuple lt; 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 e350f760052..c63a815acc3 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 @@ -18,14 +18,18 @@ */ package org.drools.core.phreak; +import org.drools.base.reteoo.AccumulateContextEntry; +import org.drools.base.rule.Accumulate; +import org.drools.base.rule.ContextEntry; +import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; import org.drools.core.common.BetaConstraints; import org.drools.core.common.InternalFactHandle; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.TupleSets; import org.drools.core.common.TupleSetsImpl; import org.drools.core.reteoo.AccumulateNode; import org.drools.core.reteoo.AccumulateNode.AccumulateContext; -import org.drools.base.reteoo.AccumulateContextEntry; import org.drools.core.reteoo.AccumulateNode.AccumulateMemory; import org.drools.core.reteoo.AccumulateNode.BaseAccumulation; import org.drools.core.reteoo.BetaMemory; @@ -33,12 +37,8 @@ import org.drools.core.reteoo.LeftTupleSink; import org.drools.core.reteoo.RightTuple; import org.drools.core.reteoo.RightTupleImpl; -import org.drools.core.reteoo.TupleMemory; -import org.drools.base.rule.Accumulate; -import org.drools.base.rule.ContextEntry; -import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; -import org.drools.core.common.PropagationContext; import org.drools.core.reteoo.Tuple; +import org.drools.core.reteoo.TupleMemory; import org.drools.core.util.AbstractHashTable; import org.drools.core.util.FastIterator; import org.kie.api.runtime.rule.FactHandle; diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakAsyncReceiveNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakAsyncReceiveNode.java index 1ad8fed76da..601279f0503 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakAsyncReceiveNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakAsyncReceiveNode.java @@ -18,6 +18,7 @@ */ package org.drools.core.phreak; +import org.drools.base.rule.ContextEntry; import org.drools.core.common.BetaConstraints; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.ReteEvaluator; @@ -26,7 +27,6 @@ import org.drools.core.reteoo.AsyncReceiveNode.AsyncReceiveMemory; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.LeftTupleSink; -import org.drools.base.rule.ContextEntry; import org.drools.core.util.index.TupleList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakAsyncSendNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakAsyncSendNode.java index 5c79b3b5383..21637bc42ad 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakAsyncSendNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakAsyncSendNode.java @@ -21,8 +21,12 @@ import java.util.LinkedHashMap; import java.util.concurrent.Executor; +import org.drools.base.rule.ContextEntry; +import org.drools.base.rule.accessor.DataProvider; +import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; import org.drools.core.common.BetaConstraints; import org.drools.core.common.InternalFactHandle; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.TupleSets; import org.drools.core.reteoo.AsyncMessage; @@ -31,10 +35,6 @@ import org.drools.core.reteoo.AsyncSendNode.AsyncSendMemory; import org.drools.core.reteoo.BetaMemory; import org.drools.core.reteoo.LeftTuple; -import org.drools.base.rule.ContextEntry; -import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; -import org.drools.base.rule.accessor.DataProvider; -import org.drools.core.common.PropagationContext; import org.kie.internal.concurrent.ExecutorProviderFactory; public class PhreakAsyncSendNode { diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakEvalNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakEvalNode.java index f062cbf8072..05171795a33 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakEvalNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakEvalNode.java @@ -18,13 +18,13 @@ */ package org.drools.core.phreak; +import org.drools.base.rule.EvalCondition; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.TupleSets; import org.drools.core.reteoo.EvalConditionNode; import org.drools.core.reteoo.EvalConditionNode.EvalMemory; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.LeftTupleSink; -import org.drools.base.rule.EvalCondition; import static org.drools.core.phreak.RuleNetworkEvaluator.normalizeStagedTuples; diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakExistsNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakExistsNode.java index dbd0714b2d2..95d796c565a 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakExistsNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakExistsNode.java @@ -18,7 +18,9 @@ */ package org.drools.core.phreak; +import org.drools.base.rule.ContextEntry; import org.drools.core.common.BetaConstraints; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.TupleSets; import org.drools.core.reteoo.BetaMemory; @@ -27,8 +29,6 @@ import org.drools.core.reteoo.LeftTupleSink; import org.drools.core.reteoo.RightTuple; import org.drools.core.reteoo.TupleMemory; -import org.drools.base.rule.ContextEntry; -import org.drools.core.common.PropagationContext; import org.drools.core.util.FastIterator; import static org.drools.core.phreak.PhreakJoinNode.updateChildLeftTuple; diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakFromNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakFromNode.java index 5445933b343..6a4f5198c86 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakFromNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakFromNode.java @@ -22,7 +22,11 @@ import java.util.LinkedHashMap; import java.util.Map; +import org.drools.base.rule.ContextEntry; +import org.drools.base.rule.accessor.DataProvider; +import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; import org.drools.core.common.BetaConstraints; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.TupleSets; import org.drools.core.reteoo.AbstractTuple; @@ -33,12 +37,8 @@ import org.drools.core.reteoo.LeftTupleSink; import org.drools.core.reteoo.RightTuple; import org.drools.core.reteoo.RightTupleImpl; -import org.drools.core.reteoo.TupleMemory; -import org.drools.base.rule.ContextEntry; -import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; -import org.drools.base.rule.accessor.DataProvider; -import org.drools.core.common.PropagationContext; import org.drools.core.reteoo.Tuple; +import org.drools.core.reteoo.TupleMemory; import org.drools.core.util.FastIterator; import org.drools.core.util.LinkedList; import org.kie.api.runtime.rule.FactHandle; diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakGroupByNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakGroupByNode.java index 026a8db31e3..84cf7c9a404 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakGroupByNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakGroupByNode.java @@ -18,17 +18,17 @@ */ package org.drools.core.phreak; +import org.drools.base.reteoo.AccumulateContextEntry; +import org.drools.base.rule.Accumulate; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.TupleSets; import org.drools.core.reteoo.AccumulateNode; -import org.drools.base.reteoo.AccumulateContextEntry; import org.drools.core.reteoo.AccumulateNode.AccumulateMemory; import org.drools.core.reteoo.AccumulateNode.GroupByContext; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.LeftTupleSink; import org.drools.core.reteoo.RightTuple; -import org.drools.base.rule.Accumulate; -import org.drools.core.common.PropagationContext; import org.drools.core.util.index.TupleList; import org.kie.api.runtime.rule.FactHandle; diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakJoinNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakJoinNode.java index b1cecc77005..313e0505f5a 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakJoinNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakJoinNode.java @@ -18,6 +18,7 @@ */ package org.drools.core.phreak; +import org.drools.base.rule.ContextEntry; import org.drools.core.common.BetaConstraints; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.TupleSets; @@ -27,7 +28,6 @@ import org.drools.core.reteoo.LeftTupleSink; import org.drools.core.reteoo.RightTuple; import org.drools.core.reteoo.TupleMemory; -import org.drools.base.rule.ContextEntry; import org.drools.core.util.AbstractHashTable; import org.drools.core.util.FastIterator; diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakNotNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakNotNode.java index 84d5e64dbbe..0e8766dde8d 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakNotNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakNotNode.java @@ -18,7 +18,9 @@ */ package org.drools.core.phreak; +import org.drools.base.rule.ContextEntry; import org.drools.core.common.BetaConstraints; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.TupleSets; import org.drools.core.reteoo.BetaMemory; @@ -27,8 +29,6 @@ import org.drools.core.reteoo.NotNode; import org.drools.core.reteoo.RightTuple; import org.drools.core.reteoo.TupleMemory; -import org.drools.base.rule.ContextEntry; -import org.drools.core.common.PropagationContext; import org.drools.core.util.FastIterator; import static org.drools.core.phreak.PhreakJoinNode.updateChildLeftTuple; diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakQueryNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakQueryNode.java index 38e3173f63c..97ce0e9021b 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakQueryNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakQueryNode.java @@ -20,6 +20,7 @@ import org.drools.core.base.DroolsQueryImpl; import org.drools.core.common.InternalFactHandle; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.TupleSets; import org.drools.core.reteoo.LeftInputAdapterNode; @@ -28,7 +29,6 @@ import org.drools.core.reteoo.QueryElementNode; import org.drools.core.reteoo.QueryElementNode.QueryElementNodeMemory; import org.drools.core.reteoo.SegmentMemory; -import org.drools.core.common.PropagationContext; public class PhreakQueryNode { public void doNode(QueryElementNode queryNode, 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 1e88d99f8ce..9171ae207cf 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 @@ -18,19 +18,19 @@ */ package org.drools.core.phreak; +import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.accessor.Salience; import org.drools.core.common.ActivationsManager; import org.drools.core.common.InternalAgendaGroup; import org.drools.core.common.InternalFactHandle; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.TupleSets; -import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.ObjectTypeConf; import org.drools.core.reteoo.RuleTerminalNode; import org.drools.core.reteoo.RuleTerminalNodeLeftTuple; import org.drools.core.reteoo.TerminalNode; -import org.drools.core.common.PropagationContext; -import org.drools.base.rule.accessor.Salience; import org.drools.core.reteoo.Tuple; import org.drools.core.rule.consequence.InternalMatch; import org.kie.api.definition.rule.Rule; diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakSubnetworkNotExistsNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakSubnetworkNotExistsNode.java index c7aa1a61596..6b5208c7e44 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakSubnetworkNotExistsNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakSubnetworkNotExistsNode.java @@ -18,16 +18,16 @@ */ package org.drools.core.phreak; +import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.common.TupleSets; import org.drools.core.reteoo.BetaMemory; import org.drools.core.reteoo.BetaNode; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.LeftTupleSink; -import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.reteoo.RightTuple; import org.drools.core.reteoo.SubnetworkTuple; -import org.drools.core.reteoo.TupleMemory; import org.drools.core.reteoo.Tuple; +import org.drools.core.reteoo.TupleMemory; import org.drools.core.util.index.TupleList; import static org.drools.core.phreak.PhreakJoinNode.updateChildLeftTuple; diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakTimerNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakTimerNode.java index bdaf7ef9211..65dbd9e8ee3 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakTimerNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakTimerNode.java @@ -18,6 +18,9 @@ */ package org.drools.core.phreak; +import java.util.Date; +import java.util.List; + import org.drools.base.common.NetworkNode; import org.drools.base.time.JobHandle; import org.drools.base.time.Trigger; @@ -49,9 +52,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Date; -import java.util.List; - import static org.drools.core.phreak.BuildtimeSegmentUtilities.nextNodePosMask; import static org.drools.core.phreak.RuleNetworkEvaluator.normalizeStagedTuples; diff --git a/drools-core/src/main/java/org/drools/core/phreak/PropagationEntry.java b/drools-core/src/main/java/org/drools/core/phreak/PropagationEntry.java index cbd689f1f7f..c257703e69f 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PropagationEntry.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PropagationEntry.java @@ -18,6 +18,12 @@ */ package org.drools.core.phreak; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.util.concurrent.CountDownLatch; + import org.drools.base.facttemplates.Event; import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.base.DroolsQueryImpl; @@ -41,12 +47,6 @@ import org.drools.core.time.impl.DefaultJobHandle; import org.drools.core.time.impl.PointInTimeTrigger; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.concurrent.CountDownLatch; - import static org.drools.base.rule.TypeDeclaration.NEVER_EXPIRES; import static org.drools.core.reteoo.EntryPointNode.removeRightTuplesMatchingOTN; diff --git a/drools-core/src/main/java/org/drools/core/phreak/ReactiveCollection.java b/drools-core/src/main/java/org/drools/core/phreak/ReactiveCollection.java index 8de145e2055..c0d8df33e40 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/ReactiveCollection.java +++ b/drools-core/src/main/java/org/drools/core/phreak/ReactiveCollection.java @@ -22,8 +22,8 @@ import java.util.Iterator; import org.drools.base.phreak.ReactiveObject; -import org.drools.core.phreak.ReactiveObjectUtil.ModificationType; import org.drools.base.reteoo.BaseTuple; +import org.drools.core.phreak.ReactiveObjectUtil.ModificationType; public class ReactiveCollection> extends AbstractReactiveObject implements Collection { diff --git a/drools-core/src/main/java/org/drools/core/phreak/ReactiveList.java b/drools-core/src/main/java/org/drools/core/phreak/ReactiveList.java index 5e85fa8ad92..34850e7cf2c 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/ReactiveList.java +++ b/drools-core/src/main/java/org/drools/core/phreak/ReactiveList.java @@ -24,8 +24,8 @@ import java.util.ListIterator; import org.drools.base.phreak.ReactiveObject; -import org.drools.core.phreak.ReactiveObjectUtil.ModificationType; import org.drools.base.reteoo.BaseTuple; +import org.drools.core.phreak.ReactiveObjectUtil.ModificationType; public class ReactiveList extends ReactiveCollection> implements List{ diff --git a/drools-core/src/main/java/org/drools/core/phreak/ReactiveObjectUtil.java b/drools-core/src/main/java/org/drools/core/phreak/ReactiveObjectUtil.java index 1501cceedec..fbddf9819e8 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/ReactiveObjectUtil.java +++ b/drools-core/src/main/java/org/drools/core/phreak/ReactiveObjectUtil.java @@ -21,17 +21,17 @@ import java.util.Collection; import org.drools.base.phreak.ReactiveObject; +import org.drools.base.reteoo.BaseTuple; +import org.drools.base.rule.ContextEntry; import org.drools.core.common.BetaConstraints; import org.drools.core.common.InternalFactHandle; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; -import org.drools.base.reteoo.BaseTuple; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.LeftTupleSinkNode; import org.drools.core.reteoo.ReactiveFromNode; import org.drools.core.reteoo.ReactiveFromNodeLeftTuple; import org.drools.core.reteoo.RightTupleImpl; -import org.drools.base.rule.ContextEntry; -import org.drools.core.common.PropagationContext; import org.drools.core.reteoo.Tuple; import static org.drools.core.phreak.PhreakFromNode.deleteChildLeftTuple; diff --git a/drools-core/src/main/java/org/drools/core/phreak/RightTupleEntry.java b/drools-core/src/main/java/org/drools/core/phreak/RightTupleEntry.java index 3bf3f7e291b..a94d2deaa0b 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/RightTupleEntry.java +++ b/drools-core/src/main/java/org/drools/core/phreak/RightTupleEntry.java @@ -20,9 +20,9 @@ import org.drools.core.common.Memory; import org.drools.core.common.PhreakPropagationContext; +import org.drools.core.common.PropagationContext; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.RightTuple; -import org.drools.core.common.PropagationContext; public class RightTupleEntry implements TupleEntry { diff --git a/drools-core/src/main/java/org/drools/core/phreak/RuleAgendaItem.java b/drools-core/src/main/java/org/drools/core/phreak/RuleAgendaItem.java index ad943b9dded..bbe098ee3d0 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/RuleAgendaItem.java +++ b/drools-core/src/main/java/org/drools/core/phreak/RuleAgendaItem.java @@ -18,9 +18,9 @@ */ package org.drools.core.phreak; -import org.drools.core.common.InternalAgendaGroup; import org.drools.base.common.RuleBasePartitionId; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.core.common.InternalAgendaGroup; import org.drools.core.reteoo.PathMemory; import org.drools.core.reteoo.TerminalNode; import org.drools.core.util.LinkedList; diff --git a/drools-core/src/main/java/org/drools/core/phreak/RuleNetworkEvaluator.java b/drools-core/src/main/java/org/drools/core/phreak/RuleNetworkEvaluator.java index fcd39d5d8b9..e64269ad056 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/RuleNetworkEvaluator.java +++ b/drools-core/src/main/java/org/drools/core/phreak/RuleNetworkEvaluator.java @@ -20,11 +20,13 @@ import java.util.List; +import org.drools.base.common.NetworkNode; +import org.drools.base.reteoo.NodeTypeEnums; +import org.drools.base.rule.ContextEntry; import org.drools.core.base.DroolsQueryImpl; import org.drools.core.common.ActivationsManager; import org.drools.core.common.BetaConstraints; import org.drools.core.common.Memory; -import org.drools.base.common.NetworkNode; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.TupleSets; import org.drools.core.common.TupleSetsImpl; @@ -51,7 +53,6 @@ import org.drools.core.reteoo.LeftTupleSink; import org.drools.core.reteoo.LeftTupleSinkNode; import org.drools.core.reteoo.LeftTupleSource; -import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.reteoo.NotNode; import org.drools.core.reteoo.ObjectSink; import org.drools.core.reteoo.PathMemory; @@ -62,7 +63,6 @@ import org.drools.core.reteoo.RightInputAdapterNode; import org.drools.core.reteoo.RightInputAdapterNode.RiaPathMemory; import org.drools.core.reteoo.RightTuple; -import org.drools.core.reteoo.RightTupleImpl; import org.drools.core.reteoo.SegmentMemory; import org.drools.core.reteoo.SubnetworkTuple; import org.drools.core.reteoo.TerminalNode; @@ -70,7 +70,6 @@ import org.drools.core.reteoo.TimerNode.TimerNodeMemory; import org.drools.core.reteoo.Tuple; import org.drools.core.reteoo.TupleMemory; -import org.drools.base.rule.ContextEntry; import org.drools.core.util.FastIterator; import org.drools.core.util.LinkedList; import org.slf4j.Logger; diff --git a/drools-core/src/main/java/org/drools/core/phreak/SegmentPropagator.java b/drools-core/src/main/java/org/drools/core/phreak/SegmentPropagator.java index 2b9ba365f14..2986421497f 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/SegmentPropagator.java +++ b/drools-core/src/main/java/org/drools/core/phreak/SegmentPropagator.java @@ -28,9 +28,9 @@ import org.drools.core.reteoo.PathMemory; import org.drools.core.reteoo.SegmentMemory; +import static org.drools.base.reteoo.NodeTypeEnums.hasNodeMemory; import static org.drools.core.phreak.TupleEvaluationUtil.forceFlushLeftTuple; import static org.drools.core.phreak.TupleEvaluationUtil.forceFlushWhenRiaNode; -import static org.drools.base.reteoo.NodeTypeEnums.hasNodeMemory; public class SegmentPropagator { diff --git a/drools-core/src/main/java/org/drools/core/phreak/StackEntry.java b/drools-core/src/main/java/org/drools/core/phreak/StackEntry.java index e6cb8265bff..18e92e915b9 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/StackEntry.java +++ b/drools-core/src/main/java/org/drools/core/phreak/StackEntry.java @@ -18,8 +18,8 @@ */ package org.drools.core.phreak; -import org.drools.core.common.Memory; import org.drools.base.common.NetworkNode; +import org.drools.core.common.Memory; import org.drools.core.common.TupleSets; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.LeftTupleSinkNode; diff --git a/drools-core/src/main/java/org/drools/core/phreak/SynchronizedPropagationList.java b/drools-core/src/main/java/org/drools/core/phreak/SynchronizedPropagationList.java index ac7899931e4..e46a618a1a0 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/SynchronizedPropagationList.java +++ b/drools-core/src/main/java/org/drools/core/phreak/SynchronizedPropagationList.java @@ -18,12 +18,12 @@ */ package org.drools.core.phreak; +import java.util.Iterator; + import org.drools.core.common.ReteEvaluator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Iterator; - public class SynchronizedPropagationList implements PropagationList { protected static final Logger log = LoggerFactory.getLogger( SynchronizedPropagationList.class ); @@ -48,11 +48,11 @@ public SynchronizedPropagationList(){} @Override public void addEntry(final PropagationEntry entry) { if (entry.requiresImmediateFlushing()) { - if (entry.isCalledFromRHS()) { - entry.execute(reteEvaluator); - } else { - reteEvaluator.getActivationsManager().executeTask( new ExecutableEntry() { - @Override + if (entry.isCalledFromRHS()) { + entry.execute(reteEvaluator); + } else { + reteEvaluator.getActivationsManager().executeTask( new ExecutableEntry() { + @Override public void execute() { if (entry instanceof PhreakTimerNode.TimerAction) { ( (PhreakTimerNode.TimerAction) entry ).execute( reteEvaluator, true ); @@ -66,7 +66,7 @@ public void enqueue() { internalAddEntry( entry ); } } ); - } + } } else { internalAddEntry( entry ); } diff --git a/drools-core/src/main/java/org/drools/core/phreak/TupleEntry.java b/drools-core/src/main/java/org/drools/core/phreak/TupleEntry.java index c3dee474621..85194ae0112 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/TupleEntry.java +++ b/drools-core/src/main/java/org/drools/core/phreak/TupleEntry.java @@ -19,9 +19,9 @@ package org.drools.core.phreak; import org.drools.core.common.Memory; +import org.drools.core.common.PropagationContext; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.RightTuple; -import org.drools.core.common.PropagationContext; public interface TupleEntry { diff --git a/drools-core/src/main/java/org/drools/core/phreak/TupleEvaluationUtil.java b/drools-core/src/main/java/org/drools/core/phreak/TupleEvaluationUtil.java index c6799544d18..e6d0996bcbc 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/TupleEvaluationUtil.java +++ b/drools-core/src/main/java/org/drools/core/phreak/TupleEvaluationUtil.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.List; +import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.common.ActivationsManager; import org.drools.core.common.Memory; import org.drools.core.common.ReteEvaluator; @@ -30,7 +31,6 @@ import org.drools.core.reteoo.AbstractTerminalNode; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.LeftTupleNode; -import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.reteoo.PathEndNode; import org.drools.core.reteoo.PathMemory; import org.drools.core.reteoo.SegmentMemory; diff --git a/drools-core/src/main/java/org/drools/core/process/impl/DefaultWorkItemManager.java b/drools-core/src/main/java/org/drools/core/process/impl/DefaultWorkItemManager.java index 8df599745a9..79ff1ebe3f5 100644 --- a/drools-core/src/main/java/org/drools/core/process/impl/DefaultWorkItemManager.java +++ b/drools-core/src/main/java/org/drools/core/process/impl/DefaultWorkItemManager.java @@ -77,8 +77,9 @@ public void internalExecuteWorkItem(WorkItem workItem) { WorkItemHandler handler = this.workItemHandlers.get(workItem.getName()); if (handler != null) { handler.executeWorkItem(workItem, this); - } else throw new WorkItemHandlerNotFoundException( "Could not find work item handler for " + workItem.getName(), - workItem.getName() ); + } else { + throw new WorkItemHandlerNotFoundException( "Could not find work item handler for " + workItem.getName(), workItem.getName() ); + } } public void internalAddWorkItem(WorkItem workItem) { @@ -106,12 +107,12 @@ public void internalAbortWorkItem(long id) { } public WorkItemHandler getWorkItemHandler(String name) { - return this.workItemHandlers.get(name); + return this.workItemHandlers.get(name); } public void retryWorkItem(long workItemId) { - WorkItem workItem = workItems.get(workItemId); - retryWorkItem(workItem); + WorkItem workItem = workItems.get(workItemId); + retryWorkItem(workItem); } public void retryWorkItemWithParams(long workItemId,Map map) { @@ -129,8 +130,10 @@ private void retryWorkItem(WorkItem workItem) { WorkItemHandler handler = this.workItemHandlers.get(workItem.getName()); if (handler != null) { handler.executeWorkItem(workItem, this); - } else throw new WorkItemHandlerNotFoundException( "Could not find work item handler for " + workItem.getName(), - workItem.getName() ); + } else { + throw new WorkItemHandlerNotFoundException( "Could not find work item handler for " + workItem.getName(), + workItem.getName() ); + } } } diff --git a/drools-core/src/main/java/org/drools/core/reteoo/AbstractTerminalNode.java b/drools-core/src/main/java/org/drools/core/reteoo/AbstractTerminalNode.java index 5faba436799..9e316914a4f 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/AbstractTerminalNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/AbstractTerminalNode.java @@ -18,6 +18,11 @@ */ package org.drools.core.reteoo; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + import org.drools.base.base.ObjectType; import org.drools.base.common.RuleBasePartitionId; import org.drools.base.definitions.rule.impl.RuleImpl; @@ -34,11 +39,6 @@ import org.drools.util.bitmask.BitMask; import org.drools.util.bitmask.EmptyBitMask; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; - import static org.drools.base.reteoo.PropertySpecificUtil.isPropertyReactive; public abstract class AbstractTerminalNode extends BaseNode implements TerminalNode { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/AbstractTuple.java b/drools-core/src/main/java/org/drools/core/reteoo/AbstractTuple.java index fe770fb8193..bb55f3a2961 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/AbstractTuple.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/AbstractTuple.java @@ -18,9 +18,9 @@ */ package org.drools.core.reteoo; +import org.drools.base.rule.Declaration; import org.drools.core.common.DefaultEventHandle; import org.drools.core.common.InternalFactHandle; -import org.drools.base.rule.Declaration; import org.drools.core.common.PropagationContext; import org.kie.api.runtime.rule.FactHandle; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/AccumulateNode.java b/drools-core/src/main/java/org/drools/core/reteoo/AccumulateNode.java index 4e95d6b71a5..429390441e8 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/AccumulateNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/AccumulateNode.java @@ -23,17 +23,10 @@ import java.util.List; import java.util.Map; +import org.drools.base.base.ClassObjectType; +import org.drools.base.base.ObjectType; import org.drools.base.reteoo.AccumulateContextEntry; import org.drools.base.reteoo.NodeTypeEnums; -import org.drools.core.RuleBaseConfiguration; -import org.drools.base.base.ClassObjectType; -import org.drools.core.common.BetaConstraints; -import org.drools.core.common.InternalFactHandle; -import org.drools.core.common.Memory; -import org.drools.core.common.ReteEvaluator; -import org.drools.core.impl.InternalRuleBase; -import org.drools.core.phreak.PhreakAccumulateNode; -import org.drools.core.reteoo.builder.BuildContext; import org.drools.base.rule.Accumulate; import org.drools.base.rule.ContextEntry; import org.drools.base.rule.Declaration; @@ -41,11 +34,18 @@ import org.drools.base.rule.TypeDeclaration; import org.drools.base.rule.accessor.Accumulator; import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; -import org.drools.base.base.ObjectType; +import org.drools.core.RuleBaseConfiguration; +import org.drools.core.common.BetaConstraints; +import org.drools.core.common.InternalFactHandle; +import org.drools.core.common.Memory; import org.drools.core.common.PropagationContext; +import org.drools.core.common.ReteEvaluator; +import org.drools.core.impl.InternalRuleBase; +import org.drools.core.phreak.PhreakAccumulateNode; +import org.drools.core.reteoo.builder.BuildContext; import org.drools.core.util.AbstractBaseLinkedListNode; -import org.drools.util.bitmask.BitMask; import org.drools.core.util.index.TupleList; +import org.drools.util.bitmask.BitMask; /** * AccumulateNode diff --git a/drools-core/src/main/java/org/drools/core/reteoo/AgendaComponentFactory.java b/drools-core/src/main/java/org/drools/core/reteoo/AgendaComponentFactory.java index 30279742fa7..9dc85d2f2c1 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/AgendaComponentFactory.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/AgendaComponentFactory.java @@ -20,8 +20,8 @@ import org.drools.core.common.InternalAgendaGroup; import org.drools.core.common.InternalFactHandle; -import org.drools.core.phreak.RuleAgendaItem; import org.drools.core.common.PropagationContext; +import org.drools.core.phreak.RuleAgendaItem; import org.kie.api.internal.utils.KieService; public interface AgendaComponentFactory extends KieService { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/AlphaNode.java b/drools-core/src/main/java/org/drools/core/reteoo/AlphaNode.java index 8555aa78176..86cc1aaf0ff 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/AlphaNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/AlphaNode.java @@ -18,6 +18,8 @@ */ package org.drools.core.reteoo; +import java.util.List; + import org.drools.base.base.ObjectType; import org.drools.base.common.NetworkNode; import org.drools.base.common.RuleBasePartitionId; @@ -32,8 +34,6 @@ import org.drools.util.bitmask.BitMask; import org.kie.api.definition.rule.Rule; -import java.util.List; - /** * AlphaNodes are nodes in the Rete network used * to apply FieldConstraint<.code>s on asserted fact 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 c2b9ff969cf..d8ed04cf5a0 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 @@ -18,16 +18,16 @@ */ package org.drools.core.reteoo; +import org.drools.base.common.NetworkNode; import org.drools.core.common.ActivationsManager; import org.drools.core.common.InternalFactHandle; -import org.drools.base.common.NetworkNode; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.phreak.PhreakRuleTerminalNode; import org.drools.core.phreak.RuleAgendaItem; import org.drools.core.phreak.RuleExecutor; import org.drools.core.reteoo.builder.BuildContext; import org.drools.core.rule.consequence.InternalMatch; -import org.drools.core.common.PropagationContext; public class AlphaTerminalNode extends LeftInputAdapterNode { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/AsyncReceiveNode.java b/drools-core/src/main/java/org/drools/core/reteoo/AsyncReceiveNode.java index dc691de8d95..ed9a445c8ce 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/AsyncReceiveNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/AsyncReceiveNode.java @@ -23,20 +23,20 @@ import java.util.function.Consumer; import org.drools.base.reteoo.NodeTypeEnums; +import org.drools.base.rule.AsyncReceive; +import org.drools.base.rule.Pattern; +import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; import org.drools.core.RuleBaseConfiguration; import org.drools.core.common.BetaConstraints; import org.drools.core.common.EmptyBetaConstraints; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.Memory; import org.drools.core.common.MemoryFactory; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.UpdateContext; import org.drools.core.phreak.PropagationEntry; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.rule.AsyncReceive; -import org.drools.base.rule.Pattern; -import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; -import org.drools.core.common.PropagationContext; import org.drools.core.util.AbstractBaseLinkedListNode; import org.drools.core.util.index.TupleList; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/AsyncSendNode.java b/drools-core/src/main/java/org/drools/core/reteoo/AsyncSendNode.java index 148eb323373..168a28d28d1 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/AsyncSendNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/AsyncSendNode.java @@ -23,19 +23,19 @@ import java.util.Objects; import org.drools.base.reteoo.NodeTypeEnums; +import org.drools.base.rule.AsyncSend; +import org.drools.base.rule.accessor.DataProvider; +import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; import org.drools.core.RuleBaseConfiguration; import org.drools.core.common.BetaConstraints; import org.drools.core.common.EmptyBetaConstraints; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.Memory; import org.drools.core.common.MemoryFactory; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.UpdateContext; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.rule.AsyncSend; -import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; -import org.drools.base.rule.accessor.DataProvider; -import org.drools.core.common.PropagationContext; import org.drools.core.util.AbstractBaseLinkedListNode; import org.drools.core.util.index.TupleList; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/BetaMemory.java b/drools-core/src/main/java/org/drools/core/reteoo/BetaMemory.java index a77dae57cfb..4b88c92ca26 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/BetaMemory.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/BetaMemory.java @@ -18,12 +18,12 @@ */ package org.drools.core.reteoo; +import org.drools.base.rule.ContextEntry; import org.drools.core.common.Memory; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.TupleSets; import org.drools.core.common.TupleSetsImpl; import org.drools.core.reteoo.RightInputAdapterNode.RiaPathMemory; -import org.drools.base.rule.ContextEntry; import org.drools.core.util.AbstractBaseLinkedListNode; public class BetaMemory extends AbstractBaseLinkedListNode diff --git a/drools-core/src/main/java/org/drools/core/reteoo/BetaNode.java b/drools-core/src/main/java/org/drools/core/reteoo/BetaNode.java index a7bb30f9ea8..f892ddd7724 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/BetaNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/BetaNode.java @@ -23,9 +23,14 @@ import java.util.List; import java.util.Objects; +import org.drools.base.base.ObjectType; +import org.drools.base.common.RuleBasePartitionId; import org.drools.base.reteoo.NodeTypeEnums; +import org.drools.base.rule.IndexableConstraint; +import org.drools.base.rule.Pattern; +import org.drools.base.rule.constraint.BetaNodeFieldConstraint; +import org.drools.base.util.index.IndexUtil; import org.drools.core.RuleBaseConfiguration; -import org.drools.base.base.ObjectType; import org.drools.core.common.BetaConstraints; import org.drools.core.common.DoubleBetaConstraints; import org.drools.core.common.DoubleNonIndexSkipBetaConstraints; @@ -36,7 +41,6 @@ import org.drools.core.common.QuadroupleBetaConstraints; import org.drools.core.common.QuadroupleNonIndexSkipBetaConstraints; import org.drools.core.common.ReteEvaluator; -import org.drools.base.common.RuleBasePartitionId; import org.drools.core.common.SingleBetaConstraints; import org.drools.core.common.SingleNonIndexSkipBetaConstraints; import org.drools.core.common.TripleBetaConstraints; @@ -45,20 +49,16 @@ import org.drools.core.common.UpdateContext; import org.drools.core.reteoo.AccumulateNode.AccumulateMemory; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.rule.IndexableConstraint; -import org.drools.base.rule.Pattern; -import org.drools.base.rule.constraint.BetaNodeFieldConstraint; import org.drools.core.util.FastIterator; import org.drools.util.bitmask.AllSetBitMask; import org.drools.util.bitmask.BitMask; import org.drools.util.bitmask.EmptyBitMask; -import org.drools.base.util.index.IndexUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.drools.base.reteoo.PropertySpecificUtil.isPropertyReactive; import static org.drools.core.phreak.RuleNetworkEvaluator.doUpdatesReorderChildLeftTuple; import static org.drools.core.phreak.TupleEvaluationUtil.flushLeftTupleIfNecessary; -import static org.drools.base.reteoo.PropertySpecificUtil.isPropertyReactive; public abstract class BetaNode extends LeftTupleSource implements diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ClassObjectTypeConf.java b/drools-core/src/main/java/org/drools/core/reteoo/ClassObjectTypeConf.java index 810e8a01b73..1766531b082 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ClassObjectTypeConf.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ClassObjectTypeConf.java @@ -28,20 +28,20 @@ import java.util.Comparator; import java.util.List; -import org.drools.core.WorkingMemoryEntryPoint; import org.drools.base.base.ClassObjectType; +import org.drools.base.base.ObjectType; +import org.drools.base.rule.EntryPointId; +import org.drools.base.rule.TypeDeclaration; +import org.drools.base.util.TimeIntervalParser; +import org.drools.core.WorkingMemoryEntryPoint; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.ReteEvaluator; import org.drools.core.impl.InternalRuleBase; -import org.drools.base.rule.EntryPointId; -import org.drools.base.rule.TypeDeclaration; import org.drools.core.rule.accessor.FactHandleFactory; import org.drools.core.rule.consequence.InternalMatch; -import org.drools.base.util.TimeIntervalParser; import org.kie.api.definition.type.Expires; import org.kie.api.definition.type.Role; import org.kie.api.definition.type.Role.Type; -import org.drools.base.base.ObjectType; public class ClassObjectTypeConf implements @@ -171,8 +171,9 @@ public static String getPackageName(Class< ? > clazz, String pkgName = ""; if ( pkg == null ) { int index = clazz.getName().lastIndexOf( '.' ); - if ( index != -1 ) pkgName = clazz.getName().substring( 0, - index ); + if ( index != -1 ) { + pkgName = clazz.getName().substring( 0, index ); + } } else { pkgName = pkg.getName(); } @@ -245,11 +246,11 @@ public EntryPointId getEntryPoint() { } public String getClassName() { - return this.cls != null ? this.cls.getName() : ""; + return this.cls != null ? this.cls.getName() : ""; } public String getTypeName() { - return getClassName(); + return getClassName(); } @Override diff --git a/drools-core/src/main/java/org/drools/core/reteoo/CompositeLeftTupleSinkAdapter.java b/drools-core/src/main/java/org/drools/core/reteoo/CompositeLeftTupleSinkAdapter.java index aa90d48adc4..4d337c21934 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/CompositeLeftTupleSinkAdapter.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/CompositeLeftTupleSinkAdapter.java @@ -18,13 +18,13 @@ */ package org.drools.core.reteoo; -import org.drools.core.common.BaseNode; -import org.drools.base.common.RuleBasePartitionId; - import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import org.drools.base.common.RuleBasePartitionId; +import org.drools.core.common.BaseNode; + public class CompositeLeftTupleSinkAdapter extends AbstractLeftTupleSinkAdapter { private LeftTupleSinkNodeList sinks; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/CompositeObjectSinkAdapter.java b/drools-core/src/main/java/org/drools/core/reteoo/CompositeObjectSinkAdapter.java index 0dfe1e5226c..99eb4c941db 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/CompositeObjectSinkAdapter.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/CompositeObjectSinkAdapter.java @@ -18,6 +18,18 @@ */ package org.drools.core.reteoo; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Objects; + import org.drools.base.base.ValueType; import org.drools.base.common.NetworkNode; import org.drools.base.reteoo.NodeTypeEnums; @@ -32,18 +44,6 @@ import org.drools.core.common.ReteEvaluator; import org.drools.core.util.index.AlphaRangeIndex; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Objects; - import static org.drools.base.util.index.IndexUtil.isBigDecimalEqualityConstraint; public class CompositeObjectSinkAdapter implements ObjectSinkPropagator { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/CompositePartitionAwareObjectSinkAdapter.java b/drools-core/src/main/java/org/drools/core/reteoo/CompositePartitionAwareObjectSinkAdapter.java index 3e6da453c65..df9fb055ba9 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/CompositePartitionAwareObjectSinkAdapter.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/CompositePartitionAwareObjectSinkAdapter.java @@ -18,6 +18,14 @@ */ package org.drools.core.reteoo; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Stream; + import org.drools.base.common.RuleBasePartitionId; import org.drools.base.reteoo.NodeTypeEnums; import org.drools.base.rule.IndexableConstraint; @@ -30,14 +38,6 @@ import org.drools.core.phreak.PropagationEntry; import org.drools.core.reteoo.CompositeObjectSinkAdapter.FieldIndex; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.stream.Stream; - public class CompositePartitionAwareObjectSinkAdapter implements ObjectSinkPropagator { private final ObjectSinkPropagator[] partitionedPropagators; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ConditionalBranchEvaluator.java b/drools-core/src/main/java/org/drools/core/reteoo/ConditionalBranchEvaluator.java index 3cbcca39019..c1480fd3b6e 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ConditionalBranchEvaluator.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ConditionalBranchEvaluator.java @@ -23,9 +23,9 @@ import java.io.ObjectInput; import java.io.ObjectOutput; -import org.drools.core.common.ReteEvaluator; import org.drools.base.common.RuleBasePartitionId; import org.drools.base.rule.EvalCondition; +import org.drools.core.common.ReteEvaluator; public class ConditionalBranchEvaluator implements Externalizable { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ConditionalBranchNode.java b/drools-core/src/main/java/org/drools/core/reteoo/ConditionalBranchNode.java index 150a0771cfe..e9ed92a59a5 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ConditionalBranchNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ConditionalBranchNode.java @@ -28,10 +28,10 @@ import org.drools.core.common.InternalFactHandle; import org.drools.core.common.Memory; import org.drools.core.common.MemoryFactory; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.UpdateContext; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.core.common.PropagationContext; import org.drools.core.util.AbstractBaseLinkedListNode; /** diff --git a/drools-core/src/main/java/org/drools/core/reteoo/EmptyLeftTupleSinkAdapter.java b/drools-core/src/main/java/org/drools/core/reteoo/EmptyLeftTupleSinkAdapter.java index 22319622907..b179540deef 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/EmptyLeftTupleSinkAdapter.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/EmptyLeftTupleSinkAdapter.java @@ -18,13 +18,13 @@ */ package org.drools.core.reteoo; -import org.drools.core.common.BaseNode; -import org.drools.base.common.RuleBasePartitionId; - import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import org.drools.base.common.RuleBasePartitionId; +import org.drools.core.common.BaseNode; + public class EmptyLeftTupleSinkAdapter extends AbstractLeftTupleSinkAdapter { private static final EmptyLeftTupleSinkAdapter instance = new EmptyLeftTupleSinkAdapter(); diff --git a/drools-core/src/main/java/org/drools/core/reteoo/EmptyObjectSinkAdapter.java b/drools-core/src/main/java/org/drools/core/reteoo/EmptyObjectSinkAdapter.java index 9bb2b1b27ea..4a0b3be8128 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/EmptyObjectSinkAdapter.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/EmptyObjectSinkAdapter.java @@ -18,15 +18,15 @@ */ package org.drools.core.reteoo; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; + import org.drools.core.common.BaseNode; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; - public class EmptyObjectSinkAdapter implements ObjectSinkPropagator { private static final long serialVersionUID = 510l; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/EntryPointNode.java b/drools-core/src/main/java/org/drools/core/reteoo/EntryPointNode.java index 16551ad8276..4f7cb882c0a 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/EntryPointNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/EntryPointNode.java @@ -18,6 +18,11 @@ */ package org.drools.core.reteoo; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + import org.drools.base.base.ClassObjectType; import org.drools.base.base.ObjectType; import org.drools.base.common.RuleBasePartitionId; @@ -29,8 +34,8 @@ import org.drools.core.common.InternalFactHandle; import org.drools.core.common.InternalWorkingMemory; import org.drools.core.common.ObjectTypeConfigurationRegistry; -import org.drools.core.common.ReteEvaluator; import org.drools.core.common.PropagationContext; +import org.drools.core.common.ReteEvaluator; import org.drools.core.impl.InternalRuleBase; import org.drools.core.phreak.PropagationEntry; import org.drools.core.reteoo.builder.BuildContext; @@ -38,11 +43,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - /** * A node that is an entry point into the Rete network. * diff --git a/drools-core/src/main/java/org/drools/core/reteoo/EvalConditionNode.java b/drools-core/src/main/java/org/drools/core/reteoo/EvalConditionNode.java index 3a1f0acceb6..8159232dd9a 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/EvalConditionNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/EvalConditionNode.java @@ -26,16 +26,16 @@ import java.util.Map; import org.drools.base.reteoo.NodeTypeEnums; +import org.drools.base.rule.EvalCondition; +import org.drools.base.rule.RuleComponent; import org.drools.core.RuleBaseConfiguration; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.Memory; import org.drools.core.common.MemoryFactory; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.UpdateContext; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.rule.EvalCondition; -import org.drools.core.common.PropagationContext; -import org.drools.base.rule.RuleComponent; import org.drools.core.util.AbstractBaseLinkedListNode; import org.kie.api.definition.rule.Rule; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ExistsNode.java b/drools-core/src/main/java/org/drools/core/reteoo/ExistsNode.java index 65a2add3d04..94cfa6b93ee 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ExistsNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ExistsNode.java @@ -21,9 +21,9 @@ import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.common.BetaConstraints; import org.drools.core.common.InternalFactHandle; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.core.common.PropagationContext; /** * ExistsNode extends BetaNode to perform tests for diff --git a/drools-core/src/main/java/org/drools/core/reteoo/FactTemplateTypeConf.java b/drools-core/src/main/java/org/drools/core/reteoo/FactTemplateTypeConf.java index 60566ec838d..7ac53a3b215 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/FactTemplateTypeConf.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/FactTemplateTypeConf.java @@ -23,17 +23,17 @@ import java.io.ObjectInput; import java.io.ObjectOutput; -import org.drools.core.WorkingMemoryEntryPoint; import org.drools.base.base.ObjectType; -import org.drools.core.common.InternalFactHandle; -import org.drools.core.common.ReteEvaluator; import org.drools.base.facttemplates.Event; import org.drools.base.facttemplates.Fact; import org.drools.base.facttemplates.FactTemplate; import org.drools.base.facttemplates.FactTemplateObjectType; -import org.drools.core.impl.InternalRuleBase; import org.drools.base.rule.EntryPointId; import org.drools.base.rule.TypeDeclaration; +import org.drools.core.WorkingMemoryEntryPoint; +import org.drools.core.common.InternalFactHandle; +import org.drools.core.common.ReteEvaluator; +import org.drools.core.impl.InternalRuleBase; import org.drools.core.rule.accessor.FactHandleFactory; public class FactTemplateTypeConf @@ -145,7 +145,7 @@ public EntryPointId getEntryPoint() { @Override public String getTypeName() { - return factTemplate.getName(); + return factTemplate.getName(); } @Override diff --git a/drools-core/src/main/java/org/drools/core/reteoo/FromNode.java b/drools-core/src/main/java/org/drools/core/reteoo/FromNode.java index 95d46da03f7..f66f3805094 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/FromNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/FromNode.java @@ -25,26 +25,26 @@ import java.util.Map; import java.util.Objects; +import org.drools.base.base.ObjectType; import org.drools.base.reteoo.NodeTypeEnums; +import org.drools.base.rule.From; +import org.drools.base.rule.Pattern; +import org.drools.base.rule.accessor.DataProvider; +import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; import org.drools.core.RuleBaseConfiguration; import org.drools.core.common.BetaConstraints; import org.drools.core.common.EmptyBetaConstraints; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.Memory; import org.drools.core.common.MemoryFactory; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.UpdateContext; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.rule.From; -import org.drools.base.rule.Pattern; -import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; -import org.drools.base.rule.accessor.DataProvider; -import org.drools.base.base.ObjectType; -import org.drools.core.common.PropagationContext; import org.drools.core.util.AbstractBaseLinkedListNode; +import org.drools.core.util.index.TupleList; import org.drools.util.bitmask.AllSetBitMask; import org.drools.util.bitmask.BitMask; -import org.drools.core.util.index.TupleList; import static org.drools.base.reteoo.PropertySpecificUtil.calculateNegativeMask; import static org.drools.base.reteoo.PropertySpecificUtil.calculatePositiveMask; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/JoinNode.java b/drools-core/src/main/java/org/drools/core/reteoo/JoinNode.java index 6be61759cbb..235ca35bb42 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/JoinNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/JoinNode.java @@ -21,9 +21,9 @@ import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.common.BetaConstraints; import org.drools.core.common.InternalFactHandle; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.core.common.PropagationContext; public class JoinNode extends BetaNode { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/LeftInputAdapterNode.java b/drools-core/src/main/java/org/drools/core/reteoo/LeftInputAdapterNode.java index 1b181d1a56a..8ce32cc1f8b 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/LeftInputAdapterNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/LeftInputAdapterNode.java @@ -23,24 +23,24 @@ import java.util.List; import java.util.Set; +import org.drools.base.base.ClassObjectType; +import org.drools.base.base.ObjectType; +import org.drools.base.common.NetworkNode; +import org.drools.base.common.RuleBasePartitionId; import org.drools.base.reteoo.BaseTerminalNode; import org.drools.base.reteoo.NodeTypeEnums; +import org.drools.base.rule.Pattern; import org.drools.core.RuleBaseConfiguration; -import org.drools.base.base.ClassObjectType; -import org.drools.base.base.ObjectType; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.Memory; import org.drools.core.common.MemoryFactory; -import org.drools.base.common.NetworkNode; import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; -import org.drools.base.common.RuleBasePartitionId; import org.drools.core.common.TupleSets; import org.drools.core.common.UpdateContext; import org.drools.core.phreak.RuntimeSegmentUtilities; import org.drools.core.reteoo.ObjectTypeNode.Id; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.rule.Pattern; import org.drools.core.rule.consequence.InternalMatch; import org.drools.core.util.AbstractBaseLinkedListNode; import org.drools.util.bitmask.AllSetBitMask; @@ -49,13 +49,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.drools.base.reteoo.PropertySpecificUtil.isPropertyReactive; import static org.drools.core.phreak.TupleEvaluationUtil.createLeftTupleTupleSets; import static org.drools.core.phreak.TupleEvaluationUtil.findPathToFlush; import static org.drools.core.phreak.TupleEvaluationUtil.findPathsToFlushFromRia; import static org.drools.core.phreak.TupleEvaluationUtil.flushLeftTupleIfNecessary; import static org.drools.core.phreak.TupleEvaluationUtil.forceFlushLeftTuple; import static org.drools.core.phreak.TupleEvaluationUtil.forceFlushPath; -import static org.drools.base.reteoo.PropertySpecificUtil.isPropertyReactive; /** * All asserting Facts must propagated into the right ObjectSink side of a BetaNode, if this is the first Pattern diff --git a/drools-core/src/main/java/org/drools/core/reteoo/LeftTuple.java b/drools-core/src/main/java/org/drools/core/reteoo/LeftTuple.java index 49a7dc8b093..daa4c9986ae 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/LeftTuple.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/LeftTuple.java @@ -18,16 +18,16 @@ */ package org.drools.core.reteoo; -import org.drools.core.common.InternalFactHandle; -import org.drools.core.common.PropagationContext; -import org.drools.core.util.index.TupleList; -import org.kie.api.runtime.rule.FactHandle; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import org.drools.core.common.InternalFactHandle; +import org.drools.core.common.PropagationContext; +import org.drools.core.util.index.TupleList; +import org.kie.api.runtime.rule.FactHandle; + /** * A parent class for all specific LeftTuple specializations * diff --git a/drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSink.java b/drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSink.java index 00b2afd198f..520824de714 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSink.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSink.java @@ -18,8 +18,8 @@ */ package org.drools.core.reteoo; -import org.drools.core.common.InternalFactHandle; import org.drools.base.common.RuleBasePartitionId; +import org.drools.core.common.InternalFactHandle; import org.drools.core.common.PropagationContext; import org.drools.util.bitmask.BitMask; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSinkPropagator.java b/drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSinkPropagator.java index 57618db5829..ec9979097e2 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSinkPropagator.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSinkPropagator.java @@ -18,10 +18,10 @@ */ package org.drools.core.reteoo; -import org.drools.core.common.BaseNode; - import java.io.Externalizable; +import org.drools.core.common.BaseNode; + public interface LeftTupleSinkPropagator extends Externalizable { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSource.java b/drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSource.java index 7bb6ac43f93..5b38af65e66 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSource.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSource.java @@ -18,6 +18,9 @@ */ package org.drools.core.reteoo; +import java.util.Collection; +import java.util.List; + import org.drools.base.base.ClassObjectType; import org.drools.base.base.ObjectType; import org.drools.base.common.RuleBasePartitionId; @@ -30,9 +33,6 @@ import org.drools.util.bitmask.BitMask; import org.drools.util.bitmask.EmptyBitMask; -import java.util.Collection; -import java.util.List; - import static org.drools.base.reteoo.PropertySpecificUtil.calculateNegativeMask; import static org.drools.base.reteoo.PropertySpecificUtil.calculatePositiveMask; import static org.drools.base.reteoo.PropertySpecificUtil.getAccessibleProperties; 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 e40e9f87a63..4038bcb265d 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 @@ -18,13 +18,13 @@ */ package org.drools.core.reteoo; +import org.drools.base.common.RuleBasePartitionId; import org.drools.core.common.ActivationsManager; import org.drools.core.common.DefaultFactHandle; import org.drools.core.common.InternalFactHandle; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; -import org.drools.base.common.RuleBasePartitionId; import org.drools.core.phreak.PhreakRuleTerminalNode; -import org.drools.core.common.PropagationContext; public class ModifyPreviousTuples { private final DefaultFactHandle.LinkedTuples linkedTuples; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/NodeSet.java b/drools-core/src/main/java/org/drools/core/reteoo/NodeSet.java index beb29d25787..5d2ffaae3ad 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/NodeSet.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/NodeSet.java @@ -18,14 +18,14 @@ */ package org.drools.core.reteoo; -import org.drools.core.common.BaseNode; - import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; +import org.drools.core.common.BaseNode; + public class NodeSet implements Iterable { private final List nodes = new ArrayList<>(); private final Set nodeIds = new HashSet<>(); diff --git a/drools-core/src/main/java/org/drools/core/reteoo/NotNodeLeftTuple.java b/drools-core/src/main/java/org/drools/core/reteoo/NotNodeLeftTuple.java index eee5b4ecdf2..b0ccf791335 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/NotNodeLeftTuple.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/NotNodeLeftTuple.java @@ -23,12 +23,12 @@ import java.util.Collections; import org.drools.base.reteoo.NodeTypeEnums; +import org.drools.base.rule.ContextEntry; import org.drools.core.common.BetaConstraints; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.MemoryFactory; -import org.drools.core.common.ReteEvaluator; -import org.drools.base.rule.ContextEntry; import org.drools.core.common.PropagationContext; +import org.drools.core.common.ReteEvaluator; import org.drools.core.util.FastIterator; public class NotNodeLeftTuple extends LeftTuple { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ObjectSink.java b/drools-core/src/main/java/org/drools/core/reteoo/ObjectSink.java index 6fc9fb37f71..4c76710f71f 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ObjectSink.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ObjectSink.java @@ -19,8 +19,8 @@ package org.drools.core.reteoo; import org.drools.core.common.InternalFactHandle; -import org.drools.core.common.ReteEvaluator; import org.drools.core.common.PropagationContext; +import org.drools.core.common.ReteEvaluator; /** * Receiver of propagated FactHandleImpls from a diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ObjectSinkPropagator.java b/drools-core/src/main/java/org/drools/core/reteoo/ObjectSinkPropagator.java index a6a93343d14..4b971610bcc 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ObjectSinkPropagator.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ObjectSinkPropagator.java @@ -20,11 +20,11 @@ import java.io.Externalizable; +import org.drools.base.common.RuleBasePartitionId; import org.drools.core.common.BaseNode; import org.drools.core.common.InternalFactHandle; -import org.drools.core.common.ReteEvaluator; -import org.drools.base.common.RuleBasePartitionId; import org.drools.core.common.PropagationContext; +import org.drools.core.common.ReteEvaluator; public interface ObjectSinkPropagator extends diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ObjectSource.java b/drools-core/src/main/java/org/drools/core/reteoo/ObjectSource.java index 0fea32bc7df..d4c12c5bfde 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ObjectSource.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ObjectSource.java @@ -18,6 +18,8 @@ */ package org.drools.core.reteoo; +import java.util.List; + import org.drools.base.base.ObjectType; import org.drools.base.common.RuleBasePartitionId; import org.drools.base.reteoo.NodeTypeEnums; @@ -33,8 +35,6 @@ import org.drools.util.bitmask.BitMask; import org.drools.util.bitmask.EmptyBitMask; -import java.util.List; - import static org.drools.base.reteoo.PropertySpecificUtil.getAccessibleProperties; import static org.drools.base.reteoo.PropertySpecificUtil.isPropertyReactive; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeConf.java b/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeConf.java index e03dc119dfe..06ddd2186ec 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeConf.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeConf.java @@ -18,15 +18,15 @@ */ package org.drools.core.reteoo; +import org.drools.base.rule.EntryPointId; +import org.drools.base.rule.TypeDeclaration; import org.drools.core.WorkingMemoryEntryPoint; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.ReteEvaluator; -import org.drools.base.rule.EntryPointId; -import org.drools.base.rule.TypeDeclaration; import org.drools.core.rule.accessor.FactHandleFactory; public interface ObjectTypeConf { - String getTypeName(); + String getTypeName(); ObjectTypeNode[] getObjectTypeNodes(); diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNode.java b/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNode.java index e6e5a4ed407..c86acfd8c51 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNode.java @@ -18,6 +18,15 @@ */ package org.drools.core.reteoo; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.io.Serializable; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + import org.drools.base.InitialFact; import org.drools.base.base.ClassObjectType; import org.drools.base.base.ObjectType; @@ -40,15 +49,6 @@ import org.drools.util.bitmask.BitMask; import org.drools.util.bitmask.EmptyBitMask; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.io.Serializable; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - import static org.drools.base.rule.TypeDeclaration.NEVER_EXPIRES; /** @@ -161,8 +161,12 @@ public String toString() { @Override public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof Id)) return false; + if (this == o) { + return true; + } + if (!(o instanceof Id)) { + return false; + } Id otherId = (Id) o; return id == otherId.id && otnId == otherId.otnId; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/PathMemory.java b/drools-core/src/main/java/org/drools/core/reteoo/PathMemory.java index efd8a8c2af2..9bb44c15910 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/PathMemory.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/PathMemory.java @@ -18,6 +18,8 @@ */ package org.drools.core.reteoo; +import java.io.Serializable; + import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.common.ActivationsFilter; @@ -30,8 +32,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.Serializable; - public class PathMemory extends AbstractBaseLinkedListNode implements Serializable, Memory { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/QueryElementNode.java b/drools-core/src/main/java/org/drools/core/reteoo/QueryElementNode.java index afd662c2ec4..f9e6b5a4ba3 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/QueryElementNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/QueryElementNode.java @@ -18,6 +18,8 @@ */ package org.drools.core.reteoo; +import java.util.List; + import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.reteoo.NodeTypeEnums; @@ -43,8 +45,6 @@ import org.drools.core.util.AbstractBaseLinkedListNode; import org.kie.api.runtime.rule.FactHandle; -import java.util.List; - public class QueryElementNode extends LeftTupleSource implements LeftTupleSinkNode, MemoryFactory { private LeftTupleSinkNode previousTupleSinkNode; @@ -474,12 +474,22 @@ public boolean equals(Object object) { } QueryElementNode other = (QueryElementNode) object; - if ( this.leftInput.getId() != other.leftInput.getId() ) return false; - if ( openQuery != other.openQuery ) return false; - if ( !openQuery && dataDriven != other.dataDriven ) return false; + if ( this.leftInput.getId() != other.leftInput.getId() ) { + return false; + } + if ( openQuery != other.openQuery ) { + return false; + } + if ( !openQuery && dataDriven != other.dataDriven ) { + return false; + } if ( queryElement == null ) { - if ( other.queryElement != null ) return false; - } else if ( !queryElement.equals( other.queryElement ) ) return false; + if ( other.queryElement != null ) { + return false; + } + } else if ( !queryElement.equals( other.queryElement ) ) { + return false; + } return true; } diff --git a/drools-core/src/main/java/org/drools/core/reteoo/QueryTerminalNode.java b/drools-core/src/main/java/org/drools/core/reteoo/QueryTerminalNode.java index 1f1b99e56a9..f03c866d304 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/QueryTerminalNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/QueryTerminalNode.java @@ -18,6 +18,8 @@ */ package org.drools.core.reteoo; +import java.util.Map; + import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.reteoo.NodeTypeEnums; @@ -27,8 +29,6 @@ import org.drools.core.common.PropagationContext; import org.drools.core.reteoo.builder.BuildContext; -import java.util.Map; - /** * Leaf Rete-OO node responsible for enacting Action s on a * matched Rule. diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ReactiveFromNode.java b/drools-core/src/main/java/org/drools/core/reteoo/ReactiveFromNode.java index c8d972f6e5d..d10ac72033e 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ReactiveFromNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ReactiveFromNode.java @@ -19,17 +19,17 @@ package org.drools.core.reteoo; import org.drools.base.reteoo.NodeTypeEnums; +import org.drools.base.rule.From; +import org.drools.base.rule.accessor.DataProvider; +import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; import org.drools.core.RuleBaseConfiguration; import org.drools.core.common.BetaConstraints; import org.drools.core.common.InternalFactHandle; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.TupleSets; import org.drools.core.common.TupleSetsImpl; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.rule.From; -import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; -import org.drools.base.rule.accessor.DataProvider; -import org.drools.core.common.PropagationContext; import org.drools.core.util.index.TupleList; public class ReactiveFromNode extends FromNode { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/Rete.java b/drools-core/src/main/java/org/drools/core/reteoo/Rete.java index f140c39b19f..bf750649aff 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/Rete.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/Rete.java @@ -18,6 +18,12 @@ */ package org.drools.core.reteoo; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.drools.base.base.ObjectType; import org.drools.base.common.RuleBasePartitionId; import org.drools.base.reteoo.NodeTypeEnums; @@ -31,12 +37,6 @@ import org.drools.core.reteoo.builder.BuildContext; import org.drools.util.bitmask.BitMask; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * The Rete-OO network. * diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ReteDumper.java b/drools-core/src/main/java/org/drools/core/reteoo/ReteDumper.java index 9a0f61ddcd9..df2dbc696f0 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ReteDumper.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ReteDumper.java @@ -29,8 +29,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import org.drools.core.common.BaseNode; import org.drools.base.common.NetworkNode; +import org.drools.core.common.BaseNode; import org.drools.core.impl.InternalRuleBase; import org.kie.api.KieBase; import org.kie.api.definition.rule.Rule; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ReteObjectTypeNode.java b/drools-core/src/main/java/org/drools/core/reteoo/ReteObjectTypeNode.java index 0993942bd2f..fce9b459326 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ReteObjectTypeNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ReteObjectTypeNode.java @@ -18,11 +18,11 @@ */ package org.drools.core.reteoo; +import org.drools.base.base.ObjectType; import org.drools.core.common.InternalWorkingMemory; +import org.drools.core.common.PropagationContext; import org.drools.core.common.PropagationContextFactory; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.base.ObjectType; -import org.drools.core.common.PropagationContext; public class ReteObjectTypeNode extends ObjectTypeNode { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ReteooBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/ReteooBuilder.java index 0211f540a92..334a844442b 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ReteooBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ReteooBuilder.java @@ -33,19 +33,19 @@ import java.util.Queue; import java.util.Set; -import org.drools.base.reteoo.NodeTypeEnums; -import org.drools.core.common.BaseNode; import org.drools.base.common.DroolsObjectInputStream; import org.drools.base.common.DroolsObjectOutputStream; -import org.drools.core.common.InternalWorkingMemory; -import org.drools.core.common.MemoryFactory; import org.drools.base.common.NetworkNode; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.reteoo.NodeTypeEnums; +import org.drools.base.rule.InvalidPatternException; +import org.drools.base.rule.WindowDeclaration; +import org.drools.core.common.BaseNode; +import org.drools.core.common.InternalWorkingMemory; +import org.drools.core.common.MemoryFactory; import org.drools.core.impl.InternalRuleBase; import org.drools.core.phreak.PhreakBuilder; import org.drools.core.reteoo.builder.ReteooRuleBuilder; -import org.drools.base.rule.InvalidPatternException; -import org.drools.base.rule.WindowDeclaration; import org.kie.api.definition.rule.Rule; /** diff --git a/drools-core/src/main/java/org/drools/core/reteoo/RightInputAdapterNode.java b/drools-core/src/main/java/org/drools/core/reteoo/RightInputAdapterNode.java index a276bc9536c..68152135dad 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/RightInputAdapterNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/RightInputAdapterNode.java @@ -18,6 +18,11 @@ */ package org.drools.core.reteoo; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + import org.drools.base.base.ObjectType; import org.drools.base.common.NetworkNode; import org.drools.base.definitions.rule.impl.RuleImpl; @@ -35,11 +40,6 @@ import org.drools.util.bitmask.BitMask; import org.kie.api.definition.rule.Rule; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - /** * When joining a subnetwork into the main network again, RightInputAdapterNode adapts the * subnetwork's tuple into a fact in order right join it with the tuple being propagated in diff --git a/drools-core/src/main/java/org/drools/core/reteoo/RightTuple.java b/drools-core/src/main/java/org/drools/core/reteoo/RightTuple.java index 219f3d81e8c..5d5b7e15bed 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/RightTuple.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/RightTuple.java @@ -19,8 +19,8 @@ package org.drools.core.reteoo; import org.drools.core.common.InternalFactHandle; -import org.drools.core.common.ReteEvaluator; import org.drools.core.common.PropagationContext; +import org.drools.core.common.ReteEvaluator; public interface RightTuple extends Tuple { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/RightTupleImpl.java b/drools-core/src/main/java/org/drools/core/reteoo/RightTupleImpl.java index b1d3e888772..ee1cd0206b2 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/RightTupleImpl.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/RightTupleImpl.java @@ -20,8 +20,8 @@ import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.common.InternalFactHandle; -import org.drools.core.common.ReteEvaluator; import org.drools.core.common.PropagationContext; +import org.drools.core.common.ReteEvaluator; import org.drools.core.util.index.TupleList; public class RightTupleImpl extends AbstractTuple implements RightTuple { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/RightTupleSink.java b/drools-core/src/main/java/org/drools/core/reteoo/RightTupleSink.java index ab3d2305b29..cd79e2bfa12 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/RightTupleSink.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/RightTupleSink.java @@ -18,8 +18,8 @@ */ package org.drools.core.reteoo; -import org.drools.core.common.ReteEvaluator; import org.drools.core.common.PropagationContext; +import org.drools.core.common.ReteEvaluator; public interface RightTupleSink extends Sink { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/RuleBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/RuleBuilder.java index 6e08b53ae75..407575e152c 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/RuleBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/RuleBuilder.java @@ -22,10 +22,10 @@ import java.util.Collection; import java.util.List; -import org.drools.core.common.InternalWorkingMemory; import org.drools.base.definitions.rule.impl.RuleImpl; -import org.drools.core.impl.InternalRuleBase; import org.drools.base.rule.WindowDeclaration; +import org.drools.core.common.InternalWorkingMemory; +import org.drools.core.impl.InternalRuleBase; public interface RuleBuilder { 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 1aa45f3085a..4c11b264c06 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 @@ -18,6 +18,9 @@ */ package org.drools.core.reteoo; +import java.util.Map; +import java.util.Objects; + import org.drools.base.base.SalienceInteger; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.reteoo.NodeTypeEnums; @@ -31,9 +34,6 @@ import org.drools.core.reteoo.builder.BuildContext; import org.drools.core.rule.consequence.InternalMatch; -import java.util.Map; -import java.util.Objects; - /** * Leaf Rete-OO node responsible for enacting Action s on a * matched Rule. 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 826da2cea61..c613d3c4168 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 @@ -18,6 +18,11 @@ */ package org.drools.core.reteoo; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.rule.Declaration; import org.drools.base.rule.consequence.Consequence; @@ -31,11 +36,6 @@ import org.drools.core.rule.consequence.InternalMatch; import org.kie.api.runtime.rule.FactHandle; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; - public class RuleTerminalNodeLeftTuple extends LeftTuple implements InternalMatch { private static final long serialVersionUID = 540l; /** @@ -326,9 +326,15 @@ public void cancelActivation(ActivationsManager activationsManager) { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } RuleTerminalNodeLeftTuple that = (RuleTerminalNodeLeftTuple) o; return ruleAgendaItem.getRule().getName().equals(that.ruleAgendaItem.getRule().getName()); } diff --git a/drools-core/src/main/java/org/drools/core/reteoo/RuntimeComponentFactory.java b/drools-core/src/main/java/org/drools/core/reteoo/RuntimeComponentFactory.java index 8fe7e31c094..638e2034775 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/RuntimeComponentFactory.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/RuntimeComponentFactory.java @@ -18,6 +18,9 @@ */ package org.drools.core.reteoo; +import org.drools.base.RuleBase; +import org.drools.base.factmodel.traits.TraitFactory; +import org.drools.base.rule.accessor.GlobalResolver; import org.drools.core.SessionConfiguration; import org.drools.core.common.AgendaFactory; import org.drools.core.common.AgendaGroupFactory; @@ -25,15 +28,12 @@ import org.drools.core.common.InternalWorkingMemory; import org.drools.core.common.PropagationContextFactory; import org.drools.core.common.ReteEvaluator; -import org.drools.base.factmodel.traits.TraitFactory; import org.drools.core.management.DroolsManagementAgent; import org.drools.core.management.GenericKieSessionMonitoringImpl; import org.drools.core.marshalling.SerializablePlaceholderResolverStrategy; import org.drools.core.rule.accessor.FactHandleFactory; -import org.drools.base.rule.accessor.GlobalResolver; import org.drools.core.rule.consequence.KnowledgeHelper; import org.drools.core.time.TimerService; -import org.drools.base.RuleBase; import org.kie.api.internal.utils.KieService; import org.kie.api.marshalling.ObjectMarshallingStrategy; import org.kie.api.marshalling.ObjectMarshallingStrategyAcceptor; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/SegmentMemory.java b/drools-core/src/main/java/org/drools/core/reteoo/SegmentMemory.java index 150a7d6a86b..cba0529fe9e 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/SegmentMemory.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/SegmentMemory.java @@ -18,6 +18,12 @@ */ package org.drools.core.reteoo; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.common.Memory; import org.drools.core.common.MemoryFactory; @@ -35,12 +41,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - import static org.drools.core.phreak.RuntimeSegmentUtilities.getQuerySegmentMemory; public class SegmentMemory extends LinkedList diff --git a/drools-core/src/main/java/org/drools/core/reteoo/SingleLeftTupleSinkAdapter.java b/drools-core/src/main/java/org/drools/core/reteoo/SingleLeftTupleSinkAdapter.java index b5365d28c37..8dea48d8100 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/SingleLeftTupleSinkAdapter.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/SingleLeftTupleSinkAdapter.java @@ -22,8 +22,8 @@ import java.io.ObjectInput; import java.io.ObjectOutput; -import org.drools.core.common.BaseNode; import org.drools.base.common.RuleBasePartitionId; +import org.drools.core.common.BaseNode; public class SingleLeftTupleSinkAdapter extends AbstractLeftTupleSinkAdapter { protected LeftTupleSink sink; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/SingleObjectSinkAdapter.java b/drools-core/src/main/java/org/drools/core/reteoo/SingleObjectSinkAdapter.java index a905aca7879..abfaceb9732 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/SingleObjectSinkAdapter.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/SingleObjectSinkAdapter.java @@ -25,9 +25,9 @@ import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.common.BaseNode; import org.drools.core.common.InternalFactHandle; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.reteoo.AccumulateNode.AccumulateMemory; -import org.drools.core.common.PropagationContext; public class SingleObjectSinkAdapter implements ObjectSinkPropagator { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/SubnetworkTuple.java b/drools-core/src/main/java/org/drools/core/reteoo/SubnetworkTuple.java index 82b7c8e5c81..eaa5d08442b 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/SubnetworkTuple.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/SubnetworkTuple.java @@ -18,13 +18,13 @@ */ package org.drools.core.reteoo; +import java.util.concurrent.atomic.AtomicInteger; + import org.drools.core.common.DefaultFactHandle; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; -import java.util.concurrent.atomic.AtomicInteger; - public class SubnetworkTuple extends LeftTuple implements RightTuple { private LeftTuple blocked; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/TimerNode.java b/drools-core/src/main/java/org/drools/core/reteoo/TimerNode.java index 5f8c18815e9..ca3447bb216 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/TimerNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/TimerNode.java @@ -21,17 +21,17 @@ import java.util.Arrays; import org.drools.base.reteoo.NodeTypeEnums; +import org.drools.base.rule.Declaration; +import org.drools.base.rule.Pattern; +import org.drools.base.time.impl.Timer; import org.drools.core.RuleBaseConfiguration; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.Memory; import org.drools.core.common.MemoryFactory; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.UpdateContext; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.base.rule.Declaration; -import org.drools.base.rule.Pattern; -import org.drools.core.common.PropagationContext; -import org.drools.base.time.impl.Timer; import org.drools.core.util.AbstractBaseLinkedListNode; import org.drools.core.util.index.TupleList; @@ -147,7 +147,7 @@ public boolean equals(final Object object) { } return Arrays.deepEquals(startEndDeclarations, other.startEndDeclarations) && - this.timer.equals(other.timer); + this.timer.equals(other.timer); } public TimerNodeMemory createMemory(final RuleBaseConfiguration config, ReteEvaluator reteEvaluator) { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/Tuple.java b/drools-core/src/main/java/org/drools/core/reteoo/Tuple.java index 3e4d72046c8..68797a42499 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/Tuple.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/Tuple.java @@ -18,16 +18,16 @@ */ package org.drools.core.reteoo; +import java.io.Serializable; + +import org.drools.base.common.NetworkNode; import org.drools.base.reteoo.BaseTuple; import org.drools.core.common.InternalFactHandle; -import org.drools.base.common.NetworkNode; import org.drools.core.common.PropagationContext; import org.drools.core.util.Entry; import org.drools.core.util.index.TupleList; import org.kie.api.runtime.rule.FactHandle; -import java.io.Serializable; - /** * Partial matches are propagated through the Rete network as Tuples. Each Tuple * Is able to return the FactHandleImpl members of the partial match for the requested pattern. diff --git a/drools-core/src/main/java/org/drools/core/reteoo/WindowNode.java b/drools-core/src/main/java/org/drools/core/reteoo/WindowNode.java index 1e07590f659..5697c3960f8 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/WindowNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/WindowNode.java @@ -18,6 +18,11 @@ */ package org.drools.core.reteoo; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + import org.drools.base.base.ObjectType; import org.drools.base.reteoo.NodeTypeEnums; import org.drools.base.rule.EntryPointId; @@ -38,11 +43,6 @@ import org.drools.core.rule.SlidingTimeWindow; import org.drools.util.bitmask.BitMask; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - /** * WindowNodes are nodes in the Rete network used * to manage windows. They support multiple types of windows, like diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/AccumulateBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/AccumulateBuilder.java index b61388cd86c..fafbfbdfb01 100755 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/AccumulateBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/AccumulateBuilder.java @@ -21,16 +21,16 @@ import java.util.ArrayList; import java.util.List; -import org.drools.core.common.BetaConstraints; -import org.drools.core.reteoo.AccumulateNode; -import org.drools.core.reteoo.CoreComponentFactory; -import org.drools.core.reteoo.LeftTupleSource; -import org.drools.core.reteoo.RightInputAdapterNode; import org.drools.base.rule.Accumulate; import org.drools.base.rule.GroupElement; import org.drools.base.rule.RuleConditionElement; import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; import org.drools.base.rule.constraint.BetaNodeFieldConstraint; +import org.drools.core.common.BetaConstraints; +import org.drools.core.reteoo.AccumulateNode; +import org.drools.core.reteoo.CoreComponentFactory; +import org.drools.core.reteoo.LeftTupleSource; +import org.drools.core.reteoo.RightInputAdapterNode; public class AccumulateBuilder implements diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/AsyncReceiveBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/AsyncReceiveBuilder.java index 3a7063ab51d..408ecf34d07 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/AsyncReceiveBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/AsyncReceiveBuilder.java @@ -18,11 +18,11 @@ */ package org.drools.core.reteoo.builder; -import org.drools.core.common.BetaConstraints; -import org.drools.core.reteoo.CoreComponentFactory; import org.drools.base.rule.AsyncReceive; import org.drools.base.rule.RuleConditionElement; import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; +import org.drools.core.common.BetaConstraints; +import org.drools.core.reteoo.CoreComponentFactory; public class AsyncReceiveBuilder implements ReteooComponentBuilder { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/AsyncSendBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/AsyncSendBuilder.java index 6906d5fee81..025ab57a814 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/AsyncSendBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/AsyncSendBuilder.java @@ -18,12 +18,12 @@ */ package org.drools.core.reteoo.builder; -import org.drools.core.common.BetaConstraints; -import org.drools.core.reteoo.AsyncSendNode; -import org.drools.core.reteoo.CoreComponentFactory; import org.drools.base.rule.AsyncSend; import org.drools.base.rule.RuleConditionElement; import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; +import org.drools.core.common.BetaConstraints; +import org.drools.core.reteoo.AsyncSendNode; +import org.drools.core.reteoo.CoreComponentFactory; public class AsyncSendBuilder implements ReteooComponentBuilder { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/BetaNodeConstraintFactory.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/BetaNodeConstraintFactory.java index 49bce73cc36..5e3dbdd0003 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/BetaNodeConstraintFactory.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/BetaNodeConstraintFactory.java @@ -18,13 +18,13 @@ */ package org.drools.core.reteoo.builder; +import org.drools.base.rule.constraint.BetaNodeFieldConstraint; import org.drools.core.RuleBaseConfiguration; import org.drools.core.common.DefaultBetaConstraints; import org.drools.core.common.DoubleBetaConstraints; import org.drools.core.common.QuadroupleBetaConstraints; import org.drools.core.common.SingleBetaConstraints; import org.drools.core.common.TripleBetaConstraints; -import org.drools.base.rule.constraint.BetaNodeFieldConstraint; import org.kie.api.internal.utils.KieService; public interface BetaNodeConstraintFactory extends KieService { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/BetaNodeConstraintFactoryImpl.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/BetaNodeConstraintFactoryImpl.java index 201604bf6a2..ddcf2cf8ab1 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/BetaNodeConstraintFactoryImpl.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/BetaNodeConstraintFactoryImpl.java @@ -18,13 +18,13 @@ */ package org.drools.core.reteoo.builder; +import org.drools.base.rule.constraint.BetaNodeFieldConstraint; import org.drools.core.RuleBaseConfiguration; import org.drools.core.common.DefaultBetaConstraints; import org.drools.core.common.DoubleBetaConstraints; import org.drools.core.common.QuadroupleBetaConstraints; import org.drools.core.common.SingleBetaConstraints; import org.drools.core.common.TripleBetaConstraints; -import org.drools.base.rule.constraint.BetaNodeFieldConstraint; public class BetaNodeConstraintFactoryImpl implements BetaNodeConstraintFactory { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/BuildContext.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/BuildContext.java index 0f218da3a7b..03ada1be5d5 100755 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/BuildContext.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/BuildContext.java @@ -18,6 +18,13 @@ */ package org.drools.core.reteoo.builder; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Deque; +import java.util.List; + import org.drools.base.RuleBuildContext; import org.drools.base.common.NetworkNode; import org.drools.base.common.RuleBasePartitionId; @@ -40,13 +47,6 @@ import org.drools.core.reteoo.TerminalNode; import org.drools.core.time.TemporalDependencyMatrix; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Deque; -import java.util.List; - import static org.drools.base.rule.TypeDeclaration.NEVER_EXPIRES; /** diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/BuildUtils.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/BuildUtils.java index ec2336b1ea1..0edca81cddb 100755 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/BuildUtils.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/BuildUtils.java @@ -23,16 +23,10 @@ import java.util.List; import java.util.Map; -import org.drools.core.common.BaseNode; -import org.drools.core.common.BetaConstraints; -import org.drools.core.common.EmptyBetaConstraints; +import org.drools.base.base.ObjectType; import org.drools.base.common.RuleBasePartitionId; import org.drools.base.definitions.rule.impl.RuleImpl; -import org.drools.core.reteoo.AlphaNode; -import org.drools.core.reteoo.BetaNode; -import org.drools.core.reteoo.EntryPointNode; import org.drools.base.reteoo.NodeTypeEnums; -import org.drools.core.reteoo.ObjectTypeNode; import org.drools.base.rule.Declaration; import org.drools.base.rule.GroupElement; import org.drools.base.rule.IntervalProviderConstraint; @@ -40,10 +34,16 @@ import org.drools.base.rule.RuleConditionElement; import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; import org.drools.base.rule.constraint.BetaNodeFieldConstraint; -import org.drools.base.base.ObjectType; import org.drools.base.time.Interval; -import org.drools.core.time.TemporalDependencyMatrix; import org.drools.base.time.TimeUtils; +import org.drools.core.common.BaseNode; +import org.drools.core.common.BetaConstraints; +import org.drools.core.common.EmptyBetaConstraints; +import org.drools.core.reteoo.AlphaNode; +import org.drools.core.reteoo.BetaNode; +import org.drools.core.reteoo.EntryPointNode; +import org.drools.core.reteoo.ObjectTypeNode; +import org.drools.core.time.TemporalDependencyMatrix; import org.kie.api.definition.rule.Rule; /** diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/CollectBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/CollectBuilder.java index e613321e8aa..7b5af6a4228 100755 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/CollectBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/CollectBuilder.java @@ -21,13 +21,6 @@ import java.util.ArrayList; import java.util.List; -import org.drools.core.base.accumulators.CollectAccumulator; -import org.drools.core.common.BetaConstraints; -import org.drools.core.common.TupleStartEqualsConstraint; -import org.drools.core.reteoo.AccumulateNode; -import org.drools.core.reteoo.CoreComponentFactory; -import org.drools.core.reteoo.LeftTupleSource; -import org.drools.core.reteoo.RightInputAdapterNode; import org.drools.base.rule.Accumulate; import org.drools.base.rule.Collect; import org.drools.base.rule.Pattern; @@ -35,6 +28,13 @@ import org.drools.base.rule.SingleAccumulate; import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; import org.drools.base.rule.constraint.BetaNodeFieldConstraint; +import org.drools.core.base.accumulators.CollectAccumulator; +import org.drools.core.common.BetaConstraints; +import org.drools.core.common.TupleStartEqualsConstraint; +import org.drools.core.reteoo.AccumulateNode; +import org.drools.core.reteoo.CoreComponentFactory; +import org.drools.core.reteoo.LeftTupleSource; +import org.drools.core.reteoo.RightInputAdapterNode; public class CollectBuilder implements diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/ConditionalBranchBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/ConditionalBranchBuilder.java index e834646babf..142e8bdbb27 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/ConditionalBranchBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/ConditionalBranchBuilder.java @@ -18,14 +18,14 @@ */ package org.drools.core.reteoo.builder; +import org.drools.base.rule.ConditionalBranch; +import org.drools.base.rule.GroupElement; +import org.drools.base.rule.RuleConditionElement; import org.drools.core.common.UpdateContext; import org.drools.core.reteoo.ConditionalBranchEvaluator; import org.drools.core.reteoo.ConditionalBranchNode; import org.drools.core.reteoo.CoreComponentFactory; import org.drools.core.reteoo.RuleTerminalNode; -import org.drools.base.rule.ConditionalBranch; -import org.drools.base.rule.GroupElement; -import org.drools.base.rule.RuleConditionElement; public class ConditionalBranchBuilder implements ReteooComponentBuilder { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/EntryPointBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/EntryPointBuilder.java index 6fd1fe976a1..60a387ba3cf 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/EntryPointBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/EntryPointBuilder.java @@ -18,10 +18,10 @@ */ package org.drools.core.reteoo.builder; -import org.drools.core.reteoo.CoreComponentFactory; -import org.drools.core.reteoo.EntryPointNode; import org.drools.base.rule.EntryPointId; import org.drools.base.rule.RuleConditionElement; +import org.drools.core.reteoo.CoreComponentFactory; +import org.drools.core.reteoo.EntryPointNode; /** * This is a builder for the entry point pattern diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/EvalBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/EvalBuilder.java index f13ba32f381..7e2a17cd7be 100755 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/EvalBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/EvalBuilder.java @@ -18,9 +18,9 @@ */ package org.drools.core.reteoo.builder; -import org.drools.core.reteoo.CoreComponentFactory; import org.drools.base.rule.EvalCondition; import org.drools.base.rule.RuleConditionElement; +import org.drools.core.reteoo.CoreComponentFactory; public class EvalBuilder implements diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/FromBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/FromBuilder.java index 9c6dd4397e6..ee654c48dc2 100755 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/FromBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/FromBuilder.java @@ -18,12 +18,12 @@ */ package org.drools.core.reteoo.builder; -import org.drools.core.common.BetaConstraints; -import org.drools.core.reteoo.CoreComponentFactory; -import org.drools.core.reteoo.FromNode; import org.drools.base.rule.From; import org.drools.base.rule.RuleConditionElement; import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; +import org.drools.core.common.BetaConstraints; +import org.drools.core.reteoo.CoreComponentFactory; +import org.drools.core.reteoo.FromNode; public class FromBuilder implements diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/GroupElementBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/GroupElementBuilder.java index 956d5628e92..6df4f4782ad 100755 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/GroupElementBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/GroupElementBuilder.java @@ -24,6 +24,12 @@ import java.util.Map; import org.drools.base.InitialFact; +import org.drools.base.reteoo.NodeTypeEnums; +import org.drools.base.rule.GroupElement; +import org.drools.base.rule.GroupElement.Type; +import org.drools.base.rule.Pattern; +import org.drools.base.rule.RuleConditionElement; +import org.drools.base.rule.constraint.BetaNodeFieldConstraint; import org.drools.core.RuleBaseConfiguration; import org.drools.core.common.BetaConstraints; import org.drools.core.common.TupleStartEqualsConstraint; @@ -31,16 +37,10 @@ import org.drools.core.reteoo.ExistsNode; import org.drools.core.reteoo.JoinNode; import org.drools.core.reteoo.LeftTupleSource; -import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.reteoo.NotNode; import org.drools.core.reteoo.ObjectSource; import org.drools.core.reteoo.ObjectTypeNode; import org.drools.core.reteoo.RightInputAdapterNode; -import org.drools.base.rule.GroupElement; -import org.drools.base.rule.GroupElement.Type; -import org.drools.base.rule.Pattern; -import org.drools.base.rule.RuleConditionElement; -import org.drools.base.rule.constraint.BetaNodeFieldConstraint; import org.kie.api.definition.rule.Propagation; public class GroupElementBuilder diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/NodeFactory.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/NodeFactory.java index a1194e0c844..c02d6a8fa65 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/NodeFactory.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/NodeFactory.java @@ -19,6 +19,8 @@ package org.drools.core.reteoo.builder; +import java.util.List; + import org.drools.base.base.ObjectType; import org.drools.base.common.RuleBasePartitionId; import org.drools.base.definitions.rule.impl.RuleImpl; @@ -59,8 +61,6 @@ import org.drools.core.reteoo.WindowNode; import org.drools.core.rule.BehaviorRuntime; -import java.util.List; - public interface NodeFactory { EntryPointNode buildEntryPointNode( int id, diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/PatternBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/PatternBuilder.java index 4405e66ce61..421ca3ce239 100755 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/PatternBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/PatternBuilder.java @@ -18,6 +18,10 @@ */ package org.drools.core.reteoo.builder; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + import org.drools.base.base.ClassObjectType; import org.drools.base.base.DroolsQuery; import org.drools.base.base.ObjectType; @@ -48,10 +52,6 @@ import org.kie.api.conf.EventProcessingOption; import org.kie.api.definition.type.Expires.Policy; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - import static org.drools.base.rule.TypeDeclaration.NEVER_EXPIRES; import static org.drools.core.reteoo.builder.GroupElementBuilder.AndBuilder.buildJoinNode; import static org.drools.core.reteoo.builder.GroupElementBuilder.AndBuilder.buildTupleSource; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/PhreakNodeFactory.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/PhreakNodeFactory.java index ed919e02092..9a912664d98 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/PhreakNodeFactory.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/PhreakNodeFactory.java @@ -19,6 +19,9 @@ package org.drools.core.reteoo.builder; +import java.io.Serializable; +import java.util.List; + import org.drools.base.base.ObjectType; import org.drools.base.common.RuleBasePartitionId; import org.drools.base.definitions.rule.impl.RuleImpl; @@ -62,9 +65,6 @@ import org.drools.core.reteoo.WindowNode; import org.drools.core.rule.BehaviorRuntime; -import java.io.Serializable; -import java.util.List; - public class PhreakNodeFactory implements NodeFactory, Serializable { private static final NodeFactory INSTANCE = new PhreakNodeFactory(); diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/QueryElementBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/QueryElementBuilder.java index 3a862a59e0a..edda701d27d 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/QueryElementBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/QueryElementBuilder.java @@ -18,10 +18,10 @@ */ package org.drools.core.reteoo.builder; -import org.drools.core.reteoo.CoreComponentFactory; import org.drools.base.rule.Pattern; import org.drools.base.rule.QueryElement; import org.drools.base.rule.RuleConditionElement; +import org.drools.core.reteoo.CoreComponentFactory; public class QueryElementBuilder diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/ReactiveFromBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/ReactiveFromBuilder.java index 113ba740e76..be45455a201 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/ReactiveFromBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/ReactiveFromBuilder.java @@ -20,13 +20,13 @@ import java.util.List; -import org.drools.core.common.BetaConstraints; -import org.drools.core.reteoo.CoreComponentFactory; -import org.drools.core.reteoo.ReactiveFromNode; import org.drools.base.rule.From; import org.drools.base.rule.RuleConditionElement; -import org.drools.base.rule.constraint.XpathConstraint; import org.drools.base.rule.constraint.AlphaNodeFieldConstraint; +import org.drools.base.rule.constraint.XpathConstraint; +import org.drools.core.common.BetaConstraints; +import org.drools.core.reteoo.CoreComponentFactory; +import org.drools.core.reteoo.ReactiveFromNode; public class ReactiveFromBuilder implements ReteooComponentBuilder { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/ReteooRuleBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/ReteooRuleBuilder.java index b19df29d347..2431318aced 100755 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/ReteooRuleBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/ReteooRuleBuilder.java @@ -18,6 +18,10 @@ */ package org.drools.core.reteoo.builder; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + import org.drools.base.base.ClassObjectType; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.rule.Accumulate; @@ -53,10 +57,6 @@ import org.drools.core.time.TemporalDependencyMatrix; import org.kie.api.conf.EventProcessingOption; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - public class ReteooRuleBuilder implements RuleBuilder { protected BuildUtils utils; diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/TimerBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/TimerBuilder.java index 78233f57c02..5e6f2570681 100755 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/TimerBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/TimerBuilder.java @@ -18,11 +18,11 @@ */ package org.drools.core.reteoo.builder; -import org.drools.core.reteoo.CoreComponentFactory; import org.drools.base.rule.Declaration; import org.drools.base.rule.RuleConditionElement; -import org.drools.core.time.impl.BaseTimer; import org.drools.base.time.impl.Timer; +import org.drools.core.reteoo.CoreComponentFactory; +import org.drools.core.time.impl.BaseTimer; public class TimerBuilder implements diff --git a/drools-core/src/main/java/org/drools/core/reteoo/builder/WindowReferenceBuilder.java b/drools-core/src/main/java/org/drools/core/reteoo/builder/WindowReferenceBuilder.java index c1a342395b3..aaf35658325 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/builder/WindowReferenceBuilder.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/builder/WindowReferenceBuilder.java @@ -18,9 +18,9 @@ */ package org.drools.core.reteoo.builder; -import org.drools.core.reteoo.WindowNode; import org.drools.base.rule.RuleConditionElement; import org.drools.base.rule.WindowReference; +import org.drools.core.reteoo.WindowNode; /** * This is a builder for named window references diff --git a/drools-core/src/main/java/org/drools/core/rule/BehaviorContext.java b/drools-core/src/main/java/org/drools/core/rule/BehaviorContext.java index 10817aa726b..d618e5c7d1e 100644 --- a/drools-core/src/main/java/org/drools/core/rule/BehaviorContext.java +++ b/drools-core/src/main/java/org/drools/core/rule/BehaviorContext.java @@ -18,11 +18,11 @@ */ package org.drools.core.rule; -import org.drools.core.common.DefaultEventHandle; -import org.drools.base.time.JobHandle; - import java.util.Collection; +import org.drools.base.time.JobHandle; +import org.drools.core.common.DefaultEventHandle; + public interface BehaviorContext { Collection getFactHandles(); diff --git a/drools-core/src/main/java/org/drools/core/rule/BehaviorManager.java b/drools-core/src/main/java/org/drools/core/rule/BehaviorManager.java index caa73ab8cc1..5de9f1d90f6 100644 --- a/drools-core/src/main/java/org/drools/core/rule/BehaviorManager.java +++ b/drools-core/src/main/java/org/drools/core/rule/BehaviorManager.java @@ -25,8 +25,8 @@ import java.util.List; import org.drools.core.common.InternalFactHandle; -import org.drools.core.common.ReteEvaluator; import org.drools.core.common.PropagationContext; +import org.drools.core.common.ReteEvaluator; import org.kie.api.runtime.rule.FactHandle; /** diff --git a/drools-core/src/main/java/org/drools/core/rule/JavaDialectRuntimeData.java b/drools-core/src/main/java/org/drools/core/rule/JavaDialectRuntimeData.java index bef6fa7a4ca..a5dae0475b8 100644 --- a/drools-core/src/main/java/org/drools/core/rule/JavaDialectRuntimeData.java +++ b/drools-core/src/main/java/org/drools/core/rule/JavaDialectRuntimeData.java @@ -18,24 +18,6 @@ */ package org.drools.core.rule; -import org.drools.base.definitions.impl.KnowledgePackageImpl; -import org.drools.base.definitions.rule.impl.QueryImpl; -import org.drools.base.definitions.rule.impl.RuleImpl; -import org.drools.base.rule.ConditionalElement; -import org.drools.base.rule.DialectRuntimeData; -import org.drools.base.rule.DialectRuntimeRegistry; -import org.drools.base.rule.EvalCondition; -import org.drools.base.rule.Function; -import org.drools.base.rule.GroupElement; -import org.drools.base.rule.accessor.Wireable; -import org.drools.core.util.KeyStoreHelper; -import org.drools.util.StringUtils; -import org.drools.wiring.api.ComponentsFactory; -import org.drools.wiring.api.classloader.ProjectClassLoader; -import org.kie.internal.concurrent.ExecutorProviderFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.Externalizable; @@ -58,6 +40,24 @@ import java.util.concurrent.CompletionService; import java.util.concurrent.ConcurrentHashMap; +import org.drools.base.definitions.impl.KnowledgePackageImpl; +import org.drools.base.definitions.rule.impl.QueryImpl; +import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.ConditionalElement; +import org.drools.base.rule.DialectRuntimeData; +import org.drools.base.rule.DialectRuntimeRegistry; +import org.drools.base.rule.EvalCondition; +import org.drools.base.rule.Function; +import org.drools.base.rule.GroupElement; +import org.drools.base.rule.accessor.Wireable; +import org.drools.core.util.KeyStoreHelper; +import org.drools.util.StringUtils; +import org.drools.wiring.api.ComponentsFactory; +import org.drools.wiring.api.classloader.ProjectClassLoader; +import org.kie.internal.concurrent.ExecutorProviderFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import static org.drools.util.ClassUtils.convertClassToResourcePath; import static org.drools.util.ClassUtils.convertResourceToClassName; diff --git a/drools-core/src/main/java/org/drools/core/rule/SlidingTimeWindow.java b/drools-core/src/main/java/org/drools/core/rule/SlidingTimeWindow.java index 1dac5907e3d..f04ae01a1d1 100644 --- a/drools-core/src/main/java/org/drools/core/rule/SlidingTimeWindow.java +++ b/drools-core/src/main/java/org/drools/core/rule/SlidingTimeWindow.java @@ -25,9 +25,11 @@ import java.util.Collection; import java.util.PriorityQueue; +import org.drools.base.time.JobHandle; import org.drools.core.common.DefaultEventHandle; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.PhreakPropagationContextFactory; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.WorkingMemoryAction; import org.drools.core.marshalling.MarshallerReaderContext; @@ -35,10 +37,8 @@ import org.drools.core.reteoo.ObjectTypeNode; import org.drools.core.reteoo.WindowNode; import org.drools.core.reteoo.WindowNode.WindowMemory; -import org.drools.core.common.PropagationContext; import org.drools.core.time.Job; import org.drools.core.time.JobContext; -import org.drools.base.time.JobHandle; import org.drools.core.time.TimerService; import org.drools.core.time.impl.PointInTimeTrigger; import org.kie.api.runtime.rule.FactHandle; diff --git a/drools-core/src/main/java/org/drools/core/rule/accessor/FactHandleFactory.java b/drools-core/src/main/java/org/drools/core/rule/accessor/FactHandleFactory.java index 32c4773839d..8235922ee44 100644 --- a/drools-core/src/main/java/org/drools/core/rule/accessor/FactHandleFactory.java +++ b/drools-core/src/main/java/org/drools/core/rule/accessor/FactHandleFactory.java @@ -21,8 +21,8 @@ import java.util.Collection; import org.drools.core.WorkingMemoryEntryPoint; -import org.drools.core.common.DefaultFactHandle; import org.drools.core.common.DefaultEventHandle; +import org.drools.core.common.DefaultFactHandle; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.ReteEvaluator; import org.drools.core.reteoo.ObjectTypeConf; diff --git a/drools-core/src/main/java/org/drools/core/rule/consequence/InternalMatch.java b/drools-core/src/main/java/org/drools/core/rule/consequence/InternalMatch.java index 648e684c0ac..064f8d5a42e 100644 --- a/drools-core/src/main/java/org/drools/core/rule/consequence/InternalMatch.java +++ b/drools-core/src/main/java/org/drools/core/rule/consequence/InternalMatch.java @@ -25,6 +25,8 @@ import java.util.Map; import org.drools.base.InitialFact; +import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.Declaration; import org.drools.base.rule.consequence.Consequence; import org.drools.core.common.ActivationGroupNode; import org.drools.core.common.ActivationNode; @@ -33,12 +35,10 @@ import org.drools.core.common.PropagationContext; import org.drools.core.common.QueryElementFactHandle; import org.drools.core.common.ReteEvaluator; -import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.core.phreak.RuleAgendaItem; import org.drools.core.reteoo.LeftTuple; import org.drools.core.reteoo.TerminalNode; import org.drools.core.reteoo.Tuple; -import org.drools.base.rule.Declaration; import org.drools.core.util.Queue.QueueEntry; import org.kie.api.runtime.process.ProcessInstance; import org.kie.api.runtime.rule.FactHandle; diff --git a/drools-core/src/main/java/org/drools/core/runtime/rule/impl/LiveQueryImpl.java b/drools-core/src/main/java/org/drools/core/runtime/rule/impl/LiveQueryImpl.java index fd205642cb5..d5f056e5414 100644 --- a/drools-core/src/main/java/org/drools/core/runtime/rule/impl/LiveQueryImpl.java +++ b/drools-core/src/main/java/org/drools/core/runtime/rule/impl/LiveQueryImpl.java @@ -18,9 +18,9 @@ */ package org.drools.core.runtime.rule.impl; -import org.kie.api.runtime.rule.FactHandle; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.InternalWorkingMemory; +import org.kie.api.runtime.rule.FactHandle; import org.kie.api.runtime.rule.LiveQuery; public class LiveQueryImpl diff --git a/drools-core/src/main/java/org/drools/core/runtime/rule/impl/OpenQueryViewChangedEventListenerAdapter.java b/drools-core/src/main/java/org/drools/core/runtime/rule/impl/OpenQueryViewChangedEventListenerAdapter.java index 23c7322b1e7..7eb0e4fbc49 100644 --- a/drools-core/src/main/java/org/drools/core/runtime/rule/impl/OpenQueryViewChangedEventListenerAdapter.java +++ b/drools-core/src/main/java/org/drools/core/runtime/rule/impl/OpenQueryViewChangedEventListenerAdapter.java @@ -20,9 +20,9 @@ import java.util.List; +import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.core.base.InternalViewChangedEventListener; import org.drools.core.common.ReteEvaluator; -import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.core.reteoo.LeftTuple; import org.kie.api.runtime.rule.ViewChangedEventListener; diff --git a/drools-core/src/main/java/org/drools/core/runtime/rule/impl/RowAdapter.java b/drools-core/src/main/java/org/drools/core/runtime/rule/impl/RowAdapter.java index e66fbca7a1a..949b1c7373c 100644 --- a/drools-core/src/main/java/org/drools/core/runtime/rule/impl/RowAdapter.java +++ b/drools-core/src/main/java/org/drools/core/runtime/rule/impl/RowAdapter.java @@ -89,18 +89,23 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } RowAdapter other = (RowAdapter) obj; if (this.tuple == null) { - if (other.tuple != null) + if (other.tuple != null) { return false; - } else if (!this.tuple.equals(other.tuple )) + } + } else if (!this.tuple.equals(other.tuple )) { return false; + } return true; } diff --git a/drools-core/src/main/java/org/drools/core/time/TimerExpressionUtil.java b/drools-core/src/main/java/org/drools/core/time/TimerExpressionUtil.java index e010cd7f7a0..f2a3a3f8175 100644 --- a/drools-core/src/main/java/org/drools/core/time/TimerExpressionUtil.java +++ b/drools-core/src/main/java/org/drools/core/time/TimerExpressionUtil.java @@ -18,14 +18,14 @@ */ package org.drools.core.time; +import java.util.Date; + import org.drools.base.base.ValueResolver; import org.drools.base.reteoo.BaseTuple; import org.drools.base.rule.Declaration; import org.drools.base.time.TimeUtils; import org.drools.util.DateUtils; -import java.util.Date; - public class TimerExpressionUtil { public static long evalTimeExpression(TimerExpression expr, BaseTuple leftTuple, Declaration[] declrs, ValueResolver valueResolver) { Object d = expr.getValue( leftTuple, declrs, valueResolver ); diff --git a/drools-core/src/main/java/org/drools/core/time/impl/BaseTimer.java b/drools-core/src/main/java/org/drools/core/time/impl/BaseTimer.java index aa063daaf1a..969e2d0c59b 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/BaseTimer.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/BaseTimer.java @@ -18,16 +18,16 @@ */ package org.drools.core.time.impl; -import org.drools.base.reteoo.SortDeclarations; -import org.drools.base.rule.ConditionalElement; -import org.drools.base.rule.Declaration; -import org.drools.base.rule.RuleConditionElement; - import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; +import org.drools.base.reteoo.SortDeclarations; +import org.drools.base.rule.ConditionalElement; +import org.drools.base.rule.Declaration; +import org.drools.base.rule.RuleConditionElement; + public abstract class BaseTimer extends ConditionalElement{ diff --git a/drools-core/src/main/java/org/drools/core/time/impl/CompositeMaxDurationTimer.java b/drools-core/src/main/java/org/drools/core/time/impl/CompositeMaxDurationTimer.java index 96c1cc29945..c5e2799f828 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/CompositeMaxDurationTimer.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/CompositeMaxDurationTimer.java @@ -27,14 +27,14 @@ import java.util.Map; import org.drools.base.base.ValueResolver; -import org.drools.base.time.impl.Timer; -import org.drools.core.common.InternalWorkingMemory; import org.drools.base.reteoo.BaseTuple; import org.drools.base.rule.ConditionalElement; import org.drools.base.rule.Declaration; -import org.drools.core.rule.consequence.InternalMatch; import org.drools.base.time.JobHandle; import org.drools.base.time.Trigger; +import org.drools.base.time.impl.Timer; +import org.drools.core.common.InternalWorkingMemory; +import org.drools.core.rule.consequence.InternalMatch; import org.kie.api.runtime.Calendars; /** diff --git a/drools-core/src/main/java/org/drools/core/time/impl/CompositeMaxDurationTrigger.java b/drools-core/src/main/java/org/drools/core/time/impl/CompositeMaxDurationTrigger.java index 5a617cacb94..8840daeb668 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/CompositeMaxDurationTrigger.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/CompositeMaxDurationTrigger.java @@ -18,14 +18,14 @@ */ package org.drools.core.time.impl; -import org.drools.base.time.Trigger; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.Date; +import org.drools.base.time.Trigger; + public class CompositeMaxDurationTrigger implements Trigger, Externalizable { diff --git a/drools-core/src/main/java/org/drools/core/time/impl/CronExpression.java b/drools-core/src/main/java/org/drools/core/time/impl/CronExpression.java index eff662f7cab..11212025df2 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/CronExpression.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/CronExpression.java @@ -765,8 +765,9 @@ public Object clone() { CronExpression copy; try { copy = new CronExpression(getCronExpression()); - if(getTimeZone() != null) + if(getTimeZone() != null) { copy.setTimeZone((TimeZone) getTimeZone().clone()); + } } catch (ParseException ex) { // never happens since the source is valid... throw new IncompatibleClassChangeError("Not Cloneable."); } diff --git a/drools-core/src/main/java/org/drools/core/time/impl/CronTimer.java b/drools-core/src/main/java/org/drools/core/time/impl/CronTimer.java index 7c1e598daf6..2ff9e668edd 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/CronTimer.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/CronTimer.java @@ -26,13 +26,13 @@ import java.util.Map; import org.drools.base.base.ValueResolver; -import org.drools.base.time.impl.Timer; import org.drools.base.reteoo.BaseTuple; import org.drools.base.rule.ConditionalElement; import org.drools.base.rule.Declaration; import org.drools.base.time.JobHandle; -import org.drools.core.time.TimerExpression; import org.drools.base.time.Trigger; +import org.drools.base.time.impl.Timer; +import org.drools.core.time.TimerExpression; import org.kie.api.runtime.Calendars; import static org.drools.core.time.TimerExpressionUtil.evalDateExpression; @@ -143,20 +143,40 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } CronTimer other = (CronTimer) obj; - if ( repeatLimit != other.repeatLimit ) return false; + if ( repeatLimit != other.repeatLimit ) { + return false; + } if ( cronExpression.getCronExpression() == null ) { - if ( other.cronExpression.getCronExpression() != null ) return false; - } else if ( !cronExpression.getCronExpression().equals( other.cronExpression.getCronExpression() ) ) return false; + if ( other.cronExpression.getCronExpression() != null ) { + return false; + } + } else if ( !cronExpression.getCronExpression().equals( other.cronExpression.getCronExpression() ) ) { + return false; + } if ( endTime == null ) { - if ( other.endTime != null ) return false; - } else if ( !endTime.equals( other.endTime ) ) return false; + if ( other.endTime != null ) { + return false; + } + } else if ( !endTime.equals( other.endTime ) ) { + return false; + } if ( startTime == null ) { - if ( other.startTime != null ) return false; - } else if ( !startTime.equals( other.startTime ) ) return false; + if ( other.startTime != null ) { + return false; + } + } else if ( !startTime.equals( other.startTime ) ) { + return false; + } return true; } diff --git a/drools-core/src/main/java/org/drools/core/time/impl/CronTrigger.java b/drools-core/src/main/java/org/drools/core/time/impl/CronTrigger.java index 9e6d199eb86..4f49aabdaee 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/CronTrigger.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/CronTrigger.java @@ -18,13 +18,13 @@ */ package org.drools.core.time.impl; -import org.drools.base.time.Trigger; -import org.kie.api.runtime.Calendars; - import java.util.Calendar; import java.util.Date; import java.util.TimeZone; +import org.drools.base.time.Trigger; +import org.kie.api.runtime.Calendars; + public class CronTrigger implements Trigger { diff --git a/drools-core/src/main/java/org/drools/core/time/impl/DefaultJobHandle.java b/drools-core/src/main/java/org/drools/core/time/impl/DefaultJobHandle.java index 24734b3664d..e87fc731ed9 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/DefaultJobHandle.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/DefaultJobHandle.java @@ -76,13 +76,23 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } final DefaultJobHandle other = (DefaultJobHandle) obj; if ( getJob() == null ) { - if ( other.getJob() != null ) return false; - } else if ( !getJob().equals( other.getJob() ) ) return false; + if ( other.getJob() != null ) { + return false; + } + } else if ( !getJob().equals( other.getJob() ) ) { + return false; + } return true; } diff --git a/drools-core/src/main/java/org/drools/core/time/impl/DefaultTimerJobFactoryManager.java b/drools-core/src/main/java/org/drools/core/time/impl/DefaultTimerJobFactoryManager.java index aa4ec5eeddb..27fce5d4b48 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/DefaultTimerJobFactoryManager.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/DefaultTimerJobFactoryManager.java @@ -21,11 +21,11 @@ import java.util.Collection; import java.util.Collections; +import org.drools.base.time.JobHandle; +import org.drools.base.time.Trigger; import org.drools.core.time.InternalSchedulerService; import org.drools.core.time.Job; import org.drools.core.time.JobContext; -import org.drools.base.time.JobHandle; -import org.drools.base.time.Trigger; public class DefaultTimerJobFactoryManager implements diff --git a/drools-core/src/main/java/org/drools/core/time/impl/DefaultTimerJobInstance.java b/drools-core/src/main/java/org/drools/core/time/impl/DefaultTimerJobInstance.java index f7bb73b7ad8..0711af5fa4d 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/DefaultTimerJobInstance.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/DefaultTimerJobInstance.java @@ -18,18 +18,18 @@ */ package org.drools.core.time.impl; +import java.io.Serializable; +import java.util.Date; +import java.util.concurrent.Callable; + +import org.drools.base.time.JobHandle; +import org.drools.base.time.Trigger; import org.drools.core.time.InternalSchedulerService; import org.drools.core.time.Job; import org.drools.core.time.JobContext; -import org.drools.base.time.JobHandle; -import org.drools.base.time.Trigger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.Serializable; -import java.util.Date; -import java.util.concurrent.Callable; - public class DefaultTimerJobInstance implements Callable, Comparable, TimerJobInstance, Serializable { private static final long serialVersionUID = -4441139572159254264L; diff --git a/drools-core/src/main/java/org/drools/core/time/impl/DurationTimer.java b/drools-core/src/main/java/org/drools/core/time/impl/DurationTimer.java index 9f455aac368..8b8fffd53a1 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/DurationTimer.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/DurationTimer.java @@ -28,16 +28,16 @@ import java.util.Map; import org.drools.base.base.ValueResolver; -import org.drools.base.time.impl.Timer; -import org.drools.core.common.DefaultEventHandle; -import org.drools.core.common.InternalWorkingMemory; import org.drools.base.reteoo.BaseTuple; import org.drools.base.rule.ConditionalElement; import org.drools.base.rule.Declaration; -import org.drools.core.rule.consequence.InternalMatch; -import org.drools.core.reteoo.Tuple; import org.drools.base.time.JobHandle; import org.drools.base.time.Trigger; +import org.drools.base.time.impl.Timer; +import org.drools.core.common.DefaultEventHandle; +import org.drools.core.common.InternalWorkingMemory; +import org.drools.core.reteoo.Tuple; +import org.drools.core.rule.consequence.InternalMatch; import org.drools.util.MathUtils; import org.kie.api.runtime.Calendars; import org.kie.api.time.Calendar; @@ -129,11 +129,19 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } DurationTimer other = (DurationTimer) obj; - if ( duration != other.duration ) return false; + if ( duration != other.duration ) { + return false; + } return true; } diff --git a/drools-core/src/main/java/org/drools/core/time/impl/ExpressionIntervalTimer.java b/drools-core/src/main/java/org/drools/core/time/impl/ExpressionIntervalTimer.java index ace0d34ec31..50e73232f75 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/ExpressionIntervalTimer.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/ExpressionIntervalTimer.java @@ -26,13 +26,13 @@ import java.util.Map; import org.drools.base.base.ValueResolver; -import org.drools.base.time.impl.Timer; import org.drools.base.reteoo.BaseTuple; import org.drools.base.rule.ConditionalElement; import org.drools.base.rule.Declaration; import org.drools.base.time.JobHandle; -import org.drools.core.time.TimerExpression; import org.drools.base.time.Trigger; +import org.drools.base.time.impl.Timer; +import org.drools.core.time.TimerExpression; import org.kie.api.runtime.Calendars; import static org.drools.core.time.TimerExpressionUtil.evalDateExpression; @@ -184,19 +184,39 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } ExpressionIntervalTimer other = (ExpressionIntervalTimer) obj; - if ( delay != other.delay ) return false; - if ( repeatLimit != other.repeatLimit ) return false; + if ( delay != other.delay ) { + return false; + } + if ( repeatLimit != other.repeatLimit ) { + return false; + } if ( endTime == null ) { - if ( other.endTime != null ) return false; - } else if ( !endTime.equals( other.endTime ) ) return false; - if ( period != other.period ) return false; + if ( other.endTime != null ) { + return false; + } + } else if ( !endTime.equals( other.endTime ) ) { + return false; + } + if ( period != other.period ) { + return false; + } if ( startTime == null ) { - if ( other.startTime != null ) return false; - } else if ( !startTime.equals( other.startTime ) ) return false; + if ( other.startTime != null ) { + return false; + } + } else if ( !startTime.equals( other.startTime ) ) { + return false; + } return true; } diff --git a/drools-core/src/main/java/org/drools/core/time/impl/IntervalTimer.java b/drools-core/src/main/java/org/drools/core/time/impl/IntervalTimer.java index b08df303f74..da1075a9a2b 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/IntervalTimer.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/IntervalTimer.java @@ -30,9 +30,9 @@ import org.drools.base.rule.ConditionalElement; import org.drools.base.rule.Declaration; import org.drools.base.time.JobHandle; +import org.drools.base.time.Trigger; import org.drools.base.time.impl.Timer; import org.drools.core.time.TimerExpression; -import org.drools.base.time.Trigger; import org.kie.api.runtime.Calendars; import static org.drools.core.time.TimerExpressionUtil.evalDateExpression; @@ -169,19 +169,39 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } IntervalTimer other = (IntervalTimer) obj; - if ( delay != other.delay ) return false; - if ( repeatLimit != other.repeatLimit ) return false; + if ( delay != other.delay ) { + return false; + } + if ( repeatLimit != other.repeatLimit ) { + return false; + } if ( endTime == null ) { - if ( other.endTime != null ) return false; - } else if ( !endTime.equals( other.endTime ) ) return false; - if ( period != other.period ) return false; + if ( other.endTime != null ) { + return false; + } + } else if ( !endTime.equals( other.endTime ) ) { + return false; + } + if ( period != other.period ) { + return false; + } if ( startTime == null ) { - if ( other.startTime != null ) return false; - } else if ( !startTime.equals( other.startTime ) ) return false; + if ( other.startTime != null ) { + return false; + } + } else if ( !startTime.equals( other.startTime ) ) { + return false; + } return true; } diff --git a/drools-core/src/main/java/org/drools/core/time/impl/JDKTimerService.java b/drools-core/src/main/java/org/drools/core/time/impl/JDKTimerService.java index e78ab658010..b1139347745 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/JDKTimerService.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/JDKTimerService.java @@ -18,14 +18,6 @@ */ package org.drools.core.time.impl; -import org.drools.core.time.InternalSchedulerService; -import org.drools.core.time.Job; -import org.drools.core.time.JobContext; -import org.drools.base.time.JobHandle; -import org.drools.core.time.TimerService; -import org.drools.base.time.Trigger; -import org.kie.api.time.SessionClock; - import java.util.Collection; import java.util.Date; import java.util.concurrent.Callable; @@ -34,6 +26,14 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; +import org.drools.base.time.JobHandle; +import org.drools.base.time.Trigger; +import org.drools.core.time.InternalSchedulerService; +import org.drools.core.time.Job; +import org.drools.core.time.JobContext; +import org.drools.core.time.TimerService; +import org.kie.api.time.SessionClock; + /** * A default Scheduler implementation that uses the * JDK built-in ScheduledThreadPoolExecutor as the diff --git a/drools-core/src/main/java/org/drools/core/time/impl/PseudoClockScheduler.java b/drools-core/src/main/java/org/drools/core/time/impl/PseudoClockScheduler.java index 7eb01770283..5be7a8f171f 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/PseudoClockScheduler.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/PseudoClockScheduler.java @@ -18,16 +18,6 @@ */ package org.drools.core.time.impl; -import org.drools.core.time.InternalSchedulerService; -import org.drools.core.time.Job; -import org.drools.core.time.JobContext; -import org.drools.base.time.JobHandle; -import org.drools.core.time.SessionPseudoClock; -import org.drools.core.time.TimerService; -import org.drools.base.time.Trigger; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; @@ -40,6 +30,16 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; +import org.drools.base.time.JobHandle; +import org.drools.base.time.Trigger; +import org.drools.core.time.InternalSchedulerService; +import org.drools.core.time.Job; +import org.drools.core.time.JobContext; +import org.drools.core.time.SessionPseudoClock; +import org.drools.core.time.TimerService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * A PseudoClockScheduler is a scheduler based on a user controlled clock * that allows the user to explicitly control current time. diff --git a/drools-core/src/main/java/org/drools/core/time/impl/ThreadSafeTrackableTimeJobFactoryManager.java b/drools-core/src/main/java/org/drools/core/time/impl/ThreadSafeTrackableTimeJobFactoryManager.java index a560ba38d97..7f49953865d 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/ThreadSafeTrackableTimeJobFactoryManager.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/ThreadSafeTrackableTimeJobFactoryManager.java @@ -18,11 +18,11 @@ */ package org.drools.core.time.impl; +import java.util.concurrent.ConcurrentHashMap; + import org.drools.core.time.JobContext; import org.drools.core.time.SelfRemovalJobContext; -import java.util.concurrent.ConcurrentHashMap; - public class ThreadSafeTrackableTimeJobFactoryManager extends TrackableTimeJobFactoryManager { public ThreadSafeTrackableTimeJobFactoryManager() { super(new ConcurrentHashMap<>()); diff --git a/drools-core/src/main/java/org/drools/core/time/impl/TimerJobFactoryManager.java b/drools-core/src/main/java/org/drools/core/time/impl/TimerJobFactoryManager.java index 06d97ec59b3..a10c1560550 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/TimerJobFactoryManager.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/TimerJobFactoryManager.java @@ -18,13 +18,13 @@ */ package org.drools.core.time.impl; +import java.util.Collection; + +import org.drools.base.time.JobHandle; +import org.drools.base.time.Trigger; import org.drools.core.time.InternalSchedulerService; import org.drools.core.time.Job; import org.drools.core.time.JobContext; -import org.drools.base.time.JobHandle; -import org.drools.base.time.Trigger; - -import java.util.Collection; public interface TimerJobFactoryManager { TimerJobInstance createTimerJobInstance(Job job, diff --git a/drools-core/src/main/java/org/drools/core/time/impl/TimerJobInstance.java b/drools-core/src/main/java/org/drools/core/time/impl/TimerJobInstance.java index 3ef2f02c63e..fe8bcb5e00f 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/TimerJobInstance.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/TimerJobInstance.java @@ -18,10 +18,10 @@ */ package org.drools.core.time.impl; -import org.drools.core.time.Job; -import org.drools.core.time.JobContext; import org.drools.base.time.JobHandle; import org.drools.base.time.Trigger; +import org.drools.core.time.Job; +import org.drools.core.time.JobContext; public interface TimerJobInstance { JobHandle getJobHandle(); diff --git a/drools-core/src/main/java/org/drools/core/time/impl/TrackableTimeJobFactoryManager.java b/drools-core/src/main/java/org/drools/core/time/impl/TrackableTimeJobFactoryManager.java index 5cfcb6869dd..5a7dfc353e0 100644 --- a/drools-core/src/main/java/org/drools/core/time/impl/TrackableTimeJobFactoryManager.java +++ b/drools-core/src/main/java/org/drools/core/time/impl/TrackableTimeJobFactoryManager.java @@ -18,18 +18,18 @@ */ package org.drools.core.time.impl; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.drools.base.time.JobHandle; +import org.drools.base.time.Trigger; import org.drools.core.time.EnqueuedSelfRemovalJobContext; import org.drools.core.time.InternalSchedulerService; import org.drools.core.time.Job; import org.drools.core.time.JobContext; -import org.drools.base.time.JobHandle; import org.drools.core.time.SelfRemovalJob; import org.drools.core.time.SelfRemovalJobContext; -import org.drools.base.time.Trigger; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; public class TrackableTimeJobFactoryManager implements diff --git a/drools-core/src/main/java/org/drools/core/util/AbstractHashTable.java b/drools-core/src/main/java/org/drools/core/util/AbstractHashTable.java index a6dbd12c980..a9b71182578 100644 --- a/drools-core/src/main/java/org/drools/core/util/AbstractHashTable.java +++ b/drools-core/src/main/java/org/drools/core/util/AbstractHashTable.java @@ -435,8 +435,12 @@ public int hashCode() { @Override public boolean equals( Object o ) { - if ( this == o ) return true; - if ( o == null || getClass() != o.getClass() ) return false; + if ( this == o ) { + return true; + } + if ( o == null || getClass() != o.getClass() ) { + return false; + } SingleHashEntry that = ( SingleHashEntry ) o; return hashCode == that.hashCode && Objects.equals( obj1, that.obj1 ); } @@ -488,8 +492,12 @@ public int hashCode() { @Override public boolean equals( Object o ) { - if ( this == o ) return true; - if ( o == null || getClass() != o.getClass() ) return false; + if ( this == o ) { + return true; + } + if ( o == null || getClass() != o.getClass() ) { + return false; + } DoubleHashEntry that = ( DoubleHashEntry ) o; return hashCode == that.hashCode && Objects.equals( obj1, that.obj1 ) && Objects.equals( obj2, that.obj2 ); } @@ -546,8 +554,12 @@ public int hashCode() { @Override public boolean equals( Object o ) { - if ( this == o ) return true; - if ( o == null || getClass() != o.getClass() ) return false; + if ( this == o ) { + return true; + } + if ( o == null || getClass() != o.getClass() ) { + return false; + } TripleHashEntry that = ( TripleHashEntry ) o; return hashCode == that.hashCode && Objects.equals( obj1, that.obj1 ) && Objects.equals( obj2, that.obj2 ) && Objects.equals( obj3, that.obj3 ); } diff --git a/drools-core/src/main/java/org/drools/core/util/ArrayQueue.java b/drools-core/src/main/java/org/drools/core/util/ArrayQueue.java index 8521978453c..768ef751947 100644 --- a/drools-core/src/main/java/org/drools/core/util/ArrayQueue.java +++ b/drools-core/src/main/java/org/drools/core/util/ArrayQueue.java @@ -22,7 +22,6 @@ import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; -import java.lang.reflect.Array; import java.util.ArrayDeque; import java.util.Collection; diff --git a/drools-core/src/main/java/org/drools/core/util/BinaryHeapQueue.java b/drools-core/src/main/java/org/drools/core/util/BinaryHeapQueue.java index e14f513aab1..3168f91b1ef 100644 --- a/drools-core/src/main/java/org/drools/core/util/BinaryHeapQueue.java +++ b/drools-core/src/main/java/org/drools/core/util/BinaryHeapQueue.java @@ -22,15 +22,14 @@ import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; -import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; -import java.util.List; import java.util.NoSuchElementException; import java.util.Objects; import java.util.stream.Stream; + import org.drools.core.util.Queue.QueueEntry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/drools-core/src/main/java/org/drools/core/util/KieFunctions.java b/drools-core/src/main/java/org/drools/core/util/KieFunctions.java index cabfe47c327..ec8d217ffd7 100644 --- a/drools-core/src/main/java/org/drools/core/util/KieFunctions.java +++ b/drools-core/src/main/java/org/drools/core/util/KieFunctions.java @@ -41,21 +41,29 @@ public static boolean isNull(Object object) { } public static boolean equalsTo(Number number, String value) { - if (number == null) return value == null; + if (number == null) { + return value == null; + } - if (value == null) throw new RuntimeException("Number: " + number + " can not be compared with a null value."); + if (value == null) { + throw new RuntimeException("Number: " + number + " can not be compared with a null value."); + } return compareTo(number, value) == 0; } public static boolean equalsTo(String string, String value) { - if (string == null) return value == null; + if (string == null) { + return value == null; + } return string.equals(value); } public static boolean equalsToIgnoreCase(String string, String value) { - if (string == null) return value == null; + if (string == null) { + return value == null; + } return string.equalsIgnoreCase(value); } @@ -65,61 +73,89 @@ public static boolean isEmpty(String string) { } public static boolean contains(String string, String value) { - if (string == null) return value == null; + if (string == null) { + return value == null; + } return value != null && string.contains(value); } public static boolean startsWith(String string, String value) { - if (string == null) return value == null; + if (string == null) { + return value == null; + } return value != null && string.startsWith(value); } public static boolean endsWith(String string, String value) { - if (string == null) return value == null; + if (string == null) { + return value == null; + } return value != null && string.endsWith(value); } public static boolean greaterThan(Number number, String value) { - if (number == null) return false; + if (number == null) { + return false; + } - if (value == null) throw new RuntimeException("Number: " + number + " can not be compared with a null value."); + if (value == null) { + throw new RuntimeException("Number: " + number + " can not be compared with a null value."); + } return compareTo(number, value) > 0; } public static boolean greaterOrEqualThan(Number number, String value) { - if (number == null) return false; + if (number == null) { + return false; + } - if (value == null) throw new RuntimeException("Number: " + number + " can not be compared with a null value."); + if (value == null) { + throw new RuntimeException("Number: " + number + " can not be compared with a null value."); + } return compareTo(number, value) >= 0; } public static boolean lessThan(Number number, String value) { - if (number == null) return false; + if (number == null) { + return false; + } - if (value == null) throw new RuntimeException("Number: " + number + " can not be compared with a null value."); + if (value == null) { + throw new RuntimeException("Number: " + number + " can not be compared with a null value."); + } return compareTo(number, value) < 0; } public static boolean lessOrEqualThan(Number number, String value) { - if (number == null) return false; + if (number == null) { + return false; + } - if (value == null) throw new RuntimeException("Number: " + number + " can not be compared with a null value."); + if (value == null) { + throw new RuntimeException("Number: " + number + " can not be compared with a null value."); + } return compareTo(number, value) <= 0; } public static boolean between(Number number, String minValue, String maxValue) { - if (number == null) return false; + if (number == null) { + return false; + } - if (minValue == null) throw new RuntimeException("Number: " + number + " can not be compared with minValue null."); + if (minValue == null) { + throw new RuntimeException("Number: " + number + " can not be compared with minValue null."); + } - if (maxValue == null) throw new RuntimeException("Number: " + number + " can not be compared with maxValue null."); + if (maxValue == null) { + throw new RuntimeException("Number: " + number + " can not be compared with maxValue null."); + } return compareTo(number, minValue) >= 0 && compareTo(number, maxValue) <= 0; } @@ -134,8 +170,12 @@ public static boolean isFalse(Boolean value) { private static int compareTo(Number number, String value) { - if (number == null) throw new RuntimeException("Number parameter can not be null."); - if (value == null) throw new RuntimeException("Number: " + number + " can not be compared with a null value."); + if (number == null) { + throw new RuntimeException("Number parameter can not be null."); + } + if (value == null) { + throw new RuntimeException("Number: " + number + " can not be compared with a null value."); + } if (number instanceof Short) { return Short.valueOf(number.shortValue()).compareTo(Short.valueOf(value)); 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 22b7e0b1abc..03f8abc245c 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 @@ -18,17 +18,14 @@ */ package org.drools.core.util; -import org.drools.core.reteoo.AbstractTuple; -import org.drools.core.reteoo.RightTuple; -import org.drools.core.reteoo.RightTupleImpl; -import org.drools.core.reteoo.Tuple; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.NoSuchElementException; +import org.drools.core.reteoo.AbstractTuple; + /** * This is a simple linked 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 diff --git a/drools-core/src/main/java/org/drools/core/util/TupleRBTree.java b/drools-core/src/main/java/org/drools/core/util/TupleRBTree.java index 01a60af266a..a9dc9f5af2f 100644 --- a/drools-core/src/main/java/org/drools/core/util/TupleRBTree.java +++ b/drools-core/src/main/java/org/drools/core/util/TupleRBTree.java @@ -18,7 +18,6 @@ */ package org.drools.core.util; -import org.drools.core.reteoo.Tuple; import org.drools.core.util.index.TupleList; public class TupleRBTree> { @@ -41,7 +40,9 @@ public void verifyProperties() { private static void verifyProperty1(Node< ? > n) { assert nodeColor( n ) == Color.RED || nodeColor( n ) == Color.BLACK; - if ( n == null ) return; + if ( n == null ) { + return; + } verifyProperty1( n.left ); verifyProperty1( n.right ); } @@ -60,7 +61,9 @@ private static void verifyProperty4(Node< ? > n) { assert nodeColor( n.right ) == Color.BLACK; assert nodeColor( n.parent ) == Color.BLACK; } - if ( n == null ) return; + if ( n == null ) { + return; + } verifyProperty4( n.left ); verifyProperty4( n.right ); } @@ -291,8 +294,12 @@ private void replaceNode(Node oldn, if ( oldn.parent == null ) { root = newn; } else { - if ( oldn == oldn.parent.left ) oldn.parent.left = newn; - else oldn.parent.right = newn; + if ( oldn == oldn.parent.left ) { + oldn.parent.left = newn; + } + else { + oldn.parent.right = newn; + } } if ( newn != null ) { newn.parent = oldn.parent; @@ -342,13 +349,21 @@ public Node insert(K key) { } private void insertCase1(Node n) { - if ( n.parent == null ) n.color = Color.BLACK; - else insertCase2( n ); + if ( n.parent == null ) { + n.color = Color.BLACK; + } + else { + insertCase2( n ); + } } private void insertCase2(Node n) { - if ( nodeColor( n.parent ) == Color.BLACK ) return; // Tree is still valid - else insertCase3( n ); + if ( nodeColor( n.parent ) == Color.BLACK ) { + return; // Tree is still valid + } + else { + insertCase3( n ); + } } void insertCase3(Node n) { @@ -385,7 +400,9 @@ void insertCase5(Node n) { public void delete(K key) { Node n = lookup(key); - if ( n == null ) return; // Key not found, do nothing + if ( n == null ) { + return; // Key not found, do nothing + } if ( n.left != null && n.right != null ) { // Copy key/value from predecessor and then delete it instead Node pred = maximumNode( n.left ); @@ -419,16 +436,24 @@ public void delete(K key) { } private void deleteCase1(Node n) { - if ( n.parent == null ) return; - else deleteCase2( n ); + if ( n.parent == null ) { + return; + } + else { + deleteCase2( n ); + } } private void deleteCase2(Node n) { if ( nodeColor( n.sibling() ) == Color.RED ) { n.parent.color = Color.RED; n.sibling().color = Color.BLACK; - if ( n == n.parent.left ) rotateLeft( n.parent ); - else rotateRight( n.parent ); + if ( n == n.parent.left ) { + rotateLeft( n.parent ); + } + else { + rotateRight( n.parent ); + } } deleteCase3( n ); } @@ -437,32 +462,33 @@ private void deleteCase3(Node n) { if ( nodeColor( n.parent ) == Color.BLACK && nodeColor( n.sibling() ) == Color.BLACK && nodeColor( n.sibling().left ) == Color.BLACK && - nodeColor( n.sibling().right ) == Color.BLACK ) - { + nodeColor( n.sibling().right ) == Color.BLACK ) { n.sibling().color = Color.RED; deleteCase1( n.parent ); } - else deleteCase4( n ); + else { + deleteCase4( n ); + } } private void deleteCase4(Node n) { if ( nodeColor( n.parent ) == Color.RED && nodeColor( n.sibling() ) == Color.BLACK && nodeColor( n.sibling().left ) == Color.BLACK && - nodeColor( n.sibling().right ) == Color.BLACK ) - { + nodeColor( n.sibling().right ) == Color.BLACK ) { n.sibling().color = Color.RED; n.parent.color = Color.BLACK; } - else deleteCase5( n ); + else { + deleteCase5( n ); + } } private void deleteCase5(Node n) { if ( n == n.parent.left && nodeColor( n.sibling() ) == Color.BLACK && nodeColor( n.sibling().left ) == Color.RED && - nodeColor( n.sibling().right ) == Color.BLACK ) - { + nodeColor( n.sibling().right ) == Color.BLACK ) { n.sibling().color = Color.RED; n.sibling().left.color = Color.BLACK; rotateRight( n.sibling() ); @@ -470,8 +496,7 @@ private void deleteCase5(Node n) { else if ( n == n.parent.right && nodeColor( n.sibling() ) == Color.BLACK && nodeColor( n.sibling().right ) == Color.RED && - nodeColor( n.sibling().left ) == Color.BLACK ) - { + nodeColor( n.sibling().left ) == Color.BLACK ) { n.sibling().color = Color.RED; n.sibling().right.color = Color.BLACK; rotateLeft( n.sibling() ); @@ -486,8 +511,7 @@ private void deleteCase6(Node n) { n.sibling().right.color = Color.BLACK; rotateLeft( n.parent ); } - else - { + else { n.sibling().left.color = Color.BLACK; rotateRight( n.parent ); } diff --git a/drools-core/src/main/java/org/drools/core/util/index/AbstractTupleIndexTree.java b/drools-core/src/main/java/org/drools/core/util/index/AbstractTupleIndexTree.java index fa5ce96e3a2..d5c6d4d0a8d 100644 --- a/drools-core/src/main/java/org/drools/core/util/index/AbstractTupleIndexTree.java +++ b/drools-core/src/main/java/org/drools/core/util/index/AbstractTupleIndexTree.java @@ -18,9 +18,9 @@ */ package org.drools.core.util.index; +import org.drools.base.util.FieldIndex; import org.drools.base.util.index.ConstraintTypeOperator; import org.drools.core.reteoo.Tuple; -import org.drools.base.util.FieldIndex; public abstract class AbstractTupleIndexTree { protected FieldIndex index; diff --git a/drools-core/src/main/java/org/drools/core/util/index/AlphaRangeIndex.java b/drools-core/src/main/java/org/drools/core/util/index/AlphaRangeIndex.java index ba200dd171e..dccad70be85 100644 --- a/drools-core/src/main/java/org/drools/core/util/index/AlphaRangeIndex.java +++ b/drools-core/src/main/java/org/drools/core/util/index/AlphaRangeIndex.java @@ -26,11 +26,11 @@ import java.util.Collections; import org.drools.base.base.ValueType; +import org.drools.base.rule.IndexableConstraint; +import org.drools.base.rule.accessor.FieldValue; import org.drools.base.util.index.ConstraintTypeOperator; import org.drools.core.reteoo.AlphaNode; import org.drools.core.reteoo.CompositeObjectSinkAdapter; -import org.drools.base.rule.IndexableConstraint; -import org.drools.base.rule.accessor.FieldValue; import org.drools.core.util.index.RangeIndex.IndexType; /** diff --git a/drools-core/src/main/java/org/drools/core/util/index/IndexFactory.java b/drools-core/src/main/java/org/drools/core/util/index/IndexFactory.java index c9866b28a4b..5769458d340 100644 --- a/drools-core/src/main/java/org/drools/core/util/index/IndexFactory.java +++ b/drools-core/src/main/java/org/drools/core/util/index/IndexFactory.java @@ -18,12 +18,12 @@ */ package org.drools.core.util.index; +import org.drools.base.rule.ContextEntry; +import org.drools.base.rule.constraint.BetaNodeFieldConstraint; import org.drools.base.util.index.ConstraintTypeOperator; import org.drools.core.RuleBaseConfiguration; import org.drools.core.reteoo.BetaMemory; import org.drools.core.reteoo.TupleMemory; -import org.drools.base.rule.ContextEntry; -import org.drools.base.rule.constraint.BetaNodeFieldConstraint; public interface IndexFactory { diff --git a/drools-core/src/main/java/org/drools/core/util/index/IndexSpec.java b/drools-core/src/main/java/org/drools/core/util/index/IndexSpec.java index 23e965d5c26..36f094d7916 100644 --- a/drools-core/src/main/java/org/drools/core/util/index/IndexSpec.java +++ b/drools-core/src/main/java/org/drools/core/util/index/IndexSpec.java @@ -18,6 +18,9 @@ */ package org.drools.core.util.index; +import java.util.ArrayList; +import java.util.List; + import org.drools.base.rule.IndexableConstraint; import org.drools.base.rule.constraint.BetaNodeFieldConstraint; import org.drools.base.util.FieldIndex; @@ -25,9 +28,6 @@ import org.drools.core.RuleBaseConfiguration; import org.kie.internal.conf.IndexPrecedenceOption; -import java.util.ArrayList; -import java.util.List; - import static org.drools.base.util.index.IndexUtil.isEqualIndexable; public class IndexSpec { diff --git a/drools-core/src/main/java/org/drools/core/util/index/RangeIndex.java b/drools-core/src/main/java/org/drools/core/util/index/RangeIndex.java index a5af9b8eb76..1dcaa9b5de4 100644 --- a/drools-core/src/main/java/org/drools/core/util/index/RangeIndex.java +++ b/drools-core/src/main/java/org/drools/core/util/index/RangeIndex.java @@ -87,20 +87,26 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } IndexKey other = (IndexKey) obj; - if (indexType != other.indexType) + if (indexType != other.indexType) { return false; + } if (key == null) { - if (other.key != null) + if (other.key != null) { return false; - } else if (!key.equals(other.key)) + } + } else if (!key.equals(other.key)) { return false; + } return true; } } diff --git a/drools-core/src/main/java/org/drools/core/util/index/TupleIndexHashTable.java b/drools-core/src/main/java/org/drools/core/util/index/TupleIndexHashTable.java index 5f82e9adaa6..ae35385ee8a 100644 --- a/drools-core/src/main/java/org/drools/core/util/index/TupleIndexHashTable.java +++ b/drools-core/src/main/java/org/drools/core/util/index/TupleIndexHashTable.java @@ -18,9 +18,12 @@ */ package org.drools.core.util.index; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; + import org.drools.base.util.FieldIndex; import org.drools.core.reteoo.AbstractTuple; -import org.drools.core.reteoo.RightTupleImpl; import org.drools.core.reteoo.Tuple; import org.drools.core.reteoo.TupleMemory; import org.drools.core.util.AbstractHashTable; @@ -28,10 +31,6 @@ import org.drools.core.util.Iterator; import org.drools.core.util.LinkedList; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; - public class TupleIndexHashTable extends AbstractHashTable implements TupleMemory { private static final long serialVersionUID = 510l; diff --git a/drools-core/src/main/java/org/drools/core/util/index/TupleList.java b/drools-core/src/main/java/org/drools/core/util/index/TupleList.java index c4230560f62..2bb514931c9 100644 --- a/drools-core/src/main/java/org/drools/core/util/index/TupleList.java +++ b/drools-core/src/main/java/org/drools/core/util/index/TupleList.java @@ -22,9 +22,8 @@ import org.drools.core.common.InternalFactHandle; import org.drools.core.reteoo.AbstractTuple; -import org.drools.core.reteoo.RightTupleImpl; -import org.drools.core.reteoo.TupleMemory; import org.drools.core.reteoo.Tuple; +import org.drools.core.reteoo.TupleMemory; import org.drools.core.util.Entry; import org.drools.core.util.FastIterator; import org.drools.core.util.Iterator; diff --git a/drools-core/src/test/java/org/drools/core/base/ClassTypeResolverTest.java b/drools-core/src/test/java/org/drools/core/base/ClassTypeResolverTest.java index 742da0e3bb8..55cfd83dc62 100644 --- a/drools-core/src/test/java/org/drools/core/base/ClassTypeResolverTest.java +++ b/drools-core/src/test/java/org/drools/core/base/ClassTypeResolverTest.java @@ -20,11 +20,11 @@ import java.util.HashSet; -import org.drools.util.ClassTypeResolver; -import org.drools.util.TypeResolver; import org.drools.core.test.model.Cheese; import org.drools.core.test.model.FirstClass; import org.drools.core.test.model.SecondClass; +import org.drools.util.ClassTypeResolver; +import org.drools.util.TypeResolver; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-core/src/test/java/org/drools/core/base/accumulators/VarianceNaNTest.java b/drools-core/src/test/java/org/drools/core/base/accumulators/VarianceNaNTest.java index 324a7353a32..a17cb635787 100644 --- a/drools-core/src/test/java/org/drools/core/base/accumulators/VarianceNaNTest.java +++ b/drools-core/src/test/java/org/drools/core/base/accumulators/VarianceNaNTest.java @@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.within; public class VarianceNaNTest { - + @Test public void shouldNotProduceNaNAfterBackout(){ VarianceAccumulateFunction varianceAccumulateFunction = new VarianceAccumulateFunction(); @@ -36,15 +36,15 @@ public void shouldNotProduceNaNAfterBackout(){ assertThat(varianceAccumulateFunction.getResult(data)).isCloseTo(Double.NaN, within(0.0)); Double value = 1.5; - + //With single value variance should be 0 varianceAccumulateFunction.accumulate(data, value); assertThat(varianceAccumulateFunction.getResult(data)).isCloseTo(0.0d, within(.001d)); - + //should be back to NaN after backout varianceAccumulateFunction.reverse(data, value); assertThat(varianceAccumulateFunction.getResult(data)).isCloseTo(Double.NaN, within(0.0)); - + //should be zero after adding number back varianceAccumulateFunction.accumulate(data, value); assertThat(varianceAccumulateFunction.getResult(data)).isCloseTo(0.0d, within(.001d)); diff --git a/drools-core/src/test/java/org/drools/core/common/DroolsObjectIOTest.java b/drools-core/src/test/java/org/drools/core/common/DroolsObjectIOTest.java index c156e0623d6..b396ff02dcf 100644 --- a/drools-core/src/test/java/org/drools/core/common/DroolsObjectIOTest.java +++ b/drools-core/src/test/java/org/drools/core/common/DroolsObjectIOTest.java @@ -36,8 +36,8 @@ import org.drools.base.common.DroolsObjectOutputStream; import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.base.definitions.rule.impl.RuleImpl; -import org.drools.core.reteoo.CoreComponentFactory; import org.drools.base.rule.GroupElement; +import org.drools.core.reteoo.CoreComponentFactory; import org.drools.core.util.DroolsStreamUtils; import org.junit.Test; diff --git a/drools-core/src/test/java/org/drools/core/facttemplates/FactTemplateFieldExtractorTest.java b/drools-core/src/test/java/org/drools/core/facttemplates/FactTemplateFieldExtractorTest.java index 1d49e2e239e..ec769f24275 100644 --- a/drools-core/src/test/java/org/drools/core/facttemplates/FactTemplateFieldExtractorTest.java +++ b/drools-core/src/test/java/org/drools/core/facttemplates/FactTemplateFieldExtractorTest.java @@ -26,10 +26,10 @@ import org.drools.base.facttemplates.FactTemplateObjectType; import org.drools.base.facttemplates.FieldTemplate; import org.drools.base.facttemplates.FieldTemplateImpl; -import org.drools.core.reteoo.CoreComponentFactory; import org.drools.base.rule.Declaration; import org.drools.base.rule.Pattern; import org.drools.base.rule.accessor.ReadAccessor; +import org.drools.core.reteoo.CoreComponentFactory; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-core/src/test/java/org/drools/core/io/impl/ByteArrayResourceSerializationTest.java b/drools-core/src/test/java/org/drools/core/io/impl/ByteArrayResourceSerializationTest.java index 9e553bd2a04..1d26ecd2f01 100644 --- a/drools-core/src/test/java/org/drools/core/io/impl/ByteArrayResourceSerializationTest.java +++ b/drools-core/src/test/java/org/drools/core/io/impl/ByteArrayResourceSerializationTest.java @@ -32,24 +32,24 @@ public class ByteArrayResourceSerializationTest { - //FIX https://issues.redhat.com/browse/DROOLS-5681 - @Test - public void bytesAttributesIsStillSerializedDeserializedCorrectly() throws IOException, ClassNotFoundException { - - final byte[] content = "some content".getBytes(StandardCharsets.UTF_8); - - ByteArrayResource bar = new ByteArrayResource(content, StandardCharsets.UTF_8.toString()); - byte[] serializedBar; - try(ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos)){ - oos.writeObject(bar); - serializedBar = baos.toByteArray(); - } - ByteArrayResource desBar; - try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(serializedBar))){ - desBar = (ByteArrayResource) ois.readObject(); - } - assertThat(desBar.getBytes()).isEqualTo(content); - } + //FIX https://issues.redhat.com/browse/DROOLS-5681 + @Test + public void bytesAttributesIsStillSerializedDeserializedCorrectly() throws IOException, ClassNotFoundException { + + final byte[] content = "some content".getBytes(StandardCharsets.UTF_8); + + ByteArrayResource bar = new ByteArrayResource(content, StandardCharsets.UTF_8.toString()); + byte[] serializedBar; + try(ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos)){ + oos.writeObject(bar); + serializedBar = baos.toByteArray(); + } + ByteArrayResource desBar; + try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(serializedBar))){ + desBar = (ByteArrayResource) ois.readObject(); + } + assertThat(desBar.getBytes()).isEqualTo(content); + } } diff --git a/drools-core/src/test/java/org/drools/core/io/impl/ByteArrayResourceToStringTest.java b/drools-core/src/test/java/org/drools/core/io/impl/ByteArrayResourceToStringTest.java index 290919c148f..2bb1143a0ad 100644 --- a/drools-core/src/test/java/org/drools/core/io/impl/ByteArrayResourceToStringTest.java +++ b/drools-core/src/test/java/org/drools/core/io/impl/ByteArrayResourceToStringTest.java @@ -18,17 +18,17 @@ */ package org.drools.core.io.impl; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + import org.apache.commons.lang3.ArrayUtils; import org.drools.io.ByteArrayResource; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - import static org.assertj.core.api.Assertions.assertThat; @RunWith(Parameterized.class) diff --git a/drools-core/src/test/java/org/drools/core/reteoo/BaseNodeTest.java b/drools-core/src/test/java/org/drools/core/reteoo/BaseNodeTest.java index e969990baf9..fa3cad6d5fe 100644 --- a/drools-core/src/test/java/org/drools/core/reteoo/BaseNodeTest.java +++ b/drools-core/src/test/java/org/drools/core/reteoo/BaseNodeTest.java @@ -18,12 +18,12 @@ */ package org.drools.core.reteoo; +import org.drools.base.common.RuleBasePartitionId; import org.drools.core.common.BaseNode; import org.drools.core.common.InternalWorkingMemory; -import org.drools.base.common.RuleBasePartitionId; +import org.drools.core.common.PropagationContext; import org.drools.core.common.UpdateContext; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.core.common.PropagationContext; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-core/src/test/java/org/drools/core/reteoo/DefaultFactHandleFactoryTest.java b/drools-core/src/test/java/org/drools/core/reteoo/DefaultFactHandleFactoryTest.java index b9a85c5fe11..9344e08a906 100644 --- a/drools-core/src/test/java/org/drools/core/reteoo/DefaultFactHandleFactoryTest.java +++ b/drools-core/src/test/java/org/drools/core/reteoo/DefaultFactHandleFactoryTest.java @@ -18,10 +18,10 @@ */ package org.drools.core.reteoo; +import org.drools.core.common.DefaultFactHandle; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; -import org.drools.core.common.DefaultFactHandle; public class DefaultFactHandleFactoryTest { diff --git a/drools-core/src/test/java/org/drools/core/reteoo/MockLeftTupleSink.java b/drools-core/src/test/java/org/drools/core/reteoo/MockLeftTupleSink.java index fa18e14aa4c..d2fa95d16c7 100644 --- a/drools-core/src/test/java/org/drools/core/reteoo/MockLeftTupleSink.java +++ b/drools-core/src/test/java/org/drools/core/reteoo/MockLeftTupleSink.java @@ -26,10 +26,10 @@ import org.drools.core.common.InternalFactHandle; import org.drools.core.common.Memory; import org.drools.core.common.MemoryFactory; +import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; import org.drools.core.common.UpdateContext; import org.drools.core.reteoo.builder.BuildContext; -import org.drools.core.common.PropagationContext; public class MockLeftTupleSink extends LeftTupleSource implements diff --git a/drools-core/src/test/java/org/drools/core/reteoo/MockObjectSink.java b/drools-core/src/test/java/org/drools/core/reteoo/MockObjectSink.java index 1f7489d52f0..b7ca5d7f846 100644 --- a/drools-core/src/test/java/org/drools/core/reteoo/MockObjectSink.java +++ b/drools-core/src/test/java/org/drools/core/reteoo/MockObjectSink.java @@ -21,13 +21,13 @@ import java.util.ArrayList; import java.util.List; +import org.drools.base.common.NetworkNode; +import org.drools.base.common.RuleBasePartitionId; import org.drools.base.reteoo.BaseTerminalNode; import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.common.InternalFactHandle; -import org.drools.base.common.NetworkNode; import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; -import org.drools.base.common.RuleBasePartitionId; import org.kie.api.definition.rule.Rule; public class MockObjectSink diff --git a/drools-core/src/test/java/org/drools/core/reteoo/MockObjectSource.java b/drools-core/src/test/java/org/drools/core/reteoo/MockObjectSource.java index 72ece6e9378..47881ab27de 100644 --- a/drools-core/src/test/java/org/drools/core/reteoo/MockObjectSource.java +++ b/drools-core/src/test/java/org/drools/core/reteoo/MockObjectSource.java @@ -18,6 +18,10 @@ */ package org.drools.core.reteoo; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + import org.drools.base.base.ObjectType; import org.drools.base.common.RuleBasePartitionId; import org.drools.core.common.InternalFactHandle; @@ -26,10 +30,6 @@ import org.drools.core.reteoo.builder.BuildContext; import org.drools.util.bitmask.BitMask; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - public class MockObjectSource extends ObjectSource { private static final long serialVersionUID = 510l; diff --git a/drools-core/src/test/java/org/drools/core/reteoo/MockRightTupleSink.java b/drools-core/src/test/java/org/drools/core/reteoo/MockRightTupleSink.java index be4150d45d9..117ec1e9cc1 100644 --- a/drools-core/src/test/java/org/drools/core/reteoo/MockRightTupleSink.java +++ b/drools-core/src/test/java/org/drools/core/reteoo/MockRightTupleSink.java @@ -22,11 +22,11 @@ import java.util.List; import org.drools.base.common.NetworkNode; +import org.drools.base.common.RuleBasePartitionId; import org.drools.base.reteoo.BaseTerminalNode; import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.common.PropagationContext; import org.drools.core.common.ReteEvaluator; -import org.drools.base.common.RuleBasePartitionId; import org.kie.api.definition.rule.Rule; public class MockRightTupleSink diff --git a/drools-core/src/test/java/org/drools/core/reteoo/NodeTypeEnumTest.java b/drools-core/src/test/java/org/drools/core/reteoo/NodeTypeEnumTest.java index 432dbfdf76c..719e49f436c 100644 --- a/drools-core/src/test/java/org/drools/core/reteoo/NodeTypeEnumTest.java +++ b/drools-core/src/test/java/org/drools/core/reteoo/NodeTypeEnumTest.java @@ -21,7 +21,11 @@ import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; -import static org.drools.base.reteoo.NodeTypeEnums.*; +import static org.drools.base.reteoo.NodeTypeEnums.isBetaNode; +import static org.drools.base.reteoo.NodeTypeEnums.isLeftTupleSink; +import static org.drools.base.reteoo.NodeTypeEnums.isLeftTupleSource; +import static org.drools.base.reteoo.NodeTypeEnums.isObjectSink; +import static org.drools.base.reteoo.NodeTypeEnums.isObjectSource; public class NodeTypeEnumTest { EntryPointNode epNode = new EntryPointNode(); diff --git a/drools-core/src/test/java/org/drools/core/reteoo/ReteComparator.java b/drools-core/src/test/java/org/drools/core/reteoo/ReteComparator.java index 1695fb220e4..123ecc24e25 100644 --- a/drools-core/src/test/java/org/drools/core/reteoo/ReteComparator.java +++ b/drools-core/src/test/java/org/drools/core/reteoo/ReteComparator.java @@ -21,8 +21,8 @@ import java.util.Arrays; import java.util.Comparator; -import org.drools.core.common.BaseNode; import org.drools.base.common.NetworkNode; +import org.drools.core.common.BaseNode; import org.drools.core.impl.InternalRuleBase; import org.kie.api.KieBase; import org.kie.api.runtime.KieRuntime; diff --git a/drools-core/src/test/java/org/drools/core/reteoo/ReteMemoryChecker.java b/drools-core/src/test/java/org/drools/core/reteoo/ReteMemoryChecker.java index 9db086b645d..6adaffc7cf0 100644 --- a/drools-core/src/test/java/org/drools/core/reteoo/ReteMemoryChecker.java +++ b/drools-core/src/test/java/org/drools/core/reteoo/ReteMemoryChecker.java @@ -18,12 +18,12 @@ */ package org.drools.core.reteoo; +import org.drools.base.common.NetworkNode; import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.common.BaseNode; import org.drools.core.common.InternalWorkingMemory; import org.drools.core.common.Memory; import org.drools.core.common.MemoryFactory; -import org.drools.base.common.NetworkNode; import org.drools.core.impl.InternalRuleBase; import org.kie.api.runtime.KieSession; diff --git a/drools-core/src/test/java/org/drools/core/reteoo/TupleIterationTest.java b/drools-core/src/test/java/org/drools/core/reteoo/TupleIterationTest.java index 7324f62cca7..99ed7c9e046 100644 --- a/drools-core/src/test/java/org/drools/core/reteoo/TupleIterationTest.java +++ b/drools-core/src/test/java/org/drools/core/reteoo/TupleIterationTest.java @@ -22,9 +22,8 @@ import java.util.Arrays; import java.util.List; -import org.drools.core.reteoo.TupleIterator.OnLeaf; - import org.drools.core.common.PropagationContext; +import org.drools.core.reteoo.TupleIterator.OnLeaf; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-core/src/test/java/org/drools/core/reteoo/builder/ReteooRuleBuilderTest.java b/drools-core/src/test/java/org/drools/core/reteoo/builder/ReteooRuleBuilderTest.java index ff625a1d5f9..9a670077dc8 100755 --- a/drools-core/src/test/java/org/drools/core/reteoo/builder/ReteooRuleBuilderTest.java +++ b/drools-core/src/test/java/org/drools/core/reteoo/builder/ReteooRuleBuilderTest.java @@ -24,16 +24,16 @@ import java.util.Collections; import java.util.List; -import org.drools.base.base.ValueResolver; import org.drools.base.base.ClassObjectType; +import org.drools.base.base.ValueResolver; import org.drools.base.definitions.rule.impl.RuleImpl; -import org.drools.core.impl.KnowledgeBaseImpl; -import org.drools.core.impl.RuleBaseFactory; -import org.drools.core.reteoo.RuleTerminalNode; import org.drools.base.rule.GroupElement; import org.drools.base.rule.GroupElementFactory; import org.drools.base.rule.Pattern; import org.drools.base.rule.consequence.Consequence; +import org.drools.core.impl.KnowledgeBaseImpl; +import org.drools.core.impl.RuleBaseFactory; +import org.drools.core.reteoo.RuleTerminalNode; import org.drools.core.rule.consequence.KnowledgeHelper; import org.junit.Before; import org.junit.Test; diff --git a/drools-core/src/test/java/org/drools/core/test/model/Address.java b/drools-core/src/test/java/org/drools/core/test/model/Address.java index 4a19ffeac73..44b8b86f8e5 100644 --- a/drools-core/src/test/java/org/drools/core/test/model/Address.java +++ b/drools-core/src/test/java/org/drools/core/test/model/Address.java @@ -65,19 +65,37 @@ public int hashCode() { } public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } Address other = (Address) obj; if ( number == null ) { - if ( other.number != null ) return false; - } else if ( !number.equals( other.number ) ) return false; + if ( other.number != null ) { + return false; + } + } else if ( !number.equals( other.number ) ) { + return false; + } if ( phone == null ) { - if ( other.phone != null ) return false; - } else if ( !phone.equals( other.phone ) ) return false; + if ( other.phone != null ) { + return false; + } + } else if ( !phone.equals( other.phone ) ) { + return false; + } if ( street == null ) { - if ( other.street != null ) return false; - } else if ( !street.equals( other.street ) ) return false; + if ( other.street != null ) { + return false; + } + } else if ( !street.equals( other.street ) ) { + return false; + } return true; } diff --git a/drools-core/src/test/java/org/drools/core/test/model/Person.java b/drools-core/src/test/java/org/drools/core/test/model/Person.java index c6d9a0bc479..17eb6175583 100755 --- a/drools-core/src/test/java/org/drools/core/test/model/Person.java +++ b/drools-core/src/test/java/org/drools/core/test/model/Person.java @@ -169,34 +169,72 @@ public int hashCode() { } public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } Person other = (Person) obj; if ( !Arrays.equals( addressArray, - other.addressArray ) ) return false; + other.addressArray ) ) { + return false; + } if ( addressList == null ) { - if ( other.addressList != null ) return false; - } else if ( !addressList.equals( other.addressList ) ) return false; + if ( other.addressList != null ) { + return false; + } + } else if ( !addressList.equals( other.addressList ) ) { + return false; + } if ( addresses == null ) { - if ( other.addresses != null ) return false; - } else if ( !addresses.equals( other.addresses ) ) return false; - if ( age != other.age ) return false; + if ( other.addresses != null ) { + return false; + } + } else if ( !addresses.equals( other.addresses ) ) { + return false; + } + if ( age != other.age ) { + return false; + } if ( city == null ) { - if ( other.city != null ) return false; - } else if ( !city.equals( other.city ) ) return false; + if ( other.city != null ) { + return false; + } + } else if ( !city.equals( other.city ) ) { + return false; + } if ( country == null ) { - if ( other.country != null ) return false; - } else if ( !country.equals( other.country ) ) return false; + if ( other.country != null ) { + return false; + } + } else if ( !country.equals( other.country ) ) { + return false; + } if ( name == null ) { - if ( other.name != null ) return false; - } else if ( !name.equals( other.name ) ) return false; + if ( other.name != null ) { + return false; + } + } else if ( !name.equals( other.name ) ) { + return false; + } if ( state == null ) { - if ( other.state != null ) return false; - } else if ( !state.equals( other.state ) ) return false; + if ( other.state != null ) { + return false; + } + } else if ( !state.equals( other.state ) ) { + return false; + } if ( street == null ) { - if ( other.street != null ) return false; - } else if ( !street.equals( other.street ) ) return false; + if ( other.street != null ) { + return false; + } + } else if ( !street.equals( other.street ) ) { + return false; + } return true; } diff --git a/drools-core/src/test/java/org/drools/core/time/impl/CompositeMaxDurationTimerTest.java b/drools-core/src/test/java/org/drools/core/time/impl/CompositeMaxDurationTimerTest.java index abd10b08591..e8e44f66469 100644 --- a/drools-core/src/test/java/org/drools/core/time/impl/CompositeMaxDurationTimerTest.java +++ b/drools-core/src/test/java/org/drools/core/time/impl/CompositeMaxDurationTimerTest.java @@ -18,11 +18,11 @@ */ package org.drools.core.time.impl; +import java.util.Date; + import org.drools.base.time.Trigger; import org.junit.Test; -import java.util.Date; - import static org.assertj.core.api.Assertions.assertThat; public class CompositeMaxDurationTimerTest { diff --git a/drools-core/src/test/java/org/drools/core/time/impl/JDKTimerServiceTest.java b/drools-core/src/test/java/org/drools/core/time/impl/JDKTimerServiceTest.java index 763865ca668..66854a69c2a 100644 --- a/drools-core/src/test/java/org/drools/core/time/impl/JDKTimerServiceTest.java +++ b/drools-core/src/test/java/org/drools/core/time/impl/JDKTimerServiceTest.java @@ -29,6 +29,8 @@ import java.util.List; import java.util.Stack; +import org.drools.base.time.JobHandle; +import org.drools.base.time.Trigger; import org.drools.core.ClockType; import org.drools.core.SessionConfiguration; import org.drools.core.common.InternalWorkingMemory; @@ -37,9 +39,7 @@ import org.drools.core.phreak.PropagationEntry; import org.drools.core.time.Job; import org.drools.core.time.JobContext; -import org.drools.base.time.JobHandle; import org.drools.core.time.TimerService; -import org.drools.base.time.Trigger; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-core/src/test/java/org/drools/core/time/impl/PseudoClockSchedulerTest.java b/drools-core/src/test/java/org/drools/core/time/impl/PseudoClockSchedulerTest.java index de6440b803c..4295f434578 100644 --- a/drools-core/src/test/java/org/drools/core/time/impl/PseudoClockSchedulerTest.java +++ b/drools-core/src/test/java/org/drools/core/time/impl/PseudoClockSchedulerTest.java @@ -22,10 +22,10 @@ import java.util.Optional; import java.util.concurrent.TimeUnit; -import org.drools.core.time.Job; -import org.drools.core.time.JobContext; import org.drools.base.time.JobHandle; import org.drools.base.time.Trigger; +import org.drools.core.time.Job; +import org.drools.core.time.JobContext; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-core/src/test/java/org/drools/core/util/BinaryHeapQueueTest.java b/drools-core/src/test/java/org/drools/core/util/BinaryHeapQueueTest.java index 58beab84933..ee0add11289 100644 --- a/drools-core/src/test/java/org/drools/core/util/BinaryHeapQueueTest.java +++ b/drools-core/src/test/java/org/drools/core/util/BinaryHeapQueueTest.java @@ -22,19 +22,19 @@ import java.util.Collection; import java.util.List; +import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.rule.consequence.ConflictResolver; +import org.drools.base.rule.consequence.Consequence; import org.drools.core.common.ActivationGroupNode; import org.drools.core.common.ActivationNode; import org.drools.core.common.InternalAgendaGroup; import org.drools.core.common.InternalFactHandle; import org.drools.core.common.InternalRuleFlowGroup; import org.drools.core.common.PropagationContext; -import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.core.phreak.RuleAgendaItem; import org.drools.core.reteoo.TerminalNode; import org.drools.core.reteoo.Tuple; import org.drools.core.rule.consequence.InternalMatch; -import org.drools.base.rule.consequence.ConflictResolver; -import org.drools.base.rule.consequence.Consequence; import org.junit.Before; import org.junit.Test; import org.kie.api.runtime.rule.FactHandle; @@ -103,7 +103,9 @@ public void testShuffled() { for (int i = max - 1; i >= 0; i--) { int sal = group.getNext().getSalience(); sb.append(" ").append(sal); - if (sal != i) ok = false; + if (sal != i) { + ok = false; + } } assertThat(ok).as("incorrect order in " + sb.toString()).isTrue(); // System.out.println( sb.toString() ); @@ -182,7 +184,7 @@ public String toString() { return "AgendaGroup '" + this.name + "'"; } - public boolean equal(final Object object) { + public boolean equals(final Object object) { if (!(object instanceof Group)) { return false; } diff --git a/drools-core/src/test/java/org/drools/core/util/DroolsStreamUtils.java b/drools-core/src/test/java/org/drools/core/util/DroolsStreamUtils.java index 0bd85c5f409..2d6355704c5 100644 --- a/drools-core/src/test/java/org/drools/core/util/DroolsStreamUtils.java +++ b/drools-core/src/test/java/org/drools/core/util/DroolsStreamUtils.java @@ -202,8 +202,9 @@ public static Object streamIn(InputStream in, ClassLoader classLoader) */ public static Object streamIn(InputStream in, ClassLoader classLoader, boolean compressed) throws IOException, ClassNotFoundException { - if (compressed) + if (compressed) { in = new GZIPInputStream(in); + } return new DroolsObjectInputStream(in, classLoader).readObject(); } } diff --git a/drools-core/src/test/java/org/drools/core/util/HeapDump.java b/drools-core/src/test/java/org/drools/core/util/HeapDump.java index a2d176b698d..32dafc3bae5 100644 --- a/drools-core/src/test/java/org/drools/core/util/HeapDump.java +++ b/drools-core/src/test/java/org/drools/core/util/HeapDump.java @@ -18,10 +18,11 @@ */ package org.drools.core.util; -import javax.management.MBeanServer; import java.lang.management.ManagementFactory; import java.lang.reflect.Method; +import javax.management.MBeanServer; + @SuppressWarnings("restriction") public class HeapDump { diff --git a/drools-core/src/test/java/org/drools/core/util/IndexedHashtableIteratorTest.java b/drools-core/src/test/java/org/drools/core/util/IndexedHashtableIteratorTest.java index a0de58e3e4a..65d2f7851f5 100644 --- a/drools-core/src/test/java/org/drools/core/util/IndexedHashtableIteratorTest.java +++ b/drools-core/src/test/java/org/drools/core/util/IndexedHashtableIteratorTest.java @@ -18,6 +18,9 @@ */ package org.drools.core.util; +import java.util.ArrayList; +import java.util.List; + import org.drools.core.reteoo.AbstractTuple; import org.drools.core.reteoo.JoinNodeLeftTuple; import org.drools.core.reteoo.RightTuple; @@ -26,9 +29,6 @@ import org.drools.core.util.index.TupleList; import org.junit.Test; -import java.util.ArrayList; -import java.util.List; - import static org.assertj.core.api.Assertions.assertThat; public class IndexedHashtableIteratorTest { diff --git a/drools-core/src/test/java/org/drools/core/util/IoUtilsTest.java b/drools-core/src/test/java/org/drools/core/util/IoUtilsTest.java index c21a2287865..b04f5d28d39 100644 --- a/drools-core/src/test/java/org/drools/core/util/IoUtilsTest.java +++ b/drools-core/src/test/java/org/drools/core/util/IoUtilsTest.java @@ -18,13 +18,13 @@ */ package org.drools.core.util; +import java.io.IOException; +import java.io.StringReader; + import org.drools.io.ReaderInputStream; import org.drools.util.IoUtils; import org.junit.Test; -import java.io.IOException; -import java.io.StringReader; - import static org.assertj.core.api.Assertions.assertThat; public class IoUtilsTest { @@ -35,8 +35,8 @@ public void testReadEmptyStream() throws IOException { byte[] bytes = IoUtils.readBytesFromInputStream( new ReaderInputStream( new StringReader( "" ) ) ); assertThat(bytes).isEmpty(); } - - @Test + + @Test public void testAsSystemSpecificPath() { String urlPath = "c:\\workdir\\server-local\\instance\\tmp\\vfs\\deployment\\deploymentf7b5abe7c4c1cb56\\rules-with-kjar-1.0.jar-57cc270a5729d6b2\\rules-with-kjar-1.0.jar"; String specificPath = IoUtils.asSystemSpecificPath(urlPath, 1); diff --git a/drools-core/src/test/java/org/drools/core/util/KeyStoreHelperTest.java b/drools-core/src/test/java/org/drools/core/util/KeyStoreHelperTest.java index 3546ec82c06..aa8b95b33a7 100755 --- a/drools-core/src/test/java/org/drools/core/util/KeyStoreHelperTest.java +++ b/drools-core/src/test/java/org/drools/core/util/KeyStoreHelperTest.java @@ -30,6 +30,7 @@ import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; import java.security.spec.InvalidKeySpecException; + import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpec; diff --git a/drools-core/src/test/java/org/drools/core/util/KieFunctionsTest.java b/drools-core/src/test/java/org/drools/core/util/KieFunctionsTest.java index ef24047e6b5..75a9a77207a 100644 --- a/drools-core/src/test/java/org/drools/core/util/KieFunctionsTest.java +++ b/drools-core/src/test/java/org/drools/core/util/KieFunctionsTest.java @@ -21,9 +21,10 @@ import java.math.BigDecimal; import java.math.BigInteger; -import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; + public class KieFunctionsTest { @Test diff --git a/drools-core/src/test/java/org/drools/core/util/LeftTupleRBTreeTest.java b/drools-core/src/test/java/org/drools/core/util/LeftTupleRBTreeTest.java index 06145713e91..0942747f4c9 100644 --- a/drools-core/src/test/java/org/drools/core/util/LeftTupleRBTreeTest.java +++ b/drools-core/src/test/java/org/drools/core/util/LeftTupleRBTreeTest.java @@ -18,11 +18,11 @@ */ package org.drools.core.util; +import java.util.Random; + import org.drools.core.util.TupleRBTree.Node; import org.junit.Test; -import java.util.Random; - import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; diff --git a/drools-core/src/test/java/org/drools/core/util/index/IndexUtilTest.java b/drools-core/src/test/java/org/drools/core/util/index/IndexUtilTest.java index 36f191f4705..61a6b336387 100644 --- a/drools-core/src/test/java/org/drools/core/util/index/IndexUtilTest.java +++ b/drools-core/src/test/java/org/drools/core/util/index/IndexUtilTest.java @@ -18,6 +18,11 @@ */ package org.drools.core.util.index; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.lang.reflect.Method; + import org.drools.base.base.ValueResolver; import org.drools.base.base.ValueType; import org.drools.base.reteoo.BaseTuple; @@ -44,11 +49,6 @@ import org.kie.internal.conf.IndexPrecedenceOption; import org.kie.internal.utils.ChainedProperties; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.reflect.Method; - import static org.assertj.core.api.Assertions.assertThat; public class IndexUtilTest { From d6c3c760cec3bdef140fde266ef91ce0c9393358 Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Tue, 7 Nov 2023 15:17:02 +0100 Subject: [PATCH 23/41] [DROOLS-7584] process completely all facts inserted before halt (#5576) * [DROOLS-7584] process completely all facts inserted before halt * fix imports order * fix testModifyWithFromSudoku to meet halt() (#22) --------- Co-authored-by: Toshiya Kobayashi --- .../core/impl/ActivationsManagerImpl.java | 57 +++------------ .../org/drools/core/phreak/RuleExecutor.java | 30 ++++---- .../kiesession/agenda/DefaultAgenda.java | 70 +++++++++++++------ .../model/codegen/execmodel/FromTest.java | 5 +- .../integrationtests/FireUntilHaltTest.java | 37 ++++++++++ 5 files changed, 116 insertions(+), 83 deletions(-) diff --git a/drools-core/src/main/java/org/drools/core/impl/ActivationsManagerImpl.java b/drools-core/src/main/java/org/drools/core/impl/ActivationsManagerImpl.java index ab3d1a3b1bf..7b4ea779675 100644 --- a/drools-core/src/main/java/org/drools/core/impl/ActivationsManagerImpl.java +++ b/drools-core/src/main/java/org/drools/core/impl/ActivationsManagerImpl.java @@ -184,8 +184,6 @@ public InternalMatch createAgendaItem(RuleTerminalNodeLeftTuple rtnLeftTuple, in @Override public void cancelActivation(InternalMatch internalMatch) { - InternalMatch item = internalMatch; - if ( internalMatch.isQueued() ) { if (internalMatch.getActivationGroupNode() != null ) { internalMatch.getActivationGroupNode().getActivationGroup().removeActivation(internalMatch); @@ -194,11 +192,11 @@ public void cancelActivation(InternalMatch internalMatch) { getAgendaEventSupport().fireActivationCancelled(internalMatch, reteEvaluator, MatchCancelledCause.WME_MODIFY); } - if (item.getRuleAgendaItem() != null) { - item.getRuleAgendaItem().getRuleExecutor().fireConsequenceEvent( this.reteEvaluator, this, item, ON_DELETE_MATCH_CONSEQUENCE_NAME ); + if (internalMatch.getRuleAgendaItem() != null) { + internalMatch.getRuleAgendaItem().getRuleExecutor().fireConsequenceEvent( this.reteEvaluator, this, internalMatch, ON_DELETE_MATCH_CONSEQUENCE_NAME ); } - reteEvaluator.getRuleEventSupport().onDeleteMatch( item ); + reteEvaluator.getRuleEventSupport().onDeleteMatch(internalMatch); } @Override @@ -284,10 +282,10 @@ public void addPropagation(PropagationEntry propagationEntry) { @Override public int fireAllRules(AgendaFilter agendaFilter, int fireLimit) { - return fireLoop( agendaFilter, fireLimit, RestHandler.FIRE_ALL_RULES ); + return fireLoop( agendaFilter, fireLimit ); } - private int fireLoop(AgendaFilter agendaFilter, int fireLimit, RestHandler restHandler) { + private int fireLoop(AgendaFilter agendaFilter, int fireLimit) { firing = true; int fireCount = 0; PropagationEntry head = propagationList.takeAll(); @@ -320,7 +318,7 @@ private int fireLoop(AgendaFilter agendaFilter, int fireLimit, RestHandler restH if ( returnedFireCount == 0 && head == null && ( group == null || ( group.isEmpty() && !group.isAutoDeactivate() ) ) && !flushExpirations() ) { // if true, the engine is now considered potentially at rest - head = restHandler.handleRest( this ); + head = handleRest(); } } @@ -349,44 +347,11 @@ private void doRetract( PropagationContext ectx ) { } } - interface RestHandler { - RestHandler FIRE_ALL_RULES = new RestHandler.FireAllRulesRestHandler(); - RestHandler FIRE_UNTIL_HALT = new RestHandler.FireUntilHaltRestHandler(); - - PropagationEntry handleRest(ActivationsManagerImpl agenda); - - class FireAllRulesRestHandler implements RestHandler { - @Override - public PropagationEntry handleRest(ActivationsManagerImpl agenda) { - PropagationEntry head = agenda.propagationList.takeAll(); - if (head == null) { - agenda.firing = false; - } - return head; - } - } - - class FireUntilHaltRestHandler implements RestHandler { - @Override - public PropagationEntry handleRest(ActivationsManagerImpl agenda) { - PropagationEntry head; - // this must use the same sync target as takeAllPropagations, to ensure this entire block is atomic, up to the point of wait - synchronized (agenda.propagationList) { - head = agenda.propagationList.takeAll(); - - // if halt() has called, the thread should not be put into a wait state - // instead this is just a safe way to make sure the queue is flushed before exiting the loop - if (head == null) { - agenda.propagationList.waitOnRest(); - head = agenda.propagationList.takeAll(); - if (head == null) { - agenda.firing = false; - } - } - } - - return head; - } + private PropagationEntry handleRest() { + PropagationEntry head = propagationList.takeAll(); + if (head == null) { + firing = false; } + return head; } } 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 29a2121a669..b4f9da38bc4 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 @@ -110,11 +110,7 @@ public int fire(ActivationsManager activationsManager, AgendaFilter filter, int return fire(activationsManager.getReteEvaluator(), activationsManager, filter, fireCount, fireLimit); } - private int fire( ReteEvaluator reteEvaluator, - ActivationsManager activationsManager, - AgendaFilter filter, - int fireCount, - int fireLimit) { + private int fire( ReteEvaluator reteEvaluator, ActivationsManager activationsManager, AgendaFilter filter, int fireCount, int fireLimit) { int localFireCount = 0; if (!tupleList.isEmpty()) { @@ -167,8 +163,10 @@ private int fire( ReteEvaluator reteEvaluator, } if (!ruleIsAllMatches) { // if firing rule is @All don't give way to other rules - if ( haltRuleFiring( fireCount, fireLimit, localFireCount, activationsManager ) ) { - break; // another rule has high priority and is on the agenda, so evaluate it first + if ( firingHalted(activationsManager) || + fireLimitReached(fireCount, fireLimit, localFireCount) || + ruleWithHigherSalienceActivated(activationsManager) ) { + break; } if (!reteEvaluator.isSequential()) { evaluateNetworkIfDirty( activationsManager ); @@ -261,22 +259,22 @@ private boolean cancelAndContinue(ReteEvaluator reteEvaluator, return filter != null && !filter.accept((InternalMatch) leftTuple); } - private boolean haltRuleFiring(int fireCount, - int fireLimit, - int localFireCount, - ActivationsManager activationsManager) { - if (!activationsManager.isFiring() || (fireLimit >= 0 && (localFireCount + fireCount >= fireLimit))) { - return true; - } + private static boolean firingHalted(ActivationsManager activationsManager) { + return !activationsManager.isFiring(); + } + private boolean ruleWithHigherSalienceActivated(ActivationsManager activationsManager) { // The eager list must be evaluated first, as dynamic salience rules will impact the results of peekNextRule activationsManager.evaluateEagerList(); - RuleAgendaItem nextRule = activationsManager.peekNextRule(); if (nextRule == ruleAgendaItem || nextRule == null) { return false; } - return !ruleAgendaItem.getAgendaGroup().equals( nextRule.getAgendaGroup() ) || !isHigherSalience(nextRule); + return !ruleAgendaItem.getAgendaGroup().equals(nextRule.getAgendaGroup()) || !isHigherSalience(nextRule); + } + + private static boolean fireLimitReached(int fireCount, int fireLimit, int localFireCount) { + return fireLimit >= 0 && (localFireCount + fireCount >= fireLimit); } private boolean isHigherSalience(RuleAgendaItem nextRule) { 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 66221696d2a..e74c10e80a7 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 @@ -18,6 +18,13 @@ */ package org.drools.kiesession.agenda; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.core.RuleBaseConfiguration; @@ -67,13 +74,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - /** * Rule-firing Agenda. * @@ -576,7 +576,7 @@ int internalFireAllRules( AgendaFilter agendaFilter, int fireLimit, boolean isIn private int fireLoop(AgendaFilter agendaFilter, int fireLimit, RestHandler restHandler, boolean isInternalFire) { int fireCount = 0; try { - PropagationEntry head = propagationList.takeAll(); + PropagationEntry head = takePropagationHead(); int returnedFireCount; boolean limitReached = fireLimit == 0; // -1 or > 0 will return false. No reason for user to give 0, just handled for completeness. @@ -604,19 +604,13 @@ private int fireLoop(AgendaFilter agendaFilter, int fireLimit, RestHandler restH // Note that if a halt() command is given, the engine is changed to INACTIVE, // and isFiring returns false allowing it to exit before all rules are fired. // - while ( isFiring() ) { + while ( isFiring() || executionStateMachine.getCurrentState().isHalting() ) { if ( head != null ) { // it is possible that there are no action propagations, but there are rules to fire. propagationList.flush(head); head = null; } - // a halt may have occurred during the flushPropagations, - // which changes the isFiring state. So a second isFiring guard is needed - if (!isFiring()) { - break; - } - evaluateEagerList(); InternalAgendaGroup group = getAgendaGroupsManager().getNextFocus(); if ( group != null && !limitReached ) { @@ -627,7 +621,7 @@ private int fireLoop(AgendaFilter agendaFilter, int fireLimit, RestHandler restH fireCount += returnedFireCount; limitReached = ( fireLimit > 0 && fireCount >= fireLimit ); - head = propagationList.takeAll(); + head = takePropagationHead(); } else { returnedFireCount = 0; // no rules fired this iteration, so we know this is 0 group = null; // set the group to null in case the fire limit has been reached @@ -636,7 +630,7 @@ private int fireLoop(AgendaFilter agendaFilter, int fireLimit, RestHandler restH if ( returnedFireCount == 0 && head == null && ( group == null || ( group.isEmpty() && !group.isAutoDeactivate() ) ) && !flushExpirations() ) { // if true, the engine is now considered potentially at rest head = restHandler.handleRest( this, isInternalFire ); - if (!isInternalFire && head == null) { + if ( ( !isInternalFire || executionStateMachine.getCurrentState().isHalting() ) && head == null) { break; } } @@ -653,6 +647,13 @@ private int fireLoop(AgendaFilter agendaFilter, int fireLimit, RestHandler restH return fireCount; } + private PropagationEntry takePropagationHead() { + if (executionStateMachine.getCurrentState().isHalting()) { + return null; + } + return propagationList.takeAll(); + } + interface RestHandler { RestHandler FIRE_ALL_RULES = new FireAllRulesRestHandler(); RestHandler FIRE_UNTIL_HALT = new FireUntilHaltRestHandler(); @@ -684,7 +685,7 @@ public PropagationEntry handleRest(DefaultAgenda agenda, boolean isInternalFire) PropagationEntry head; // this must use the same sync target as takeAllPropagations, to ensure this entire block is atomic, up to the point of wait synchronized (agenda.propagationList) { - head = agenda.propagationList.takeAll(); + head = agenda.takePropagationHead(); // if halt() has called, the thread should not be put into a wait state // instead this is just a safe way to make sure the queue is flushed before exiting the loop @@ -692,7 +693,7 @@ public PropagationEntry handleRest(DefaultAgenda agenda, boolean isInternalFire) agenda.executionStateMachine.getCurrentState() == ExecutionStateMachine.ExecutionState.FIRING_UNTIL_HALT || agenda.executionStateMachine.getCurrentState() == ExecutionStateMachine.ExecutionState.INACTIVE_ON_FIRING_UNTIL_HALT )) { agenda.propagationList.waitOnRest(); - head = agenda.propagationList.takeAll(); + head = agenda.takePropagationHead(); } } @@ -771,13 +772,38 @@ public String toString() { } } + static class ImmediateHalt extends PropagationEntry.AbstractPropagationEntry { + + private final ExecutionStateMachine executionStateMachine; + private final PropagationList propagationList; + + protected ImmediateHalt( ExecutionStateMachine executionStateMachine, PropagationList propagationList ) { + this.executionStateMachine = executionStateMachine; + this.propagationList = propagationList; + } + + @Override + public void internalExecute(ReteEvaluator reteEvaluator ) { + executionStateMachine.immediateHalt(propagationList); + reteEvaluator.getActivationsManager().haltGroupEvaluation(); + } + + @Override + public String toString() { + return "ImmediateHalt"; + } + } + @Override public synchronized void halt() { // only attempt halt an engine that is currently firing // This will place a halt command on the propagation queue // that will allow the engine to halt safely if ( isFiring() ) { - propagationList.addEntry(new Halt(executionStateMachine)); + PropagationEntry halt = executionStateMachine.getCurrentState() == ExecutionStateMachine.ExecutionState.FIRING_ALL_RULES ? + new ImmediateHalt(executionStateMachine, propagationList) : + new Halt(executionStateMachine); + propagationList.addEntry(halt); } } @@ -881,6 +907,10 @@ public boolean isFiring() { return firing; } + public boolean isHalting() { + return this == HALTING; + } + public boolean isAlive() { return alive; } diff --git a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/FromTest.java b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/FromTest.java index 23f4b42e582..afbcfe18403 100644 --- a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/FromTest.java +++ b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/FromTest.java @@ -259,7 +259,7 @@ public void testModifyWithFromSudoku() { "rule \"set a value\" when\n" + " $s : Setting( $rn: rowNo, $cn: colNo, $v: value )\n" + " $c : Cell( rowNo == $rn, colNo == $cn, value == null)\n" + - " $ctr : Counter( $count: count )\n" + + " $ctr : Counter( $count: count != 0 )\n" + "then\n" + " System.out.println(\"set a value [\" + $v + \"] to $c = \" + $c);\n" + " modify( $c ){ setValue( $v ) }\n" + @@ -269,6 +269,7 @@ public void testModifyWithFromSudoku() { " $s: Setting( $rn: rowNo, $cn: colNo, $v: value )\n" + " Cell( rowNo == $rn, colNo == $cn, value == $v, $exCells: exCells )\n" + " $c: Cell( free contains $v ) from $exCells\n" + + " Counter( $count: count != 0 )\n" + "then\n" + " System.out.println(\"eliminate a value [\" + $v + \"] from Cell : $c = \" + $c);\n" + " modify( $c ){ blockValue( $v ) }\n" + @@ -280,6 +281,7 @@ public void testModifyWithFromSudoku() { " not( $x: Cell( free contains $v )\n" + " and\n" + " Cell( this == $c, exCells contains $x ) )\n" + + " Counter( $count: count != 0 )\n" + "then\n" + " System.out.println( \"done setting cell \" + $c.toString() ); \n" + " delete( $s );\n" + @@ -288,6 +290,7 @@ public void testModifyWithFromSudoku() { "when\n" + " not Setting()\n" + " $c: Cell( $rn: rowNo, $cn: colNo, freeCount == 1 )\n" + + " Counter( $count: count != 0 )\n" + "then\n" + " Integer i = $c.getFreeValue();\n" + " System.out.println( \"single \" + i + \" at \" + $c.toString() );\n" + diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/FireUntilHaltTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/FireUntilHaltTest.java index d734e8586b8..44266921339 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/FireUntilHaltTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/FireUntilHaltTest.java @@ -21,6 +21,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; import org.drools.mvel.compiler.Cheese; import org.drools.mvel.compiler.Person; @@ -161,4 +164,38 @@ public void testFireUntilHaltFailingAcrossEntryPoints() throws Exception { assertThat(alive).as("Thread should have died!").isFalse(); assertThat(list.size()).isEqualTo(1); } + + @Test + public void testAllFactsProcessedBeforeHalt() throws Exception { + String drl = "package org.example.drools;\n" + + "\n" + + "global java.util.concurrent.CountDownLatch latch;\n" + + "\n" + + "rule \"R1\" when\n" + + " $s : String()\n" + + "then\n" + + " latch.countDown();\n" + + "end\n" + + "rule \"R2\" when\n" + + " $s : String()\n" + + "then\n" + + " latch.countDown();\n" + + "end\n"; + + KieBase kbase = KieBaseUtil.getKieBaseFromKieModuleFromDrl("test", kieBaseTestConfiguration, drl); + KieSession ksession = kbase.newKieSession(); + + CountDownLatch latch = new CountDownLatch(4); + ksession.setGlobal("latch", latch); + + Executors.newSingleThreadExecutor().execute(ksession::fireUntilHalt); + + ksession.insert("aaa"); + ksession.insert("bbb"); + + ksession.halt(); + + // the 2 facts inserted should be processed before halt + assertThat(latch.await(100, TimeUnit.MILLISECONDS)).isTrue(); + } } From 234a1b4069cb7da7d2b3e3e22c0d3bc1b57f8420 Mon Sep 17 00:00:00 2001 From: Paolo Bizzarri Date: Wed, 8 Nov 2023 08:34:14 +0100 Subject: [PATCH 24/41] [kie-issues #673] Remove checkstyle warnings from drools compiler module (#5574) * Fixed imports * Replaced tabs with spaces * Fixed issues with missing braces * fixed last class * Reverted changes for generated files. * Ignored warnings from generated files --- build-parent/pom.xml | 4 ++ drools-compiler/pom.xml | 1 + .../builder/DroolsAssemblerContext.java | 4 +- .../builder/InternalKnowledgeBuilder.java | 6 +- .../builder/PackageRegistryManager.java | 6 +- .../conf/DecisionTableConfigurationImpl.java | 16 +++-- .../builder/conf/JaxbConfigurationImpl.java | 5 +- .../builder/impl/BuildResultCollector.java | 4 +- .../impl/BuildResultCollectorImpl.java | 10 +-- .../builder/impl/ClassDefinitionFactory.java | 30 ++++----- .../builder/impl/ClassHierarchyManager.java | 12 ++-- .../impl/CompositeBuilderConfiguration.java | 2 - .../impl/CompositeKnowledgeBuilderImpl.java | 14 ++-- .../builder/impl/DeclaredClassBuilder.java | 10 +-- .../impl/DroolsAssemblerContextImpl.java | 4 +- .../builder/impl/EvaluatorRegistry.java | 8 ++- .../builder/impl/HierarchySorter.java | 23 +++++-- .../KnowledgeBuilderConfigurationImpl.java | 2 +- .../builder/impl/KnowledgeBuilderImpl.java | 32 +++++----- ...nowledgeBuilderRulesConfigurationImpl.java | 8 +-- .../impl/PackageAttributeManagerImpl.java | 4 +- .../builder/impl/PackageDescrBuilder.java | 12 ++-- .../builder/impl/PackageDescrManager.java | 4 +- .../builder/impl/PackageRegistryCompiler.java | 4 +- .../impl/PackageRegistryManagerImpl.java | 22 +++---- .../builder/impl/ResourceHandlerManager.java | 6 +- .../builder/impl/TypeDeclarationBuilder.java | 12 ++-- .../builder/impl/TypeDeclarationCache.java | 8 +-- .../impl/TypeDeclarationConfigurator.java | 8 +-- .../builder/impl/TypeDeclarationContext.java | 4 +- .../impl/TypeDeclarationContextImpl.java | 4 +- .../builder/impl/TypeDeclarationFactory.java | 10 +-- .../impl/TypeDeclarationNameResolver.java | 8 +-- .../builder/impl/TypeDeclarationUtils.java | 12 ++-- .../compiler/builder/impl/TypeDefinition.java | 2 +- .../builder/impl/classbuilder/BuildUtils.java | 7 +- .../classbuilder/EnumClassDefinition.java | 2 +- .../classbuilder/EnumLiteralDefinition.java | 12 +++- .../builder/impl/errors/ErrorHandler.java | 6 +- .../impl/errors/FunctionErrorHandler.java | 2 +- .../builder/impl/errors/RuleErrorHandler.java | 4 +- .../impl/errors/RuleInvokerErrorHandler.java | 2 +- .../AbstractPackageCompilationPhase.java | 4 +- .../AccumulateFunctionCompilationPhase.java | 6 +- .../impl/processors/AnnotationNormalizer.java | 20 +++--- .../impl/processors/CompilationPhase.java | 4 +- .../CompositePackageCompilationPhase.java | 12 ++-- .../ConsequenceCompilationPhase.java | 6 +- .../processors/FunctionCompilationPhase.java | 2 +- .../processors/GlobalCompilationPhase.java | 2 +- .../processors/ImmutableFunctionCompiler.java | 4 +- .../ImmutableGlobalCompilationPhase.java | 2 +- .../ImmutableRuleCompilationPhase.java | 2 +- .../impl/processors/IteratingPhase.java | 4 +- .../OtherDeclarationCompilationPhase.java | 4 +- .../processors/PackageCompilationPhase.java | 4 +- .../builder/impl/processors/ReteCompiler.java | 10 +-- .../processors/RuleAnnotationNormalizer.java | 4 +- .../impl/processors/RuleCompilationPhase.java | 14 ++-- .../impl/processors/RuleValidator.java | 4 +- .../TypeDeclarationAnnotationNormalizer.java | 4 +- .../TypeDeclarationCompilationPhase.java | 10 +-- ...eDeclarationCompositeCompilationPhase.java | 12 ++-- .../WindowDeclarationCompilationPhase.java | 6 +- .../DecisionTableResourceHandler.java | 4 +- .../impl/resources/DrlResourceHandler.java | 4 +- .../impl/resources/DslrResourceHandler.java | 6 +- .../impl/resources/ResourceHandler.java | 22 +++---- .../resources/TemplateResourceHandler.java | 8 +-- .../compiler/compiler/BoundIdentifiers.java | 6 +- .../compiler/ConfigurableSeverityResult.java | 2 +- .../DeprecatedResourceTypeWarning.java | 1 - .../org/drools/compiler/compiler/Dialect.java | 6 +- .../compiler/DialectConfiguration.java | 2 +- .../compiler/compiler/DroolsWarning.java | 2 +- .../compiler/compiler/DuplicateFunction.java | 2 +- .../compiler/compiler/DuplicateRule.java | 16 ++--- .../compiler/JavaDialectConfiguration.java | 2 +- .../compiler/PackageBuilderResults.java | 1 - .../compiler/compiler/PackageRegistry.java | 6 +- .../compiler/compiler/ProcessBuilder.java | 6 +- .../compiler/ProjectJavaCompiler.java | 2 +- .../compiler/compiler/RuleBuildError.java | 2 +- .../compiler/compiler/RuleBuildWarning.java | 2 +- .../compiler/SerializableDroolsError.java | 6 +- .../compiler/TypeDeclarationError.java | 2 +- .../compiler/io/memory/MemoryFile.java | 28 ++++++-- .../compiler/io/memory/MemoryFileSystem.java | 22 +++++-- .../compiler/io/memory/MemoryFolder.java | 14 ++-- .../kie/builder/impl/AbstractKieModule.java | 4 +- .../kie/builder/impl/AbstractKieProject.java | 8 ++- .../kie/builder/impl/ClasspathKieProject.java | 2 +- .../DecisionTableConfigurationDelegate.java | 6 +- .../kie/builder/impl/InternalKieModule.java | 4 +- .../kie/builder/impl/InternalKieServices.java | 2 +- .../kie/builder/impl/KieBaseUpdaterImpl.java | 12 ++-- .../kie/builder/impl/KieBuilderImpl.java | 8 ++- .../kie/builder/impl/KieBuilderSetImpl.java | 4 +- .../kie/builder/impl/KieContainerImpl.java | 6 +- .../kie/builder/impl/KieFileSystemImpl.java | 2 +- .../kie/builder/impl/KieMetaInfoBuilder.java | 10 +-- .../kie/builder/impl/KieServicesImpl.java | 64 +++++++++---------- .../kie/builder/impl/MemoryKieModule.java | 10 ++- .../kie/builder/impl/ZipKieModule.java | 2 +- .../KieScannerStatusChangeEventImpl.java | 12 ++-- .../compiler/kie/util/ChangeSetBuilder.java | 6 +- .../compiler/kie/util/InjectionHelper.java | 16 ++--- .../compiler/kie/util/KieJarChangeSet.java | 12 +++- .../kproject/models/KieBaseModelImpl.java | 8 ++- .../kproject/models/KieModuleModelImpl.java | 2 +- .../kproject/models/KieSessionModelImpl.java | 10 +-- .../org/drools/compiler/lang/DescrDumper.java | 4 +- .../drools/compiler/lang/DumperContext.java | 2 +- .../management/KieContainerMonitor.java | 40 ++++++------ .../compiler/rule/builder/CollectBuilder.java | 6 +- .../builder/ConditionalBranchBuilder.java | 4 +- .../rule/builder/ConstraintBuilder.java | 10 +-- .../rule/builder/EntryPointBuilder.java | 4 +- .../rule/builder/EvaluatorDefinition.java | 2 +- .../rule/builder/EvaluatorWrapper.java | 6 +- .../compiler/rule/builder/ForallBuilder.java | 8 +-- .../rule/builder/FunctionBuilder.java | 4 +- .../rule/builder/GroupElementBuilder.java | 8 +-- .../rule/builder/JavaRuleClassBuilder.java | 2 +- .../rule/builder/NamedConsequenceBuilder.java | 4 +- .../rule/builder/PackageBuildContext.java | 4 +- .../compiler/rule/builder/PatternBuilder.java | 28 ++++---- .../PatternBuilderForAbductiveQuery.java | 8 +-- .../rule/builder/PatternBuilderForQuery.java | 10 +-- .../rule/builder/QueryElementBuilder.java | 14 ++-- .../rule/builder/RuleBuildContext.java | 10 +-- .../compiler/rule/builder/RuleBuilder.java | 12 ++-- .../rule/builder/RuleConditionBuilder.java | 2 +- .../rule/builder/WindowReferenceBuilder.java | 6 +- .../rule/builder/dialect/DialectUtil.java | 14 ++-- .../rule/builder/util/AnnotationFactory.java | 2 +- .../rule/builder/util/ConstraintUtil.java | 2 +- .../rule/builder/util/PackageBuilderUtil.java | 10 +-- .../impl/DroolsJaxbHelperProviderImpl.java | 3 +- .../testframework/TestingEventListener.java | 4 +- .../lang/descr/CompositePackageDescrTest.java | 2 +- .../compiler/lang/descr/PackageDescrTest.java | 2 +- 142 files changed, 610 insertions(+), 507 deletions(-) diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 817329c2584..445879b659a 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -44,6 +44,7 @@ true true + weekly false @@ -1581,6 +1582,9 @@ + + + diff --git a/drools-compiler/pom.xml b/drools-compiler/pom.xml index 5e08c4dbc88..2e6f8099db3 100644 --- a/drools-compiler/pom.xml +++ b/drools-compiler/pom.xml @@ -39,6 +39,7 @@ org.drools.compiler org.kie.test.testcategory.TurtleTestCategory 2 + JavaParser.java|JavaLexer.java diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/DroolsAssemblerContext.java b/drools-compiler/src/main/java/org/drools/compiler/builder/DroolsAssemblerContext.java index 5d128f9ea91..350a500aa86 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/DroolsAssemblerContext.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/DroolsAssemblerContext.java @@ -22,14 +22,14 @@ import java.util.List; import java.util.Map; +import org.drools.base.base.ObjectType; +import org.drools.base.rule.TypeDeclaration; import org.drools.compiler.builder.impl.BuilderConfigurationProvider; import org.drools.compiler.builder.impl.InternalKnowledgeBaseProvider; import org.drools.compiler.builder.impl.RootClassLoaderProvider; import org.drools.compiler.compiler.PackageRegistry; import org.drools.compiler.rule.builder.PackageBuildContext; import org.drools.compiler.rule.builder.RuleBuildContext; -import org.drools.base.base.ObjectType; -import org.drools.base.rule.TypeDeclaration; import org.drools.drl.ast.descr.PackageDescr; import org.kie.internal.builder.KnowledgeBuilderErrors; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/InternalKnowledgeBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/builder/InternalKnowledgeBuilder.java index ede2753a3bc..765dee174ef 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/InternalKnowledgeBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/InternalKnowledgeBuilder.java @@ -27,14 +27,14 @@ import java.util.function.Function; import java.util.function.Supplier; +import org.drools.base.base.ObjectType; +import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.base.rule.TypeDeclaration; import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.compiler.builder.impl.KnowledgeBuilderImpl; import org.drools.compiler.compiler.PackageBuilderErrors; import org.drools.compiler.compiler.PackageBuilderResults; import org.drools.compiler.compiler.PackageRegistry; -import org.drools.base.base.ObjectType; -import org.drools.base.definitions.InternalKnowledgePackage; -import org.drools.base.rule.TypeDeclaration; import org.drools.drl.ast.descr.PackageDescr; import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.kie.api.KieBase; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/PackageRegistryManager.java b/drools-compiler/src/main/java/org/drools/compiler/builder/PackageRegistryManager.java index b1cdfe0b17d..500dccf177e 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/PackageRegistryManager.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/PackageRegistryManager.java @@ -18,12 +18,12 @@ */ package org.drools.compiler.builder; -import org.drools.compiler.compiler.PackageRegistry; -import org.drools.drl.ast.descr.PackageDescr; - import java.util.Collection; import java.util.Map; +import org.drools.compiler.compiler.PackageRegistry; +import org.drools.drl.ast.descr.PackageDescr; + /** * Manages handling and creation of {@link PackageRegistry} instances. */ diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/conf/DecisionTableConfigurationImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/conf/DecisionTableConfigurationImpl.java index 2404648188d..b54c4e9603a 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/conf/DecisionTableConfigurationImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/conf/DecisionTableConfigurationImpl.java @@ -127,13 +127,21 @@ public int getCol() { @Override public boolean equals( Object o ) { - if ( this == o ) return true; - if ( o == null || getClass() != o.getClass() ) return false; + if ( this == o ) { + return true; + } + if ( o == null || getClass() != o.getClass() ) { + return false; + } RuleTemplateInfo that = ( RuleTemplateInfo ) o; - if ( row != that.row ) return false; - if ( col != that.col ) return false; + if ( row != that.row ) { + return false; + } + if ( col != that.col ) { + return false; + } return template != null ? template.equals( that.template ) : that.template == null; } diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/conf/JaxbConfigurationImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/conf/JaxbConfigurationImpl.java index 16800f1bddd..4ce70d1b9e5 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/conf/JaxbConfigurationImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/conf/JaxbConfigurationImpl.java @@ -27,15 +27,14 @@ import java.util.List; import java.util.Properties; +import com.sun.tools.xjc.Language; +import com.sun.tools.xjc.Options; import org.drools.io.ResourceConfigurationImpl; import org.kie.api.io.ResourceConfiguration; import org.kie.internal.builder.JaxbConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.sun.tools.xjc.Language; -import com.sun.tools.xjc.Options; - public class JaxbConfigurationImpl extends ResourceConfigurationImpl implements JaxbConfiguration { private final Logger logger = LoggerFactory.getLogger( JaxbConfigurationImpl.class ); diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/BuildResultCollector.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/BuildResultCollector.java index f3ea9df9198..22a2892b6c2 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/BuildResultCollector.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/BuildResultCollector.java @@ -18,12 +18,12 @@ */ package org.drools.compiler.builder.impl; +import java.util.Collection; + import org.kie.internal.builder.KnowledgeBuilderResult; import org.kie.internal.builder.KnowledgeBuilderResults; import org.kie.internal.builder.ResultSeverity; -import java.util.Collection; - /** * Holds build processing info, warnings and errors. */ diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/BuildResultCollectorImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/BuildResultCollectorImpl.java index d408eff0e38..fd7c4ede15c 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/BuildResultCollectorImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/BuildResultCollectorImpl.java @@ -18,6 +18,11 @@ */ package org.drools.compiler.builder.impl; +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.List; + import org.drools.compiler.compiler.ConfigurableSeverityResult; import org.drools.compiler.compiler.DroolsErrorWrapper; import org.drools.compiler.compiler.DroolsWarning; @@ -31,11 +36,6 @@ import org.kie.internal.builder.KnowledgeBuilderResults; import org.kie.internal.builder.ResultSeverity; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; - import static java.util.Arrays.asList; public class BuildResultCollectorImpl implements BuildResultCollector { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ClassDefinitionFactory.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ClassDefinitionFactory.java index 8f2b7d62a56..a7ff5e79854 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ClassDefinitionFactory.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ClassDefinitionFactory.java @@ -33,35 +33,35 @@ import java.util.Map; import java.util.Set; -import org.drools.compiler.compiler.PackageRegistry; -import org.drools.compiler.compiler.TypeDeclarationError; -import org.drools.drl.ast.descr.AbstractClassTypeDeclarationDescr; -import org.drools.drl.ast.descr.AnnotationDescr; -import org.drools.drl.ast.descr.EnumDeclarationDescr; -import org.drools.drl.ast.descr.EnumLiteralDescr; -import org.drools.drl.ast.descr.PatternDescr; -import org.drools.drl.ast.descr.QualifiedName; -import org.drools.drl.ast.descr.TypeDeclarationDescr; -import org.drools.drl.ast.descr.TypeFieldDescr; -import org.drools.compiler.rule.builder.util.AnnotationFactory; -import org.drools.util.TypeResolver; import org.drools.base.base.ClassFieldInspector; import org.drools.base.base.CoreComponentsBuilder; import org.drools.base.factmodel.AnnotationDefinition; import org.drools.base.factmodel.ClassDefinition; -import org.drools.compiler.builder.impl.classbuilder.EnumClassDefinition; -import org.drools.compiler.builder.impl.classbuilder.EnumLiteralDefinition; import org.drools.base.factmodel.FieldDefinition; -import org.kie.internal.definition.GenericTypeDefinition; import org.drools.base.factmodel.traits.Thing; import org.drools.base.factmodel.traits.Trait; import org.drools.base.factmodel.traits.Traitable; import org.drools.base.factmodel.traits.TraitableBean; import org.drools.base.rule.TypeDeclaration; +import org.drools.compiler.builder.impl.classbuilder.EnumClassDefinition; +import org.drools.compiler.builder.impl.classbuilder.EnumLiteralDefinition; +import org.drools.compiler.compiler.PackageRegistry; +import org.drools.compiler.compiler.TypeDeclarationError; +import org.drools.compiler.rule.builder.util.AnnotationFactory; +import org.drools.drl.ast.descr.AbstractClassTypeDeclarationDescr; +import org.drools.drl.ast.descr.AnnotationDescr; +import org.drools.drl.ast.descr.EnumDeclarationDescr; +import org.drools.drl.ast.descr.EnumLiteralDescr; +import org.drools.drl.ast.descr.PatternDescr; +import org.drools.drl.ast.descr.QualifiedName; +import org.drools.drl.ast.descr.TypeDeclarationDescr; +import org.drools.drl.ast.descr.TypeFieldDescr; import org.drools.util.ClassUtils; +import org.drools.util.TypeResolver; import org.kie.api.definition.type.Key; import org.kie.api.definition.type.Position; import org.kie.api.io.Resource; +import org.kie.internal.definition.GenericTypeDefinition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ClassHierarchyManager.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ClassHierarchyManager.java index f3e8ecba24d..493fb9c8bb6 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ClassHierarchyManager.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ClassHierarchyManager.java @@ -27,9 +27,6 @@ import java.util.List; import java.util.Map; -import org.drools.compiler.compiler.PackageRegistry; -import org.drools.compiler.compiler.TypeDeclarationError; -import org.drools.util.TypeResolver; import org.drools.base.base.ClassFieldInspector; import org.drools.base.base.CoreComponentsBuilder; import org.drools.base.definitions.InternalKnowledgePackage; @@ -37,12 +34,15 @@ import org.drools.base.factmodel.FieldDefinition; import org.drools.base.factmodel.traits.Alias; import org.drools.base.rule.TypeDeclaration; +import org.drools.compiler.compiler.PackageRegistry; +import org.drools.compiler.compiler.TypeDeclarationError; import org.drools.drl.ast.descr.AbstractClassTypeDeclarationDescr; import org.drools.drl.ast.descr.AnnotationDescr; import org.drools.drl.ast.descr.PatternDescr; import org.drools.drl.ast.descr.QualifiedName; import org.drools.drl.ast.descr.TypeDeclarationDescr; import org.drools.drl.ast.descr.TypeFieldDescr; +import org.drools.util.TypeResolver; import org.kie.api.definition.type.Key; import org.kie.api.io.Resource; @@ -193,9 +193,9 @@ private static void buildDescrsFromFields(Class klass, TypeDeclarationDescr type inheritedFlDescr.setResource(resource); inheritedFlDescr.setInherited(!Modifier.isAbstract(inspector.getGetterMethods().get(name).getModifiers())); - if (!fieldMap.containsKey(inheritedFlDescr.getFieldName())) - fieldMap.put(inheritedFlDescr.getFieldName(), - inheritedFlDescr); + if (!fieldMap.containsKey(inheritedFlDescr.getFieldName())) { + fieldMap.put(inheritedFlDescr.getFieldName(), inheritedFlDescr); + } } } } diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeBuilderConfiguration.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeBuilderConfiguration.java index bd554eb712e..7f976908795 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeBuilderConfiguration.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeBuilderConfiguration.java @@ -27,8 +27,6 @@ import org.kie.internal.conf.ConfigurationFactory; import org.kie.internal.utils.ChainedProperties; -import java.util.Properties; - public class CompositeBuilderConfiguration extends CompositeConfiguration implements KnowledgeBuilderConfiguration { public CompositeBuilderConfiguration(ChainedProperties properties, ClassLoader classloader, diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeKnowledgeBuilderImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeKnowledgeBuilderImpl.java index 5c521da7bf4..1c53ddae0b3 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeKnowledgeBuilderImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeKnowledgeBuilderImpl.java @@ -18,6 +18,13 @@ */ package org.drools.compiler.builder.impl; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + import org.drools.compiler.lang.descr.CompositePackageDescr; import org.kie.api.internal.assembler.KieAssemblers; import org.kie.api.internal.utils.KieService; @@ -31,13 +38,6 @@ import org.kie.internal.builder.ResourceChangeSet; import org.kie.internal.io.ResourceWithConfigurationImpl; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - public class CompositeKnowledgeBuilderImpl implements CompositeKnowledgeBuilder { private static final KieAssemblers ASSEMBLERS = KieService.load(KieAssemblers.class); diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/DeclaredClassBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/DeclaredClassBuilder.java index 602b09e9cf7..00ff2e3030b 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/DeclaredClassBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/DeclaredClassBuilder.java @@ -18,16 +18,16 @@ */ package org.drools.compiler.builder.impl; +import org.drools.base.factmodel.ClassDefinition; +import org.drools.base.rule.TypeDeclaration; +import org.drools.compiler.builder.impl.classbuilder.ClassBuilder; import org.drools.compiler.compiler.PackageRegistry; import org.drools.compiler.compiler.TypeDeclarationError; +import org.drools.core.rule.JavaDialectRuntimeData; import org.drools.drl.ast.descr.AbstractClassTypeDeclarationDescr; import org.drools.drl.ast.descr.TypeDeclarationDescr; -import org.drools.compiler.builder.impl.classbuilder.ClassBuilder; -import org.drools.base.factmodel.ClassDefinition; -import org.drools.core.rule.JavaDialectRuntimeData; -import org.drools.base.rule.TypeDeclaration; -import org.drools.wiring.api.classloader.ProjectClassLoader; import org.drools.util.TypeResolver; +import org.drools.wiring.api.classloader.ProjectClassLoader; import static org.drools.util.ClassUtils.convertClassToResourcePath; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/DroolsAssemblerContextImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/DroolsAssemblerContextImpl.java index 01a0a48486f..74e0c96e6d7 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/DroolsAssemblerContextImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/DroolsAssemblerContextImpl.java @@ -22,12 +22,12 @@ import java.util.List; import java.util.Map; -import org.drools.compiler.builder.DroolsAssemblerContext; -import org.drools.compiler.compiler.PackageRegistry; import org.drools.base.base.ClassObjectType; import org.drools.base.base.ObjectType; import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.base.rule.TypeDeclaration; +import org.drools.compiler.builder.DroolsAssemblerContext; +import org.drools.compiler.compiler.PackageRegistry; import org.drools.drl.ast.descr.PackageDescr; import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.kie.internal.builder.KnowledgeBuilderErrors; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/EvaluatorRegistry.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/EvaluatorRegistry.java index 4cf8588d8a4..e50e5387cdd 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/EvaluatorRegistry.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/EvaluatorRegistry.java @@ -26,11 +26,11 @@ import java.util.Map; import java.util.Set; -import org.drools.compiler.rule.builder.ConstraintBuilder; -import org.drools.compiler.rule.builder.EvaluatorDefinition; import org.drools.base.base.ValueType; import org.drools.base.common.DroolsObjectInput; import org.drools.base.rule.accessor.Evaluator; +import org.drools.compiler.rule.builder.ConstraintBuilder; +import org.drools.compiler.rule.builder.EvaluatorDefinition; import org.drools.drl.parser.impl.Operator; /** @@ -100,7 +100,9 @@ public void writeExternal( ObjectOutput out ) throws IOException { } private static ClassLoader getDefaultClassLoader() { - if ( Thread.currentThread().getContextClassLoader() != null ) return Thread.currentThread().getContextClassLoader(); + if ( Thread.currentThread().getContextClassLoader() != null ) { + return Thread.currentThread().getContextClassLoader(); + } return EvaluatorRegistry.class.getClassLoader(); } diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/HierarchySorter.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/HierarchySorter.java index 0022f30a520..950c21dfc90 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/HierarchySorter.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/HierarchySorter.java @@ -18,7 +18,12 @@ */ package org.drools.compiler.builder.impl; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class HierarchySorter { @@ -83,7 +88,9 @@ public List sort( Map> hierarchy ) { java.util.Iterator> iter = map.values().iterator(); while ( iter.hasNext() ) { Node n = iter.next(); - if ( n.getData() == null ) root.addChild( n ); + if ( n.getData() == null ) { + root.addChild( n ); + } } @@ -154,12 +161,18 @@ public String toString() { @Override public boolean equals( Object o ) { - if ( this == o ) return true; - if ( o == null || getClass() != o.getClass() ) return false; + if ( this == o ) { + return true; + } + if ( o == null || getClass() != o.getClass() ) { + return false; + } Node node = (Node) o; - if ( !key.equals( node.key ) ) return false; + if ( !key.equals( node.key ) ) { + return false; + } return true; } diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderConfigurationImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderConfigurationImpl.java index c21cc85b10e..45cbfd6160b 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderConfigurationImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderConfigurationImpl.java @@ -23,6 +23,7 @@ import java.util.Map; import java.util.Set; +import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.compiler.compiler.Dialect; import org.drools.compiler.compiler.DialectCompiletimeRegistry; import org.drools.compiler.compiler.DialectConfiguration; @@ -30,7 +31,6 @@ import org.drools.compiler.kie.builder.impl.InternalKieModule.CompilationCache; import org.drools.compiler.rule.builder.ConstraintBuilder; import org.drools.core.BaseConfiguration; -import org.drools.base.definitions.InternalKnowledgePackage; import org.kie.api.conf.ConfigurationKey; import org.kie.api.conf.OptionKey; import org.kie.internal.builder.KnowledgeBuilderConfiguration; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java index de0b6592eb8..bce0435301f 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java @@ -18,6 +18,22 @@ */ package org.drools.compiler.builder.impl; +import java.io.File; +import java.io.IOException; +import java.io.Reader; +import java.lang.reflect.Type; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Deque; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.ForkJoinPool; +import java.util.function.Supplier; + import org.drools.base.base.ObjectType; import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.base.definitions.rule.impl.RuleImpl; @@ -89,22 +105,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; -import java.io.IOException; -import java.io.Reader; -import java.lang.reflect.Type; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Deque; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.ForkJoinPool; -import java.util.function.Supplier; - import static java.util.Arrays.asList; public class KnowledgeBuilderImpl implements InternalKnowledgeBuilder, TypeDeclarationContext, BuildResultCollector, GlobalVariableContext { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderRulesConfigurationImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderRulesConfigurationImpl.java index 0c8a95b904b..e34574cd3bb 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderRulesConfigurationImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderRulesConfigurationImpl.java @@ -139,8 +139,8 @@ private void init() { DrlParser.DEFAULT_LANGUAGE_LEVEL.toString())); setProperty(ParallelRulesBuildThresholdOption.PROPERTY_NAME, - getPropertyValue(ParallelRulesBuildThresholdOption.PROPERTY_NAME, - String.valueOf(DEFAULT_PARALLEL_RULES_BUILD_THRESHOLD))); + getPropertyValue(ParallelRulesBuildThresholdOption.PROPERTY_NAME, + String.valueOf(DEFAULT_PARALLEL_RULES_BUILD_THRESHOLD))); this.accumulateFunctions = AccumulateUtil.buildAccumulateFunctionsMap(getProperties(), getFunctionFactoryClassLoader() ); @@ -359,11 +359,11 @@ public void setGroupDRLsInKieBasesByFolder( boolean groupDRLsInKieBasesByFolder } public int getParallelRulesBuildThreshold() { - return parallelRulesBuildThreshold.getParallelRulesBuildThreshold(); + return parallelRulesBuildThreshold.getParallelRulesBuildThreshold(); } public void setParallelRulesBuildThreshold(int parallelRulesBuildThreshold) { - this.parallelRulesBuildThreshold = ParallelRulesBuildThresholdOption.get(parallelRulesBuildThreshold); + this.parallelRulesBuildThreshold = ParallelRulesBuildThresholdOption.get(parallelRulesBuildThreshold); } public LanguageLevelOption getLanguageLevel() { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageAttributeManagerImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageAttributeManagerImpl.java index ae15602e9ce..eeecc540b75 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageAttributeManagerImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageAttributeManagerImpl.java @@ -18,11 +18,11 @@ */ package org.drools.compiler.builder.impl; -import org.drools.drl.ast.descr.AttributeDescr; - import java.util.HashMap; import java.util.Map; +import org.drools.drl.ast.descr.AttributeDescr; + public class PackageAttributeManagerImpl { //This list of package level attributes is initialised with the PackageDescr's attributes added to the assembler. //The package level attributes are inherited by individual rules not containing explicit overriding parameters. diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageDescrBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageDescrBuilder.java index aebdd80511e..883b9e9d17f 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageDescrBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageDescrBuilder.java @@ -18,6 +18,12 @@ */ package org.drools.compiler.builder.impl; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; + import org.drools.compiler.builder.impl.resources.ResourceHandler; import org.drools.compiler.lang.descr.CompositePackageDescr; import org.drools.drl.ast.descr.PackageDescr; @@ -27,12 +33,6 @@ import org.kie.api.io.ResourceType; import org.kie.internal.builder.KnowledgeBuilderResult; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; - public class PackageDescrBuilder { private final BuildResultCollector buildResultCollector; private ResourceHandlerManager handlerManager; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageDescrManager.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageDescrManager.java index 568ccfafa5a..ddb5f8826b0 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageDescrManager.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageDescrManager.java @@ -18,11 +18,11 @@ */ package org.drools.compiler.builder.impl; -import org.drools.drl.ast.descr.PackageDescr; - import java.util.Collection; import java.util.List; +import org.drools.drl.ast.descr.PackageDescr; + /** * Manages handling of {@link PackageDescr} instances. * diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageRegistryCompiler.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageRegistryCompiler.java index ea660b17d47..034b72ba75f 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageRegistryCompiler.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageRegistryCompiler.java @@ -18,10 +18,10 @@ */ package org.drools.compiler.builder.impl; -import org.kie.internal.builder.KnowledgeBuilderResult; - import java.util.Collection; +import org.kie.internal.builder.KnowledgeBuilderResult; + /** * Builds the consequence in all of the {@link org.drools.compiler.compiler.PackageRegistry} * it contains, and provides the results. diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageRegistryManagerImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageRegistryManagerImpl.java index d5044c8ca4a..608efe4979c 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageRegistryManagerImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/PackageRegistryManagerImpl.java @@ -18,10 +18,20 @@ */ package org.drools.compiler.builder.impl; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutionException; + +import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.compiler.builder.PackageRegistryManager; import org.drools.compiler.compiler.PackageRegistry; import org.drools.core.base.ClassFieldAccessorCache; -import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.core.reteoo.CoreComponentFactory; import org.drools.drl.ast.descr.AttributeDescr; import org.drools.drl.ast.descr.ImportDescr; @@ -32,16 +42,6 @@ import org.kie.internal.builder.conf.DefaultDialectOption; import org.kie.internal.builder.conf.DefaultPackageNameOption; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutionException; - import static org.drools.util.StringUtils.isEmpty; public class PackageRegistryManagerImpl implements PackageRegistryManager, PackageRegistryCompiler, PackageDescrManager { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ResourceHandlerManager.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ResourceHandlerManager.java index 7b7d62aecd6..267fdb17ac8 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ResourceHandlerManager.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ResourceHandlerManager.java @@ -18,6 +18,9 @@ */ package org.drools.compiler.builder.impl; +import java.util.List; +import java.util.function.Supplier; + import org.drools.compiler.builder.impl.resources.DecisionTableResourceHandler; import org.drools.compiler.builder.impl.resources.DrlResourceHandler; import org.drools.compiler.builder.impl.resources.DslrResourceHandler; @@ -27,9 +30,6 @@ import org.kie.api.builder.ReleaseId; import org.kie.api.io.ResourceType; -import java.util.List; -import java.util.function.Supplier; - import static java.util.Arrays.asList; public class ResourceHandlerManager { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationBuilder.java index e740f1ed7f6..70d08ad88ce 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationBuilder.java @@ -25,13 +25,13 @@ import java.util.Map; import java.util.Set; -import org.drools.compiler.compiler.PackageRegistry; -import org.drools.compiler.compiler.TypeDeclarationError; import org.drools.base.definitions.InternalKnowledgePackage; -import org.drools.compiler.builder.impl.classbuilder.ClassBuilder; -import org.drools.compiler.builder.impl.classbuilder.ClassBuilderFactory; import org.drools.base.factmodel.ClassDefinition; import org.drools.base.rule.TypeDeclaration; +import org.drools.compiler.builder.impl.classbuilder.ClassBuilder; +import org.drools.compiler.builder.impl.classbuilder.ClassBuilderFactory; +import org.drools.compiler.compiler.PackageRegistry; +import org.drools.compiler.compiler.TypeDeclarationError; import org.drools.drl.ast.descr.AbstractClassTypeDeclarationDescr; import org.drools.drl.ast.descr.AnnotationDescr; import org.drools.drl.ast.descr.EnumDeclarationDescr; @@ -227,7 +227,9 @@ private boolean isDefinition( AbstractClassTypeDeclarationDescr prev ) { } private void setResourcesInDescriptors( PackageDescr packageDescr, Resource currentResource ) { - if (currentResource == null) return; + if (currentResource == null) { + return; + } for ( AbstractClassTypeDeclarationDescr typeDescr : packageDescr.getClassAndEnumDeclarationDescrs() ) { if ( typeDescr.getResource() == null ) { typeDescr.setResource( currentResource ); diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationCache.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationCache.java index 352c4174ff2..9db06a06762 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationCache.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationCache.java @@ -28,24 +28,24 @@ import java.util.Map; import java.util.Set; -import org.drools.compiler.compiler.PackageRegistry; -import org.drools.compiler.compiler.TypeDeclarationError; -import org.drools.drl.ast.descr.PackageDescr; import org.drools.base.factmodel.ClassDefinition; import org.drools.base.factmodel.FieldDefinition; import org.drools.base.factmodel.traits.Thing; import org.drools.base.rule.Annotated; import org.drools.base.rule.TypeDeclaration; +import org.drools.compiler.compiler.PackageRegistry; +import org.drools.compiler.compiler.TypeDeclarationError; +import org.drools.drl.ast.descr.PackageDescr; import org.drools.util.ClassUtils; import org.kie.api.definition.type.Position; import org.kie.api.io.Resource; import org.kie.api.runtime.rule.Match; import org.kie.internal.builder.conf.PropertySpecificOption; +import static org.drools.base.util.Drools.hasMvel; import static org.drools.compiler.builder.impl.ClassDefinitionFactory.createClassDefinition; import static org.drools.compiler.builder.impl.TypeDeclarationConfigurator.processMvelBasedAccessors; import static org.drools.util.bitmask.BitMaskUtil.isSet; -import static org.drools.base.util.Drools.hasMvel; public class TypeDeclarationCache { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationConfigurator.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationConfigurator.java index 37f6eee0af5..ad0f0dcc9c6 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationConfigurator.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationConfigurator.java @@ -20,15 +20,15 @@ import java.util.Map; +import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.base.rule.Annotated; +import org.drools.base.rule.TypeDeclaration; import org.drools.compiler.compiler.AnalysisResult; import org.drools.compiler.compiler.BoundIdentifiers; import org.drools.compiler.compiler.Dialect; import org.drools.compiler.compiler.PackageRegistry; import org.drools.compiler.compiler.TypeDeclarationError; import org.drools.compiler.rule.builder.PackageBuildContext; -import org.drools.base.definitions.InternalKnowledgePackage; -import org.drools.base.rule.Annotated; -import org.drools.base.rule.TypeDeclaration; import org.drools.drl.ast.descr.AbstractClassTypeDeclarationDescr; import org.drools.drl.ast.descr.BaseDescr; import org.kie.api.definition.type.Duration; @@ -36,8 +36,8 @@ import org.kie.api.definition.type.Timestamp; import org.kie.internal.builder.conf.PropertySpecificOption; -import static org.drools.compiler.rule.builder.util.AnnotationFactory.toAnnotated; import static org.drools.base.rule.TypeDeclaration.processTypeAnnotations; +import static org.drools.compiler.rule.builder.util.AnnotationFactory.toAnnotated; public class TypeDeclarationConfigurator { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationContext.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationContext.java index 9f27e95f81a..64ef208363a 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationContext.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationContext.java @@ -18,12 +18,12 @@ */ package org.drools.compiler.builder.impl; +import java.util.List; + import org.drools.compiler.builder.PackageRegistryManager; import org.drools.drl.ast.descr.PackageDescr; import org.kie.internal.builder.ResourceChange; -import java.util.List; - /** * The build context for {@link TypeDeclarationBuilder}, {@link ClassDefinitionFactory} and * all their related siblings. diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationContextImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationContextImpl.java index cc16536f333..640fff5aac5 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationContextImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationContextImpl.java @@ -23,10 +23,10 @@ import java.util.List; import java.util.Map; -import org.drools.compiler.builder.PackageRegistryManager; -import org.drools.compiler.compiler.PackageRegistry; import org.drools.base.base.ObjectType; import org.drools.base.rule.TypeDeclaration; +import org.drools.compiler.builder.PackageRegistryManager; +import org.drools.compiler.compiler.PackageRegistry; import org.drools.drl.ast.descr.PackageDescr; import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.kie.internal.builder.ResourceChange; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationFactory.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationFactory.java index 7ec15766230..415aa53b52b 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationFactory.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationFactory.java @@ -25,17 +25,17 @@ import java.util.List; import java.util.Map; +import org.drools.base.base.ClassFieldInspector; +import org.drools.base.base.CoreComponentsBuilder; +import org.drools.base.factmodel.FieldDefinition; +import org.drools.base.factmodel.GeneratedFact; +import org.drools.base.rule.TypeDeclaration; import org.drools.compiler.compiler.PackageRegistry; import org.drools.compiler.compiler.TypeDeclarationError; import org.drools.drl.ast.descr.AbstractClassTypeDeclarationDescr; import org.drools.drl.ast.descr.EnumDeclarationDescr; import org.drools.drl.ast.descr.TypeDeclarationDescr; import org.drools.drl.ast.descr.TypeFieldDescr; -import org.drools.base.base.ClassFieldInspector; -import org.drools.base.base.CoreComponentsBuilder; -import org.drools.base.factmodel.FieldDefinition; -import org.drools.base.factmodel.GeneratedFact; -import org.drools.base.rule.TypeDeclaration; import org.kie.api.definition.type.FactField; import org.kie.api.definition.type.PropertyChangeSupport; import org.kie.api.definition.type.Role; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationNameResolver.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationNameResolver.java index b4a917f3d0e..bc139bd43fc 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationNameResolver.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationNameResolver.java @@ -21,18 +21,18 @@ import java.util.Collection; import java.util.List; +import org.drools.base.rule.TypeDeclaration; import org.drools.compiler.compiler.PackageRegistry; import org.drools.compiler.compiler.TypeDeclarationError; -import org.drools.util.TypeResolver; -import org.kie.internal.definition.GenericTypeDefinition; -import org.drools.base.rule.TypeDeclaration; -import org.drools.util.ClassUtils; import org.drools.drl.ast.descr.AbstractClassTypeDeclarationDescr; import org.drools.drl.ast.descr.EnumDeclarationDescr; import org.drools.drl.ast.descr.PackageDescr; import org.drools.drl.ast.descr.QualifiedName; import org.drools.drl.ast.descr.TypeDeclarationDescr; import org.drools.drl.ast.descr.TypeFieldDescr; +import org.drools.util.ClassUtils; +import org.drools.util.TypeResolver; +import org.kie.internal.definition.GenericTypeDefinition; public class TypeDeclarationNameResolver { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationUtils.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationUtils.java index a354d148bec..91fd2f09d5f 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationUtils.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationUtils.java @@ -23,17 +23,17 @@ import java.util.ArrayList; import java.util.List; -import org.drools.compiler.compiler.PackageRegistry; -import org.drools.drl.ast.descr.AbstractClassTypeDeclarationDescr; -import org.drools.drl.ast.descr.ImportDescr; -import org.drools.drl.ast.descr.PackageDescr; -import org.drools.util.TypeResolver; import org.drools.base.base.ClassFieldInspector; import org.drools.base.base.CoreComponentsBuilder; -import org.drools.compiler.builder.impl.classbuilder.BuildUtils; import org.drools.base.factmodel.ClassDefinition; import org.drools.base.rule.TypeDeclaration; +import org.drools.compiler.builder.impl.classbuilder.BuildUtils; +import org.drools.compiler.compiler.PackageRegistry; +import org.drools.drl.ast.descr.AbstractClassTypeDeclarationDescr; +import org.drools.drl.ast.descr.ImportDescr; +import org.drools.drl.ast.descr.PackageDescr; import org.drools.util.StringUtils; +import org.drools.util.TypeResolver; import org.kie.api.definition.type.Modifies; public class TypeDeclarationUtils { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDefinition.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDefinition.java index 927902fff0c..59527f260f7 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDefinition.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDefinition.java @@ -18,8 +18,8 @@ */ package org.drools.compiler.builder.impl; -import org.drools.drl.ast.descr.AbstractClassTypeDeclarationDescr; import org.drools.base.rule.TypeDeclaration; +import org.drools.drl.ast.descr.AbstractClassTypeDeclarationDescr; public class TypeDefinition { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/classbuilder/BuildUtils.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/classbuilder/BuildUtils.java index dda932f9eb0..0fa7128c26e 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/classbuilder/BuildUtils.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/classbuilder/BuildUtils.java @@ -152,7 +152,7 @@ public static String getTypeDescriptor(String type) { // Can only be used with internal names, i.e. after [ has been prefix public static String arrayType( String type ) { - if ( isArray( type ) ) + if ( isArray( type ) ) { if ( type.length() == arrayDimSize(type) +1 ) { return type; } else { @@ -162,6 +162,7 @@ public static String arrayType( String type ) { } return ans.toString(); } + } return null; } @@ -258,7 +259,9 @@ public static Object getDefaultValue( FieldDefinition fld ) { } public static boolean isBoxed(String type) { - if (type == null) return false; + if (type == null) { + return false; + } return "java.lang.Short".equals(type) || "java.lang.Byte".equals(type) || "java.lang.Character".equals(type) diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/classbuilder/EnumClassDefinition.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/classbuilder/EnumClassDefinition.java index 4e41aa5ef9f..72dc90489a9 100755 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/classbuilder/EnumClassDefinition.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/classbuilder/EnumClassDefinition.java @@ -21,9 +21,9 @@ import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; -import java.util.List; import java.util.ArrayList; import java.util.Collections; +import java.util.List; import org.drools.base.factmodel.ClassDefinition; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/classbuilder/EnumLiteralDefinition.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/classbuilder/EnumLiteralDefinition.java index 1c8aaa4319a..8aded1498ac 100755 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/classbuilder/EnumLiteralDefinition.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/classbuilder/EnumLiteralDefinition.java @@ -87,12 +87,18 @@ public void setConstructorArgs(List constructorArgs) { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } EnumLiteralDefinition that = (EnumLiteralDefinition) o; - if (name != null ? !name.equals(that.name) : that.name != null) return false; + if (name != null ? !name.equals(that.name) : that.name != null) { + return false; + } return true; } diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/ErrorHandler.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/ErrorHandler.java index 4721de837af..d94d2ce33ce 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/ErrorHandler.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/ErrorHandler.java @@ -18,12 +18,12 @@ */ package org.drools.compiler.builder.impl.errors; -import org.drools.drl.parser.DroolsError; -import org.kie.internal.jci.CompilationProblem; - import java.util.ArrayList; import java.util.List; +import org.drools.drl.parser.DroolsError; +import org.kie.internal.jci.CompilationProblem; + /** * This is the super of the error handlers. Each error handler knows how to * report a compile error of its type, should it happen. This is needed, as diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/FunctionErrorHandler.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/FunctionErrorHandler.java index 8d813147ba9..af429c0c6f4 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/FunctionErrorHandler.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/FunctionErrorHandler.java @@ -18,9 +18,9 @@ */ package org.drools.compiler.builder.impl.errors; -import org.drools.drl.parser.DroolsError; import org.drools.compiler.compiler.FunctionError; import org.drools.drl.ast.descr.FunctionDescr; +import org.drools.drl.parser.DroolsError; public class FunctionErrorHandler extends ErrorHandler { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/RuleErrorHandler.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/RuleErrorHandler.java index b9ed5d4f0f2..3a6c85bede7 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/RuleErrorHandler.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/RuleErrorHandler.java @@ -18,10 +18,10 @@ */ package org.drools.compiler.builder.impl.errors; -import org.drools.drl.parser.DroolsError; +import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.compiler.compiler.RuleBuildError; import org.drools.drl.ast.descr.BaseDescr; -import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.drl.parser.DroolsError; public class RuleErrorHandler extends ErrorHandler { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/RuleInvokerErrorHandler.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/RuleInvokerErrorHandler.java index a04bab9dff5..79b837f819d 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/RuleInvokerErrorHandler.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/RuleInvokerErrorHandler.java @@ -18,8 +18,8 @@ */ package org.drools.compiler.builder.impl.errors; -import org.drools.drl.ast.descr.BaseDescr; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.drl.ast.descr.BaseDescr; public class RuleInvokerErrorHandler extends RuleErrorHandler { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/AbstractPackageCompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/AbstractPackageCompilationPhase.java index b93ad54c60a..667ed7cf79f 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/AbstractPackageCompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/AbstractPackageCompilationPhase.java @@ -18,14 +18,14 @@ */ package org.drools.compiler.builder.impl.processors; +import java.util.Collection; + import org.drools.compiler.builder.impl.BuildResultCollector; import org.drools.compiler.builder.impl.BuildResultCollectorImpl; import org.drools.compiler.compiler.PackageRegistry; import org.drools.drl.ast.descr.PackageDescr; import org.kie.internal.builder.KnowledgeBuilderResult; -import java.util.Collection; - public abstract class AbstractPackageCompilationPhase implements CompilationPhase { protected final PackageRegistry pkgRegistry; protected final PackageDescr packageDescr; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/AccumulateFunctionCompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/AccumulateFunctionCompilationPhase.java index 99b9e96c566..d2f79ac2f82 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/AccumulateFunctionCompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/AccumulateFunctionCompilationPhase.java @@ -18,14 +18,14 @@ */ package org.drools.compiler.builder.impl.processors; +import java.lang.reflect.InvocationTargetException; + import org.drools.compiler.compiler.PackageRegistry; -import org.drools.util.TypeResolver; import org.drools.drl.ast.descr.AccumulateImportDescr; import org.drools.drl.ast.descr.PackageDescr; +import org.drools.util.TypeResolver; import org.kie.api.runtime.rule.AccumulateFunction; -import java.lang.reflect.InvocationTargetException; - public class AccumulateFunctionCompilationPhase extends AbstractPackageCompilationPhase { private final TypeResolver typeResolver; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/AnnotationNormalizer.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/AnnotationNormalizer.java index 46e93428adc..aed49a9d58a 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/AnnotationNormalizer.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/AnnotationNormalizer.java @@ -18,17 +18,17 @@ */ package org.drools.compiler.builder.impl.processors; -import org.drools.compiler.compiler.AnnotationDeclarationError; -import org.drools.util.TypeResolver; -import org.drools.drl.ast.descr.AnnotatedBaseDescr; -import org.drools.drl.ast.descr.AnnotationDescr; -import org.kie.internal.builder.KnowledgeBuilderResult; - import java.lang.reflect.Array; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; +import org.drools.compiler.compiler.AnnotationDeclarationError; +import org.drools.drl.ast.descr.AnnotatedBaseDescr; +import org.drools.drl.ast.descr.AnnotationDescr; +import org.drools.util.TypeResolver; +import org.kie.internal.builder.KnowledgeBuilderResult; + import static org.drools.util.StringUtils.ucFirst; public abstract class AnnotationNormalizer { @@ -40,8 +40,12 @@ public abstract class AnnotationNormalizer { } public static AnnotationNormalizer of(TypeResolver typeResolver, boolean isStrict) { - if (isStrict) return new AnnotationNormalizer.Strict(typeResolver); - else return new AnnotationNormalizer.NonStrict(typeResolver); + if (isStrict) { + return new AnnotationNormalizer.Strict(typeResolver); + } + else { + return new AnnotationNormalizer.NonStrict(typeResolver); + } } abstract boolean isStrict(); diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/CompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/CompilationPhase.java index 670613dbf6a..83d5ed97d79 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/CompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/CompilationPhase.java @@ -18,10 +18,10 @@ */ package org.drools.compiler.builder.impl.processors; -import org.kie.internal.builder.KnowledgeBuilderResult; - import java.util.Collection; +import org.kie.internal.builder.KnowledgeBuilderResult; + /** * Processes a PackageDescr and produces {@link KnowledgeBuilderResult}s. * diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/CompositePackageCompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/CompositePackageCompilationPhase.java index 8ba36a2a315..ce84fb08ce3 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/CompositePackageCompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/CompositePackageCompilationPhase.java @@ -18,6 +18,11 @@ */ package org.drools.compiler.builder.impl.processors; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; + import org.drools.compiler.builder.PackageRegistryManager; import org.drools.compiler.builder.impl.BuildResultCollector; import org.drools.compiler.builder.impl.GlobalVariableContext; @@ -27,17 +32,12 @@ import org.drools.compiler.compiler.PackageRegistry; import org.drools.compiler.lang.descr.CompositePackageDescr; import org.drools.kiesession.rulebase.InternalKnowledgeBase; -import org.drools.util.TypeResolver; import org.drools.util.StringUtils; +import org.drools.util.TypeResolver; import org.kie.internal.builder.KnowledgeBuilderResult; import org.kie.internal.builder.ResultSeverity; import org.kie.internal.builder.conf.LanguageLevelOption; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.function.Supplier; - import static java.util.Arrays.asList; public class CompositePackageCompilationPhase implements CompilationPhase { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ConsequenceCompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ConsequenceCompilationPhase.java index 2ee32596c72..3f403b73da2 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ConsequenceCompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ConsequenceCompilationPhase.java @@ -18,13 +18,13 @@ */ package org.drools.compiler.builder.impl.processors; +import java.util.ArrayList; +import java.util.Collection; + import org.drools.compiler.builder.impl.PackageRegistryCompiler; import org.drools.compiler.rule.builder.dialect.DialectError; import org.kie.internal.builder.KnowledgeBuilderResult; -import java.util.ArrayList; -import java.util.Collection; - public class ConsequenceCompilationPhase implements CompilationPhase { private PackageRegistryCompiler packageRegistryCompiler; private Collection results = new ArrayList<>(); diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/FunctionCompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/FunctionCompilationPhase.java index 87387bff6a5..338a3eef997 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/FunctionCompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/FunctionCompilationPhase.java @@ -18,9 +18,9 @@ */ package org.drools.compiler.builder.impl.processors; +import org.drools.base.rule.Function; import org.drools.compiler.compiler.DuplicateFunction; import org.drools.compiler.compiler.PackageRegistry; -import org.drools.base.rule.Function; import org.drools.drl.ast.descr.FunctionDescr; import org.drools.drl.ast.descr.FunctionImportDescr; import org.drools.drl.ast.descr.PackageDescr; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/GlobalCompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/GlobalCompilationPhase.java index 30ba1c84f36..3039a50b1ac 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/GlobalCompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/GlobalCompilationPhase.java @@ -20,10 +20,10 @@ import java.lang.reflect.Type; +import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.compiler.builder.impl.AssetFilter; import org.drools.compiler.builder.impl.GlobalVariableContext; import org.drools.compiler.compiler.PackageRegistry; -import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.drl.ast.descr.PackageDescr; import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.kie.internal.builder.ResourceChange; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ImmutableFunctionCompiler.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ImmutableFunctionCompiler.java index 649e904d3f9..d63774fc353 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ImmutableFunctionCompiler.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ImmutableFunctionCompiler.java @@ -18,6 +18,8 @@ */ package org.drools.compiler.builder.impl.processors; +import java.util.List; + import org.drools.compiler.compiler.Dialect; import org.drools.compiler.compiler.PackageRegistry; import org.drools.core.rule.JavaDialectRuntimeData; @@ -25,8 +27,6 @@ import org.drools.drl.ast.descr.PackageDescr; import org.drools.wiring.api.classloader.ProjectClassLoader; -import java.util.List; - import static org.drools.core.impl.KnowledgeBaseImpl.registerFunctionClassAndInnerClasses; import static org.drools.util.StringUtils.isEmpty; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ImmutableGlobalCompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ImmutableGlobalCompilationPhase.java index 981806d9f63..e8221ebc21f 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ImmutableGlobalCompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ImmutableGlobalCompilationPhase.java @@ -22,10 +22,10 @@ import java.util.HashSet; import java.util.Set; +import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.compiler.builder.impl.GlobalVariableContext; import org.drools.compiler.compiler.GlobalError; import org.drools.compiler.compiler.PackageRegistry; -import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.drl.ast.descr.GlobalDescr; import org.drools.drl.ast.descr.PackageDescr; import org.slf4j.Logger; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ImmutableRuleCompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ImmutableRuleCompilationPhase.java index 6d67af015f9..ac94c80e789 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ImmutableRuleCompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ImmutableRuleCompilationPhase.java @@ -29,6 +29,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutionException; +import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.compiler.builder.impl.KnowledgeBuilderImpl; import org.drools.compiler.builder.impl.TypeDeclarationContext; import org.drools.compiler.compiler.DialectCompiletimeRegistry; @@ -36,7 +37,6 @@ import org.drools.compiler.compiler.RuleBuildError; import org.drools.compiler.rule.builder.RuleBuildContext; import org.drools.compiler.rule.builder.RuleBuilder; -import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.drl.ast.descr.AttributeDescr; import org.drools.drl.ast.descr.PackageDescr; import org.drools.drl.ast.descr.RuleDescr; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/IteratingPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/IteratingPhase.java index 370adcc30d6..ac5b5d8e804 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/IteratingPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/IteratingPhase.java @@ -18,14 +18,14 @@ */ package org.drools.compiler.builder.impl.processors; +import java.util.Collection; + import org.drools.compiler.builder.PackageRegistryManager; import org.drools.compiler.builder.impl.BuildResultCollectorImpl; import org.drools.compiler.compiler.PackageRegistry; import org.drools.compiler.lang.descr.CompositePackageDescr; import org.kie.internal.builder.KnowledgeBuilderResult; -import java.util.Collection; - /** * Decorates a {@link CompilationPhase} via its {@link SinglePackagePhaseFactory}. * Iterates over a collection of {@link CompositePackageDescr} diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/OtherDeclarationCompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/OtherDeclarationCompilationPhase.java index 3139f075a99..6477cf7133e 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/OtherDeclarationCompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/OtherDeclarationCompilationPhase.java @@ -18,6 +18,8 @@ */ package org.drools.compiler.builder.impl.processors; +import java.util.List; + import org.drools.compiler.builder.impl.AssetFilter; import org.drools.compiler.builder.impl.GlobalVariableContext; import org.drools.compiler.builder.impl.TypeDeclarationContext; @@ -26,8 +28,6 @@ import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.kie.internal.builder.KnowledgeBuilderConfiguration; -import java.util.List; - import static java.util.Arrays.asList; public class OtherDeclarationCompilationPhase extends AbstractPackageCompilationPhase { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/PackageCompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/PackageCompilationPhase.java index 9ed117d62b5..b3c2e979368 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/PackageCompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/PackageCompilationPhase.java @@ -18,6 +18,8 @@ */ package org.drools.compiler.builder.impl.processors; +import java.util.List; + import org.drools.compiler.builder.impl.AssetFilter; import org.drools.compiler.builder.impl.KnowledgeBuilderImpl; import org.drools.compiler.builder.impl.TypeDeclarationBuilder; @@ -28,8 +30,6 @@ import org.kie.internal.builder.KnowledgeBuilderConfiguration; import org.kie.internal.builder.conf.LanguageLevelOption; -import java.util.List; - import static java.util.Arrays.asList; public final class PackageCompilationPhase extends AbstractPackageCompilationPhase { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ReteCompiler.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ReteCompiler.java index e4ea65d8fe4..4c8dd6f66e9 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ReteCompiler.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/ReteCompiler.java @@ -18,18 +18,18 @@ */ package org.drools.compiler.builder.impl.processors; -import org.drools.compiler.builder.impl.AssetFilter; -import org.drools.compiler.compiler.PackageRegistry; +import java.util.ArrayList; +import java.util.Collection; + import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.compiler.builder.impl.AssetFilter; +import org.drools.compiler.compiler.PackageRegistry; import org.drools.core.impl.InternalRuleBase; import org.drools.drl.ast.descr.PackageDescr; import org.drools.drl.ast.descr.RuleDescr; import org.kie.internal.builder.ResourceChange; -import java.util.ArrayList; -import java.util.Collection; - public class ReteCompiler extends AbstractPackageCompilationPhase { private final AssetFilter assetFilter; private InternalRuleBase kBase; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/RuleAnnotationNormalizer.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/RuleAnnotationNormalizer.java index bbab170c2a1..fbbf1ad0a17 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/RuleAnnotationNormalizer.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/RuleAnnotationNormalizer.java @@ -18,6 +18,8 @@ */ package org.drools.compiler.builder.impl.processors; +import java.util.Collection; + import org.drools.drl.ast.descr.AnnotatedBaseDescr; import org.drools.drl.ast.descr.BaseDescr; import org.drools.drl.ast.descr.ConditionalElementDescr; @@ -27,8 +29,6 @@ import org.drools.drl.ast.descr.RuleDescr; import org.kie.internal.builder.KnowledgeBuilderResult; -import java.util.Collection; - public class RuleAnnotationNormalizer implements CompilationPhase { private final AnnotationNormalizer annotationNormalizer; private final PackageDescr packageDescr; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/RuleCompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/RuleCompilationPhase.java index 40261b2956e..3cbee9a04c4 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/RuleCompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/RuleCompilationPhase.java @@ -18,12 +18,17 @@ */ package org.drools.compiler.builder.impl.processors; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + +import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.compiler.builder.impl.AssetFilter; import org.drools.compiler.builder.impl.TypeDeclarationContext; import org.drools.compiler.compiler.PackageRegistry; import org.drools.compiler.lang.descr.CompositePackageDescr; -import org.drools.base.definitions.InternalKnowledgePackage; -import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.drl.ast.descr.AttributeDescr; import org.drools.drl.ast.descr.PackageDescr; import org.drools.drl.ast.descr.RuleDescr; @@ -31,11 +36,6 @@ import org.kie.api.io.Resource; import org.kie.internal.builder.ResourceChange; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - public class RuleCompilationPhase extends ImmutableRuleCompilationPhase { public static CompilationPhase of( diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/RuleValidator.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/RuleValidator.java index 69c9648ec69..7753109aaec 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/RuleValidator.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/RuleValidator.java @@ -21,10 +21,10 @@ import java.util.HashSet; import java.util.Set; -import org.drools.compiler.compiler.DuplicateRule; -import org.drools.compiler.compiler.PackageRegistry; import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.compiler.compiler.DuplicateRule; +import org.drools.compiler.compiler.PackageRegistry; import org.drools.drl.ast.descr.PackageDescr; import org.drools.drl.ast.descr.RuleDescr; import org.drools.drl.parser.ParserError; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/TypeDeclarationAnnotationNormalizer.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/TypeDeclarationAnnotationNormalizer.java index 27041586f9d..26e442acc5c 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/TypeDeclarationAnnotationNormalizer.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/TypeDeclarationAnnotationNormalizer.java @@ -18,14 +18,14 @@ */ package org.drools.compiler.builder.impl.processors; +import java.util.Collection; + import org.drools.drl.ast.descr.EnumDeclarationDescr; import org.drools.drl.ast.descr.PackageDescr; import org.drools.drl.ast.descr.TypeDeclarationDescr; import org.drools.drl.ast.descr.TypeFieldDescr; import org.kie.internal.builder.KnowledgeBuilderResult; -import java.util.Collection; - public class TypeDeclarationAnnotationNormalizer implements CompilationPhase { private final AnnotationNormalizer annotationNormalizer; private final PackageDescr packageDescr; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/TypeDeclarationCompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/TypeDeclarationCompilationPhase.java index b2703f895e4..87a388656b4 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/TypeDeclarationCompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/TypeDeclarationCompilationPhase.java @@ -18,6 +18,11 @@ */ package org.drools.compiler.builder.impl.processors; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.drools.compiler.builder.impl.TypeDeclarationBuilder; import org.drools.compiler.builder.impl.TypeDefinition; import org.drools.compiler.compiler.PackageRegistry; @@ -26,11 +31,6 @@ import org.drools.drl.ast.descr.PackageDescr; import org.kie.api.io.Resource; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class TypeDeclarationCompilationPhase extends AbstractPackageCompilationPhase { private final TypeDeclarationBuilder typeBuilder; private final Resource currentResource; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/TypeDeclarationCompositeCompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/TypeDeclarationCompositeCompilationPhase.java index 777e19cec2c..2a7bc5460d6 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/TypeDeclarationCompositeCompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/TypeDeclarationCompositeCompilationPhase.java @@ -18,12 +18,6 @@ */ package org.drools.compiler.builder.impl.processors; -import org.drools.compiler.builder.impl.TypeDeclarationBuilder; -import org.drools.compiler.builder.impl.TypeDefinition; -import org.drools.compiler.lang.descr.CompositePackageDescr; -import org.drools.drl.ast.descr.AbstractClassTypeDeclarationDescr; -import org.kie.internal.builder.KnowledgeBuilderResult; - import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -31,6 +25,12 @@ import java.util.List; import java.util.Map; +import org.drools.compiler.builder.impl.TypeDeclarationBuilder; +import org.drools.compiler.builder.impl.TypeDefinition; +import org.drools.compiler.lang.descr.CompositePackageDescr; +import org.drools.drl.ast.descr.AbstractClassTypeDeclarationDescr; +import org.kie.internal.builder.KnowledgeBuilderResult; + public class TypeDeclarationCompositeCompilationPhase implements CompilationPhase { private Collection packages; private final TypeDeclarationBuilder typeBuilder; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/WindowDeclarationCompilationPhase.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/WindowDeclarationCompilationPhase.java index f849619528a..cf837f62e7e 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/WindowDeclarationCompilationPhase.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/processors/WindowDeclarationCompilationPhase.java @@ -18,15 +18,15 @@ */ package org.drools.compiler.builder.impl.processors; +import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.base.rule.Pattern; +import org.drools.base.rule.WindowDeclaration; import org.drools.compiler.builder.impl.TypeDeclarationContext; import org.drools.compiler.compiler.DescrBuildError; import org.drools.compiler.compiler.DialectCompiletimeRegistry; import org.drools.compiler.compiler.PackageRegistry; import org.drools.compiler.rule.builder.RuleBuildContext; import org.drools.compiler.rule.builder.RuleConditionBuilder; -import org.drools.base.definitions.InternalKnowledgePackage; -import org.drools.base.rule.Pattern; -import org.drools.base.rule.WindowDeclaration; import org.drools.drl.ast.descr.AttributeDescr; import org.drools.drl.ast.descr.PackageDescr; import org.drools.drl.ast.descr.RuleDescr; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/DecisionTableResourceHandler.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/DecisionTableResourceHandler.java index ee69c6b1b78..2446ad74605 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/DecisionTableResourceHandler.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/DecisionTableResourceHandler.java @@ -18,6 +18,8 @@ */ package org.drools.compiler.builder.impl.resources; +import java.util.List; + import org.drools.compiler.builder.conf.DecisionTableConfigurationImpl; import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.compiler.lang.descr.CompositePackageDescr; @@ -31,8 +33,6 @@ import org.kie.internal.builder.DecisionTableConfiguration; import org.kie.internal.builder.conf.TrimCellsInDTableOption; -import java.util.List; - public class DecisionTableResourceHandler extends ResourceHandler { public DecisionTableResourceHandler(KnowledgeBuilderConfigurationImpl configuration, ReleaseId releaseId) { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/DrlResourceHandler.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/DrlResourceHandler.java index 62fba20aaa8..336f0c9b1b5 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/DrlResourceHandler.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/DrlResourceHandler.java @@ -18,6 +18,8 @@ */ package org.drools.compiler.builder.impl.resources; +import java.io.IOException; + import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.drl.ast.descr.PackageDescr; import org.drools.drl.parser.DrlParser; @@ -29,8 +31,6 @@ import org.kie.api.io.ResourceType; import org.kie.internal.builder.conf.LanguageLevelOption; -import java.io.IOException; - public class DrlResourceHandler extends ResourceHandler { public DrlResourceHandler(KnowledgeBuilderConfigurationImpl configuration) { super(configuration); diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/DslrResourceHandler.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/DslrResourceHandler.java index bf93130fe7f..6a34b6ac126 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/DslrResourceHandler.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/DslrResourceHandler.java @@ -18,6 +18,9 @@ */ package org.drools.compiler.builder.impl.resources; +import java.io.IOException; +import java.util.function.Supplier; + import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.drl.ast.descr.PackageDescr; import org.drools.drl.parser.DroolsParserException; @@ -26,9 +29,6 @@ import org.kie.api.io.ResourceConfiguration; import org.kie.api.io.ResourceType; -import java.io.IOException; -import java.util.function.Supplier; - public class DslrResourceHandler extends ResourceHandler { private Supplier expander; diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/ResourceHandler.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/ResourceHandler.java index 86e61cc6269..dabe96bebc0 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/ResourceHandler.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/ResourceHandler.java @@ -18,14 +18,24 @@ */ package org.drools.compiler.builder.impl.resources; +import java.io.File; +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.io.UncheckedIOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.UUID; + import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; +import org.drools.drl.ast.descr.PackageDescr; import org.drools.drl.parser.DrlParser; import org.drools.drl.parser.DroolsParserException; import org.drools.drl.parser.ParserError; import org.drools.drl.parser.lang.ExpanderException; import org.drools.drl.parser.lang.dsl.DefaultExpander; import org.drools.util.IoUtils; -import org.drools.drl.ast.descr.PackageDescr; import org.kie.api.builder.ReleaseId; import org.kie.api.io.Resource; import org.kie.api.io.ResourceConfiguration; @@ -35,16 +45,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.UncheckedIOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.UUID; - public abstract class ResourceHandler { protected KnowledgeBuilderConfigurationImpl configuration; protected Collection results = new ArrayList<>(); diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/TemplateResourceHandler.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/TemplateResourceHandler.java index 2b45b1a4718..329baf97dc4 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/TemplateResourceHandler.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/TemplateResourceHandler.java @@ -18,6 +18,10 @@ */ package org.drools.compiler.builder.impl.resources; +import java.io.IOException; +import java.io.StringReader; +import java.util.function.Supplier; + import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.compiler.builder.impl.errors.MissingImplementationException; import org.drools.drl.ast.descr.PackageDescr; @@ -31,10 +35,6 @@ import org.kie.api.io.ResourceConfiguration; import org.kie.api.io.ResourceType; -import java.io.IOException; -import java.io.StringReader; -import java.util.function.Supplier; - public class TemplateResourceHandler extends ResourceHandler { private Supplier expander; diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/BoundIdentifiers.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/BoundIdentifiers.java index e588ccf05a4..a4e62079737 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/BoundIdentifiers.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/BoundIdentifiers.java @@ -24,15 +24,15 @@ import java.util.List; import java.util.Map; -import org.drools.compiler.rule.builder.EvaluatorWrapper; -import org.drools.compiler.rule.builder.PackageBuildContext; -import org.drools.compiler.rule.builder.RuleBuildContext; import org.drools.base.base.ClassObjectType; import org.drools.base.base.ObjectType; import org.drools.base.facttemplates.Fact; import org.drools.base.rule.Declaration; import org.drools.base.rule.Pattern; import org.drools.base.rule.XpathBackReference; +import org.drools.compiler.rule.builder.EvaluatorWrapper; +import org.drools.compiler.rule.builder.PackageBuildContext; +import org.drools.compiler.rule.builder.RuleBuildContext; import static org.drools.util.ClassUtils.rawType; diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/ConfigurableSeverityResult.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/ConfigurableSeverityResult.java index 46ca5bb189e..c31c24a0bd7 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/ConfigurableSeverityResult.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/ConfigurableSeverityResult.java @@ -20,10 +20,10 @@ package org.drools.compiler.compiler; import org.drools.drl.parser.BaseKnowledgeBuilderResultImpl; +import org.kie.api.io.Resource; import org.kie.internal.builder.KnowledgeBuilderConfiguration; import org.kie.internal.builder.ResultSeverity; import org.kie.internal.builder.conf.KBuilderSeverityOption; -import org.kie.api.io.Resource; /** diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/DeprecatedResourceTypeWarning.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/DeprecatedResourceTypeWarning.java index ab6b40eed66..8f8199bd6c1 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/DeprecatedResourceTypeWarning.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/DeprecatedResourceTypeWarning.java @@ -18,7 +18,6 @@ */ package org.drools.compiler.compiler; -import org.drools.io.InternalResource; import org.kie.api.io.Resource; public class DeprecatedResourceTypeWarning extends DroolsWarning { diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/Dialect.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/Dialect.java index c679080d1f1..ca9849dba19 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/Dialect.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/Dialect.java @@ -18,6 +18,9 @@ */ package org.drools.compiler.compiler; +import java.util.List; +import java.util.Map; + import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.compiler.rule.builder.AccumulateBuilder; @@ -51,9 +54,6 @@ import org.kie.api.io.Resource; import org.kie.internal.builder.KnowledgeBuilderResult; -import java.util.List; -import java.util.Map; - import static org.drools.base.base.CoreComponentsBuilder.throwExceptionForMissingMvel; /** diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/DialectConfiguration.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/DialectConfiguration.java index 7736a68f570..fd2edbd2f56 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/DialectConfiguration.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/DialectConfiguration.java @@ -18,8 +18,8 @@ */ package org.drools.compiler.compiler; -import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; /** * Each Dialect can have its own configuration. Implementations of this class are typically diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/DroolsWarning.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/DroolsWarning.java index 02bde4e972c..6794f4aba7a 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/DroolsWarning.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/DroolsWarning.java @@ -19,8 +19,8 @@ package org.drools.compiler.compiler; import org.drools.drl.parser.BaseKnowledgeBuilderResultImpl; -import org.kie.internal.builder.ResultSeverity; import org.kie.api.io.Resource; +import org.kie.internal.builder.ResultSeverity; public abstract class DroolsWarning extends BaseKnowledgeBuilderResultImpl { diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/DuplicateFunction.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/DuplicateFunction.java index 89a91bd673d..7babf441215 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/DuplicateFunction.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/DuplicateFunction.java @@ -19,8 +19,8 @@ package org.drools.compiler.compiler; -import org.drools.drl.ast.descr.FunctionDescr; import org.drools.base.rule.Function; +import org.drools.drl.ast.descr.FunctionDescr; import org.kie.internal.builder.KnowledgeBuilderConfiguration; diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/DuplicateRule.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/DuplicateRule.java index 5ee49fbd17f..71c286dbd27 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/DuplicateRule.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/DuplicateRule.java @@ -40,16 +40,16 @@ public DuplicateRule(RuleDescr ruleDescr, PackageDescr pkg, KnowledgeBuilderConf line[0] = ruleDescr.getLine(); } - @Override - public String getMessage() { - return "Rule name " + rule + @Override + public String getMessage() { + return "Rule name " + rule + " already exists in package " + pkgDescr.getName(); - } + } - @Override - public int[] getLines() { - return line; - } + @Override + public int[] getLines() { + return line; + } @Override protected String getOptionKey() { diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/JavaDialectConfiguration.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/JavaDialectConfiguration.java index bf8e66d0fb2..16ed57f5d61 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/JavaDialectConfiguration.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/JavaDialectConfiguration.java @@ -18,9 +18,9 @@ */ package org.drools.compiler.compiler; +import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.compiler.builder.impl.KnowledgeBuilderFactoryServiceImpl; -import org.drools.base.definitions.InternalKnowledgePackage; import org.kie.memorycompiler.JavaCompiler; import org.kie.memorycompiler.JavaCompilerFactory; import org.kie.memorycompiler.JavaConfiguration; diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/PackageBuilderResults.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/PackageBuilderResults.java index 247ed5abf57..39e2a0e6ba5 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/PackageBuilderResults.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/PackageBuilderResults.java @@ -26,7 +26,6 @@ import java.util.Arrays; import org.drools.drl.parser.BaseKnowledgeBuilderResultImpl; -import org.drools.drl.parser.DroolsError; import org.kie.internal.builder.KnowledgeBuilderResult; import org.kie.internal.builder.KnowledgeBuilderResults; diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/PackageRegistry.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/PackageRegistry.java index 4023bcffcdf..f2f3722d74e 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/PackageRegistry.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/PackageRegistry.java @@ -18,12 +18,12 @@ */ package org.drools.compiler.compiler; -import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; -import org.drools.drl.ast.descr.ImportDescr; -import org.drools.util.TypeResolver; import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.base.rule.DialectRuntimeRegistry; import org.drools.base.rule.ImportDeclaration; +import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; +import org.drools.drl.ast.descr.ImportDescr; +import org.drools.util.TypeResolver; import org.kie.api.io.Resource; import org.kie.internal.builder.KnowledgeBuilderConfiguration; diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/ProcessBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/ProcessBuilder.java index a87965e1a2e..ec6ffb7cc9f 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/ProcessBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/ProcessBuilder.java @@ -18,13 +18,13 @@ */ package org.drools.compiler.compiler; +import java.io.IOException; +import java.util.List; + import org.kie.api.definition.process.Process; import org.kie.api.io.Resource; import org.kie.internal.builder.KnowledgeBuilderResult; -import java.io.IOException; -import java.util.List; - public interface ProcessBuilder { List addProcessFromXml(Resource resource) throws IOException; diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/ProjectJavaCompiler.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/ProjectJavaCompiler.java index 501562b27d1..78ee7b54fac 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/ProjectJavaCompiler.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/ProjectJavaCompiler.java @@ -27,6 +27,7 @@ import org.drools.compiler.builder.impl.errors.ErrorHandler; import org.drools.compiler.builder.impl.errors.SrcErrorHandler; import org.drools.compiler.kie.builder.impl.CompilationProblemAdapter; +import org.drools.util.PortablePath; import org.drools.wiring.api.classloader.ProjectClassLoader; import org.kie.internal.builder.KnowledgeBuilderResult; import org.kie.internal.jci.CompilationProblem; @@ -34,7 +35,6 @@ import org.kie.memorycompiler.JavaCompiler; import org.kie.memorycompiler.JavaCompilerFactory; import org.kie.memorycompiler.JavaConfiguration; -import org.drools.util.PortablePath; import org.kie.memorycompiler.resources.MemoryResourceReader; import org.kie.memorycompiler.resources.ResourceStore; diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/RuleBuildError.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/RuleBuildError.java index 32c6001fcb8..f8e2712b98e 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/RuleBuildError.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/RuleBuildError.java @@ -18,8 +18,8 @@ */ package org.drools.compiler.compiler; -import org.drools.drl.ast.descr.BaseDescr; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.drl.ast.descr.BaseDescr; public class RuleBuildError extends DescrBuildError { private final RuleImpl rule; diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/RuleBuildWarning.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/RuleBuildWarning.java index b4fbd2d039f..a3123b3c247 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/RuleBuildWarning.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/RuleBuildWarning.java @@ -18,8 +18,8 @@ */ package org.drools.compiler.compiler; -import org.drools.drl.ast.descr.BaseDescr; import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.drl.ast.descr.BaseDescr; public class RuleBuildWarning extends DescrBuildWarning { private final RuleImpl rule; diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/SerializableDroolsError.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/SerializableDroolsError.java index 0fbbdd0d9c4..8ce502d862d 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/SerializableDroolsError.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/SerializableDroolsError.java @@ -18,14 +18,14 @@ */ package org.drools.compiler.compiler; -import org.drools.drl.parser.BaseKnowledgeBuilderResultImpl; -import org.drools.drl.parser.DroolsError; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import org.drools.drl.parser.BaseKnowledgeBuilderResultImpl; +import org.drools.drl.parser.DroolsError; + public class SerializableDroolsError extends DroolsError implements Externalizable { private String message; private int[] errorLines; diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/TypeDeclarationError.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/TypeDeclarationError.java index 2160300c9c9..c0bfe0ccf42 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/TypeDeclarationError.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/TypeDeclarationError.java @@ -18,8 +18,8 @@ */ package org.drools.compiler.compiler; -import org.drools.drl.ast.descr.BaseDescr; import org.drools.base.rule.TypeDeclaration; +import org.drools.drl.ast.descr.BaseDescr; import org.drools.drl.parser.DroolsError; public class TypeDeclarationError extends DroolsError { diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/io/memory/MemoryFile.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/io/memory/MemoryFile.java index 8a48399447b..6deac44012d 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/io/memory/MemoryFile.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/io/memory/MemoryFile.java @@ -87,16 +87,30 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } MemoryFile other = (MemoryFile) obj; if ( folder == null ) { - if ( other.folder != null ) return false; - } else if ( !folder.equals( other.folder ) ) return false; + if ( other.folder != null ) { + return false; + } + } else if ( !folder.equals( other.folder ) ) { + return false; + } if ( name == null ) { - if ( other.name != null ) return false; - } else if ( !name.equals( other.name ) ) return false; + if ( other.name != null ) { + return false; + } + } else if ( !name.equals( other.name ) ) { + return false; + } return true; } diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/io/memory/MemoryFileSystem.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/io/memory/MemoryFileSystem.java index 479f95dbbc4..0fb2aebe7de 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/io/memory/MemoryFileSystem.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/io/memory/MemoryFileSystem.java @@ -50,9 +50,9 @@ import org.drools.io.ByteArrayResource; import org.drools.io.InternalResource; import org.drools.util.IoUtils; +import org.drools.util.PortablePath; import org.drools.util.StringUtils; import org.kie.api.io.Resource; -import org.drools.util.PortablePath; import org.kie.memorycompiler.resources.ResourceReader; import org.kie.memorycompiler.resources.ResourceStore; import org.slf4j.Logger; @@ -295,14 +295,24 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } MemoryFileSystem other = (MemoryFileSystem) obj; if ( folder == null ) { - if ( other.folder != null ) return false; - } else if ( !folder.equals( other.folder ) ) return false; + if ( other.folder != null ) { + return false; + } + } else if ( !folder.equals( other.folder ) ) { + return false; + } return fileContents.equals( other.fileContents ) && folders.equals( other.folders ); } diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/io/memory/MemoryFolder.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/io/memory/MemoryFolder.java index 63e157d8ec2..bb358fbc738 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/io/memory/MemoryFolder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/io/memory/MemoryFolder.java @@ -24,8 +24,8 @@ import java.util.Objects; import org.drools.compiler.compiler.io.File; -import org.drools.compiler.compiler.io.Folder; import org.drools.compiler.compiler.io.FileSystemItem; +import org.drools.compiler.compiler.io.Folder; import org.drools.util.PortablePath; public class MemoryFolder implements Folder, Serializable { @@ -93,9 +93,15 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } MemoryFolder other = (MemoryFolder) obj; return Objects.equals(path, other.path); } diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/AbstractKieModule.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/AbstractKieModule.java index d8a4d9b044a..be8c7744827 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/AbstractKieModule.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/AbstractKieModule.java @@ -32,13 +32,13 @@ import java.util.function.Function; import java.util.function.Predicate; +import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.base.definitions.impl.KnowledgePackageImpl; import org.drools.compiler.builder.InternalKnowledgeBuilder; import org.drools.compiler.builder.conf.DecisionTableConfigurationImpl; import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.compiler.kproject.models.KieBaseModelImpl; import org.drools.core.RuleBaseConfiguration; -import org.drools.base.definitions.InternalKnowledgePackage; -import org.drools.base.definitions.impl.KnowledgePackageImpl; import org.drools.core.impl.InternalRuleBase; import org.drools.core.impl.RuleBaseFactory; import org.drools.io.ResourceConfigurationImpl; diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/AbstractKieProject.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/AbstractKieProject.java index 134c67e2f13..ed3466a805e 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/AbstractKieProject.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/AbstractKieProject.java @@ -345,8 +345,12 @@ private Asset( InternalKieModule kmodule, String name ) { @Override public boolean equals( Object o ) { - if ( this == o ) return true; - if ( o == null || getClass() != o.getClass() ) return false; + if ( this == o ) { + return true; + } + if ( o == null || getClass() != o.getClass() ) { + return false; + } Asset asset = (Asset) o; return kmodule.equals( asset.kmodule ) && name.equals( asset.name ); } diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/ClasspathKieProject.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/ClasspathKieProject.java index 34c9fae29aa..42c9d6659af 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/ClasspathKieProject.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/ClasspathKieProject.java @@ -43,12 +43,12 @@ import org.drools.compiler.kie.builder.impl.event.KieServicesEventListerner; import org.drools.compiler.kproject.models.KieModuleModelImpl; import org.drools.util.IoUtils; +import org.drools.util.PortablePath; import org.drools.util.StringUtils; import org.kie.api.KieServices; import org.kie.api.builder.KieRepository; import org.kie.api.builder.ReleaseId; import org.kie.api.builder.model.KieModuleModel; -import org.drools.util.PortablePath; import org.kie.util.maven.support.PomModel; import org.kie.util.maven.support.ReleaseIdImpl; import org.slf4j.Logger; diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/DecisionTableConfigurationDelegate.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/DecisionTableConfigurationDelegate.java index 004cd72c3a9..04baa568a7f 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/DecisionTableConfigurationDelegate.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/DecisionTableConfigurationDelegate.java @@ -18,15 +18,15 @@ */ package org.drools.compiler.kie.builder.impl; +import java.util.List; +import java.util.Properties; + import org.kie.api.io.Resource; import org.kie.api.io.ResourceConfiguration; import org.kie.internal.builder.DecisionTableConfiguration; import org.kie.internal.builder.DecisionTableInputType; import org.kie.internal.builder.RuleTemplateConfiguration; -import java.util.List; -import java.util.Properties; - public class DecisionTableConfigurationDelegate implements DecisionTableConfiguration { private final DecisionTableConfiguration delegate; diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/InternalKieModule.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/InternalKieModule.java index a0a37c5b692..d870a9d5884 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/InternalKieModule.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/InternalKieModule.java @@ -31,14 +31,15 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; +import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.compiler.compiler.io.memory.MemoryFileSystem; import org.drools.compiler.kie.util.ChangeSetBuilder; import org.drools.compiler.kie.util.KieJarChangeSet; import org.drools.compiler.kproject.models.KieBaseModelImpl; import org.drools.compiler.kproject.models.KieModuleModelImpl; -import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.io.InternalResource; import org.drools.kiesession.rulebase.InternalKnowledgeBase; +import org.drools.util.PortablePath; import org.drools.wiring.api.ResourceProvider; import org.drools.wiring.api.classloader.ProjectClassLoader; import org.kie.api.KieBaseConfiguration; @@ -56,7 +57,6 @@ import org.kie.internal.builder.ResourceChangeSet; import org.kie.internal.utils.ClassLoaderResolver; import org.kie.internal.utils.NoDepsClassLoaderResolver; -import org.drools.util.PortablePath; import org.kie.util.maven.support.DependencyFilter; import org.kie.util.maven.support.PomModel; import org.slf4j.Logger; diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/InternalKieServices.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/InternalKieServices.java index 805fcb493a5..1f6dec010e6 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/InternalKieServices.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/InternalKieServices.java @@ -29,5 +29,5 @@ public interface InternalKieServices extends KieServices { * Clear the containerId reference from the internal registry hold by the KieServices. * Epsecially helpful to avoid leaking reference on container dispose(), to inadvertently keep a reference in the internal registry which would never be GC. */ - void clearRefToContainerId(String containerId, KieContainer containerRef); + void clearRefToContainerId(String containerId, KieContainer containerRef); } diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieBaseUpdaterImpl.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieBaseUpdaterImpl.java index fc4453c095f..0134ada0ae4 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieBaseUpdaterImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieBaseUpdaterImpl.java @@ -20,17 +20,17 @@ import java.util.List; -import org.drools.compiler.builder.InternalKnowledgeBuilder; -import org.drools.compiler.compiler.PackageBuilderErrors; -import org.drools.core.impl.KieBaseUpdate; import org.drools.base.base.ClassObjectType; -import org.drools.core.common.InternalWorkingMemory; -import org.drools.core.common.InternalWorkingMemoryEntryPoint; import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.base.definitions.impl.KnowledgePackageImpl; import org.drools.base.definitions.rule.impl.RuleImpl; -import org.drools.core.reteoo.EntryPointNode; import org.drools.base.rule.DialectRuntimeData; +import org.drools.compiler.builder.InternalKnowledgeBuilder; +import org.drools.compiler.compiler.PackageBuilderErrors; +import org.drools.core.common.InternalWorkingMemory; +import org.drools.core.common.InternalWorkingMemoryEntryPoint; +import org.drools.core.impl.KieBaseUpdate; +import org.drools.core.reteoo.EntryPointNode; import org.kie.api.builder.model.KieBaseModel; import org.kie.api.io.Resource; import org.kie.api.runtime.rule.EntryPoint; diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieBuilderImpl.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieBuilderImpl.java index 809cebf4f08..ec1cb65533d 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieBuilderImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieBuilderImpl.java @@ -447,9 +447,13 @@ private static String packageNameFromCsv(InternalResource resource) { int pkgPos = content.indexOf( "RuleSet" ); if (pkgPos >= 0) { pkgPos += "RuleSet ".length(); - for (; !Character.isJavaIdentifierStart( content.charAt( pkgPos ) ); pkgPos++); + for (; !Character.isJavaIdentifierStart( content.charAt( pkgPos ) ); pkgPos++) { + + }; int end = pkgPos+1; - for (; Character.isLetterOrDigit( content.charAt( end ) ) || content.charAt( end ) == '.'; end++); + for (; Character.isLetterOrDigit( content.charAt( end ) ) || content.charAt( end ) == '.'; end++) { + + }; return content.substring( pkgPos, end ).trim(); } return null; diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieBuilderSetImpl.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieBuilderSetImpl.java index 76ad7a8450d..08a49525748 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieBuilderSetImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieBuilderSetImpl.java @@ -32,10 +32,11 @@ import java.util.Map; import java.util.Set; +import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.compiler.builder.InternalKnowledgeBuilder; import org.drools.compiler.builder.impl.KnowledgeBuilderImpl; -import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.io.BaseResource; +import org.drools.util.PortablePath; import org.drools.wiring.api.classloader.ProjectClassLoader; import org.kie.api.KieServices; import org.kie.api.builder.Message; @@ -48,7 +49,6 @@ import org.kie.internal.builder.KnowledgeBuilder; import org.kie.internal.builder.KnowledgeBuilderResult; import org.kie.internal.builder.ResultSeverity; -import org.drools.util.PortablePath; import org.kie.internal.builder.conf.GroupDRLsInKieBasesByFolderOption; import static java.util.Arrays.asList; diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieContainerImpl.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieContainerImpl.java index 5eb73dd68e5..323b66e1cbb 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieContainerImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieContainerImpl.java @@ -83,8 +83,8 @@ import org.slf4j.LoggerFactory; import static java.util.stream.Collectors.toList; -import static org.drools.compiler.kie.util.InjectionHelper.wireSessionComponents; import static org.drools.base.util.Drools.isJndiAvailable; +import static org.drools.compiler.kie.util.InjectionHelper.wireSessionComponents; import static org.drools.util.ClassUtils.convertResourceToClassName; public class KieContainerImpl @@ -608,7 +608,9 @@ public KieSession newKieSession(String kSessionName, Environment environment, Ki } KieBase kBase = getKieBaseFromKieSessionModel( kSessionModel ); - if ( kBase == null ) return null; + if ( kBase == null ) { + return null; + } KieSession kSession = kBase.newKieSession( conf != null ? conf : getKieSessionConfiguration( kSessionModel ), environment ); registerNewKieSession(kSessionModel, (InternalKnowledgeBase) kBase, kSession); diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieFileSystemImpl.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieFileSystemImpl.java index 83beb49a590..7b0acf37f82 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieFileSystemImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieFileSystemImpl.java @@ -31,13 +31,13 @@ import org.drools.compiler.kproject.models.KieModuleModelImpl; import org.drools.io.InternalResource; import org.drools.util.IoUtils; +import org.drools.util.PortablePath; import org.kie.api.builder.KieFileSystem; import org.kie.api.builder.ReleaseId; import org.kie.api.io.Resource; import org.kie.api.io.ResourceConfiguration; import org.kie.api.io.ResourceType; import org.kie.internal.io.ResourceTypeImpl; -import org.drools.util.PortablePath; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieMetaInfoBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieMetaInfoBuilder.java index ff5ebc80592..9bf29f65cb1 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieMetaInfoBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieMetaInfoBuilder.java @@ -25,21 +25,21 @@ import java.util.Map; import java.util.Set; -import org.drools.compiler.builder.InternalKnowledgeBuilder; -import org.kie.memorycompiler.resources.ResourceStore; -import org.drools.compiler.compiler.PackageRegistry; -import org.drools.compiler.kproject.models.KieModuleModelImpl; import org.drools.base.factmodel.ClassDefinition; -import org.drools.core.rule.JavaDialectRuntimeData; import org.drools.base.rule.KieModuleMetaInfo; import org.drools.base.rule.TypeDeclaration; import org.drools.base.rule.TypeMetaInfo; +import org.drools.compiler.builder.InternalKnowledgeBuilder; +import org.drools.compiler.compiler.PackageRegistry; +import org.drools.compiler.kproject.models.KieModuleModelImpl; +import org.drools.core.rule.JavaDialectRuntimeData; import org.drools.util.IoUtils; import org.kie.api.builder.model.KieModuleModel; import org.kie.api.definition.KiePackage; import org.kie.api.definition.rule.Rule; import org.kie.api.definition.type.FactType; import org.kie.internal.builder.KnowledgeBuilder; +import org.kie.memorycompiler.resources.ResourceStore; import static org.drools.base.util.Drools.hasMvel; diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieServicesImpl.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieServicesImpl.java index 2b964647143..88b62799c09 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieServicesImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieServicesImpl.java @@ -18,6 +18,13 @@ */ package org.drools.compiler.kie.builder.impl; +import java.io.File; +import java.lang.ref.WeakReference; +import java.util.Properties; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + import org.drools.compiler.kie.builder.impl.event.KieServicesEventListerner; import org.drools.compiler.kproject.models.KieModuleModelImpl; import org.drools.core.BaseConfigurationFactories; @@ -50,13 +57,6 @@ import org.kie.internal.utils.ChainedProperties; import org.kie.util.maven.support.ReleaseIdImpl; -import java.io.File; -import java.lang.ref.WeakReference; -import java.util.Properties; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - import static org.drools.compiler.compiler.io.memory.MemoryFileSystem.readFromJar; import static org.drools.util.ClassUtils.findParentClassLoader; @@ -85,7 +85,7 @@ public KieContainer getKieClasspathContainer() { } public KieContainer getKieClasspathContainer(ClassLoader classLoader) { - return getKieClasspathContainer( null, classLoader ); + return getKieClasspathContainer( null, classLoader ); } public KieContainer getKieClasspathContainer(String containerId) { @@ -99,9 +99,9 @@ public KieContainer getKieClasspathContainer(String containerId, ClassLoader cla if ( classpathKContainer == null ) { classpathClassLoader = classLoader; if (containerId == null) { - classpathKContainerId = UUID.randomUUID().toString(); + classpathKContainerId = UUID.randomUUID().toString(); } else { - classpathKContainerId = containerId; + classpathKContainerId = containerId; } classpathKContainer = newKieClasspathContainer(classpathKContainerId, classLoader); } else if (classLoader != classpathClassLoader) { @@ -113,7 +113,7 @@ public KieContainer getKieClasspathContainer(String containerId, ClassLoader cla } if (containerId != null && !classpathKContainerId.equals(containerId)) { - throw new IllegalStateException("The default global singleton KieClasspathContainer was already created with id "+classpathKContainerId); + throw new IllegalStateException("The default global singleton KieClasspathContainer was already created with id "+classpathKContainerId); } return classpathKContainer; @@ -124,7 +124,7 @@ public KieContainer newKieClasspathContainer() { } public KieContainer newKieClasspathContainer(ClassLoader classLoader) { - return newKieClasspathContainer( null, classLoader ); + return newKieClasspathContainer( null, classLoader ); } public KieContainer newKieClasspathContainer(String containerId) { @@ -137,17 +137,17 @@ public KieContainer newKieClasspathContainer(String containerId, ClassLoader cla @Override public KieContainer newKieClasspathContainer(String containerId, ClassLoader classLoader, ReleaseId releaseId) { - if (containerId == null) { + if (containerId == null) { return new KieContainerImpl(UUID.randomUUID().toString(), new ClasspathKieProject(classLoader, listener, releaseId), null); - } - if ( kContainers.get(containerId) == null ) { + } + if ( kContainers.get(containerId) == null ) { KieContainerImpl newContainer = new KieContainerImpl(containerId, new ClasspathKieProject(classLoader, listener, releaseId), null, releaseId); KieContainer check = kContainers.putIfAbsent(containerId, newContainer); if (check == null) { - return newContainer; + return newContainer; } else { - newContainer.dispose(); - throw new IllegalStateException("There's already another KieContainer created with the id "+containerId); + newContainer.dispose(); + throw new IllegalStateException("There's already another KieContainer created with the id "+containerId); } } else { throw new IllegalStateException("There's already another KieContainer created with the id "+containerId); @@ -167,17 +167,17 @@ public void nullKieClasspathContainer() { * Voids the internal map of containerId (s) used for handling reference and unique checks. This method is intended for use in unit test only. */ public void nullAllContainerIds() { - synchronized ( lock ) { - kContainers.clear(); - } + synchronized ( lock ) { + kContainers.clear(); + } } @Override - public void clearRefToContainerId(String containerId, KieContainer containerRef) { - kContainers.remove(containerId, containerRef); - } + public void clearRefToContainerId(String containerId, KieContainer containerRef) { + kContainers.remove(containerId, containerRef); + } - public KieContainer newKieContainer(ReleaseId releaseId) { + public KieContainer newKieContainer(ReleaseId releaseId) { return newKieContainer(null, releaseId, null); } @@ -186,7 +186,7 @@ public KieContainer newKieContainer(String containerId, ReleaseId releaseId) { } public KieContainer newKieContainer(ReleaseId releaseId, ClassLoader classLoader) { - return newKieContainer(null, releaseId, classLoader); + return newKieContainer(null, releaseId, classLoader); } public KieContainer newKieContainer(String containerId, ReleaseId releaseId, ClassLoader classLoader) { @@ -203,18 +203,18 @@ public KieContainer newKieContainer(String containerId, ReleaseId releaseId, Cla kProject.init(); } - if (containerId == null) { + if (containerId == null) { return new KieContainerImpl( UUID.randomUUID().toString(), kProject, getRepository(), releaseId ); - } + } - if ( kContainers.get(containerId) == null ) { + if ( kContainers.get(containerId) == null ) { KieContainerImpl newContainer = new KieContainerImpl( containerId, kProject, getRepository(), releaseId ); KieContainer check = kContainers.putIfAbsent(containerId, newContainer); if (check == null) { - return newContainer; + return newContainer; } else { - newContainer.dispose(); - throw new IllegalStateException("There's already another KieContainer created with the id "+containerId); + newContainer.dispose(); + throw new IllegalStateException("There's already another KieContainer created with the id "+containerId); } } else { throw new IllegalStateException("There's already another KieContainer created with the id "+containerId); diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/MemoryKieModule.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/MemoryKieModule.java index d3258487517..53e396e4876 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/MemoryKieModule.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/MemoryKieModule.java @@ -39,6 +39,7 @@ import org.drools.compiler.kproject.models.KieModuleModelImpl; import org.drools.io.InternalResource; import org.drools.kiesession.rulebase.InternalKnowledgeBase; +import org.drools.util.PortablePath; import org.drools.wiring.api.ResourceProvider; import org.kie.api.builder.ReleaseId; import org.kie.api.builder.model.KieBaseModel; @@ -46,7 +47,6 @@ import org.kie.api.internal.utils.KieService; import org.kie.internal.builder.KnowledgeBuilder; import org.kie.internal.builder.conf.AlphaNetworkCompilerOption; -import org.drools.util.PortablePath; import org.kie.memorycompiler.resources.ResourceReader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -240,8 +240,12 @@ public InputStream getResourceAsStream(String name) throws IOException { } @Override public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof MemoryKieModuleResourceProvider)) return false; + if (this == o) { + return true; + } + if (!(o instanceof MemoryKieModuleResourceProvider)) { + return false; + } MemoryKieModuleResourceProvider that = (MemoryKieModuleResourceProvider) o; diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/ZipKieModule.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/ZipKieModule.java index ae150b9d126..9bfa87bcb6d 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/ZipKieModule.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/ZipKieModule.java @@ -35,10 +35,10 @@ import java.util.zip.ZipInputStream; import org.drools.io.InternalResource; +import org.drools.util.PortablePath; import org.kie.api.builder.ReleaseId; import org.kie.api.builder.model.KieModuleModel; import org.kie.internal.io.ResourceFactory; -import org.drools.util.PortablePath; import static org.drools.util.IoUtils.readBytesFromInputStream; diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/event/KieScannerStatusChangeEventImpl.java b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/event/KieScannerStatusChangeEventImpl.java index c6c40a49401..80afb2a9145 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/event/KieScannerStatusChangeEventImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/event/KieScannerStatusChangeEventImpl.java @@ -38,15 +38,19 @@ public int hashCode() { } @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (!(obj instanceof KieScannerStatusChangeEventImpl)) + } + if (!(obj instanceof KieScannerStatusChangeEventImpl)) { return false; + } KieScannerStatusChangeEventImpl other = (KieScannerStatusChangeEventImpl) obj; - if (status != other.status) + if (status != other.status) { return false; + } return true; } @Override diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/util/ChangeSetBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/kie/util/ChangeSetBuilder.java index ebc9900e3cf..be0f530dffc 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/util/ChangeSetBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/util/ChangeSetBuilder.java @@ -29,8 +29,8 @@ import java.util.Map; import java.util.Set; +import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.compiler.builder.impl.KnowledgeBuilderFactoryServiceImpl; -import org.drools.drl.parser.DrlParser; import org.drools.compiler.kie.builder.impl.InternalKieModule; import org.drools.drl.ast.descr.BaseDescr; import org.drools.drl.ast.descr.FunctionDescr; @@ -39,10 +39,10 @@ import org.drools.drl.ast.descr.RuleDescr; import org.drools.drl.ast.descr.TypeDeclarationDescr; import org.drools.drl.ast.descr.TypeFieldDescr; -import org.drools.util.TypeResolver; -import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.drl.parser.DrlParser; import org.drools.io.ByteArrayResource; import org.drools.util.StringUtils; +import org.drools.util.TypeResolver; import org.kie.api.io.ResourceType; import org.kie.internal.builder.ChangeType; import org.kie.internal.builder.KnowledgeBuilder; diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/util/InjectionHelper.java b/drools-compiler/src/main/java/org/drools/compiler/kie/util/InjectionHelper.java index 269667a9e3e..dab276dffc2 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/util/InjectionHelper.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/util/InjectionHelper.java @@ -88,7 +88,7 @@ public static void wireSessionComponents(BeanCreator beanCreator, KieSessionMode } private static void wireWIHs(BeanCreator beanCreator, BeanCreator fallbackBeanCreator, ClassLoader cl, List wihModels, KieSession kSession) { - for (WorkItemHandlerModel wihModel : wihModels) { + for (WorkItemHandlerModel wihModel : wihModels) { WorkItemHandler wih; try { wih = beanCreator.createBean(cl, wihModel.getType(), wihModel.getQualifierModel()); @@ -104,7 +104,7 @@ private static void wireWIHs(BeanCreator beanCreator, BeanCreator fallbackBeanCr } private static void wireListeners(BeanCreator beanCreator, BeanCreator fallbackBeanCreator, ClassLoader cl, List listenerModels, KieRuntimeEventManager kRuntimeEventManager) { - for (ListenerModel listenerModel : listenerModels) { + for (ListenerModel listenerModel : listenerModels) { Object listener = createListener( beanCreator, fallbackBeanCreator, cl, listenerModel ); switch(listenerModel.getKind()) { case AGENDA_EVENT_LISTENER: @@ -135,15 +135,15 @@ private static Object createListener( BeanCreator beanCreator, BeanCreator fallb } private static void wireChannels(BeanCreator beanCreator, BeanCreator fallbackBeanCreator, ClassLoader cl, List channelModels, KieSession kSession) { - wireSessionChannels(beanCreator, fallbackBeanCreator, cl, channelModels, kSession); + wireSessionChannels(beanCreator, fallbackBeanCreator, cl, channelModels, kSession); } private static void wireChannels(BeanCreator beanCreator, BeanCreator fallbackBeanCreator, ClassLoader cl, List channelModels, StatelessKieSession kSession) { - wireSessionChannels(beanCreator, fallbackBeanCreator, cl, channelModels, kSession); + wireSessionChannels(beanCreator, fallbackBeanCreator, cl, channelModels, kSession); } private static void wireSessionChannels(BeanCreator beanCreator, BeanCreator fallbackBeanCreator, ClassLoader cl, List channelModels, Object kSession) { - for (ChannelModel channelModel : channelModels) { + for (ChannelModel channelModel : channelModels) { Channel channel; try { channel = beanCreator.createBean(cl, channelModel.getType(), channelModel.getQualifierModel()); @@ -155,11 +155,11 @@ private static void wireSessionChannels(BeanCreator beanCreator, BeanCreator fal } } if (kSession instanceof KieSession) { - ((KieSession) kSession).registerChannel(channelModel.getName(), channel); + ((KieSession) kSession).registerChannel(channelModel.getName(), channel); } else if (kSession instanceof StatelessKieSession) { - ((StatelessKieSession) kSession).registerChannel(channelModel.getName(), channel); + ((StatelessKieSession) kSession).registerChannel(channelModel.getName(), channel); } else { - throw new IllegalArgumentException("kSession not of correct type. Expected KieSession or StatelessKieSession but was: " + kSession.getClass().getCanonicalName()); + throw new IllegalArgumentException("kSession not of correct type. Expected KieSession or StatelessKieSession but was: " + kSession.getClass().getCanonicalName()); } } } diff --git a/drools-compiler/src/main/java/org/drools/compiler/kie/util/KieJarChangeSet.java b/drools-compiler/src/main/java/org/drools/compiler/kie/util/KieJarChangeSet.java index 735c9d65559..33a8882f759 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kie/util/KieJarChangeSet.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kie/util/KieJarChangeSet.java @@ -64,9 +64,15 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } KieJarChangeSet other = (KieJarChangeSet) obj; return changes.equals(other.changes); } diff --git a/drools-compiler/src/main/java/org/drools/compiler/kproject/models/KieBaseModelImpl.java b/drools-compiler/src/main/java/org/drools/compiler/kproject/models/KieBaseModelImpl.java index bdae5fabbcf..c64a98e84ba 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kproject/models/KieBaseModelImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kproject/models/KieBaseModelImpl.java @@ -358,8 +358,12 @@ public String toString() { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } KieBaseModelImpl that = (KieBaseModelImpl) o; return name.equals(that.name); diff --git a/drools-compiler/src/main/java/org/drools/compiler/kproject/models/KieModuleModelImpl.java b/drools-compiler/src/main/java/org/drools/compiler/kproject/models/KieModuleModelImpl.java index d73d5cb9f8b..60e6e4ba872 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kproject/models/KieModuleModelImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kproject/models/KieModuleModelImpl.java @@ -25,10 +25,10 @@ import java.util.Map; import org.drools.base.base.XMLSupport; +import org.drools.util.PortablePath; import org.drools.util.StringUtils; import org.kie.api.builder.model.KieBaseModel; import org.kie.api.builder.model.KieModuleModel; -import org.drools.util.PortablePath; public class KieModuleModelImpl implements KieModuleModel { diff --git a/drools-compiler/src/main/java/org/drools/compiler/kproject/models/KieSessionModelImpl.java b/drools-compiler/src/main/java/org/drools/compiler/kproject/models/KieSessionModelImpl.java index 08847623e41..d69de72b721 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/kproject/models/KieSessionModelImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/kproject/models/KieSessionModelImpl.java @@ -224,17 +224,17 @@ public void addWorkItemHandelerModel(WorkItemHandlerModel wih) { } public ChannelModel newChannelModel(String name, String type) { - ChannelModelImpl channelModel = new ChannelModelImpl(this, name, type); - channels.add(channelModel); - return channelModel; + ChannelModelImpl channelModel = new ChannelModelImpl(this, name, type); + channels.add(channelModel); + return channelModel; } public List getChannelModels() { - return channels; + return channels; } public void addChannelModel(ChannelModel channel) { - channels.add(channel); + channels.add(channel); } public KieSessionModel addCalendar(String name, String type) { diff --git a/drools-compiler/src/main/java/org/drools/compiler/lang/DescrDumper.java b/drools-compiler/src/main/java/org/drools/compiler/lang/DescrDumper.java index 32fe74e4101..812215bc027 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/lang/DescrDumper.java +++ b/drools-compiler/src/main/java/org/drools/compiler/lang/DescrDumper.java @@ -37,7 +37,7 @@ import java.util.Map; import java.util.regex.Pattern; -import org.drools.drl.parser.DrlExprParser; +import org.drools.base.rule.XpathBackReference; import org.drools.drl.ast.descr.AtomicExprDescr; import org.drools.drl.ast.descr.BaseDescr; import org.drools.drl.ast.descr.BindingDescr; @@ -46,8 +46,8 @@ import org.drools.drl.ast.descr.ExprConstraintDescr; import org.drools.drl.ast.descr.OperatorDescr; import org.drools.drl.ast.descr.RelationalExprDescr; +import org.drools.drl.parser.DrlExprParser; import org.drools.drl.parser.impl.Operator; -import org.drools.base.rule.XpathBackReference; import org.kie.internal.builder.conf.LanguageLevelOption; import static org.drools.compiler.rule.builder.dialect.DialectUtil.findClassByName; diff --git a/drools-compiler/src/main/java/org/drools/compiler/lang/DumperContext.java b/drools-compiler/src/main/java/org/drools/compiler/lang/DumperContext.java index 266494c354b..aa11677b462 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/lang/DumperContext.java +++ b/drools-compiler/src/main/java/org/drools/compiler/lang/DumperContext.java @@ -24,9 +24,9 @@ import java.util.List; import java.util.Map; +import org.drools.compiler.rule.builder.RuleBuildContext; import org.drools.drl.ast.descr.BindingDescr; import org.drools.drl.ast.descr.OperatorDescr; -import org.drools.compiler.rule.builder.RuleBuildContext; public class DumperContext { protected Map aliases; diff --git a/drools-compiler/src/main/java/org/drools/compiler/management/KieContainerMonitor.java b/drools-compiler/src/main/java/org/drools/compiler/management/KieContainerMonitor.java index 48fe0d1ebaa..8ec1bf107a1 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/management/KieContainerMonitor.java +++ b/drools-compiler/src/main/java/org/drools/compiler/management/KieContainerMonitor.java @@ -19,34 +19,34 @@ package org.drools.compiler.management; import org.drools.core.impl.InternalKieContainer; -import org.kie.api.management.KieContainerMonitorMXBean; import org.kie.api.management.GAV; +import org.kie.api.management.KieContainerMonitorMXBean; public class KieContainerMonitor implements KieContainerMonitorMXBean { private InternalKieContainer kieContainer; - public KieContainerMonitor(InternalKieContainer kieContainer) { - this.kieContainer = kieContainer; - } + public KieContainerMonitor(InternalKieContainer kieContainer) { + this.kieContainer = kieContainer; + } - @Override - public String getContainerId() { - return kieContainer.getContainerId(); - } + @Override + public String getContainerId() { + return kieContainer.getContainerId(); + } - @Override - public String getConfiguredReleaseIdStr() { - return ( kieContainer.getConfiguredReleaseId() != null ) - ? kieContainer.getConfiguredReleaseId().toString() - : KieContainerMonitorMXBean.CLASSPATH_KIECONTAINER_RELEASEID.toString() ; - } + @Override + public String getConfiguredReleaseIdStr() { + return ( kieContainer.getConfiguredReleaseId() != null ) + ? kieContainer.getConfiguredReleaseId().toString() + : KieContainerMonitorMXBean.CLASSPATH_KIECONTAINER_RELEASEID.toString() ; + } - @Override - public String getResolvedReleaseIdStr() { - return ( kieContainer.getResolvedReleaseId() != null ) - ? kieContainer.getResolvedReleaseId().toString() - : KieContainerMonitorMXBean.CLASSPATH_KIECONTAINER_RELEASEID.toString() ; - } + @Override + public String getResolvedReleaseIdStr() { + return ( kieContainer.getResolvedReleaseId() != null ) + ? kieContainer.getResolvedReleaseId().toString() + : KieContainerMonitorMXBean.CLASSPATH_KIECONTAINER_RELEASEID.toString() ; + } @Override public GAV getConfiguredReleaseId() { diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/CollectBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/CollectBuilder.java index 8c08a58154b..245a25d4371 100755 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/CollectBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/CollectBuilder.java @@ -18,12 +18,12 @@ */ package org.drools.compiler.rule.builder; -import org.drools.drl.ast.descr.BaseDescr; -import org.drools.drl.ast.descr.CollectDescr; -import org.drools.drl.ast.descr.PatternDescr; import org.drools.base.rule.Collect; import org.drools.base.rule.Pattern; import org.drools.base.rule.RuleConditionElement; +import org.drools.drl.ast.descr.BaseDescr; +import org.drools.drl.ast.descr.CollectDescr; +import org.drools.drl.ast.descr.PatternDescr; public class CollectBuilder implements diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/ConditionalBranchBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/ConditionalBranchBuilder.java index 8490aaad03a..00d9c015056 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/ConditionalBranchBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/ConditionalBranchBuilder.java @@ -20,8 +20,6 @@ import java.util.List; -import org.drools.drl.parser.DroolsError; -import org.drools.compiler.compiler.RuleBuildError; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.rule.ConditionalBranch; import org.drools.base.rule.EvalCondition; @@ -29,10 +27,12 @@ import org.drools.base.rule.NamedConsequence; import org.drools.base.rule.Pattern; import org.drools.base.rule.RuleConditionElement; +import org.drools.compiler.compiler.RuleBuildError; import org.drools.drl.ast.descr.BaseDescr; import org.drools.drl.ast.descr.ConditionalBranchDescr; import org.drools.drl.ast.descr.EvalDescr; import org.drools.drl.ast.descr.NamedConsequenceDescr; +import org.drools.drl.parser.DroolsError; public class ConditionalBranchBuilder implements RuleConditionBuilder { diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/ConstraintBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/ConstraintBuilder.java index b0e3dca43e2..8980117e2ab 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/ConstraintBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/ConstraintBuilder.java @@ -23,11 +23,6 @@ import java.util.List; import java.util.Map; -import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; -import org.drools.compiler.compiler.AnalysisResult; -import org.drools.compiler.compiler.DialectConfiguration; -import org.drools.compiler.compiler.JavaDialectConfiguration; -import org.drools.compiler.kie.util.BeanCreator; import org.drools.base.base.ObjectType; import org.drools.base.base.ValueType; import org.drools.base.rule.Declaration; @@ -37,6 +32,11 @@ import org.drools.base.rule.accessor.FieldValue; import org.drools.base.rule.accessor.ReadAccessor; import org.drools.base.rule.constraint.Constraint; +import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; +import org.drools.compiler.compiler.AnalysisResult; +import org.drools.compiler.compiler.DialectConfiguration; +import org.drools.compiler.compiler.JavaDialectConfiguration; +import org.drools.compiler.kie.util.BeanCreator; import org.drools.core.time.TimerExpression; import org.drools.drl.ast.descr.BaseDescr; import org.drools.drl.ast.descr.LiteralRestrictionDescr; diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/EntryPointBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/EntryPointBuilder.java index 54e97274c67..ffe6a519950 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/EntryPointBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/EntryPointBuilder.java @@ -18,11 +18,11 @@ */ package org.drools.compiler.rule.builder; -import org.drools.drl.ast.descr.BaseDescr; -import org.drools.drl.ast.descr.EntryPointDescr; import org.drools.base.rule.EntryPointId; import org.drools.base.rule.Pattern; import org.drools.base.rule.RuleConditionElement; +import org.drools.drl.ast.descr.BaseDescr; +import org.drools.drl.ast.descr.EntryPointDescr; /** * A class capable of building entry point instances diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/EvaluatorDefinition.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/EvaluatorDefinition.java index c77425d68a0..c81b14b911e 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/EvaluatorDefinition.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/EvaluatorDefinition.java @@ -21,8 +21,8 @@ import java.io.Externalizable; import org.drools.base.base.ValueType; -import org.drools.drl.parser.impl.Operator; import org.drools.base.rule.accessor.Evaluator; +import org.drools.drl.parser.impl.Operator; /** * An evaluator definition interface that allows for pluggable diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/EvaluatorWrapper.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/EvaluatorWrapper.java index cb13ddb5d76..86445c6db40 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/EvaluatorWrapper.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/EvaluatorWrapper.java @@ -20,16 +20,16 @@ import org.drools.base.base.ValueResolver; import org.drools.base.base.ValueType; -import org.drools.core.base.extractors.ConstantValueReader; import org.drools.base.base.extractors.SelfReferenceClassFieldReader; import org.drools.base.base.field.ObjectFieldImpl; -import org.drools.core.common.DefaultEventHandle; -import org.drools.core.common.ReteEvaluator; import org.drools.base.rule.Declaration; import org.drools.base.rule.accessor.Evaluator; import org.drools.base.rule.accessor.FieldValue; import org.drools.base.rule.accessor.ReadAccessor; import org.drools.base.time.Interval; +import org.drools.core.base.extractors.ConstantValueReader; +import org.drools.core.common.DefaultEventHandle; +import org.drools.core.common.ReteEvaluator; import org.kie.api.runtime.rule.FactHandle; import static org.drools.core.common.InternalFactHandle.dummyFactHandleOf; diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/ForallBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/ForallBuilder.java index 431c1cd5ec5..f111830f3b5 100755 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/ForallBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/ForallBuilder.java @@ -18,15 +18,15 @@ */ package org.drools.compiler.rule.builder; +import org.drools.base.rule.Forall; +import org.drools.base.rule.GroupElement; +import org.drools.base.rule.Pattern; +import org.drools.base.rule.RuleConditionElement; import org.drools.drl.ast.descr.BaseDescr; import org.drools.drl.ast.descr.ExistsDescr; import org.drools.drl.ast.descr.ForallDescr; import org.drools.drl.ast.descr.NotDescr; import org.drools.drl.ast.descr.PatternDescr; -import org.drools.base.rule.Forall; -import org.drools.base.rule.GroupElement; -import org.drools.base.rule.Pattern; -import org.drools.base.rule.RuleConditionElement; public class ForallBuilder implements diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/FunctionBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/FunctionBuilder.java index e88e3d075e4..54e3c7dfe88 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/FunctionBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/FunctionBuilder.java @@ -21,11 +21,11 @@ import java.util.List; import java.util.Map; -import org.drools.drl.ast.descr.FunctionDescr; import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.base.rule.LineMappings; -import org.kie.internal.builder.KnowledgeBuilderResult; +import org.drools.drl.ast.descr.FunctionDescr; import org.drools.util.TypeResolver; +import org.kie.internal.builder.KnowledgeBuilderResult; public interface FunctionBuilder extends EngineElementBuilder { diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/GroupElementBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/GroupElementBuilder.java index 2fd20abb3e6..2b798176631 100755 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/GroupElementBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/GroupElementBuilder.java @@ -18,16 +18,16 @@ */ package org.drools.compiler.rule.builder; +import org.drools.base.rule.GroupElement; +import org.drools.base.rule.GroupElementFactory; +import org.drools.base.rule.Pattern; +import org.drools.base.rule.RuleConditionElement; import org.drools.drl.ast.descr.AndDescr; import org.drools.drl.ast.descr.BaseDescr; import org.drools.drl.ast.descr.ConditionalElementDescr; import org.drools.drl.ast.descr.ExistsDescr; import org.drools.drl.ast.descr.NotDescr; import org.drools.drl.ast.descr.OrDescr; -import org.drools.base.rule.GroupElement; -import org.drools.base.rule.GroupElementFactory; -import org.drools.base.rule.Pattern; -import org.drools.base.rule.RuleConditionElement; public class GroupElementBuilder implements diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/JavaRuleClassBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/JavaRuleClassBuilder.java index 6599079d019..528a75d1006 100755 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/JavaRuleClassBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/JavaRuleClassBuilder.java @@ -18,8 +18,8 @@ */ package org.drools.compiler.rule.builder; -import org.drools.drl.ast.descr.RuleDescr; import org.drools.core.rule.consequence.KnowledgeHelper; +import org.drools.drl.ast.descr.RuleDescr; import org.drools.util.StringUtils; public class JavaRuleClassBuilder implements RuleClassBuilder { diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/NamedConsequenceBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/NamedConsequenceBuilder.java index bc9c3872efc..7eb32dcc479 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/NamedConsequenceBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/NamedConsequenceBuilder.java @@ -18,10 +18,10 @@ */ package org.drools.compiler.rule.builder; -import org.drools.drl.ast.descr.BaseDescr; -import org.drools.drl.ast.descr.NamedConsequenceDescr; import org.drools.base.rule.NamedConsequence; import org.drools.base.rule.Pattern; +import org.drools.drl.ast.descr.BaseDescr; +import org.drools.drl.ast.descr.NamedConsequenceDescr; public class NamedConsequenceBuilder implements RuleConditionBuilder { diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PackageBuildContext.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PackageBuildContext.java index 16093c00e2b..d17fc0e1a79 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PackageBuildContext.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PackageBuildContext.java @@ -25,13 +25,13 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.base.rule.Dialectable; import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.compiler.builder.impl.TypeDeclarationContext; import org.drools.compiler.compiler.Dialect; import org.drools.compiler.compiler.DialectCompiletimeRegistry; import org.drools.compiler.compiler.DroolsWarning; -import org.drools.base.definitions.InternalKnowledgePackage; -import org.drools.base.rule.Dialectable; import org.drools.drl.ast.descr.BaseDescr; import org.drools.drl.parser.DroolsError; diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java index 3f0aec39b78..d50ef6c1bcf 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java @@ -18,6 +18,20 @@ */ package org.drools.compiler.rule.builder; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; + import org.drools.base.base.AcceptsClassObjectType; import org.drools.base.base.ClassObjectType; import org.drools.base.base.ObjectType; @@ -97,20 +111,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; - import static org.drools.compiler.lang.DescrDumper.normalizeEval; import static org.drools.compiler.rule.builder.util.AnnotationFactory.getTypedAnnotation; import static org.drools.compiler.rule.builder.util.PatternBuilderUtil.getNormalizeDate; diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilderForAbductiveQuery.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilderForAbductiveQuery.java index af334cdac12..c5762b7d4ee 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilderForAbductiveQuery.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilderForAbductiveQuery.java @@ -20,12 +20,12 @@ import java.util.Arrays; -import org.drools.compiler.compiler.DescrBuildError; -import org.drools.base.base.ClassObjectType; -import org.drools.base.rule.Declaration; -import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.base.base.AcceptsClassObjectType; +import org.drools.base.base.ClassObjectType; import org.drools.base.base.ObjectType; +import org.drools.base.definitions.rule.impl.QueryImpl; +import org.drools.base.rule.Declaration; +import org.drools.compiler.compiler.DescrBuildError; import org.drools.drl.ast.descr.AnnotationDescr; import org.drools.drl.ast.descr.QueryDescr; diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilderForQuery.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilderForQuery.java index eb2234b4483..0fd991ff5c4 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilderForQuery.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilderForQuery.java @@ -18,16 +18,16 @@ */ package org.drools.compiler.rule.builder; -import org.drools.compiler.compiler.DescrBuildError; -import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.drl.ast.descr.QueryDescr; import org.drools.base.base.ClassObjectType; +import org.drools.base.base.ObjectType; import org.drools.base.base.extractors.ArrayElementReader; +import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.base.rule.Declaration; import org.drools.base.rule.Pattern; -import org.drools.base.definitions.rule.impl.QueryImpl; +import org.drools.base.rule.accessor.ReadAccessor; import org.drools.base.rule.constraint.QueryNameConstraint; -import org.drools.base.base.ObjectType; +import org.drools.compiler.compiler.DescrBuildError; +import org.drools.drl.ast.descr.QueryDescr; public class PatternBuilderForQuery implements EngineElementBuilder { diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/QueryElementBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/QueryElementBuilder.java index a6345f30fe4..9c20dd4f2f4 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/QueryElementBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/QueryElementBuilder.java @@ -22,24 +22,24 @@ import java.util.List; import java.util.Map; -import org.drools.compiler.compiler.AnalysisResult; -import org.drools.compiler.compiler.BoundIdentifiers; -import org.drools.compiler.compiler.DescrBuildError; -import org.drools.compiler.lang.DescrDumper; -import org.drools.compiler.lang.DumperContext; import org.drools.base.base.ClassObjectType; import org.drools.base.base.CoreComponentsBuilder; +import org.drools.base.base.ObjectType; import org.drools.base.base.extractors.ArrayElementReader; import org.drools.base.base.extractors.SelfReferenceClassFieldReader; +import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.base.rule.Declaration; import org.drools.base.rule.Pattern; import org.drools.base.rule.QueryArgument; import org.drools.base.rule.QueryElement; -import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.base.rule.RuleConditionElement; import org.drools.base.rule.accessor.DeclarationScopeResolver; -import org.drools.base.base.ObjectType; import org.drools.base.rule.accessor.ReadAccessor; +import org.drools.compiler.compiler.AnalysisResult; +import org.drools.compiler.compiler.BoundIdentifiers; +import org.drools.compiler.compiler.DescrBuildError; +import org.drools.compiler.lang.DescrDumper; +import org.drools.compiler.lang.DumperContext; import org.drools.drl.ast.descr.BaseDescr; import org.drools.drl.ast.descr.BindingDescr; import org.drools.drl.ast.descr.ConstraintConnectiveDescr; diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleBuildContext.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleBuildContext.java index 95aa5893379..20d940009a6 100755 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleBuildContext.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleBuildContext.java @@ -24,16 +24,16 @@ import java.lang.reflect.Type; import java.util.Optional; -import org.drools.compiler.builder.impl.TypeDeclarationContext; -import org.drools.compiler.compiler.Dialect; -import org.drools.compiler.compiler.DialectCompiletimeRegistry; -import org.drools.compiler.compiler.RuleBuildError; -import org.drools.core.common.TruthMaintenanceSystemFactory; import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.rule.EntryPointId; import org.drools.base.rule.Pattern; import org.drools.base.rule.accessor.DeclarationScopeResolver; +import org.drools.compiler.builder.impl.TypeDeclarationContext; +import org.drools.compiler.compiler.Dialect; +import org.drools.compiler.compiler.DialectCompiletimeRegistry; +import org.drools.compiler.compiler.RuleBuildError; +import org.drools.core.common.TruthMaintenanceSystemFactory; import org.drools.drl.ast.descr.QueryDescr; import org.drools.drl.ast.descr.RuleDescr; import org.drools.util.TypeResolver; diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleBuilder.java index cdef6fe7f23..07dc0190f00 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleBuilder.java @@ -28,25 +28,25 @@ import java.util.function.Consumer; import java.util.function.Function; -import org.drools.compiler.compiler.DroolsWarning; -import org.drools.compiler.compiler.RuleBuildError; -import org.drools.compiler.compiler.RuleBuildWarning; import org.drools.base.base.CoreComponentsBuilder; import org.drools.base.base.EnabledBoolean; import org.drools.base.base.SalienceInteger; -import org.drools.core.common.InternalAgendaGroup; +import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.factmodel.AnnotationDefinition; import org.drools.base.rule.GroupElement; -import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.base.rule.accessor.Salience; import org.drools.base.time.TimeUtils; +import org.drools.base.time.impl.Timer; +import org.drools.compiler.compiler.DroolsWarning; +import org.drools.compiler.compiler.RuleBuildError; +import org.drools.compiler.compiler.RuleBuildWarning; +import org.drools.core.common.InternalAgendaGroup; import org.drools.core.time.TimerExpression; import org.drools.core.time.impl.CronExpression; import org.drools.core.time.impl.CronTimer; import org.drools.core.time.impl.ExpressionIntervalTimer; import org.drools.core.time.impl.IntervalTimer; -import org.drools.base.time.impl.Timer; import org.drools.drl.ast.descr.AnnotationDescr; import org.drools.drl.ast.descr.AttributeDescr; import org.drools.drl.ast.descr.QueryDescr; diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleConditionBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleConditionBuilder.java index 1caafd5b13b..f41f6d124ea 100755 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleConditionBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleConditionBuilder.java @@ -18,9 +18,9 @@ */ package org.drools.compiler.rule.builder; -import org.drools.drl.ast.descr.BaseDescr; import org.drools.base.rule.Pattern; import org.drools.base.rule.RuleConditionElement; +import org.drools.drl.ast.descr.BaseDescr; /** * An interface to define classes capable of building diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/WindowReferenceBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/WindowReferenceBuilder.java index 867b59b10c3..1bb25382fe7 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/WindowReferenceBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/WindowReferenceBuilder.java @@ -18,12 +18,12 @@ */ package org.drools.compiler.rule.builder; -import org.drools.compiler.compiler.DescrBuildError; -import org.drools.drl.ast.descr.BaseDescr; -import org.drools.drl.ast.descr.WindowReferenceDescr; import org.drools.base.rule.Pattern; import org.drools.base.rule.RuleConditionElement; import org.drools.base.rule.WindowReference; +import org.drools.compiler.compiler.DescrBuildError; +import org.drools.drl.ast.descr.BaseDescr; +import org.drools.drl.ast.descr.WindowReferenceDescr; /** * A class capable of building window source references diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/DialectUtil.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/DialectUtil.java index 3ca1706d3db..3041c4f38be 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/DialectUtil.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/DialectUtil.java @@ -24,14 +24,14 @@ import java.util.regex.Pattern; import org.drools.compiler.builder.impl.TypeDeclarationContext; -import org.kie.memorycompiler.resources.ResourceReader; -import org.drools.drl.ast.descr.ImportDescr; -import org.drools.drl.ast.descr.PackageDescr; import org.drools.compiler.rule.builder.RuleBuildContext; import org.drools.compiler.rule.builder.dialect.java.parser.JavaBlockDescr; import org.drools.compiler.rule.builder.dialect.java.parser.JavaCatchBlockDescr; import org.drools.compiler.rule.builder.dialect.java.parser.JavaContainerBlockDescr; import org.drools.compiler.rule.builder.dialect.java.parser.JavaTryBlockDescr; +import org.drools.drl.ast.descr.ImportDescr; +import org.drools.drl.ast.descr.PackageDescr; +import org.kie.memorycompiler.resources.ResourceReader; import static org.drools.util.ClassUtils.findClass; @@ -56,7 +56,9 @@ public static String getUniqueLegalName(final String packageName, final String fileName = packageName.replace('.', '/') + "/" + newName; - if (src == null || !src.isAvailable(fileName + "." + ext)) return newName; + if (src == null || !src.isAvailable(fileName + "." + ext)) { + return newName; + } // make sure the class name does not exist, if it does increase the counter int counter = -1; @@ -66,7 +68,9 @@ public static String getUniqueLegalName(final String packageName, final String actualName = fileName + "_" + counter + "." + ext; //MVEL:test null to Fix failing test on MVELConsequenceBuilderTest.testImperativeCodeError() - if (!src.isAvailable(actualName)) break; + if (!src.isAvailable(actualName)) { + break; + } } // we have duplicate file names so append counter return newName + "_" + counter; diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/util/AnnotationFactory.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/util/AnnotationFactory.java index 39d4d82d046..db572bf5d40 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/util/AnnotationFactory.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/util/AnnotationFactory.java @@ -22,10 +22,10 @@ import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; -import org.drools.util.TypeResolver; import org.drools.base.rule.Annotated; import org.drools.drl.ast.descr.AnnotatedBaseDescr; import org.drools.drl.ast.descr.AnnotationDescr; +import org.drools.util.TypeResolver; import static java.lang.reflect.Proxy.newProxyInstance; import static org.drools.util.StringUtils.ucFirst; diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/util/ConstraintUtil.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/util/ConstraintUtil.java index 7cf071f3192..abfb6cbf702 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/util/ConstraintUtil.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/util/ConstraintUtil.java @@ -19,8 +19,8 @@ package org.drools.compiler.rule.builder.util; import org.drools.base.base.ClassObjectType; -import org.drools.base.rule.Pattern; import org.drools.base.base.ObjectType; +import org.drools.base.rule.Pattern; import org.drools.base.util.index.ConstraintTypeOperator; import org.drools.drl.ast.descr.BaseDescr; import org.drools.drl.ast.descr.OperatorDescr; diff --git a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/util/PackageBuilderUtil.java b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/util/PackageBuilderUtil.java index 92565eb54fb..2ea28949018 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/rule/builder/util/PackageBuilderUtil.java +++ b/drools-compiler/src/main/java/org/drools/compiler/rule/builder/util/PackageBuilderUtil.java @@ -18,16 +18,16 @@ */ package org.drools.compiler.rule.builder.util; +import org.drools.base.rule.EntryPointId; +import org.drools.base.rule.Pattern; +import org.drools.base.rule.QueryElement; +import org.drools.base.rule.RuleConditionElement; import org.drools.compiler.compiler.DescrBuildError; +import org.drools.compiler.rule.builder.RuleBuildContext; import org.drools.drl.ast.descr.AccumulateDescr; import org.drools.drl.ast.descr.EntryPointDescr; import org.drools.drl.ast.descr.PatternDescr; import org.drools.drl.ast.descr.WindowReferenceDescr; -import org.drools.compiler.rule.builder.RuleBuildContext; -import org.drools.base.rule.EntryPointId; -import org.drools.base.rule.Pattern; -import org.drools.base.rule.QueryElement; -import org.drools.base.rule.RuleConditionElement; public class PackageBuilderUtil { diff --git a/drools-compiler/src/main/java/org/drools/compiler/runtime/pipeline/impl/DroolsJaxbHelperProviderImpl.java b/drools-compiler/src/main/java/org/drools/compiler/runtime/pipeline/impl/DroolsJaxbHelperProviderImpl.java index e6f93ed5ec4..6b8db5a0935 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/runtime/pipeline/impl/DroolsJaxbHelperProviderImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/runtime/pipeline/impl/DroolsJaxbHelperProviderImpl.java @@ -30,6 +30,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; + import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; @@ -41,13 +42,13 @@ import com.sun.tools.xjc.ModelLoader; import com.sun.tools.xjc.Options; import com.sun.tools.xjc.model.Model; +import org.drools.base.rule.TypeDeclaration; import org.drools.compiler.builder.conf.JaxbConfigurationImpl; import org.drools.compiler.builder.impl.KnowledgeBuilderImpl; import org.drools.compiler.compiler.Dialect; import org.drools.compiler.compiler.PackageRegistry; import org.drools.compiler.compiler.ProjectJavaCompiler; import org.drools.core.common.DefaultFactHandle; -import org.drools.base.rule.TypeDeclaration; import org.drools.drl.ast.descr.PackageDescr; import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.wiring.api.classloader.ProjectClassLoader; diff --git a/drools-compiler/src/main/java/org/drools/compiler/testframework/TestingEventListener.java b/drools-compiler/src/main/java/org/drools/compiler/testframework/TestingEventListener.java index bdec940b81b..0fee42b4d29 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/testframework/TestingEventListener.java +++ b/drools-compiler/src/main/java/org/drools/compiler/testframework/TestingEventListener.java @@ -63,7 +63,9 @@ public TestingEventListener() { public AgendaFilter getAgendaFilter(final HashSet ruleNames, final boolean inclusive) { return new AgendaFilter() { public boolean accept(Match match) { - if (ruleNames.size() ==0) return true; + if (ruleNames.size() ==0) { + return true; + } String ruleName = match.getRule().getName(); //jdelong: please don't want to see records of cancelled activations diff --git a/drools-compiler/src/test/java/org/drools/compiler/lang/descr/CompositePackageDescrTest.java b/drools-compiler/src/test/java/org/drools/compiler/lang/descr/CompositePackageDescrTest.java index 82eb14892d2..c39dc3789a7 100644 --- a/drools-compiler/src/test/java/org/drools/compiler/lang/descr/CompositePackageDescrTest.java +++ b/drools-compiler/src/test/java/org/drools/compiler/lang/descr/CompositePackageDescrTest.java @@ -18,8 +18,8 @@ */ package org.drools.compiler.lang.descr; -import org.drools.io.ByteArrayResource; import org.drools.drl.ast.descr.PackageDescr; +import org.drools.io.ByteArrayResource; import org.junit.Before; import org.junit.Test; diff --git a/drools-compiler/src/test/java/org/drools/compiler/lang/descr/PackageDescrTest.java b/drools-compiler/src/test/java/org/drools/compiler/lang/descr/PackageDescrTest.java index 0a0d330a212..b5e7cee1202 100644 --- a/drools-compiler/src/test/java/org/drools/compiler/lang/descr/PackageDescrTest.java +++ b/drools-compiler/src/test/java/org/drools/compiler/lang/descr/PackageDescrTest.java @@ -24,9 +24,9 @@ import java.io.ObjectOutputStream; import java.io.OutputStream; +import org.drools.drl.ast.descr.PackageDescr; import org.drools.drl.ast.dsl.PackageDescrBuilder; import org.drools.drl.ast.dsl.impl.PackageDescrBuilderImpl; -import org.drools.drl.ast.descr.PackageDescr; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; From cc0d57cc3fcc24444a99b8ec0fce0f683d79f9a3 Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Wed, 8 Nov 2023 08:46:06 +0100 Subject: [PATCH 25/41] [DROOLS-7582] fix fact handles iteration from ObjectTypeNode attached to a named entry-point (#5578) --- .../core/common/InternalWorkingMemory.java | 4 - .../org/drools/core/common/ReteEvaluator.java | 4 - .../drools/core/reteoo/ObjectTypeNode.java | 4 +- .../IncrementalCompilationCepTest.java | 73 ++++++++++++++++++- 4 files changed, 73 insertions(+), 12 deletions(-) diff --git a/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemory.java b/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemory.java index cf4594691b4..f6e01ce45cd 100644 --- a/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemory.java +++ b/drools-core/src/main/java/org/drools/core/common/InternalWorkingMemory.java @@ -49,10 +49,6 @@ public interface InternalWorkingMemory NodeMemories getNodeMemories(); - default FactHandleClassStore getStoreForClass(Class clazz) { - return getObjectStore().getStoreForClass(clazz); - } - Lock getLock(); InternalFactHandle getInitialFactHandle(); diff --git a/drools-core/src/main/java/org/drools/core/common/ReteEvaluator.java b/drools-core/src/main/java/org/drools/core/common/ReteEvaluator.java index 49503f63036..fc0a6e3df28 100644 --- a/drools-core/src/main/java/org/drools/core/common/ReteEvaluator.java +++ b/drools-core/src/main/java/org/drools/core/common/ReteEvaluator.java @@ -100,10 +100,6 @@ default boolean isThreadSafe() { return true; } - default FactHandleClassStore getStoreForClass(Class clazz) { - return getDefaultEntryPoint().getObjectStore().getStoreForClass(clazz); - } - SessionConfiguration getSessionConfiguration(); RuleSessionConfiguration getRuleSessionConfiguration(); diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNode.java b/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNode.java index c86acfd8c51..6a455177f75 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNode.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNode.java @@ -355,7 +355,7 @@ public void updateSink(ObjectSink sink, PropagationContext context, InternalWork if (InitialFact.class.isAssignableFrom(classType)) { sink.assertObject(workingMemory.getInitialFactHandle(), context, workingMemory); } else { - Iterator it = workingMemory.getStoreForClass(classType).iterator(); + Iterator it = getFactHandlesIterator(workingMemory); while (it.hasNext()) { sink.assertObject(it.next(), context, workingMemory); } @@ -366,7 +366,7 @@ public Iterator getFactHandlesIterator(InternalWorkingMemory Class classType = ((ClassObjectType) getObjectType()).getClassType(); return InitialFact.class.isAssignableFrom(classType) ? Collections.singleton(workingMemory.getInitialFactHandle()).iterator() : - workingMemory.getStoreForClass(classType).iterator(); + workingMemory.getEntryPoint(((EntryPointNode)source).getEntryPoint().getEntryPointId()).getObjectStore().getStoreForClass(classType).iterator(); } /** diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/incrementalcompilation/IncrementalCompilationCepTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/incrementalcompilation/IncrementalCompilationCepTest.java index 65f2fdc4193..cfe32dd596d 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/incrementalcompilation/IncrementalCompilationCepTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/incrementalcompilation/IncrementalCompilationCepTest.java @@ -32,10 +32,10 @@ import java.util.concurrent.atomic.AtomicInteger; import org.drools.base.base.ClassObjectType; -import org.drools.kiesession.entrypoints.NamedEntryPoint; -import org.drools.core.reteoo.ObjectTypeNode; import org.drools.base.base.ObjectType; +import org.drools.core.reteoo.ObjectTypeNode; import org.drools.core.time.impl.PseudoClockScheduler; +import org.drools.kiesession.entrypoints.NamedEntryPoint; import org.drools.testcoverage.common.model.ChildEventA; import org.drools.testcoverage.common.model.ChildEventB; import org.drools.testcoverage.common.model.Message; @@ -52,6 +52,8 @@ import org.kie.api.KieServices; import org.kie.api.builder.ReleaseId; import org.kie.api.builder.Results; +import org.kie.api.definition.type.Expires; +import org.kie.api.definition.type.Key; import org.kie.api.definition.type.Role; import org.kie.api.marshalling.KieMarshallers; import org.kie.api.marshalling.Marshaller; @@ -61,6 +63,7 @@ import org.kie.api.runtime.conf.ClockTypeOption; import org.kie.api.runtime.conf.TimedRuleExecutionOption; import org.kie.api.runtime.conf.TimerJobFactoryOption; +import org.kie.api.runtime.rule.EntryPoint; import org.kie.api.runtime.rule.FactHandle; import org.kie.api.time.SessionPseudoClock; import org.kie.internal.builder.conf.PropertySpecificOption; @@ -1106,4 +1109,70 @@ public void testObjectTypeNodeExpirationOffset() { kieSession2.dispose(); } + + @Test + public void testIncrementalCompilationWithExpiringEvent() { + incrementalCompilationWithExpiringEventFromEntryPoint(false); + } + + @Test + public void testIncrementalCompilationWithExpiringEventFromEntryPoint() { + incrementalCompilationWithExpiringEventFromEntryPoint(true); + } + + private void incrementalCompilationWithExpiringEventFromEntryPoint(boolean useEntryPoint) { + // DROOLS-7582 + final String drl1 = + "import " + ExpiringEvent.class.getCanonicalName() + "\n" + + "rule \"Old Rule\" when\n" + + " $e : ExpiringEvent($id : id)\n" + (useEntryPoint ? " from entry-point \"events\"" : "\n") + + "then\n" + + " System.out.println(\"received event in old rule: \" + $id);\n" + + "end"; + + final String drl2 = + "import " + ExpiringEvent.class.getCanonicalName() + "\n" + + "rule \"New Rule\" when\n" + + " $e : ExpiringEvent($id : id)\n" + (useEntryPoint ? " from entry-point \"events\"" : "\n") + + "then\n" + + " System.out.println(\"received event in new rule: \" + $id);\n" + + "end"; + + final KieServices ks = KieServices.Factory.get(); + final ReleaseId releaseId1 = ks.newReleaseId("org.kie", "test-upgrade", "1.0.0"); + KieUtil.getKieModuleFromDrls(releaseId1, kieBaseTestConfiguration, KieSessionTestConfiguration.STATEFUL_PSEUDO, + new HashMap<>(), drl1); + final ReleaseId releaseId2 = ks.newReleaseId("org.kie", "test-upgrade", "1.1.0"); + KieUtil.getKieModuleFromDrls(releaseId2, kieBaseTestConfiguration, KieSessionTestConfiguration.STATEFUL_PSEUDO, + new HashMap<>(), drl2); + + final KieContainer kc = ks.newKieContainer(releaseId1); + final KieSession ksession = kc.newKieSession(); + EntryPoint entryPoint = useEntryPoint ? ksession.getEntryPoint("events") : ksession; + + final PseudoClockScheduler clock = ksession.getSessionClock(); + + entryPoint.insert(new ExpiringEvent(1)); + clock.advanceTime(3, TimeUnit.SECONDS); + assertThat( ksession.fireAllRules() ).isEqualTo(1); + + kc.updateToVersion(releaseId2); + + clock.advanceTime(3, TimeUnit.SECONDS); + assertThat( ksession.fireAllRules() ).isEqualTo(1); + } + + @Role(Role.Type.EVENT) + @Expires("5s") + public static class ExpiringEvent { + @Key + private int id; + public ExpiringEvent(int id) { + this.id = id; + } + + public int getId() { + return id; + } + } } From fdcab2a4b1c6f1e652476d074c40cb80d9ed98aa Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Thu, 9 Nov 2023 13:53:31 +0100 Subject: [PATCH 26/41] [DROOLS-7583] fix insert logical for rule units (#5579) --- .../rule/consequence/KnowledgeHelper.java | 2 + .../consequence/DefaultKnowledgeHelper.java | 29 +++++---- .../impl/LogicalAddByElementTestUnit.java | 54 +++++++++++++++ .../impl/RuleUnitProviderImplTest.java | 65 ++++++++++++++++++- .../ruleunits/impl/LogicalAddByElement.drl | 35 ++++++++++ 5 files changed, 169 insertions(+), 16 deletions(-) create mode 100644 drools-ruleunits/drools-ruleunits-impl/src/test/java/org/drools/ruleunits/impl/LogicalAddByElementTestUnit.java create mode 100644 drools-ruleunits/drools-ruleunits-impl/src/test/resources/org/drools/ruleunits/impl/LogicalAddByElement.drl diff --git a/drools-core/src/main/java/org/drools/core/rule/consequence/KnowledgeHelper.java b/drools-core/src/main/java/org/drools/core/rule/consequence/KnowledgeHelper.java index 970ac5672be..07b3cce82f2 100644 --- a/drools-core/src/main/java/org/drools/core/rule/consequence/KnowledgeHelper.java +++ b/drools-core/src/main/java/org/drools/core/rule/consequence/KnowledgeHelper.java @@ -37,6 +37,8 @@ public interface KnowledgeHelper extends ConsequenceContext, Serializable { void setActivation(InternalMatch internalMatch); + InternalMatch getActivation(); + default void restoreActivationOnConsequenceFailure(InternalMatch internalMatch) { } diff --git a/drools-kiesession/src/main/java/org/drools/kiesession/consequence/DefaultKnowledgeHelper.java b/drools-kiesession/src/main/java/org/drools/kiesession/consequence/DefaultKnowledgeHelper.java index 2b53bd0b948..4dab8d194a8 100644 --- a/drools-kiesession/src/main/java/org/drools/kiesession/consequence/DefaultKnowledgeHelper.java +++ b/drools-kiesession/src/main/java/org/drools/kiesession/consequence/DefaultKnowledgeHelper.java @@ -18,6 +18,14 @@ */ package org.drools.kiesession.consequence; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; + import org.drools.base.beliefsystem.Mode; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.factmodel.traits.CoreWrapper; @@ -37,9 +45,9 @@ import org.drools.core.reteoo.Tuple; import org.drools.core.rule.consequence.InternalMatch; import org.drools.core.rule.consequence.KnowledgeHelper; -import org.drools.util.bitmask.BitMask; import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.kiesession.session.StatefulKnowledgeSessionImpl; +import org.drools.util.bitmask.BitMask; import org.kie.api.runtime.Channel; import org.kie.api.runtime.KieRuntime; import org.kie.api.runtime.process.NodeInstance; @@ -51,14 +59,6 @@ import org.kie.api.runtime.rule.FactHandle; import org.kie.api.runtime.rule.Match; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; - import static org.drools.base.reteoo.PropertySpecificUtil.allSetButTraitBitMask; import static org.drools.base.reteoo.PropertySpecificUtil.onlyTraitBitSetMask; @@ -165,12 +165,13 @@ private KnowledgeHelper executeOnTMS() { if (!TruthMaintenanceSystemFactory.present()) { TruthMaintenanceSystemFactory.throwExceptionForMissingTms(); } - if (tmsKnowledgeHelper != null) { - return tmsKnowledgeHelper; + if (tmsKnowledgeHelper == null) { + reteEvaluator.enableTMS(); + tmsKnowledgeHelper = reteEvaluator.createKnowledgeHelper(); + } + if (internalMatch != tmsKnowledgeHelper.getActivation()) { + tmsKnowledgeHelper.setActivation(internalMatch); } - reteEvaluator.enableTMS(); - tmsKnowledgeHelper = reteEvaluator.createKnowledgeHelper(); - tmsKnowledgeHelper.setActivation(internalMatch); return tmsKnowledgeHelper; } diff --git a/drools-ruleunits/drools-ruleunits-impl/src/test/java/org/drools/ruleunits/impl/LogicalAddByElementTestUnit.java b/drools-ruleunits/drools-ruleunits-impl/src/test/java/org/drools/ruleunits/impl/LogicalAddByElementTestUnit.java new file mode 100644 index 00000000000..c76942cedc4 --- /dev/null +++ b/drools-ruleunits/drools-ruleunits-impl/src/test/java/org/drools/ruleunits/impl/LogicalAddByElementTestUnit.java @@ -0,0 +1,54 @@ +/** + * 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.ruleunits.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.drools.ruleunits.api.DataSource; +import org.drools.ruleunits.api.DataStore; +import org.drools.ruleunits.api.RuleUnitData; + +public class LogicalAddByElementTestUnit implements RuleUnitData { + private final DataStore strings; + private final DataStore ints; + private final List results = new ArrayList<>(); + + public LogicalAddByElementTestUnit() { + this(DataSource.createStore(), DataSource.createStore()); + } + + public LogicalAddByElementTestUnit(DataStore strings, DataStore ints) { + this.strings = strings; + this.ints = ints; + } + + public DataStore getStrings() { + return strings; + } + + public DataStore getInts() { + return ints; + } + + public List getResults() { + return results; + } + +} diff --git a/drools-ruleunits/drools-ruleunits-impl/src/test/java/org/drools/ruleunits/impl/RuleUnitProviderImplTest.java b/drools-ruleunits/drools-ruleunits-impl/src/test/java/org/drools/ruleunits/impl/RuleUnitProviderImplTest.java index 04865bcae8b..6bf4e5b8b63 100644 --- a/drools-ruleunits/drools-ruleunits-impl/src/test/java/org/drools/ruleunits/impl/RuleUnitProviderImplTest.java +++ b/drools-ruleunits/drools-ruleunits-impl/src/test/java/org/drools/ruleunits/impl/RuleUnitProviderImplTest.java @@ -18,6 +18,10 @@ */ package org.drools.ruleunits.impl; +import java.util.ArrayList; +import java.util.Objects; +import java.util.Optional; + import org.drools.core.base.RuleNameStartsWithAgendaFilter; import org.drools.ruleunits.api.DataHandle; import org.drools.ruleunits.api.RuleUnitInstance; @@ -29,8 +33,10 @@ import org.drools.ruleunits.impl.listener.TestRuleRuntimeEventListener; import org.junit.jupiter.api.Test; import org.kie.api.builder.CompilationErrorsException; - -import java.util.Objects; +import org.kie.api.event.rule.ObjectDeletedEvent; +import org.kie.api.event.rule.ObjectInsertedEvent; +import org.kie.api.event.rule.ObjectUpdatedEvent; +import org.kie.api.event.rule.RuleRuntimeEventListener; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; @@ -77,6 +83,61 @@ public void logicalAdd() { } } + @Test + public void logicalAddByElement() { + // DROOLS-7583 + LogicalAddByElementTestUnit unit = new LogicalAddByElementTestUnit(); + + ArrayList eventsRecorded = new ArrayList<>(); + + RuleConfig ruleConfig = RuleUnitProvider.get().newRuleConfig(); + ruleConfig.getRuleRuntimeListeners().add(new RuleRuntimeEventListener() { + @Override + public void objectInserted(ObjectInsertedEvent event) { + String byRuleName = Optional.ofNullable(event.getRule()) + .map(rule -> " by " + rule.getName()) + .orElse(""); + eventsRecorded.add(event.getObject() + " inserted" + byRuleName); + } + + @Override + public void objectUpdated(ObjectUpdatedEvent event) { + } + + @Override + public void objectDeleted(ObjectDeletedEvent event) { + String byRuleName = Optional.ofNullable(event.getRule()) + .map(rule -> " by " + rule.getName()) + .orElse(""); + eventsRecorded.add(event.getOldObject() + " deleted" + byRuleName); + } + }); + + try ( RuleUnitInstance unitInstance = RuleUnitProvider.get().createRuleUnitInstance(unit, ruleConfig) ) { + + DataHandle handleToStringWithLength3 = unit.getStrings().add("abc"); + unit.getStrings().add("len4"); + + assertThat(unitInstance.fire()).isEqualTo(4); + + assertThat(eventsRecorded).containsExactly( + "abc inserted", + "len4 inserted", + "3 inserted by R1", + "4 inserted by R1"); + assertThat(unit.getResults()).containsExactly("3 exists", "4 exists"); + + eventsRecorded.clear(); + unit.getResults().clear(); + + unit.getStrings().remove(handleToStringWithLength3); + assertThat(unitInstance.fire()).isEqualTo(0); + + assertThat(eventsRecorded).doesNotContain("4 deleted"); + assertThat(eventsRecorded).containsExactly("abc deleted", "3 deleted"); + } + } + @Test public void update() { UpdateTestUnit unit = new UpdateTestUnit(); diff --git a/drools-ruleunits/drools-ruleunits-impl/src/test/resources/org/drools/ruleunits/impl/LogicalAddByElement.drl b/drools-ruleunits/drools-ruleunits-impl/src/test/resources/org/drools/ruleunits/impl/LogicalAddByElement.drl new file mode 100644 index 00000000000..7badb5d3eca --- /dev/null +++ b/drools-ruleunits/drools-ruleunits-impl/src/test/resources/org/drools/ruleunits/impl/LogicalAddByElement.drl @@ -0,0 +1,35 @@ +/** + * Copyright 2022 Red Hat, Inc. and/or its affiliates. + * + * Licensed 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.ruleunits.impl; +unit LogicalAddByElementTestUnit; + +rule R1 when + $s: /strings +then + ints.addLogical($s.length()); +end + +rule R2 when + exists ( /ints[ this == 3] ) +then + results.add("3 exists"); +end + +rule R3 when + exists ( /ints[ this == 4] ) +then + results.add("4 exists"); +end \ No newline at end of file From 9f1564669645543abdba639bf095228e71c13008 Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Mon, 13 Nov 2023 08:18:04 +0100 Subject: [PATCH 27/41] [KIE-686] fix peer update propagation for FromNode (#5584) * [KIE-686] fix peer update propagation for FromNode * Update drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/UnexpectedLoopTest.java Co-authored-by: Toshiya Kobayashi --------- Co-authored-by: Toshiya Kobayashi --- .../org/drools/base/reteoo/NodeTypeEnums.java | 4 - .../drools/core/phreak/SegmentPropagator.java | 4 +- .../marshalling/MarshallingHelper.java | 11 ++- .../integrationtests/UnexpectedLoopTest.java | 75 +++++++++++++++++++ .../integrationtests/model/CalcFact.java | 34 +++++++++ .../compiler/integrationtests/model/Item.java | 25 +++++++ .../integrationtests/model/RecordFact.java | 34 +++++++++ .../integrationtests/joinFromFrom.drl | 35 +++++++++ 8 files changed, 214 insertions(+), 8 deletions(-) create mode 100644 drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/UnexpectedLoopTest.java create mode 100644 drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/model/CalcFact.java create mode 100644 drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/model/Item.java create mode 100644 drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/model/RecordFact.java create mode 100644 drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/compiler/integrationtests/joinFromFrom.drl diff --git a/drools-base/src/main/java/org/drools/base/reteoo/NodeTypeEnums.java b/drools-base/src/main/java/org/drools/base/reteoo/NodeTypeEnums.java index df05b2fb781..c78a15f580a 100644 --- a/drools-base/src/main/java/org/drools/base/reteoo/NodeTypeEnums.java +++ b/drools-base/src/main/java/org/drools/base/reteoo/NodeTypeEnums.java @@ -110,8 +110,4 @@ public static boolean isEndNode(NetworkNode node) { public static boolean isLeftTupleNode(NetworkNode node) { return isLeftTupleSource(node) || isLeftTupleSink(node); } - - public static boolean hasNodeMemory(NetworkNode node) { - return node.getType() == FromNode || node.getType() == ReactiveFromNode || node.getType() == AccumulateNode; - } } diff --git a/drools-core/src/main/java/org/drools/core/phreak/SegmentPropagator.java b/drools-core/src/main/java/org/drools/core/phreak/SegmentPropagator.java index 2986421497f..2f723dea800 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/SegmentPropagator.java +++ b/drools-core/src/main/java/org/drools/core/phreak/SegmentPropagator.java @@ -28,7 +28,7 @@ import org.drools.core.reteoo.PathMemory; import org.drools.core.reteoo.SegmentMemory; -import static org.drools.base.reteoo.NodeTypeEnums.hasNodeMemory; +import static org.drools.base.reteoo.NodeTypeEnums.AccumulateNode; import static org.drools.core.phreak.TupleEvaluationUtil.forceFlushLeftTuple; import static org.drools.core.phreak.TupleEvaluationUtil.forceFlushWhenRiaNode; @@ -134,7 +134,7 @@ private static void updateChildLeftTupleDuringInsert(LeftTuple childLeftTuple, T break; default: // no clash, so just add - if ( hasNodeMemory( childLeftTuple.getTupleSink() ) ) { + if ( childLeftTuple.getTupleSink().getType() == AccumulateNode ) { trgLeftTuples.addInsert(childLeftTuple); } else { trgLeftTuples.addUpdate(childLeftTuple); diff --git a/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/marshalling/MarshallingHelper.java b/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/marshalling/MarshallingHelper.java index bbd31d15fd4..df17f92c993 100644 --- a/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/marshalling/MarshallingHelper.java +++ b/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/marshalling/MarshallingHelper.java @@ -18,11 +18,14 @@ */ package org.drools.serialization.protobuf.marshalling; +import org.drools.base.common.NetworkNode; import org.drools.core.reteoo.LeftTupleSource; -import org.drools.base.reteoo.NodeTypeEnums; import org.drools.core.reteoo.TerminalNode; import org.drools.core.reteoo.Tuple; +import static org.drools.base.reteoo.NodeTypeEnums.AccumulateNode; +import static org.drools.base.reteoo.NodeTypeEnums.FromNode; +import static org.drools.base.reteoo.NodeTypeEnums.ReactiveFromNode; import static org.drools.core.marshalling.TupleKey.createTupleArray; public class MarshallingHelper { @@ -51,6 +54,10 @@ private static boolean hasNodeMemory( LeftTupleSource leftTupleSource) { if (leftTupleSource == null) { return false; } - return NodeTypeEnums.hasNodeMemory( leftTupleSource ) ? true : hasNodeMemory(leftTupleSource.getLeftTupleSource()); + return nodeWithMemory( leftTupleSource ) || hasNodeMemory(leftTupleSource.getLeftTupleSource()); + } + + private static boolean nodeWithMemory(NetworkNode node) { + return node.getType() == FromNode || node.getType() == ReactiveFromNode || node.getType() == AccumulateNode; } } diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/UnexpectedLoopTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/UnexpectedLoopTest.java new file mode 100644 index 00000000000..69975047075 --- /dev/null +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/UnexpectedLoopTest.java @@ -0,0 +1,75 @@ +/** + * 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.compiler.integrationtests; + +import java.util.Collection; +import java.util.List; + +import org.drools.compiler.integrationtests.model.CalcFact; +import org.drools.compiler.integrationtests.model.Item; +import org.drools.compiler.integrationtests.model.RecordFact; +import org.drools.testcoverage.common.util.KieBaseTestConfiguration; +import org.drools.testcoverage.common.util.KieBaseUtil; +import org.drools.testcoverage.common.util.TestParametersUtil; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.kie.api.KieBase; +import org.kie.api.runtime.KieSession; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(Parameterized.class) +public class UnexpectedLoopTest { + + private final KieBaseTestConfiguration kieBaseTestConfiguration; + + public UnexpectedLoopTest(final KieBaseTestConfiguration kieBaseTestConfiguration) { + this.kieBaseTestConfiguration = kieBaseTestConfiguration; + } + + @Parameterized.Parameters(name = "KieBase type={0}") + public static Collection getParameters() { + return TestParametersUtil.getKieBaseCloudConfigurations(true); + } + + @Test + public void joinFromFromPeerUpdate_shouldNotLoop() { + + final KieBase kieBase = KieBaseUtil.getKieBaseFromClasspathResources(getClass(), kieBaseTestConfiguration, + "org/drools/compiler/integrationtests/joinFromFrom.drl"); + final KieSession ksession = kieBase.newKieSession(); + try { + RecordFact record1 = new RecordFact(null, 0); + Item item1 = new Item(null); + CalcFact calcFact = new CalcFact(List.of(item1), 4144); + + ksession.insert("test"); + ksession.insert(record1); + ksession.insert(item1); + ksession.insert(calcFact); + + int fired = ksession.fireAllRules(10); + + assertThat(fired).as("Unexpected loop detected. Expects firing R2 once").isEqualTo(1); + } finally { + ksession.dispose(); + } + } +} diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/model/CalcFact.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/model/CalcFact.java new file mode 100644 index 00000000000..47afd6f718d --- /dev/null +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/model/CalcFact.java @@ -0,0 +1,34 @@ +package org.drools.compiler.integrationtests.model; + +import java.util.List; + +public class CalcFact { + + private List itemList; + private int lineNumber; + + public CalcFact(List itemList, int lineNumber) { + this.itemList = itemList; + this.lineNumber = lineNumber; + } + + public List getItemList() { + return itemList; + } + + public void setItemList(List itemList) { + this.itemList = itemList; + } + + public int getLineNumber() { + return lineNumber; + } + + @Override + public String toString() { + return "CalcFact{" + + "itemList=" + itemList + + ", lineNumber=" + lineNumber + + '}'; + } +} diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/model/Item.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/model/Item.java new file mode 100644 index 00000000000..665fc8b7b01 --- /dev/null +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/model/Item.java @@ -0,0 +1,25 @@ +package org.drools.compiler.integrationtests.model; + +public class Item { + + private String decomposedPointFlag; + + public Item(String decomposedPointFlag) { + this.decomposedPointFlag = decomposedPointFlag; + } + + public String getDecomposedPointFlag() { + return decomposedPointFlag; + } + + public void setDecomposedPointFlag(String decomposedPointFlag) { + this.decomposedPointFlag = decomposedPointFlag; + } + + @Override + public String toString() { + return "Item{" + + "pointFlag='" + decomposedPointFlag + '\'' + + '}'; + } +} diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/model/RecordFact.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/model/RecordFact.java new file mode 100644 index 00000000000..0338cc46cf9 --- /dev/null +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/model/RecordFact.java @@ -0,0 +1,34 @@ +package org.drools.compiler.integrationtests.model; + +import java.math.BigDecimal; + +public class RecordFact { + + private BigDecimal decomposedPoint; + private int lineNumber; + + public RecordFact(BigDecimal decomposedPoint, int lineNumber) { + this.decomposedPoint = decomposedPoint; + this.lineNumber = lineNumber; + } + + public BigDecimal getDecomposedPoint() { + return decomposedPoint; + } + + public void setDecomposedPoint(BigDecimal decomposedPoint) { + this.decomposedPoint = decomposedPoint; + } + + public int getLineNumber() { + return lineNumber; + } + + @Override + public String toString() { + return "RecordFact{" + + ", decomposedPoint=" + decomposedPoint + + ", lineNumber=" + lineNumber + + '}'; + } +} diff --git a/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/compiler/integrationtests/joinFromFrom.drl b/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/compiler/integrationtests/joinFromFrom.drl new file mode 100644 index 00000000000..329fe0efa56 --- /dev/null +++ b/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/compiler/integrationtests/joinFromFrom.drl @@ -0,0 +1,35 @@ +package org.drools.compiler.integrationtests; + +import org.drools.compiler.integrationtests.model.CalcFact; +import org.drools.compiler.integrationtests.model.Item; +import org.drools.compiler.integrationtests.model.RecordFact; + +dialect "mvel" + +rule R1 + when + String() + CalcFact( $lineNumber : lineNumber, $itemList : itemList ) + Integer() + then +end + +rule R2 + when + String() + $fact : CalcFact( $itemList : itemList ) + $item : Item( decomposedPointFlag == null ) from $itemList + $record : RecordFact( decomposedPoint == null ) + not RecordFact( lineNumber == $fact.lineNumber ) + then + modify($record){ + decomposedPoint = null + } + modify($item){ + decomposedPointFlag = "1" + } + modify($fact){ + itemList = $itemList + } + System.out.println("[DEBUG] after $item=" + $item); +end From 5e8a7eec13e8eaa5e106b8e74e5651fc026fbee3 Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Mon, 13 Nov 2023 08:19:14 +0100 Subject: [PATCH 28/41] [DROOLS-7587] fix session configuration lookup in session pool (#5585) --- .../kiesession/session/KieSessionsPoolImpl.java | 2 +- .../session/SessionsPoolTest.java | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drools-kiesession/src/main/java/org/drools/kiesession/session/KieSessionsPoolImpl.java b/drools-kiesession/src/main/java/org/drools/kiesession/session/KieSessionsPoolImpl.java index 042554ff4f6..670ced6c646 100644 --- a/drools-kiesession/src/main/java/org/drools/kiesession/session/KieSessionsPoolImpl.java +++ b/drools-kiesession/src/main/java/org/drools/kiesession/session/KieSessionsPoolImpl.java @@ -64,7 +64,7 @@ protected String getKey( String kSessionName, KieSessionConfiguration conf, bool protected StatefulSessionPool createStatefulSessionPool( String kSessionName, KieSessionConfiguration conf, boolean stateless ) { return new StatefulSessionPool(kBase, initialSize, () -> stateless ? - ((StatefulKnowledgeSessionImpl ) RuntimeComponentFactory.get().createStatefulSession(kBase, environment, ( SessionConfiguration ) conf, true )).setStateless( true ) : + ((StatefulKnowledgeSessionImpl ) RuntimeComponentFactory.get().createStatefulSession(kBase, environment, conf.as(SessionConfiguration.KEY), true )).setStateless( true ) : (StatefulKnowledgeSessionImpl ) kBase.newKieSession(conf, environment, true)); } diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/session/SessionsPoolTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/session/SessionsPoolTest.java index 5bc42bd12bc..737492325ba 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/session/SessionsPoolTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/session/SessionsPoolTest.java @@ -195,6 +195,23 @@ public void testStatelessKieSessionsPool() { assertThat(list.size()).isEqualTo(1); } + @Test + public void testStatelessKieSessionsPoolWithConf() { + KieServices kieServices = KieServices.get(); + + KieSessionsPool pool = getKieContainer().getKieBase().newKieSessionsPool( 1 ); + StatelessKieSession session = pool.newStatelessKieSession(kieServices.newKieSessionConfiguration()); + + List list = new ArrayList<>(); + session.setGlobal( "list", list ); + session.execute( "test" ); + assertThat(list.size()).isEqualTo(1); + + list.clear(); + session.execute( "test" ); + assertThat(list.size()).isEqualTo(1); + } + private KieContainer getKieContainer() { String drl = "global java.util.List list\n" + From 55a8ef17b6e58de1350ef9a3c86db39397c1b071 Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Wed, 15 Nov 2023 10:52:44 +0100 Subject: [PATCH 29/41] [DROOLS-7588] document soft expiration (#5586) --- .../rule-engine/_cep-memory-management-con.adoc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drools-docs/src/modules/ROOT/pages/rule-engine/_cep-memory-management-con.adoc b/drools-docs/src/modules/ROOT/pages/rule-engine/_cep-memory-management-con.adoc index c286ede97bd..6b26745f86d 100644 --- a/drools-docs/src/modules/ROOT/pages/rule-engine/_cep-memory-management-con.adoc +++ b/drools-docs/src/modules/ROOT/pages/rule-engine/_cep-memory-management-con.adoc @@ -18,8 +18,18 @@ end ---- This example rule sets any `StockPoint` events to expire after 30 minutes and to be removed from the KIE session if no other rules use the events. + -- +By default the expiration defined in this way is a hard expiration, which means that the {RULE_ENGINE} removes the event from the session immediately after this expiration time, regardless if there are rules that could still match the event. You can also define a soft expiration, which means that the {RULE_ENGINE} removes the event from the session only if no other rules use the event. It is possible to define a soft expiration policy for an event as it follows. + +[source] +---- +declare StockPoint + @expires( 30m, policy = TIME_SOFT ) +end +---- + * *Inferred expiration:* The {RULE_ENGINE} can calculate the expiration offset for a given event implicitly by analyzing the temporal constraints in the rules: + -- @@ -39,5 +49,5 @@ For this example rule, the {RULE_ENGINE} automatically calculates that whenever The same is applied to a sliding window of time `window:time()`, but a sliding window of length `window:length()` doesn't calculate its expiration. -The {RULE_ENGINE} analyzes the entire KIE base to find the offset for every event type and to ensure that no other rules use the events that are pending removal. Whenever an implicit expiration clashes with an explicit expiration value, the {RULE_ENGINE} uses the greater time frame of the two to store the event longer. +The {RULE_ENGINE} analyzes the entire KIE base to find the offset for every event type and to ensure that no other rules use the events that are pending removal. Whenever an implicit expiration clashes with an explicit expiration value, the explict one takes precedence if is hard (the default) while the implicit expiration is taken into account if the explicit one is defined as soft. -- From 9856d2db3afc3f99bfdff30416ae97ba4deae159 Mon Sep 17 00:00:00 2001 From: Umut Sahin Date: Mon, 27 Nov 2023 16:00:37 +0300 Subject: [PATCH 30/41] Updated AppPaths.java for better gradle compatibility (#5587) * Added better gradle compatibility to AppPaths * Updated headers to Apache * Updated findBuildTool method to better identify gradle * Reverted findBuildTool changes --- .../main/java/org/drools/codegen/common/AppPaths.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/AppPaths.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/AppPaths.java index 98655143bdd..37479b76a1c 100644 --- a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/AppPaths.java +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/AppPaths.java @@ -45,11 +45,12 @@ public static AppPaths.BuildTool findBuildTool() { private final Collection classesPaths = new ArrayList<>(); private final boolean isJar; + private final BuildTool bt; private final Path resourcesPath; private final Path outputTarget; public static AppPaths fromProjectDir(Path projectDir, Path outputTarget) { - return new AppPaths(Collections.singleton(projectDir), Collections.emptyList(), false, BuildTool.MAVEN, "main", outputTarget); + return new AppPaths(Collections.singleton(projectDir), Collections.emptyList(), false, BuildTool.findBuildTool(), "main", outputTarget); } /** @@ -59,7 +60,7 @@ public static AppPaths fromProjectDir(Path projectDir, Path outputTarget) { * @return */ public static AppPaths fromTestDir(Path projectDir) { - return new AppPaths(Collections.singleton(projectDir), Collections.emptyList(), false, BuildTool.MAVEN, "test", Paths.get(projectDir.toString(), TARGET_DIR)); + return new AppPaths(Collections.singleton(projectDir), Collections.emptyList(), false, BuildTool.findBuildTool(), "test", Paths.get(projectDir.toString(), TARGET_DIR)); } /** @@ -72,6 +73,7 @@ public static AppPaths fromTestDir(Path projectDir) { protected AppPaths(Set projectPaths, Collection classesPaths, boolean isJar, BuildTool bt, String resourcesBasePath, Path outputTarget) { this.isJar = isJar; + this.bt = bt; this.projectPaths.addAll(projectPaths); this.classesPaths.addAll(classesPaths); this.outputTarget = outputTarget; @@ -91,7 +93,9 @@ public Path[] getPaths() { } public Path getFirstProjectPath() { - return projectPaths.iterator().next(); + return bt == BuildTool.MAVEN + ? projectPaths.iterator().next() + : outputTarget; } private Path[] getJarPaths() { From f82e66f3dbbd6c9208e58084d39a088da8c25c31 Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Tue, 28 Nov 2023 08:25:32 +0100 Subject: [PATCH 31/41] [KIE-724] allow to write rules in yaml format making files with extension .drl.yaml to be a native drools resource type (#5592) * [KIE-724] allow to write rules in yaml format making files with extension .drl.yaml to be a native drools resource type * add missing header --- .../builder/impl/ResourceHandlerManager.java | 7 +- .../impl/resources/YamlResourceHandler.java | 67 ++++++++++ .../drools/drl/extensions/YamlFactory.java | 37 ++++++ .../drools/drl/extensions/YamlProvider.java | 27 ++++ .../org/drools/drlonyaml/cli/Drl2Yaml.java | 23 +--- .../org/drools/drlonyaml/cli/Yaml2Drl.java | 22 +--- .../pom.xml | 60 +++++++++ .../drlonyaml/integration/tests/Message.java | 36 ++++++ .../tests/ProgrammaticProjectTest.java | 115 ++++++++++++++++++ .../src/test/resources/logback.xml | 38 ++++++ .../org/drools/drlonyaml/model/Utils.java | 16 +++ .../drools-drlonyaml-todrl/pom.xml | 4 + .../drlonyaml/todrl/YAMLtoDrlDumper.java | 7 ++ .../drlonyaml/todrl/YamlProviderImpl.java | 38 ++++++ .../org.drools.drl.extensions.YamlProvider | 1 + drools-drlonyaml-parent/pom.xml | 1 + .../java/org/kie/api/io/ResourceType.java | 5 + 17 files changed, 466 insertions(+), 38 deletions(-) create mode 100644 drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/YamlResourceHandler.java create mode 100644 drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java create mode 100644 drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlProvider.java create mode 100644 drools-drlonyaml-parent/drools-drlonyaml-integration-tests/pom.xml create mode 100644 drools-drlonyaml-parent/drools-drlonyaml-integration-tests/src/test/java/org/drools/drlonyaml/integration/tests/Message.java create mode 100644 drools-drlonyaml-parent/drools-drlonyaml-integration-tests/src/test/java/org/drools/drlonyaml/integration/tests/ProgrammaticProjectTest.java create mode 100644 drools-drlonyaml-parent/drools-drlonyaml-integration-tests/src/test/resources/logback.xml create mode 100644 drools-drlonyaml-parent/drools-drlonyaml-todrl/src/main/java/org/drools/drlonyaml/todrl/YamlProviderImpl.java create mode 100644 drools-drlonyaml-parent/drools-drlonyaml-todrl/src/main/resources/META-INF/services/org.drools.drl.extensions.YamlProvider diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ResourceHandlerManager.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ResourceHandlerManager.java index 267fdb17ac8..816a1822d2d 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ResourceHandlerManager.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/ResourceHandlerManager.java @@ -26,6 +26,7 @@ import org.drools.compiler.builder.impl.resources.DslrResourceHandler; import org.drools.compiler.builder.impl.resources.ResourceHandler; import org.drools.compiler.builder.impl.resources.TemplateResourceHandler; +import org.drools.compiler.builder.impl.resources.YamlResourceHandler; import org.drools.drl.parser.lang.dsl.DefaultExpander; import org.kie.api.builder.ReleaseId; import org.kie.api.io.ResourceType; @@ -39,12 +40,14 @@ public class ResourceHandlerManager { public ResourceHandlerManager(KnowledgeBuilderConfigurationImpl configuration, ReleaseId releaseId, Supplier dslExpander){ this.mappers = asList( new DrlResourceHandler(configuration), + new YamlResourceHandler(configuration), new TemplateResourceHandler(configuration, releaseId, dslExpander), new DslrResourceHandler(configuration, dslExpander) , new DecisionTableResourceHandler(configuration, releaseId)); this.orderedResourceTypes = asList( ResourceType.DRL, + ResourceType.YAML, ResourceType.GDRL, ResourceType.RDRL, ResourceType.DESCR, @@ -59,10 +62,6 @@ public List getOrderedResourceTypes(){ return this.orderedResourceTypes; } - public List getMappers(){ - return this.mappers; - } - public ResourceHandler handlerForType(ResourceType type) { for (ResourceHandler mapper : this.mappers) { if (mapper.handles(type)) { diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/YamlResourceHandler.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/YamlResourceHandler.java new file mode 100644 index 00000000000..6c07fd13393 --- /dev/null +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/resources/YamlResourceHandler.java @@ -0,0 +1,67 @@ +/** + * 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.compiler.builder.impl.resources; + +import java.io.IOException; +import java.io.StringReader; + +import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; +import org.drools.drl.ast.descr.PackageDescr; +import org.drools.drl.extensions.YamlFactory; +import org.drools.drl.parser.DrlParser; +import org.drools.drl.parser.DroolsParserException; +import org.drools.drl.parser.ParserError; +import org.drools.io.DescrResource; +import org.kie.api.io.Resource; +import org.kie.api.io.ResourceConfiguration; +import org.kie.api.io.ResourceType; +import org.kie.internal.builder.conf.LanguageLevelOption; + +public class YamlResourceHandler extends ResourceHandler { + public YamlResourceHandler(KnowledgeBuilderConfigurationImpl configuration) { + super(configuration); + } + + @Override + public boolean handles(ResourceType type) { + return type == ResourceType.YAML; + } + + public PackageDescr process(Resource resource, ResourceConfiguration resourceConfig) throws DroolsParserException, IOException { + PackageDescr pkg; + boolean hasErrors = false; + if (resource instanceof DescrResource) { + pkg = (PackageDescr) ((DescrResource) resource).getDescr(); + } else { + String drl = YamlFactory.loadFromResource(resource); + DrlParser parser = new DrlParser(this.configuration.getOption(LanguageLevelOption.KEY)); + pkg = parser.parse(new StringReader(drl)); + this.results.addAll(parser.getErrors()); + if (pkg == null) { + this.results.add(new ParserError(resource, "Parser returned a null Package", 0, 0)); + } + hasErrors = parser.hasErrors(); + } + if (pkg != null) { + pkg.setResource(resource); + } + return hasErrors ? null : pkg; + } + +} \ No newline at end of file diff --git a/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java b/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java new file mode 100644 index 00000000000..fcfc21b9322 --- /dev/null +++ b/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java @@ -0,0 +1,37 @@ +/** + * 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.drl.extensions; + +import org.kie.api.internal.utils.KieService; +import org.kie.api.io.Resource; + +public class YamlFactory { + + private static class YamlProviderHolder { + private static final YamlProvider provider = KieService.load(YamlProvider.class); + } + + public static YamlProvider getYamlProvider() { + return YamlProviderHolder.provider; + } + + public static String loadFromResource(Resource resource) { + return getYamlProvider().loadFromResource(resource); + } +} diff --git a/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlProvider.java b/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlProvider.java new file mode 100644 index 00000000000..8fd017e9714 --- /dev/null +++ b/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlProvider.java @@ -0,0 +1,27 @@ +/** + * 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.drl.extensions; + +import org.kie.api.internal.utils.KieService; +import org.kie.api.io.Resource; + +public interface YamlProvider extends KieService { + + String loadFromResource(Resource resource); +} diff --git a/drools-drlonyaml-parent/drools-drlonyaml-cli/src/main/java/org/drools/drlonyaml/cli/Drl2Yaml.java b/drools-drlonyaml-parent/drools-drlonyaml-cli/src/main/java/org/drools/drlonyaml/cli/Drl2Yaml.java index 48230d48d1e..eb05d197280 100644 --- a/drools-drlonyaml-parent/drools-drlonyaml-cli/src/main/java/org/drools/drlonyaml/cli/Drl2Yaml.java +++ b/drools-drlonyaml-parent/drools-drlonyaml-cli/src/main/java/org/drools/drlonyaml/cli/Drl2Yaml.java @@ -18,9 +18,6 @@ */ package org.drools.drlonyaml.cli; -import static org.drools.drlonyaml.cli.utils.Utils.conventionInputStream; -import static org.drools.drlonyaml.cli.utils.Utils.conventionOutputConsumer; - import java.io.File; import java.io.InputStream; import java.io.StringReader; @@ -31,15 +28,14 @@ import org.drools.drl.parser.DrlParser; import org.drools.drlonyaml.model.DrlPackage; import org.drools.util.IoUtils; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; -import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature; - import picocli.CommandLine.Command; import picocli.CommandLine.Option; import picocli.CommandLine.Parameters; +import static org.drools.drlonyaml.cli.utils.Utils.conventionInputStream; +import static org.drools.drlonyaml.cli.utils.Utils.conventionOutputConsumer; +import static org.drools.drlonyaml.model.Utils.getYamlMapper; + /** * Note: beyond different annotations, Parameters and Options are managed per subcommand, * in order to have them listed after the specific subcommand on the CLI. @@ -55,14 +51,7 @@ public class Drl2Yaml implements Callable { private InputStream inputStream; private static final DrlParser drlParser = new DrlParser(); - private static final ObjectMapper mapper; - static { - YAMLFactory yamlFactory = YAMLFactory.builder() - .enable(Feature.MINIMIZE_QUOTES) - .build(); - mapper = new ObjectMapper(yamlFactory); - } - + @Override public Integer call() throws Exception { inputStream = conventionInputStream(inputFile); @@ -76,7 +65,7 @@ public static String drl2yaml(String drl) throws Exception { PackageDescr pkgDescr = drlParser.parse(new StringReader(drl)); DrlPackage model = DrlPackage.from(pkgDescr); StringWriter writer = new StringWriter(); - mapper.writeValue(writer, model); + getYamlMapper().writeValue(writer, model); final String yaml = writer.toString(); writer.close(); return yaml; diff --git a/drools-drlonyaml-parent/drools-drlonyaml-cli/src/main/java/org/drools/drlonyaml/cli/Yaml2Drl.java b/drools-drlonyaml-parent/drools-drlonyaml-cli/src/main/java/org/drools/drlonyaml/cli/Yaml2Drl.java index 35ed656881f..00123c54dfd 100644 --- a/drools-drlonyaml-parent/drools-drlonyaml-cli/src/main/java/org/drools/drlonyaml/cli/Yaml2Drl.java +++ b/drools-drlonyaml-parent/drools-drlonyaml-cli/src/main/java/org/drools/drlonyaml/cli/Yaml2Drl.java @@ -18,9 +18,6 @@ */ package org.drools.drlonyaml.cli; -import static org.drools.drlonyaml.cli.utils.Utils.conventionInputStream; -import static org.drools.drlonyaml.cli.utils.Utils.conventionOutputConsumer; - import java.io.File; import java.io.InputStream; import java.util.concurrent.Callable; @@ -28,15 +25,14 @@ import org.drools.drlonyaml.model.DrlPackage; import org.drools.drlonyaml.todrl.YAMLtoDrlDumper; import org.drools.util.IoUtils; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; -import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature; - import picocli.CommandLine.Command; import picocli.CommandLine.Option; import picocli.CommandLine.Parameters; +import static org.drools.drlonyaml.cli.utils.Utils.conventionInputStream; +import static org.drools.drlonyaml.cli.utils.Utils.conventionOutputConsumer; +import static org.drools.drlonyaml.model.Utils.getYamlMapper; + /** * Note: beyond different annotations, Parameters and Options are managed per subcommand, * in order to have them listed after the specific subcommand on the CLI. @@ -51,14 +47,6 @@ public class Yaml2Drl implements Callable { private File inputFile; private InputStream inputStream; - private static final ObjectMapper mapper; - static { - YAMLFactory yamlFactory = YAMLFactory.builder() - .enable(Feature.MINIMIZE_QUOTES) - .build(); - mapper = new ObjectMapper(yamlFactory); - } - @Override public Integer call() throws Exception { inputStream = conventionInputStream(inputFile); @@ -69,7 +57,7 @@ public Integer call() throws Exception { } public static String yaml2drl(String yaml) throws Exception { - DrlPackage readValue = mapper.readValue(yaml, DrlPackage.class); + DrlPackage readValue = getYamlMapper().readValue(yaml, DrlPackage.class); final String drlText = YAMLtoDrlDumper.dumpDRL(readValue); return drlText; } diff --git a/drools-drlonyaml-parent/drools-drlonyaml-integration-tests/pom.xml b/drools-drlonyaml-parent/drools-drlonyaml-integration-tests/pom.xml new file mode 100644 index 00000000000..4acce993d56 --- /dev/null +++ b/drools-drlonyaml-parent/drools-drlonyaml-integration-tests/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + + org.drools + drools-drlonyaml-parent + 8.45.0-SNAPSHOT + + drools-drlonyaml-integration-tests + Drools :: DRL on YAML :: Integration Tests + + + org.drools.drlonyaml.integration.tests + + + + + org.drools + drools-drlonyaml-todrl + + + org.drools + drools-engine + + + ch.qos.logback + logback-classic + test + + + junit + junit + test + + + org.assertj + assertj-core + test + + + diff --git a/drools-drlonyaml-parent/drools-drlonyaml-integration-tests/src/test/java/org/drools/drlonyaml/integration/tests/Message.java b/drools-drlonyaml-parent/drools-drlonyaml-integration-tests/src/test/java/org/drools/drlonyaml/integration/tests/Message.java new file mode 100644 index 00000000000..ca5d3e51049 --- /dev/null +++ b/drools-drlonyaml-parent/drools-drlonyaml-integration-tests/src/test/java/org/drools/drlonyaml/integration/tests/Message.java @@ -0,0 +1,36 @@ +/** + * 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.drlonyaml.integration.tests; + +public class Message { + + private final String text; + + public Message(String text) { + this.text = text; + } + + public String getText() { + return text; + } + + public int getSize() { + return text.length(); + } +} diff --git a/drools-drlonyaml-parent/drools-drlonyaml-integration-tests/src/test/java/org/drools/drlonyaml/integration/tests/ProgrammaticProjectTest.java b/drools-drlonyaml-parent/drools-drlonyaml-integration-tests/src/test/java/org/drools/drlonyaml/integration/tests/ProgrammaticProjectTest.java new file mode 100644 index 00000000000..b9259d09f1c --- /dev/null +++ b/drools-drlonyaml-parent/drools-drlonyaml-integration-tests/src/test/java/org/drools/drlonyaml/integration/tests/ProgrammaticProjectTest.java @@ -0,0 +1,115 @@ +/** + * 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.drlonyaml.integration.tests; + +import java.io.StringReader; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; + +import org.drools.drl.ast.descr.PackageDescr; +import org.drools.drl.parser.DrlParser; +import org.drools.drlonyaml.model.DrlPackage; +import org.drools.model.codegen.ExecutableModelProject; +import org.junit.Test; +import org.kie.api.runtime.KieSession; +import org.kie.internal.utils.KieHelper; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.drools.drlonyaml.model.Utils.getYamlMapper; + +public class ProgrammaticProjectTest { + + @Test + public void testDrl() { + KieSession ksession = new KieHelper() + .addContent(getDrlRule(), "org/drools/drlonyaml/integration/tests/rule.drl") + .build(ExecutableModelProject.class) + .newKieSession(); + + checkKieSession(ksession); + } + + @Test + public void testYaml() { + KieSession ksession = new KieHelper() + .addContent(getYamlRule(), "org/drools/drlonyaml/integration/tests/rule.drl.yaml") + .build(ExecutableModelProject.class) + .newKieSession(); + + checkKieSession(ksession); + } + + private static void checkKieSession(KieSession ksession) { + List result = new ArrayList<>(); + ksession.setGlobal("result", result); + + ksession.insert(new Message("test")); + ksession.insert(new Message("Hello World")); + ksession.insert(10); + ksession.insert(11); + + int count = ksession.fireAllRules(); + assertThat(count).isEqualTo(1); + assertThat(result).hasSize(1); + assertThat(result.get(0)).isEqualTo("Hello World"); + } + + private String drl2yaml(String drl) { + try (StringWriter writer = new StringWriter()) { + PackageDescr pkgDescr = new DrlParser().parse(new StringReader(drl)); + DrlPackage model = DrlPackage.from(pkgDescr); + getYamlMapper().writeValue(writer, model); + return writer.toString(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private String getDrlRule() { + return "package org.drools.drlonyaml.integration.tests\n" + + "\n" + + "global java.util.List result;\n" + + "\n" + + "rule R when\n" + + " $i : Integer()\n" + + " $m : Message( size == $i )\n" + + "then\n" + + " result.add( $m.getText() );\n" + + "end"; + } + + private String getYamlRule() { + return "name: org.drools.drlonyaml.integration.tests\n" + + "globals:\n" + + "- type: java.util.List\n" + + " id: result\n" + + "rules:\n" + + "- name: R\n" + + " when:\n" + + " - given: Integer\n" + + " as: $i\n" + + " - given: Message\n" + + " as: $m\n" + + " having:\n" + + " - size == $i\n" + + " then: |\n" + + " result.add( $m.getText() );"; + } +} diff --git a/drools-drlonyaml-parent/drools-drlonyaml-integration-tests/src/test/resources/logback.xml b/drools-drlonyaml-parent/drools-drlonyaml-integration-tests/src/test/resources/logback.xml new file mode 100644 index 00000000000..2e72b33bc53 --- /dev/null +++ b/drools-drlonyaml-parent/drools-drlonyaml-integration-tests/src/test/resources/logback.xml @@ -0,0 +1,38 @@ + + + + + + + + %-5level %msg%n + + + + + + + + + + + diff --git a/drools-drlonyaml-parent/drools-drlonyaml-model/src/main/java/org/drools/drlonyaml/model/Utils.java b/drools-drlonyaml-parent/drools-drlonyaml-model/src/main/java/org/drools/drlonyaml/model/Utils.java index a6c7f138a0c..7c5836be996 100644 --- a/drools-drlonyaml-parent/drools-drlonyaml-model/src/main/java/org/drools/drlonyaml/model/Utils.java +++ b/drools-drlonyaml-parent/drools-drlonyaml-model/src/main/java/org/drools/drlonyaml/model/Utils.java @@ -21,6 +21,9 @@ import java.util.ArrayList; import java.util.List; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator; import org.drools.drl.ast.descr.AndDescr; import org.drools.drl.ast.descr.BaseDescr; import org.drools.drl.ast.descr.ExistsDescr; @@ -28,6 +31,15 @@ import org.drools.drl.ast.descr.PatternDescr; public class Utils { + private static final ObjectMapper mapper; + + static { + YAMLFactory yamlFactory = YAMLFactory.builder() + .enable(YAMLGenerator.Feature.MINIMIZE_QUOTES) + .build(); + mapper = new ObjectMapper(yamlFactory); + } + private Utils() { // only static methods. } @@ -53,4 +65,8 @@ public static List from(List descrs) { } return results; } + + public static ObjectMapper getYamlMapper() { + return mapper; + } } diff --git a/drools-drlonyaml-parent/drools-drlonyaml-todrl/pom.xml b/drools-drlonyaml-parent/drools-drlonyaml-todrl/pom.xml index 37a2ab9fbcf..ca6a18e6e48 100644 --- a/drools-drlonyaml-parent/drools-drlonyaml-todrl/pom.xml +++ b/drools-drlonyaml-parent/drools-drlonyaml-todrl/pom.xml @@ -33,6 +33,10 @@ + + org.drools + drools-drl-extensions + org.drools drools-drlonyaml-model diff --git a/drools-drlonyaml-parent/drools-drlonyaml-todrl/src/main/java/org/drools/drlonyaml/todrl/YAMLtoDrlDumper.java b/drools-drlonyaml-parent/drools-drlonyaml-todrl/src/main/java/org/drools/drlonyaml/todrl/YAMLtoDrlDumper.java index 9c615393c27..7d937a1629c 100644 --- a/drools-drlonyaml-parent/drools-drlonyaml-todrl/src/main/java/org/drools/drlonyaml/todrl/YAMLtoDrlDumper.java +++ b/drools-drlonyaml-parent/drools-drlonyaml-todrl/src/main/java/org/drools/drlonyaml/todrl/YAMLtoDrlDumper.java @@ -27,6 +27,8 @@ import freemarker.template.Template; import freemarker.template.TemplateExceptionHandler; +import static org.drools.drlonyaml.model.Utils.getYamlMapper; + public class YAMLtoDrlDumper { public static final Configuration CONFIGURATION = config(); @@ -50,4 +52,9 @@ public static String dumpDRL(DrlPackage drl) throws Exception { out.close(); return result; } + + public static String yaml2drl(String yaml) throws Exception { + DrlPackage readValue = getYamlMapper().readValue(yaml, DrlPackage.class); + return YAMLtoDrlDumper.dumpDRL(readValue); + } } diff --git a/drools-drlonyaml-parent/drools-drlonyaml-todrl/src/main/java/org/drools/drlonyaml/todrl/YamlProviderImpl.java b/drools-drlonyaml-parent/drools-drlonyaml-todrl/src/main/java/org/drools/drlonyaml/todrl/YamlProviderImpl.java new file mode 100644 index 00000000000..fe8924750eb --- /dev/null +++ b/drools-drlonyaml-parent/drools-drlonyaml-todrl/src/main/java/org/drools/drlonyaml/todrl/YamlProviderImpl.java @@ -0,0 +1,38 @@ +/** + * 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.drlonyaml.todrl; + +import org.drools.drl.extensions.YamlProvider; +import org.drools.util.IoUtils; +import org.kie.api.io.Resource; + +import static org.drools.drlonyaml.todrl.YAMLtoDrlDumper.yaml2drl; + +public class YamlProviderImpl implements YamlProvider { + + @Override + public String loadFromResource(Resource resource) { + try { + String content = new String(IoUtils.readBytesFromInputStream(resource.getInputStream())); + return yaml2drl(content); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/drools-drlonyaml-parent/drools-drlonyaml-todrl/src/main/resources/META-INF/services/org.drools.drl.extensions.YamlProvider b/drools-drlonyaml-parent/drools-drlonyaml-todrl/src/main/resources/META-INF/services/org.drools.drl.extensions.YamlProvider new file mode 100644 index 00000000000..47adfda8c25 --- /dev/null +++ b/drools-drlonyaml-parent/drools-drlonyaml-todrl/src/main/resources/META-INF/services/org.drools.drl.extensions.YamlProvider @@ -0,0 +1 @@ +org.drools.drlonyaml.todrl.YamlProviderImpl \ No newline at end of file diff --git a/drools-drlonyaml-parent/pom.xml b/drools-drlonyaml-parent/pom.xml index db0bfdba1d3..66f2239ee3a 100644 --- a/drools-drlonyaml-parent/pom.xml +++ b/drools-drlonyaml-parent/pom.xml @@ -36,5 +36,6 @@ drools-drlonyaml-todrl drools-drlonyaml-cli drools-drlonyaml-cli-tests + drools-drlonyaml-integration-tests diff --git a/kie-api/src/main/java/org/kie/api/io/ResourceType.java b/kie-api/src/main/java/org/kie/api/io/ResourceType.java index 3b0f22416c3..868e2698537 100644 --- a/kie-api/src/main/java/org/kie/api/io/ResourceType.java +++ b/kie-api/src/main/java/org/kie/api/io/ResourceType.java @@ -258,6 +258,11 @@ public static ResourceType addResourceTypeToRegistry(final String resourceType, "src/main/resources", "no_op"); + public static final ResourceType YAML = addResourceTypeToRegistry("YAML", + "YAML format DRL", + "src/main/resources", + "drl.yaml", "drl.yml"); + public static ResourceType determineResourceType(final String resourceName) { for ( Map.Entry entry : CACHE.entrySet() ) { if (resourceName.endsWith(entry.getKey())) { From bdf4e86ec9e44cbdcddaee9339e3e6a13f2fac57 Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Wed, 29 Nov 2023 10:19:18 +0100 Subject: [PATCH 32/41] [KIE-726] create a maven archetype for rules in yaml format (#5595) --- .../drools/drl/extensions/YamlFactory.java | 10 ++ .../kie-drools-yaml-archetype/.gitignore | 14 ++ .../kie-drools-yaml-archetype/pom.xml | 90 +++++++++++++ .../META-INF/maven/archetype-metadata.xml | 71 ++++++++++ .../resources/archetype-resources/pom.xml | 100 ++++++++++++++ .../src/main/java/Measurement.java | 71 ++++++++++ .../src/main/resources/META-INF/kmodule.xml | 27 ++++ .../src/main/resources/rules.drl.yaml | 30 +++++ .../src/test/java/RuleTest.java | 123 ++++++++++++++++++ .../src/test/resources/logback-test.xml | 32 +++++ .../archetype.properties | 27 ++++ .../projects/integrationtestDefaults/goal.txt | 1 + .../integrationtestDefaults/reference/pom.xml | 97 ++++++++++++++ .../src/main/java/it/pkg/Measurement.java | 51 ++++++++ .../src/main/resources/META-INF/kmodule.xml | 24 ++++ .../src/main/resources/it/pkg/rules.drl.yaml | 14 ++ .../src/test/java/it/pkg/RuleTest.java | 103 +++++++++++++++ .../src/test/resources/logback-test.xml | 32 +++++ kie-archetypes/pom.xml | 1 + kie-maven-plugin/pom.xml | 5 + .../invoker.properties | 26 ++++ .../pom.xml | 77 +++++++++++ .../src/main/java/org/yaml/Measurement.java | 51 ++++++++ .../src/main/resources/META-INF/kmodule.xml | 27 ++++ .../main/resources/org/yaml/rules.drl.yaml | 13 ++ .../kie/maven/plugin/ittests/YamlTestIT.java | 85 ++++++++++++ 26 files changed, 1202 insertions(+) create mode 100644 kie-archetypes/kie-drools-yaml-archetype/.gitignore create mode 100644 kie-archetypes/kie-drools-yaml-archetype/pom.xml create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/pom.xml create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/java/Measurement.java create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/resources/rules.drl.yaml create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/test/java/RuleTest.java create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/test/resources/logback-test.xml create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/archetype.properties create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/goal.txt create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/pom.xml create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/java/it/pkg/Measurement.java create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/resources/META-INF/kmodule.xml create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/resources/it/pkg/rules.drl.yaml create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/test/java/it/pkg/RuleTest.java create mode 100644 kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/test/resources/logback-test.xml create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/invoker.properties create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/pom.xml create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/java/org/yaml/Measurement.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/resources/META-INF/kmodule.xml create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/resources/org/yaml/rules.drl.yaml create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/test/java-filtered/org/kie/maven/plugin/ittests/YamlTestIT.java diff --git a/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java b/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java index fcfc21b9322..ef564015bd0 100644 --- a/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java +++ b/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java @@ -18,20 +18,30 @@ */ package org.drools.drl.extensions; +import org.drools.base.common.MissingDependencyException; import org.kie.api.internal.utils.KieService; import org.kie.api.io.Resource; public class YamlFactory { + private static final String NO_YAML = "You're trying to parse a rule file in YAML format without having drools yaml support. Please add the module org.drools:drools-drlonyaml-todrl to your classpath."; + private static class YamlProviderHolder { private static final YamlProvider provider = KieService.load(YamlProvider.class); } public static YamlProvider getYamlProvider() { + if (YamlProviderHolder.provider == null) { + throwExceptionForMissingYaml(); + } return YamlProviderHolder.provider; } public static String loadFromResource(Resource resource) { return getYamlProvider().loadFromResource(resource); } + + private static void throwExceptionForMissingYaml() { + throw new MissingDependencyException(NO_YAML); + } } diff --git a/kie-archetypes/kie-drools-yaml-archetype/.gitignore b/kie-archetypes/kie-drools-yaml-archetype/.gitignore new file mode 100644 index 00000000000..adf03446e4d --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/.gitignore @@ -0,0 +1,14 @@ +/target +/local + +# Eclipse, Netbeans and IntelliJ files +/.* +!.gitignore +/nbproject +/*.ipr +/*.iws +/*.iml +*.xpr + +# Repository wide ignore mac DS_Store files +.DS_Store diff --git a/kie-archetypes/kie-drools-yaml-archetype/pom.xml b/kie-archetypes/kie-drools-yaml-archetype/pom.xml new file mode 100644 index 00000000000..b684ef46d9a --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/pom.xml @@ -0,0 +1,90 @@ + + + + 4.0.0 + + org.kie + kie-archetypes + 8.45.0-SNAPSHOT + + + kie-drools-yaml-archetype + maven-archetype + + KIE :: Drools Maven Archetype with Executable Model and YAML format rules + + Drools rule example with executable model and traditional API and rule style with rules in yaml format. + Use property droolsVersion to specify which version of Drools to use in a generated project. + + http://drools.org + + + $ + + + + + + src/main/resources + true + + + + + src/test/resources + false + + **/pom.xml + **/archetype.properties + + + + src/test/resources + true + + **/pom.xml + **/archetype.properties + + + + + + + org.apache.maven.archetype + archetype-packaging + 3.2.1 + + + + + + + maven-archetype-plugin + 3.2.1 + + true + + + + + + diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml new file mode 100644 index 00000000000..9d9247c21ec --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -0,0 +1,71 @@ + + + + + + ${project.version} + + + ${version.org.slf4j} + + + ${version.junit} + + + ${version.ch.qos.logback} + + + + + src/main/java + + **/*.java + + + + src/main/resources + + **/*.xml + + + + src/main/resources + + **/*.drl.yaml + + + + src/test/java + + **/*.java + + + + src/test/resources + + **/*.xml + + + + diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/pom.xml b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 00000000000..163da146465 --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,100 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) + + + + 4.0.0 + + ${dollar}{groupId} + ${dollar}{artifactId} + ${dollar}{version} + kjar + + ${dollar}{artifactId} + + + UTF-8 + 11 + ${droolsVersion} + ${slf4jVersion} + ${junitVersion} + ${logbackVersion} + + + + + + org.drools + drools-bom + pom + ${drools-version} + import + + + + + + + + org.drools + drools-engine + + + org.drools + drools-drlonyaml-todrl + + + org.drools + drools-xml-support + + + + junit + junit + ${junit-version} + test + + + ch.qos.logback + logback-classic + ${logback-version} + test + + + + + + + maven-compiler-plugin + 3.8.1 + + + org.kie + kie-maven-plugin + ${drools-version} + true + + + + + diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/java/Measurement.java b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/java/Measurement.java new file mode 100644 index 00000000000..9c8f9f2950e --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/java/Measurement.java @@ -0,0 +1,71 @@ +/** + * 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. + */ +#* + * 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. +*# +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +package ${package}; + +public class Measurement { + private String id; + private String val; + + public Measurement(String id, String val) { + super(); + this.id = id; + this.val = val; + } + + public String getId() { + return id; + } + + public String getVal() { + return val; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("Measurement ["); + if (id != null) + builder.append("id=").append(id).append(", "); + if (val != null) + builder.append("val=").append(val); + builder.append("]"); + return builder.toString(); + } +} diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml new file mode 100644 index 00000000000..d0701d88834 --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml @@ -0,0 +1,27 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) + + + + + diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/resources/rules.drl.yaml b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/resources/rules.drl.yaml new file mode 100644 index 00000000000..3bf3bcd0cb6 --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/resources/rules.drl.yaml @@ -0,0 +1,30 @@ +#* +* Copyright 2022 Red Hat, Inc. and/or its affiliates. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* +* 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. +*# +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +name: ${package} +globals: +- type: java.util.Set + id: controlSet +rules: +- name: will execute per each Measurement having ID color + when: + - given: Measurement + having: + - id == "color" + - "$colorVal : val" + then: | + controlSet.add($colorVal); \ No newline at end of file diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/test/java/RuleTest.java b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/test/java/RuleTest.java new file mode 100644 index 00000000000..050caa121fe --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/test/java/RuleTest.java @@ -0,0 +1,123 @@ +/** + * 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. + */ +#* + * 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. +*# +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +package ${package}; + +import java.util.HashSet; +import java.util.Set; + +import org.drools.model.codegen.ExecutableModelProject; +import org.junit.Test; +import org.kie.api.KieBase; +import org.kie.api.KieServices; +import org.kie.api.builder.KieFileSystem; +import org.kie.api.builder.ReleaseId; +import org.kie.api.definition.KiePackage; +import org.kie.api.definition.rule.Rule; +import org.kie.api.runtime.KieContainer; +import org.kie.api.runtime.KieSession; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class RuleTest { + static final Logger LOG = LoggerFactory.getLogger(RuleTest.class); + + @Test + public void test() { + KieContainer kContainer = createKieContainer(); + + LOG.info("Creating kieBase"); + KieBase kieBase = kContainer.getKieBase(); + + LOG.info("There should be rules: "); + for ( KiePackage kp : kieBase.getKiePackages() ) { + for (Rule rule : kp.getRules()) { + LOG.info("kp " + kp + " rule " + rule.getName()); + } + } + + LOG.info("Creating kieSession"); + KieSession session = kieBase.newKieSession(); + + try { + LOG.info("Populating globals"); + Set check = new HashSet(); + session.setGlobal("controlSet", check); + + LOG.info("Now running data"); + + Measurement mRed = new Measurement("color", "red"); + session.insert(mRed); + session.fireAllRules(); + + Measurement mGreen = new Measurement("color", "green"); + session.insert(mGreen); + session.fireAllRules(); + + Measurement mBlue = new Measurement("color", "blue"); + session.insert(mBlue); + session.fireAllRules(); + + LOG.info("Final checks"); + + assertEquals("Size of object in Working Memory is 3", 3, session.getObjects().size()); + assertTrue("contains red", check.contains("red")); + assertTrue("contains green", check.contains("green")); + assertTrue("contains blue", check.contains("blue")); + } finally { + session.dispose(); + } + } + + private KieContainer createKieContainer() { + // Programmatically collect resources and build a KieContainer + KieServices ks = KieServices.Factory.get(); + KieFileSystem kfs = ks.newKieFileSystem(); + String packagePath = "${dollar}{package}".replace(".", "/"); + kfs.write("src/main/resources/" + packagePath + "/rules.drl.yaml", + ks.getResources().newInputStreamResource(this.getClass().getClassLoader().getResourceAsStream(packagePath + "/rules.drl.yaml"))); + ReleaseId releaseId = ks.newReleaseId("${dollar}{groupId}", "${dollar}{artifactId}", "${dollar}{version}"); + kfs.generateAndWritePomXML(releaseId); + ks.newKieBuilder(kfs).buildAll(ExecutableModelProject.class); + return ks.newKieContainer(releaseId); + } +} \ No newline at end of file diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/test/resources/logback-test.xml b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/test/resources/logback-test.xml new file mode 100644 index 00000000000..58a20a47330 --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/test/resources/logback-test.xml @@ -0,0 +1,32 @@ + + + + + + %d [%t] %-5p %m%n + + + + + + + \ No newline at end of file diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/archetype.properties b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/archetype.properties new file mode 100644 index 00000000000..c7ece5a6066 --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/archetype.properties @@ -0,0 +1,27 @@ +# +# 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=it.pkg +version=0.1-SNAPSHOT +groupId=archetype.it +artifactId=basic +droolsVersion=${project.version} +slf4jVersion=1.7.2 +junitVersion=4.11 +logbackVersion=1.2.9 diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/goal.txt b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/goal.txt new file mode 100644 index 00000000000..31ed2f87a27 --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/goal.txt @@ -0,0 +1 @@ +clean verify diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/pom.xml b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/pom.xml new file mode 100644 index 00000000000..cf2ffc0924c --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/pom.xml @@ -0,0 +1,97 @@ + + + + 4.0.0 + + archetype.it + basic + 0.1-SNAPSHOT + kjar + + basic + + + UTF-8 + 11 + ${project.version} + 1.7.2 + 4.11 + 1.2.9 + + + + + + org.drools + drools-bom + pom + ${dollar}{drools-version} + import + + + + + + + + org.drools + drools-engine + + + org.drools + drools-drlonyaml-todrl + + + org.drools + drools-xml-support + + + + junit + junit + ${junit-version} + test + + + ch.qos.logback + logback-classic + ${logback-version} + test + + + + + + + maven-compiler-plugin + 3.8.1 + + + org.kie + kie-maven-plugin + ${drools-version} + true + + + + + diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/java/it/pkg/Measurement.java b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/java/it/pkg/Measurement.java new file mode 100644 index 00000000000..26a3ff54708 --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/java/it/pkg/Measurement.java @@ -0,0 +1,51 @@ +/** + * 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 it.pkg; + +public class Measurement { + private String id; + private String val; + + public Measurement(String id, String val) { + super(); + this.id = id; + this.val = val; + } + + public String getId() { + return id; + } + + public String getVal() { + return val; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("Measurement ["); + if (id != null) + builder.append("id=").append(id).append(", "); + if (val != null) + builder.append("val=").append(val); + builder.append("]"); + return builder.toString(); + } +} diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/resources/META-INF/kmodule.xml b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/resources/META-INF/kmodule.xml new file mode 100644 index 00000000000..decf47d1de2 --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/resources/META-INF/kmodule.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/resources/it/pkg/rules.drl.yaml b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/resources/it/pkg/rules.drl.yaml new file mode 100644 index 00000000000..62a2f1944a4 --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/resources/it/pkg/rules.drl.yaml @@ -0,0 +1,14 @@ + +name: it.pkg +globals: +- type: java.util.Set + id: controlSet +rules: +- name: will execute per each Measurement having ID color + when: + - given: Measurement + having: + - id == "color" + - "$colorVal : val" + then: | + controlSet.add($colorVal); \ No newline at end of file diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/test/java/it/pkg/RuleTest.java b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/test/java/it/pkg/RuleTest.java new file mode 100644 index 00000000000..07dd2a90bc7 --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/test/java/it/pkg/RuleTest.java @@ -0,0 +1,103 @@ +/** + * 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 it.pkg; + +import java.util.HashSet; +import java.util.Set; + +import org.drools.model.codegen.ExecutableModelProject; +import org.junit.Test; +import org.kie.api.KieBase; +import org.kie.api.KieServices; +import org.kie.api.builder.KieFileSystem; +import org.kie.api.builder.ReleaseId; +import org.kie.api.definition.KiePackage; +import org.kie.api.definition.rule.Rule; +import org.kie.api.runtime.KieContainer; +import org.kie.api.runtime.KieSession; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class RuleTest { + static final Logger LOG = LoggerFactory.getLogger(RuleTest.class); + + @Test + public void test() { + KieContainer kContainer = createKieContainer(); + + LOG.info("Creating kieBase"); + KieBase kieBase = kContainer.getKieBase(); + + LOG.info("There should be rules: "); + for ( KiePackage kp : kieBase.getKiePackages() ) { + for (Rule rule : kp.getRules()) { + LOG.info("kp " + kp + " rule " + rule.getName()); + } + } + + LOG.info("Creating kieSession"); + KieSession session = kieBase.newKieSession(); + + try { + LOG.info("Populating globals"); + Set check = new HashSet(); + session.setGlobal("controlSet", check); + + LOG.info("Now running data"); + + Measurement mRed = new Measurement("color", "red"); + session.insert(mRed); + session.fireAllRules(); + + Measurement mGreen = new Measurement("color", "green"); + session.insert(mGreen); + session.fireAllRules(); + + Measurement mBlue = new Measurement("color", "blue"); + session.insert(mBlue); + session.fireAllRules(); + + LOG.info("Final checks"); + + assertEquals("Size of object in Working Memory is 3", 3, session.getObjects().size()); + assertTrue("contains red", check.contains("red")); + assertTrue("contains green", check.contains("green")); + assertTrue("contains blue", check.contains("blue")); + } finally { + session.dispose(); + } + } + + private KieContainer createKieContainer() { + // Programmatically collect resources and build a KieContainer + KieServices ks = KieServices.Factory.get(); + KieFileSystem kfs = ks.newKieFileSystem(); + String packagePath = "it.pkg".replace(".", "/"); + kfs.write("src/main/resources/" + packagePath + "/rules.drl.yaml", + ks.getResources().newInputStreamResource(this.getClass().getClassLoader().getResourceAsStream(packagePath + "/rules.drl.yaml"))); + ReleaseId releaseId = ks.newReleaseId("archetype.it", "basic", "0.1-SNAPSHOT"); + kfs.generateAndWritePomXML(releaseId); + ks.newKieBuilder(kfs).buildAll(ExecutableModelProject.class); + return ks.newKieContainer(releaseId); + } +} \ No newline at end of file diff --git a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/test/resources/logback-test.xml b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/test/resources/logback-test.xml new file mode 100644 index 00000000000..58a20a47330 --- /dev/null +++ b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/test/resources/logback-test.xml @@ -0,0 +1,32 @@ + + + + + + %d [%t] %-5p %m%n + + + + + + + \ No newline at end of file diff --git a/kie-archetypes/pom.xml b/kie-archetypes/pom.xml index d06d304611c..3b9d4eb99de 100644 --- a/kie-archetypes/pom.xml +++ b/kie-archetypes/pom.xml @@ -40,6 +40,7 @@ kie-drools-dmn-archetype kie-drools-exec-model-ruleunit-archetype kie-drools-exec-model-archetype + kie-drools-yaml-archetype diff --git a/kie-maven-plugin/pom.xml b/kie-maven-plugin/pom.xml index 0605f956983..6483ad51852 100644 --- a/kie-maven-plugin/pom.xml +++ b/kie-maven-plugin/pom.xml @@ -255,6 +255,11 @@ drools-decisiontables runtime + + org.drools + drools-drlonyaml-todrl + runtime + org.drools drools-templates diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/invoker.properties b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/invoker.properties new file mode 100644 index 00000000000..c5669b72883 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/invoker.properties @@ -0,0 +1,26 @@ +# +# 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 comma or space separated list of goals/phases to execute, may +# specify an empty list to execute the default goal of the IT project. +# Environment variables used by maven plugins can be added here +invoker.goals = clean install + +# Uncomment the following to debug invoker. Do note that you have to connect the remote debugger after "maven-invoker-plugin:3.2.0:run" has been print on console +#invoker.mavenOpts=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/pom.xml b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/pom.xml new file mode 100644 index 00000000000..1471752feb6 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/pom.xml @@ -0,0 +1,77 @@ + + + + + + 4.0.0 + + org.kie + kie-maven-plugin-test-kjar-parent + @org.kie.version@ + ../kie-maven-plugin-test-kjar-setup/kie-maven-plugin-test-kjar-parent/pom.xml + + + kie-maven-plugin-test-kjar-15-yaml + + kjar + + + + + org.kie + kie-api + ${org.kie.version} + + + org.drools + drools-model-compiler + ${org.kie.version} + + + org.drools + drools-canonical-model + ${org.kie.version} + + + org.drools + drools-core + ${org.kie.version} + + + org.drools + drools-compiler + ${org.kie.version} + + + org.drools + drools-drlonyaml-todrl + ${org.kie.version} + + + org.kie + kie-maven-plugin-test-kjar-common + @org.kie.version@ + + + + diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/java/org/yaml/Measurement.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/java/org/yaml/Measurement.java new file mode 100644 index 00000000000..e341d6943d5 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/java/org/yaml/Measurement.java @@ -0,0 +1,51 @@ +/** + * 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.yaml; + +public class Measurement { + private String id; + private String val; + + public Measurement(String id, String val) { + super(); + this.id = id; + this.val = val; + } + + public String getId() { + return id; + } + + public String getVal() { + return val; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("Measurement ["); + if (id != null) + builder.append("id=").append(id).append(", "); + if (val != null) + builder.append("val=").append(val); + builder.append("]"); + return builder.toString(); + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/resources/META-INF/kmodule.xml b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/resources/META-INF/kmodule.xml new file mode 100644 index 00000000000..1fe23858ca9 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/resources/META-INF/kmodule.xml @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/resources/org/yaml/rules.drl.yaml b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/resources/org/yaml/rules.drl.yaml new file mode 100644 index 00000000000..a9f81455d9c --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/resources/org/yaml/rules.drl.yaml @@ -0,0 +1,13 @@ +name: org.yaml +globals: +- type: java.util.Set + id: controlSet +rules: +- name: will execute per each Measurement having ID color + when: + - given: Measurement + having: + - id == "color" + - "$colorVal : val" + then: | + controlSet.add($colorVal); \ No newline at end of file diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/test/java-filtered/org/kie/maven/plugin/ittests/YamlTestIT.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/test/java-filtered/org/kie/maven/plugin/ittests/YamlTestIT.java new file mode 100644 index 00000000000..ded38386ade --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/test/java-filtered/org/kie/maven/plugin/ittests/YamlTestIT.java @@ -0,0 +1,85 @@ +/** + * 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.maven.plugin.ittests; + +import java.io.File; +import java.lang.reflect.Constructor; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.HashSet; +import java.util.Set; + +import org.kie.api.KieBase; +import org.kie.api.runtime.KieContainer; + +import org.assertj.core.api.Assertions; +import org.junit.Test; +import org.kie.api.runtime.KieSession; + +import org.yaml.Measurement; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class YamlTestIT { + + private final static String GROUP_ID = "org.kie"; + private final static String GAV_ARTIFACT_ID = "kie-maven-plugin-test-kjar-15-yaml"; + private static final String GAV_VERSION = "${org.kie.version}"; + private final static String KBASE_NAME = "YamlKBase"; + + + @Test + public void testYamlRules() throws Exception { + final URL targetLocation = YamlTestIT.class.getProtectionDomain().getCodeSource().getLocation(); + final KieContainer kieContainer = ITTestsUtils.getKieContainer(targetLocation, GAV_ARTIFACT_ID, GAV_VERSION); + final KieBase kieBase = kieContainer.getKieBase(KBASE_NAME); + Assertions.assertThat(kieBase).isNotNull(); + KieSession kSession = null; + try { + + kSession = kieBase.newKieSession(); + Assertions.assertThat(kSession).isNotNull(); + + Set check = new HashSet(); + kSession.setGlobal("controlSet", check); + + Measurement mRed = new Measurement("color", "red"); + kSession.insert(mRed); + kSession.fireAllRules(); + + Measurement mGreen = new Measurement("color", "green"); + kSession.insert(mGreen); + kSession.fireAllRules(); + + Measurement mBlue = new Measurement("color", "blue"); + kSession.insert(mBlue); + kSession.fireAllRules(); + + assertEquals("Size of object in Working Memory is 3", 3, kSession.getObjects().size()); + assertTrue("contains red", check.contains("red")); + assertTrue("contains green", check.contains("green")); + assertTrue("contains blue", check.contains("blue")); + + } finally { + kSession.dispose(); + } + } +} + From 46432072a1581862e200cb2d1f1db245786e342b Mon Sep 17 00:00:00 2001 From: Luca Molteni Date: Fri, 1 Dec 2023 10:07:12 +0100 Subject: [PATCH 33/41] Lazily calculate identity hashcode inside the DefaultFactHandle (#5606) --- .../main/java/org/drools/core/common/DefaultFactHandle.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drools-core/src/main/java/org/drools/core/common/DefaultFactHandle.java b/drools-core/src/main/java/org/drools/core/common/DefaultFactHandle.java index f78edfeecd1..649d119b360 100644 --- a/drools-core/src/main/java/org/drools/core/common/DefaultFactHandle.java +++ b/drools-core/src/main/java/org/drools/core/common/DefaultFactHandle.java @@ -98,7 +98,7 @@ public DefaultFactHandle(final long id, final Object object, final long recency, final WorkingMemoryEntryPoint wmEntryPoint) { - this( id, determineIdentityHashCode( object ), object, recency, wmEntryPoint ); + this( id, 0, object, recency, wmEntryPoint ); } public DefaultFactHandle(final long id, @@ -183,14 +183,14 @@ public void setDisconnected( boolean disconnected ) { } public int getObjectHashCode() { - if (this.objectHashCode == 0 && this.object != null) { + if (this.objectHashCode == 0) { this.objectHashCode = object.hashCode(); } return objectHashCode; } public int getIdentityHashCode() { - if (this.identityHashCode == 0 && this.object != null) { + if (this.identityHashCode == 0) { this.identityHashCode = determineIdentityHashCode( object ); } return this.identityHashCode; From 390e0685d909e9dded786f40a1cda38dc51b54bb Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Fri, 1 Dec 2023 12:47:12 +0100 Subject: [PATCH 34/41] [KIE-734] support yaml format in quarkus extension (#5607) --- .../codegen/project/DroolsModelBuilder.java | 72 +++++++++++-------- .../deployment/DroolsCompilationProvider.java | 1 + .../drools-quarkus-integration-test/pom.xml | 4 ++ .../drools/quarkus/test/TestableResource.java | 21 +++--- .../src/main/resources/META-INF/kmodule.xml | 3 + .../org/drools/yaml/CanDrink.drl.yaml | 25 +++++++ .../org/drools/quarkus/test/RuntimeTest.java | 14 ++-- 7 files changed, 95 insertions(+), 45 deletions(-) create mode 100755 drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/org/drools/yaml/CanDrink.drl.yaml diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/DroolsModelBuilder.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/DroolsModelBuilder.java index 15640645286..0ab40f9c5c7 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/DroolsModelBuilder.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/DroolsModelBuilder.java @@ -18,6 +18,16 @@ */ package org.drools.model.codegen.project; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + import org.drools.codegen.common.DroolsModelBuildContext; import org.drools.codegen.common.GeneratedFile; import org.drools.codegen.common.GeneratedFileType; @@ -26,6 +36,8 @@ import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl; import org.drools.compiler.builder.impl.resources.DecisionTableResourceHandler; import org.drools.compiler.builder.impl.resources.DrlResourceHandler; +import org.drools.compiler.builder.impl.resources.ResourceHandler; +import org.drools.compiler.builder.impl.resources.YamlResourceHandler; import org.drools.compiler.kie.builder.impl.DecisionTableConfigurationDelegate; import org.drools.compiler.lang.descr.CompositePackageDescr; import org.drools.drl.ast.descr.PackageDescr; @@ -42,16 +54,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - import static org.drools.compiler.kie.builder.impl.AbstractKieModule.loadResourceConfiguration; import static org.kie.internal.builder.KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration; @@ -68,7 +70,9 @@ public class DroolsModelBuilder { private final boolean decisionTableSupported; private final KnowledgeBuilderConfigurationImpl knowledgeBuilderConfiguration; private final DroolsModelBuildContext context; - private Function packageModelWriterProvider; + private final Function packageModelWriterProvider; + + private final Map handlersMap = new HashMap<>(); public DroolsModelBuilder( DroolsModelBuildContext context, @@ -95,20 +99,14 @@ private static KnowledgeBuilderConfigurationImpl configFromContext(DroolsModelBu } public void build() { - - DrlResourceHandler drlResourceHandler = - new DrlResourceHandler(knowledgeBuilderConfiguration); - DecisionTableResourceHandler decisionTableHandler = - new DecisionTableResourceHandler(knowledgeBuilderConfiguration, DUMMY_RELEASE_ID); - Map packages = new HashMap<>(); - for (Resource resource : resources) { try { - if (resource.getResourceType() == ResourceType.DRL) { - handleDrl(drlResourceHandler, packages, resource); + ResourceType resourceType = resource.getResourceType(); + if (resourceType == ResourceType.DRL || resourceType == ResourceType.YAML) { + handleResource(getHandlerForType(resourceType), packages, resource, null); } else if (resource.getResourceType() == ResourceType.DTABLE) { - handleDtable(decisionTableHandler, packages, resource); + handleDtable(getHandlerForType(resourceType), packages, resource); } } catch (DroolsParserException | IOException e) { throw new RuntimeException(e); @@ -136,23 +134,31 @@ public void build() { this.packageModels = compiler.getPackageModels(); } - public boolean hasRuleUnits() { - return codegenPackageSources.stream().anyMatch(pkg -> !pkg.getRuleUnits().isEmpty()); + private ResourceHandler getHandlerForType(ResourceType type) { + return handlersMap.computeIfAbsent(type, this::createHandlerForType); + } + + private ResourceHandler createHandlerForType(ResourceType type) { + if (type == ResourceType.DRL) { + return new DrlResourceHandler(knowledgeBuilderConfiguration); + } else if (type == ResourceType.YAML) { + return new YamlResourceHandler(knowledgeBuilderConfiguration); + } else if (type == ResourceType.DTABLE) { + return new DecisionTableResourceHandler(knowledgeBuilderConfiguration, DUMMY_RELEASE_ID); + } + throw new IllegalArgumentException("No registered ResourceHandler for type " + type); } - private void handleDtable(DecisionTableResourceHandler decisionTableHandler, Map packages, Resource resource) throws DroolsParserException { + private void handleDtable(ResourceHandler decisionTableHandler, Map packages, Resource resource) throws DroolsParserException, IOException { Collection resourceConfigurations = loadDtableResourceConfiguration(resource); for (ResourceConfiguration cfg : resourceConfigurations) { - PackageDescr packageDescr = decisionTableHandler.process(resource, cfg); - CompositePackageDescr compositePackageDescr = - packages.computeIfAbsent(packageDescr.getNamespace(), CompositePackageDescr::new); - compositePackageDescr.addPackageDescr(resource, packageDescr); + handleResource(decisionTableHandler, packages, resource, cfg); } } - private void handleDrl(DrlResourceHandler drlResourceHandler, Map packages, Resource resource) throws DroolsParserException, IOException { - PackageDescr packageDescr = drlResourceHandler.process(resource); - Collection results = drlResourceHandler.getResults(); + private void handleResource(ResourceHandler resourceHandler, Map packages, Resource resource, ResourceConfiguration cfg) throws DroolsParserException, IOException { + PackageDescr packageDescr = resourceHandler.process(resource, cfg); + Collection results = resourceHandler.getResults(); if (!results.isEmpty()) { throw new DroolsParserException( results.stream() @@ -164,6 +170,10 @@ private void handleDrl(DrlResourceHandler drlResourceHandler, Map !pkg.getRuleUnits().isEmpty()); + } + public Collection generateCanonicalModelSources() { List modelFiles = new ArrayList<>(); List legacyModelFiles = new ArrayList<>(); diff --git a/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/DroolsCompilationProvider.java b/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/DroolsCompilationProvider.java index bf4829fd6c5..885900c3af7 100644 --- a/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/DroolsCompilationProvider.java +++ b/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/DroolsCompilationProvider.java @@ -32,6 +32,7 @@ private static Set initExtensions() { Set extensions = new HashSet<>(); extensions.addAll(ResourceType.DRL.getAllExtensions()); extensions.addAll(ResourceType.DTABLE.getAllExtensions()); + extensions.addAll(ResourceType.YAML.getAllExtensions()); return Collections.unmodifiableSet(extensions); } diff --git a/drools-quarkus-extension/drools-quarkus-integration-test/pom.xml b/drools-quarkus-extension/drools-quarkus-integration-test/pom.xml index ad4c2de0ab0..335fd594651 100644 --- a/drools-quarkus-extension/drools-quarkus-integration-test/pom.xml +++ b/drools-quarkus-extension/drools-quarkus-integration-test/pom.xml @@ -45,6 +45,10 @@ org.drools drools-decisiontables + + org.drools + drools-drlonyaml-todrl + io.quarkus quarkus-core diff --git a/drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java index cc47c1a1e36..9cb7dd190fc 100644 --- a/drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java +++ b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/java/org/drools/quarkus/test/TestableResource.java @@ -18,6 +18,16 @@ */ package org.drools.quarkus.test; +import java.util.Collection; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import javax.inject.Inject; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.core.Response; + import org.kie.api.KieBase; import org.kie.api.definition.KiePackage; import org.kie.api.runtime.KieRuntimeBuilder; @@ -25,15 +35,6 @@ import org.kie.api.runtime.rule.FactHandle; import org.kie.api.time.SessionPseudoClock; -import javax.inject.Inject; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.core.Response; -import java.util.Collection; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; @@ -100,7 +101,7 @@ public Response testAllPkgsKBase() { List pkgNames = kBase.getKiePackages().stream().map(KiePackage::getName).collect(Collectors.toList()); assertThat(pkgNames) - .containsExactlyInAnyOrder("org.drools.quarkus.test","org.drools.drl","org.drools.dtable","org.drools.cep","org.drools.tms","org.drools.probe"); + .containsExactlyInAnyOrder("org.drools.quarkus.test","org.drools.drl","org.drools.dtable","org.drools.cep","org.drools.tms","org.drools.probe","org.drools.yaml"); return Response.ok().build(); } diff --git a/drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/META-INF/kmodule.xml b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/META-INF/kmodule.xml index cb43d34c56b..a090bae9e02 100644 --- a/drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/META-INF/kmodule.xml +++ b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/META-INF/kmodule.xml @@ -26,6 +26,9 @@ + + + diff --git a/drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/org/drools/yaml/CanDrink.drl.yaml b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/org/drools/yaml/CanDrink.drl.yaml new file mode 100755 index 00000000000..9e96ede9f5b --- /dev/null +++ b/drools-quarkus-extension/drools-quarkus-integration-test/src/main/resources/org/drools/yaml/CanDrink.drl.yaml @@ -0,0 +1,25 @@ +name: org.drools.yaml +imports: + - org.drools.quarkus.test.Person + - org.drools.quarkus.test.Result +rules: + - name: R1 + when: + - given: Result + as: $r + - given: Person + as: $p + having: + - age >= 18 + then: | + $r.setValue( $p.getName() + " can drink"); + - name: R2 + when: + - given: Result + as: $r + - given: Person + as: $p + having: + - age < 18 + then: | + $r.setValue( $p.getName() + " can NOT drink"); diff --git a/drools-quarkus-extension/drools-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java b/drools-quarkus-extension/drools-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java index 76cedc9fb6c..602a4064d09 100644 --- a/drools-quarkus-extension/drools-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java +++ b/drools-quarkus-extension/drools-quarkus-integration-test/src/test/java/org/drools/quarkus/test/RuntimeTest.java @@ -18,16 +18,17 @@ */ package org.drools.quarkus.test; +import java.util.List; +import java.util.stream.Collectors; + +import javax.inject.Inject; + import io.quarkus.test.junit.QuarkusTest; import org.junit.jupiter.api.Test; import org.kie.api.definition.KiePackage; import org.kie.api.runtime.KieRuntimeBuilder; import org.kie.api.runtime.KieSession; -import javax.inject.Inject; -import java.util.List; -import java.util.stream.Collectors; - import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -48,6 +49,11 @@ public void testDTableEvaluation() { testSimpleDrl(runtimeBuilder.newKieSession("canDrinkKSDTable"), "org.drools.dtable"); } + @Test + public void testYamlEvaluation() { + testSimpleDrl(runtimeBuilder.newKieSession("canDrinkKSDYaml"), "org.drools.yaml"); + } + private void testSimpleDrl(KieSession ksession, String assetPackage) { List pkgNames = ksession.getKieBase().getKiePackages().stream().map(KiePackage::getName).collect(Collectors.toList()); assertEquals(2, pkgNames.size()); From 73a17d39fb2441bfc7e4b1f8587901087d73285b Mon Sep 17 00:00:00 2001 From: Toshiya Kobayashi Date: Mon, 4 Dec 2023 16:36:47 +0900 Subject: [PATCH 35/41] [KIE-684] GHA Windows failure in drools (#5590) - additional fix in maven-compiler-plugin --- build-parent/pom.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 445879b659a..20be5836ace 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -1324,6 +1324,14 @@ + + maven-compiler-plugin + ${version.compiler.plugin} + + UTF-8 + + + org.apache.maven.plugins maven-enforcer-plugin From a041ca0ce5863dc0345fcec876bb1a24597f1240 Mon Sep 17 00:00:00 2001 From: Mario Fusco Date: Tue, 5 Dec 2023 11:59:26 +0100 Subject: [PATCH 36/41] fix Javadocs generation with JDK 17 (#5608) --- .../src/main/java/org/kie/pmml/api/enums/ARRAY_TYPE.java | 3 --- .../src/main/java/org/kie/pmml/api/enums/BASELINE_METHOD.java | 3 --- .../main/java/org/kie/pmml/api/enums/BOOLEAN_OPERATOR.java | 3 --- .../main/java/org/kie/pmml/api/enums/BUILTIN_FUNCTIONS.java | 3 --- .../src/main/java/org/kie/pmml/api/enums/CAST_INTEGER.java | 3 --- .../src/main/java/org/kie/pmml/api/enums/CLOSURE.java | 3 --- .../src/main/java/org/kie/pmml/api/enums/COUNT_HITS.java | 3 --- .../src/main/java/org/kie/pmml/api/enums/DATA_TYPE.java | 3 --- .../main/java/org/kie/pmml/api/enums/FIELD_USAGE_TYPE.java | 3 --- .../kie/pmml/api/enums/INVALID_VALUE_TREATMENT_METHOD.java | 3 --- .../src/main/java/org/kie/pmml/api/enums/IN_NOTIN.java | 3 --- .../main/java/org/kie/pmml/api/enums/LOCAL_TERM_WEIGHTS.java | 3 --- .../src/main/java/org/kie/pmml/api/enums/MINING_FUNCTION.java | 3 --- .../kie/pmml/api/enums/MISSING_VALUE_TREATMENT_METHOD.java | 4 ---- .../src/main/java/org/kie/pmml/api/enums/OPERATOR.java | 3 --- .../src/main/java/org/kie/pmml/api/enums/OP_TYPE.java | 3 --- .../java/org/kie/pmml/api/enums/OUTLIER_TREATMENT_METHOD.java | 3 --- .../src/main/java/org/kie/pmml/api/enums/PMML_MODEL.java | 4 ---- .../java/org/kie/pmml/api/enums/REASONCODE_ALGORITHM.java | 3 --- .../src/main/java/org/kie/pmml/api/enums/RESULT_FEATURE.java | 3 --- .../src/main/java/org/kie/pmml/api/enums/VALUE_PROPERTY.java | 3 --- .../pmml/api/enums/builtinfunctions/ArithmeticFunctions.java | 3 --- .../kie/pmml/api/enums/builtinfunctions/BooleanFunctions.java | 3 --- .../kie/pmml/api/enums/builtinfunctions/DateFunctions.java | 3 --- .../api/enums/builtinfunctions/DistributionFunctions.java | 3 --- .../api/enums/builtinfunctions/MathematicalFunctions.java | 3 --- .../kie/pmml/api/enums/builtinfunctions/StringFunctions.java | 3 --- .../java/org/kie/pmml/commons/model/KiePMMLExtension.java | 3 --- .../java/org/kie/pmml/commons/model/KiePMMLMiningField.java | 3 --- .../java/org/kie/pmml/commons/model/KiePMMLOutputField.java | 3 --- .../main/java/org/kie/pmml/commons/model/KiePMMLTarget.java | 3 --- .../java/org/kie/pmml/commons/model/KiePMMLTargetValue.java | 3 --- .../org/kie/pmml/commons/model/expressions/KiePMMLApply.java | 3 --- .../kie/pmml/commons/model/expressions/KiePMMLConstant.java | 3 --- .../kie/pmml/commons/model/expressions/KiePMMLDiscretize.java | 3 --- .../pmml/commons/model/expressions/KiePMMLDiscretizeBin.java | 3 --- .../kie/pmml/commons/model/expressions/KiePMMLExpression.java | 3 --- .../kie/pmml/commons/model/expressions/KiePMMLFieldRef.java | 3 --- .../kie/pmml/commons/model/expressions/KiePMMLLinearNorm.java | 3 --- .../kie/pmml/commons/model/expressions/KiePMMLMapValues.java | 3 --- .../pmml/commons/model/expressions/KiePMMLNormContinuous.java | 3 --- .../pmml/commons/model/expressions/KiePMMLNormDiscrete.java | 3 --- .../kie/pmml/commons/model/expressions/KiePMMLTextIndex.java | 3 --- .../model/expressions/KiePMMLTextIndexNormalization.java | 3 --- .../commons/model/predicates/KiePMMLCompoundPredicate.java | 3 --- .../pmml/commons/model/predicates/KiePMMLFalsePredicate.java | 3 --- .../kie/pmml/commons/model/predicates/KiePMMLPredicate.java | 3 --- .../pmml/commons/model/predicates/KiePMMLSimplePredicate.java | 3 --- .../commons/model/predicates/KiePMMLSimpleSetPredicate.java | 3 --- .../pmml/commons/model/predicates/KiePMMLTruePredicate.java | 3 --- .../pmml/commons/transformations/KiePMMLDefineFunction.java | 3 --- .../kie/pmml/commons/transformations/KiePMMLDerivedField.java | 3 --- .../commons/transformations/KiePMMLLocalTransformations.java | 3 --- .../pmml/commons/transformations/KiePMMLParameterField.java | 3 --- .../transformations/KiePMMLTransformationDictionary.java | 3 --- 55 files changed, 167 deletions(-) diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/ARRAY_TYPE.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/ARRAY_TYPE.java index 429195f01dc..a41a57bf9c8 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/ARRAY_TYPE.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/ARRAY_TYPE.java @@ -23,9 +23,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; import org.kie.pmml.api.exceptions.KiePMMLException; -/** - * @see PREDICATE - */ public enum ARRAY_TYPE implements Named { INT("int"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/BASELINE_METHOD.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/BASELINE_METHOD.java index a4b78b07010..f3aa75be58d 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/BASELINE_METHOD.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/BASELINE_METHOD.java @@ -22,9 +22,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see baselinemethod - */ public enum BASELINE_METHOD implements Named { MAX("max"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/BOOLEAN_OPERATOR.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/BOOLEAN_OPERATOR.java index df6c10cb503..b6bd3e079ae 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/BOOLEAN_OPERATOR.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/BOOLEAN_OPERATOR.java @@ -22,9 +22,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see CompoundPredicate - */ public enum BOOLEAN_OPERATOR implements Named { OR("or", "||"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/BUILTIN_FUNCTIONS.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/BUILTIN_FUNCTIONS.java index c3dcd53a41e..83de0650470 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/BUILTIN_FUNCTIONS.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/BUILTIN_FUNCTIONS.java @@ -38,9 +38,6 @@ import static org.kie.pmml.api.enums.builtinfunctions.MathematicalFunctions.isMathematicalFunctions; import static org.kie.pmml.api.enums.builtinfunctions.StringFunctions.isStringFunctions; -/** - * @see Built-in functions - */ public enum BUILTIN_FUNCTIONS implements Named { PLUS("+"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/CAST_INTEGER.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/CAST_INTEGER.java index 64e37659f58..6e1dbbde568 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/CAST_INTEGER.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/CAST_INTEGER.java @@ -26,9 +26,6 @@ import org.apache.commons.math3.util.Precision; import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see castInteger - */ public enum CAST_INTEGER implements Named { ROUND("round", CAST_INTEGER::getRound), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/CLOSURE.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/CLOSURE.java index f0b87f5964d..e82f015d6f3 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/CLOSURE.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/CLOSURE.java @@ -22,9 +22,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see Interval - */ public enum CLOSURE implements Named { OPEN_CLOSED("openClosed"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/COUNT_HITS.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/COUNT_HITS.java index aec34ccaa9a..d838cc96653 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/COUNT_HITS.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/COUNT_HITS.java @@ -22,9 +22,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see countHits - */ public enum COUNT_HITS implements Named { ALL_HITS("allHits"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/DATA_TYPE.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/DATA_TYPE.java index 6458800e31e..06420b3f5f5 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/DATA_TYPE.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/DATA_TYPE.java @@ -29,9 +29,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; import org.kie.pmml.api.utils.ConverterTypeUtil; -/** - * @see DATATYPE - */ public enum DATA_TYPE implements Named { STRING("string", String.class), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/FIELD_USAGE_TYPE.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/FIELD_USAGE_TYPE.java index e877f30d09f..626d0f61dde 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/FIELD_USAGE_TYPE.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/FIELD_USAGE_TYPE.java @@ -23,9 +23,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see FIELD-USAGE-TYPE - */ public enum FIELD_USAGE_TYPE implements Named { ACTIVE("active"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/INVALID_VALUE_TREATMENT_METHOD.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/INVALID_VALUE_TREATMENT_METHOD.java index e945f519e76..a8318dbc789 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/INVALID_VALUE_TREATMENT_METHOD.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/INVALID_VALUE_TREATMENT_METHOD.java @@ -23,9 +23,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see INVALID-VALUE-TREATMENT-METHOD - */ public enum INVALID_VALUE_TREATMENT_METHOD implements Named { RETURN_INVALID("returnInvalid"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/IN_NOTIN.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/IN_NOTIN.java index 919f190c256..e99165944cd 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/IN_NOTIN.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/IN_NOTIN.java @@ -22,9 +22,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see SimpleSetPredicate - */ public enum IN_NOTIN implements Named { IN("isIn"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/LOCAL_TERM_WEIGHTS.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/LOCAL_TERM_WEIGHTS.java index 0883e83a6fe..ef059c30ad1 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/LOCAL_TERM_WEIGHTS.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/LOCAL_TERM_WEIGHTS.java @@ -22,9 +22,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see localTermWeights - */ public enum LOCAL_TERM_WEIGHTS implements Named { TERM_FREQUENCY("termFrequency"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/MINING_FUNCTION.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/MINING_FUNCTION.java index d863b361718..c9b34051202 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/MINING_FUNCTION.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/MINING_FUNCTION.java @@ -23,9 +23,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see MINING-FUNCTION - */ public enum MINING_FUNCTION implements Named { ASSOCIATION_RULES("associationRules"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/MISSING_VALUE_TREATMENT_METHOD.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/MISSING_VALUE_TREATMENT_METHOD.java index 043b7a0048f..10d71b009a7 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/MISSING_VALUE_TREATMENT_METHOD.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/MISSING_VALUE_TREATMENT_METHOD.java @@ -23,10 +23,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see - * MISSING-VALUE_TREATMENT-METHOD - */ public enum MISSING_VALUE_TREATMENT_METHOD implements Named { AS_IS("asIs"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/OPERATOR.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/OPERATOR.java index 57634d3ac41..649e7c9d9ca 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/OPERATOR.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/OPERATOR.java @@ -23,9 +23,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see PREDICATE - */ public enum OPERATOR implements Named { EQUAL("equal", "=="), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/OP_TYPE.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/OP_TYPE.java index ddd200c1804..badc7746169 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/OP_TYPE.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/OP_TYPE.java @@ -23,9 +23,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see OPTYPE - */ public enum OP_TYPE implements Named { CATEGORICAL("categorical"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/OUTLIER_TREATMENT_METHOD.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/OUTLIER_TREATMENT_METHOD.java index b3fbe6fe3c9..f1e743d3dbd 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/OUTLIER_TREATMENT_METHOD.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/OUTLIER_TREATMENT_METHOD.java @@ -23,9 +23,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see OUTLIER-TREATMENT-METHOD - */ public enum OUTLIER_TREATMENT_METHOD implements Named { AS_IS("asIs"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/PMML_MODEL.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/PMML_MODEL.java index 8df83f87fe7..64c2885acd8 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/PMML_MODEL.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/PMML_MODEL.java @@ -23,10 +23,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * PMML models - * @see MODEL-ELEMENT - */ public enum PMML_MODEL implements Named { ANOMALY_DETECTION_MODEL("AnomalyDetectionModel"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/REASONCODE_ALGORITHM.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/REASONCODE_ALGORITHM.java index a49740c7766..2173a663fd1 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/REASONCODE_ALGORITHM.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/REASONCODE_ALGORITHM.java @@ -22,9 +22,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see reasonCodeAlgorithm - */ public enum REASONCODE_ALGORITHM implements Named { POINTS_ABOVE("pointsAbove"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/RESULT_FEATURE.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/RESULT_FEATURE.java index 2da043b6869..c48f906526b 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/RESULT_FEATURE.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/RESULT_FEATURE.java @@ -23,9 +23,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see RESULT_FEATURE - */ public enum RESULT_FEATURE implements Named { PREDICTED_VALUE("predictedValue"), PREDICTED_DISPLAY_VALUE("predictedDisplayValue"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/VALUE_PROPERTY.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/VALUE_PROPERTY.java index 4cb04bf2db2..10ba0e9b3de 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/VALUE_PROPERTY.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/VALUE_PROPERTY.java @@ -23,9 +23,6 @@ import org.kie.pmml.api.exceptions.KieEnumException; -/** - * @see Value - */ public enum VALUE_PROPERTY implements Named { VALID("valid"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/ArithmeticFunctions.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/ArithmeticFunctions.java index 0f2064d3ea0..1507ee1b45b 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/ArithmeticFunctions.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/ArithmeticFunctions.java @@ -27,9 +27,6 @@ import static org.kie.pmml.api.enums.BUILTIN_FUNCTIONS.checkNumbers; -/** - * @see Built-in functions - */ public enum ArithmeticFunctions { PLUS("+"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/BooleanFunctions.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/BooleanFunctions.java index 098b4761fea..4677c37ec65 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/BooleanFunctions.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/BooleanFunctions.java @@ -34,9 +34,6 @@ import static org.kie.pmml.api.enums.BUILTIN_FUNCTIONS.checkNumbers; import static org.kie.pmml.api.enums.BUILTIN_FUNCTIONS.checkRangeLength; -/** - * @see Built-in functions - */ public enum BooleanFunctions { IS_MISSING("isMissing"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/DateFunctions.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/DateFunctions.java index 83898e442a7..8fdd0678f1d 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/DateFunctions.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/DateFunctions.java @@ -37,9 +37,6 @@ import static org.kie.pmml.api.enums.BUILTIN_FUNCTIONS.checkInteger; import static org.kie.pmml.api.enums.BUILTIN_FUNCTIONS.checkLength; -/** - * @see Built-in functions - */ public enum DateFunctions { DATE_DAYS_SINCE_YEAR("dateDaysSinceYear"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/DistributionFunctions.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/DistributionFunctions.java index 17a96e0fd05..9076e2434a0 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/DistributionFunctions.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/DistributionFunctions.java @@ -27,9 +27,6 @@ import static org.kie.pmml.api.enums.BUILTIN_FUNCTIONS.checkNumbers; -/** - * @see Built-in functions - */ public enum DistributionFunctions { NORMAL_CDF("normalCDF"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/MathematicalFunctions.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/MathematicalFunctions.java index 18ee405cca9..1921708cca3 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/MathematicalFunctions.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/MathematicalFunctions.java @@ -25,9 +25,6 @@ import static org.kie.pmml.api.enums.BUILTIN_FUNCTIONS.checkNumbers; -/** - * @see Built-in functions - */ public enum MathematicalFunctions { EXPM1("expm1"), diff --git a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/StringFunctions.java b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/StringFunctions.java index 3d321468e4a..83d8c86ebfa 100644 --- a/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/StringFunctions.java +++ b/kie-pmml-trusty/kie-pmml-api/src/main/java/org/kie/pmml/api/enums/builtinfunctions/StringFunctions.java @@ -34,9 +34,6 @@ import static org.kie.pmml.api.enums.BUILTIN_FUNCTIONS.checkString; import static org.kie.pmml.api.enums.BUILTIN_FUNCTIONS.checkStrings; -/** - * @see Built-in functions - */ public enum StringFunctions { UPPERCASE("uppercase"), diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLExtension.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLExtension.java index 1ae45a0ac2f..e9afac10908 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLExtension.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLExtension.java @@ -21,9 +21,6 @@ import java.io.Serializable; import java.util.List; -/** - * @see Extension - */ public class KiePMMLExtension implements Serializable { private static final long serialVersionUID = -7441789522335799516L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLMiningField.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLMiningField.java index a223676f6e6..1e13e8ce896 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLMiningField.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLMiningField.java @@ -31,9 +31,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - * @see Mining Schema - */ public class KiePMMLMiningField extends AbstractKiePMMLComponent { private static final Logger logger = LoggerFactory.getLogger(KiePMMLMiningField.class); diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLOutputField.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLOutputField.java index 8080b242d4c..8af62455420 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLOutputField.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLOutputField.java @@ -35,9 +35,6 @@ import static org.kie.pmml.commons.utils.KiePMMLModelUtils.commonEvaluate; -/** - * @see OutputField - */ public class KiePMMLOutputField extends AbstractKiePMMLComponent { private static final Logger logger = LoggerFactory.getLogger(KiePMMLOutputField.class); diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLTarget.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLTarget.java index 949af4e6e80..c84aa39459b 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLTarget.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLTarget.java @@ -30,9 +30,6 @@ import org.kie.pmml.api.models.TargetField; import org.kie.pmml.commons.model.abstracts.AbstractKiePMMLComponent; -/** - * @see Target - */ public class KiePMMLTarget extends AbstractKiePMMLComponent { private static final long serialVersionUID = -6336733489238275499L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLTargetValue.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLTargetValue.java index 73d7280454f..19234fb8c95 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLTargetValue.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/KiePMMLTargetValue.java @@ -25,9 +25,6 @@ import org.kie.pmml.api.models.TargetValue; import org.kie.pmml.commons.model.abstracts.AbstractKiePMMLComponent; -/** - * @see TargetValue - */ public class KiePMMLTargetValue extends AbstractKiePMMLComponent { private static final long serialVersionUID = -4948552909458142415L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLApply.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLApply.java index 9a9bcd097c3..bd948833edf 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLApply.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLApply.java @@ -32,9 +32,6 @@ import org.kie.pmml.commons.model.abstracts.AbstractKiePMMLComponent; import org.kie.pmml.commons.transformations.KiePMMLDefineFunction; -/** - * @see Apply - */ public class KiePMMLApply extends AbstractKiePMMLComponent implements KiePMMLExpression { private static final long serialVersionUID = -6975232157053159223L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLConstant.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLConstant.java index 7ab5f360edb..9c789b60001 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLConstant.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLConstant.java @@ -29,9 +29,6 @@ import static org.kie.pmml.commons.utils.KiePMMLModelUtils.commonEvaluate; -/** - * @see Constant - */ public class KiePMMLConstant extends AbstractKiePMMLComponent implements KiePMMLExpression { private static final long serialVersionUID = 3312643278386342170L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLDiscretize.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLDiscretize.java index 0802eeef4a3..f6902b2069a 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLDiscretize.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLDiscretize.java @@ -29,9 +29,6 @@ import static org.kie.pmml.commons.model.expressions.ExpressionsUtils.getFromPossibleSources; -/** - * @see Discretize - */ public class KiePMMLDiscretize extends AbstractKiePMMLComponent implements KiePMMLExpression { private static final long serialVersionUID = -7935602676734880795L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLDiscretizeBin.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLDiscretizeBin.java index 534305b82e3..f155ddfac44 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLDiscretizeBin.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLDiscretizeBin.java @@ -24,9 +24,6 @@ import org.kie.pmml.commons.model.KiePMMLExtension; import org.kie.pmml.commons.model.abstracts.AbstractKiePMMLComponent; -/** - * @see DiscretizeBin - */ public class KiePMMLDiscretizeBin extends AbstractKiePMMLComponent { private static final long serialVersionUID = -6437255657731885594L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLExpression.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLExpression.java index b90af6dc925..3bb99c1e6fd 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLExpression.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLExpression.java @@ -22,9 +22,6 @@ import org.kie.pmml.commons.model.ProcessingDTO; -/** - * @see EXPRESSION - */ public interface KiePMMLExpression extends Serializable { Object evaluate(final ProcessingDTO processingDTO); diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLFieldRef.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLFieldRef.java index 0a9139ff051..3b5e418393b 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLFieldRef.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLFieldRef.java @@ -27,9 +27,6 @@ import static org.kie.pmml.commons.model.expressions.ExpressionsUtils.getFromPossibleSources; -/** - * @see FieldRef - */ public class KiePMMLFieldRef extends AbstractKiePMMLComponent implements KiePMMLExpression { private static final long serialVersionUID = 4576394527423997787L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLLinearNorm.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLLinearNorm.java index 127bb8528ae..c714fd6eb3c 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLLinearNorm.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLLinearNorm.java @@ -23,9 +23,6 @@ import org.kie.pmml.commons.model.KiePMMLExtension; import org.kie.pmml.commons.model.abstracts.AbstractKiePMMLComponent; -/** - * @see LinearNorm - */ public class KiePMMLLinearNorm extends AbstractKiePMMLComponent { private static final long serialVersionUID = -6437255657731885594L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLMapValues.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLMapValues.java index 3774df21945..6200a6b86b1 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLMapValues.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLMapValues.java @@ -34,9 +34,6 @@ import static org.kie.pmml.commons.model.expressions.ExpressionsUtils.getFromPossibleSources; -/** - * @see MapValues - */ public class KiePMMLMapValues extends AbstractKiePMMLComponent implements KiePMMLExpression { private static final long serialVersionUID = 4576394527423997787L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLNormContinuous.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLNormContinuous.java index d9bc5216dd3..5fba1bbfea3 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLNormContinuous.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLNormContinuous.java @@ -29,9 +29,6 @@ import static org.kie.pmml.commons.model.expressions.ExpressionsUtils.getFromPossibleSources; -/** - * @see NormContinuous - */ public class KiePMMLNormContinuous extends AbstractKiePMMLComponent implements KiePMMLExpression { private static final long serialVersionUID = -7935602676734880795L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLNormDiscrete.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLNormDiscrete.java index 5df2b0a3a8e..8693632fdd7 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLNormDiscrete.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLNormDiscrete.java @@ -26,9 +26,6 @@ import static org.kie.pmml.commons.model.expressions.ExpressionsUtils.getFromPossibleSources; -/** - * @see NormDiscrete - */ public class KiePMMLNormDiscrete extends AbstractKiePMMLComponent implements KiePMMLExpression { private static final long serialVersionUID = -7935602676734880795L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLTextIndex.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLTextIndex.java index 9b40ccba7ba..d99361174ae 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLTextIndex.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLTextIndex.java @@ -44,9 +44,6 @@ import static java.util.stream.Collectors.counting; import static org.kie.pmml.commons.model.expressions.ExpressionsUtils.getFromPossibleSources; -/** - * @see TextIndex - */ public class KiePMMLTextIndex extends AbstractKiePMMLComponent implements KiePMMLExpression { private static final long serialVersionUID = -1946996874918753317L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLTextIndexNormalization.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLTextIndexNormalization.java index c9ba98c69ff..3ae767f038f 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLTextIndexNormalization.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/expressions/KiePMMLTextIndexNormalization.java @@ -26,9 +26,6 @@ import org.kie.pmml.commons.model.abstracts.AbstractKiePMMLComponent; -/** - * @see TextIndexNormalization - */ public class KiePMMLTextIndexNormalization extends AbstractKiePMMLComponent { private static final long serialVersionUID = -1816258381871863674L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLCompoundPredicate.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLCompoundPredicate.java index 7580426d784..c00a9640665 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLCompoundPredicate.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLCompoundPredicate.java @@ -28,9 +28,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - * @see CompoundPredicate - */ public class KiePMMLCompoundPredicate extends KiePMMLPredicate { private static final Logger logger = LoggerFactory.getLogger(KiePMMLCompoundPredicate.class); diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLFalsePredicate.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLFalsePredicate.java index ca2fd39d2ba..59843bad764 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLFalsePredicate.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLFalsePredicate.java @@ -24,9 +24,6 @@ import org.kie.pmml.commons.model.KiePMMLExtension; -/** - * @see False - */ public class KiePMMLFalsePredicate extends KiePMMLPredicate { private static final String FALSE = "False"; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLPredicate.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLPredicate.java index 6aa88858867..2c6980a1355 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLPredicate.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLPredicate.java @@ -24,9 +24,6 @@ import org.kie.pmml.commons.model.KiePMMLExtension; import org.kie.pmml.commons.model.abstracts.AbstractKiePMMLComponent; -/** - * @see PREDICATE - */ public abstract class KiePMMLPredicate extends AbstractKiePMMLComponent { protected KiePMMLPredicate(String name, List extensions) { diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLSimplePredicate.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLSimplePredicate.java index 7a65182402a..ae0808b2836 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLSimplePredicate.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLSimplePredicate.java @@ -30,9 +30,6 @@ import static org.kie.pmml.api.enums.BOOLEAN_OPERATOR.SURROGATE; -/** - * @see SimplePredicate - */ public class KiePMMLSimplePredicate extends KiePMMLPredicate { private static final Logger logger = LoggerFactory.getLogger(KiePMMLSimplePredicate.class); diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLSimpleSetPredicate.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLSimpleSetPredicate.java index 910aa906881..c3d691d2bfc 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLSimpleSetPredicate.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLSimpleSetPredicate.java @@ -32,9 +32,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - * @see SimpleSetPredicate - */ public class KiePMMLSimpleSetPredicate extends KiePMMLPredicate { private static final Logger logger = LoggerFactory.getLogger(KiePMMLSimpleSetPredicate.class); diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLTruePredicate.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLTruePredicate.java index 56c434b5618..eb257413071 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLTruePredicate.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/model/predicates/KiePMMLTruePredicate.java @@ -26,9 +26,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - * @see True - */ public class KiePMMLTruePredicate extends KiePMMLPredicate { private static final Logger logger = LoggerFactory.getLogger(KiePMMLTruePredicate.class); diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLDefineFunction.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLDefineFunction.java index 0f0403d83b0..0ff429495f8 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLDefineFunction.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLDefineFunction.java @@ -33,9 +33,6 @@ import static org.kie.pmml.commons.utils.KiePMMLModelUtils.commonEvaluate; -/** - * @see DefineFunction - */ public class KiePMMLDefineFunction extends AbstractKiePMMLComponent implements Serializable { private static final long serialVersionUID = 9187889880911645935L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLDerivedField.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLDerivedField.java index d9fd6bb0f85..ca3f2df7b53 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLDerivedField.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLDerivedField.java @@ -30,9 +30,6 @@ import static org.kie.pmml.commons.utils.KiePMMLModelUtils.commonEvaluate; -/** - * @see DerivedField - */ public class KiePMMLDerivedField extends AbstractKiePMMLComponent implements Serializable { private static final long serialVersionUID = 9187889880911645935L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLLocalTransformations.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLLocalTransformations.java index 20ce2d582d4..9b5b68ebc30 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLLocalTransformations.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLLocalTransformations.java @@ -25,9 +25,6 @@ import org.kie.pmml.commons.model.KiePMMLExtension; import org.kie.pmml.commons.model.abstracts.AbstractKiePMMLComponent; -/** - * @see LocalTransformations - */ public class KiePMMLLocalTransformations extends AbstractKiePMMLComponent implements Serializable { private static final long serialVersionUID = 9187889880911645935L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLParameterField.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLParameterField.java index c8d28b03c9a..41e2adbad4f 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLParameterField.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLParameterField.java @@ -26,9 +26,6 @@ import org.kie.pmml.commons.model.KiePMMLExtension; import org.kie.pmml.commons.model.abstracts.AbstractKiePMMLComponent; -/** - * @see ParameterField - */ public class KiePMMLParameterField extends AbstractKiePMMLComponent implements Serializable { private static final long serialVersionUID = 9187889880911645935L; diff --git a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLTransformationDictionary.java b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLTransformationDictionary.java index e5a1e7d1721..f73bf33f52f 100644 --- a/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLTransformationDictionary.java +++ b/kie-pmml-trusty/kie-pmml-commons/src/main/java/org/kie/pmml/commons/transformations/KiePMMLTransformationDictionary.java @@ -25,9 +25,6 @@ import org.kie.pmml.commons.model.KiePMMLExtension; import org.kie.pmml.commons.model.abstracts.AbstractKiePMMLComponent; -/** - * @see TransformationDictionary - */ public class KiePMMLTransformationDictionary extends AbstractKiePMMLComponent implements Serializable { private static final long serialVersionUID = 9187889880911645935L; From ad6909d5c50f785a51d6059a5bba4658eb87e33e Mon Sep 17 00:00:00 2001 From: Naman Jain <54635559+njain2208@users.noreply.github.com> Date: Wed, 6 Dec 2023 01:32:58 -0600 Subject: [PATCH 37/41] Update PropertiesSheetListener.java (#5610) --- .../decisiontable/parser/xls/PropertiesSheetListener.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/xls/PropertiesSheetListener.java b/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/xls/PropertiesSheetListener.java index 5f64f49d4a8..8e1bad3673c 100644 --- a/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/xls/PropertiesSheetListener.java +++ b/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/xls/PropertiesSheetListener.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -40,7 +41,7 @@ public class PropertiesSheetListener implements DataListener { private static final String EMPTY_STRING = ""; - private final Map _rowProperties = new HashMap<>(); + private final Map _rowProperties = new LinkedHashMap<>(); private final CaseInsensitiveMap _properties = new CaseInsensitiveMap(); From 444f9f90cded38191ec3dfe4b7a10cd6735a7e45 Mon Sep 17 00:00:00 2001 From: Jan Stastny Date: Wed, 6 Dec 2023 13:33:36 +0100 Subject: [PATCH 38/41] kie-issues#742: upgrade jacoco maven plugin to 0.8.11 (#5609) Co-authored-by: jstastny-cz --- build-parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 20be5836ace..ef2b4a41977 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -180,7 +180,7 @@ false 0.9 - 0.8.7 + 0.8.11 false false From 09dbd7f5b735d061a187b8fca2fab5d17c06fb7e Mon Sep 17 00:00:00 2001 From: Toshiya Kobayashi Date: Thu, 7 Dec 2023 19:08:42 +0900 Subject: [PATCH 39/41] [DROOLS-7578] Evaluate Impact analysis for ansible integration rules (#5594) - Introduced DeleteSpecificFactAction for retract_fact - Add a test case --- .../pom.xml | 4 - .../analysis/graph/ModelToGraphConverter.java | 30 +++++++ .../DeleteSpecificFactActionTest.java | 78 +++++++++++++++++++ .../model/right/DeleteSpecificFactAction.java | 53 +++++++++++++ .../model/right/SpecificProperty.java | 38 +++++++++ 5 files changed, 199 insertions(+), 4 deletions(-) create mode 100644 drools-impact-analysis/drools-impact-analysis-itests/src/test/java/org/drools/impact/analysis/integrationtests/DeleteSpecificFactActionTest.java create mode 100644 drools-impact-analysis/drools-impact-analysis-model/src/main/java/org/drools/impact/analysis/model/right/DeleteSpecificFactAction.java create mode 100644 drools-impact-analysis/drools-impact-analysis-model/src/main/java/org/drools/impact/analysis/model/right/SpecificProperty.java diff --git a/drools-impact-analysis/drools-impact-analysis-graph/drools-impact-analysis-graph-common/pom.xml b/drools-impact-analysis/drools-impact-analysis-graph/drools-impact-analysis-graph-common/pom.xml index 0f27e9eb2d3..9c40c10fe93 100644 --- a/drools-impact-analysis/drools-impact-analysis-graph/drools-impact-analysis-graph-common/pom.xml +++ b/drools-impact-analysis/drools-impact-analysis-graph/drools-impact-analysis-graph-common/pom.xml @@ -47,10 +47,6 @@ org.slf4j slf4j-api - - ch.qos.logback - logback-classic - junit diff --git a/drools-impact-analysis/drools-impact-analysis-graph/drools-impact-analysis-graph-common/src/main/java/org/drools/impact/analysis/graph/ModelToGraphConverter.java b/drools-impact-analysis/drools-impact-analysis-graph/drools-impact-analysis-graph-common/src/main/java/org/drools/impact/analysis/graph/ModelToGraphConverter.java index ae740a7dfc4..c8c048c64d4 100644 --- a/drools-impact-analysis/drools-impact-analysis-graph/drools-impact-analysis-graph-common/src/main/java/org/drools/impact/analysis/graph/ModelToGraphConverter.java +++ b/drools-impact-analysis/drools-impact-analysis-graph/drools-impact-analysis-graph-common/src/main/java/org/drools/impact/analysis/graph/ModelToGraphConverter.java @@ -30,12 +30,14 @@ import org.drools.impact.analysis.model.left.MapConstraint; import org.drools.impact.analysis.model.left.Pattern; import org.drools.impact.analysis.model.right.ConsequenceAction; +import org.drools.impact.analysis.model.right.DeleteSpecificFactAction; import org.drools.impact.analysis.model.right.InsertAction; import org.drools.impact.analysis.model.right.InsertedProperty; import org.drools.impact.analysis.model.right.ModifiedMapProperty; import org.drools.impact.analysis.model.right.ModifiedProperty; import org.drools.impact.analysis.model.right.ModifyAction; import org.drools.impact.analysis.model.right.RightHandSide; +import org.drools.impact.analysis.model.right.SpecificProperty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -189,6 +191,14 @@ private void processInsert(GraphAnalysis graphAnalysis, String pkgName, String r } private void processDelete(GraphAnalysis graphAnalysis, String pkgName, String ruleName, ConsequenceAction action) { + if (action instanceof DeleteSpecificFactAction) { + processDeleteSpecificFact(graphAnalysis, pkgName, ruleName, (DeleteSpecificFactAction) action); + } else { + processDeleteAnyFact(graphAnalysis, pkgName, ruleName, action); + } + } + + private void processDeleteAnyFact(GraphAnalysis graphAnalysis, String pkgName, String ruleName, ConsequenceAction action) { Class deletedClass = action.getActionClass(); // all rules which react to the fact Node source = graphAnalysis.getNode(fqdn(pkgName, ruleName)); @@ -198,6 +208,26 @@ private void processDelete(GraphAnalysis graphAnalysis, String pkgName, String r } } + private void processDeleteSpecificFact(GraphAnalysis graphAnalysis, String pkgName, String ruleName, DeleteSpecificFactAction action) { + Node source = graphAnalysis.getNode(fqdn(pkgName, ruleName)); + + Class deletedClass = action.getActionClass(); + if (!graphAnalysis.isRegisteredClass(deletedClass)) { + // Not likely happen but not invalid + logger.warn("Not found {} in reactiveMap", deletedClass); + return; + } + List specificProperties = action.getSpecificProperties(); + for (SpecificProperty specificProperty : specificProperties) { + String property = specificProperty.getProperty(); + for (AnalyzedRule reactedRule : graphAnalysis.getRulesReactiveTo(deletedClass, property)) { + // Reactive to this class+property. Deleting this fact means NEGATIVE impact. + Node target = graphAnalysis.getNode(fqdn(pkgName, reactedRule.getRule().getName())); + linkNodesIfExpected(source, target, ReactivityType.NEGATIVE); + } + } + } + private void processModify(GraphAnalysis graphAnalysis, String pkgName, String ruleName, ModifyAction action) { Node source = graphAnalysis.getNode(fqdn(pkgName, ruleName)); diff --git a/drools-impact-analysis/drools-impact-analysis-itests/src/test/java/org/drools/impact/analysis/integrationtests/DeleteSpecificFactActionTest.java b/drools-impact-analysis/drools-impact-analysis-itests/src/test/java/org/drools/impact/analysis/integrationtests/DeleteSpecificFactActionTest.java new file mode 100644 index 00000000000..4458cbc3d53 --- /dev/null +++ b/drools-impact-analysis/drools-impact-analysis-itests/src/test/java/org/drools/impact/analysis/integrationtests/DeleteSpecificFactActionTest.java @@ -0,0 +1,78 @@ +/** + * 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.impact.analysis.integrationtests; + +import java.util.List; + +import org.drools.impact.analysis.graph.Graph; +import org.drools.impact.analysis.graph.ModelToGraphConverter; +import org.drools.impact.analysis.graph.ReactivityType; +import org.drools.impact.analysis.integrationtests.domain.Address; +import org.drools.impact.analysis.integrationtests.domain.Person; +import org.drools.impact.analysis.model.AnalysisModel; +import org.drools.impact.analysis.model.right.ConsequenceAction; +import org.drools.impact.analysis.model.right.DeleteSpecificFactAction; +import org.drools.impact.analysis.model.right.SpecificProperty; +import org.drools.impact.analysis.parser.ModelBuilder; +import org.junit.Test; + +/** + * This test is to verify that DeleteSpecificFactAction can be handled correctly. + * DeleteSpecificFactAction cannot be created by ModelBuilder from DRL, so we programmatically add it to the model. + */ +public class DeleteSpecificFactActionTest extends AbstractGraphTest { + + @Test + public void insertDeleteSpecific() { + String str = + "package mypkg;\n" + + "import " + Person.class.getCanonicalName() + ";" + + "import " + Address.class.getCanonicalName() + ";" + + "rule R1 when\n" + + " $p : Person(name == \"John\")\n" + + "then\n" + + " Address address = new Address();" + + " address.setStreet(\"ABC\");" + + " insert(address);" + + "end\n" + + "rule R2 when\n" + + " $p : Person(name == \"Paul\")\n" + + "then\n" + + // Here, delete a fact with street == "ABC" (ansible-rulebook can do it) + "end\n" + + "rule R3 when\n" + + " $a : Address(street == \"ABC\")\n" + + "then\n" + + "end\n"; + + AnalysisModel analysisModel = new ModelBuilder().build(str); + + // Tweak analysisModel because DeleteSpecificFactAction cannot be created by ModelBuilder + List actions = analysisModel.getPackages().get(0).getRules().get(1).getRhs().getActions(); + DeleteSpecificFactAction deleteSpecificFactAction = new DeleteSpecificFactAction(Address.class); + deleteSpecificFactAction.addSpecificProperty(new SpecificProperty("street", "ABC")); + actions.add(deleteSpecificFactAction); + + ModelToGraphConverter converter = new ModelToGraphConverter(); + Graph graph = converter.toGraph(analysisModel); + + assertLink(graph, "mypkg.R1", "mypkg.R3", ReactivityType.POSITIVE); + assertLink(graph, "mypkg.R2", "mypkg.R3", ReactivityType.NEGATIVE); + } +} diff --git a/drools-impact-analysis/drools-impact-analysis-model/src/main/java/org/drools/impact/analysis/model/right/DeleteSpecificFactAction.java b/drools-impact-analysis/drools-impact-analysis-model/src/main/java/org/drools/impact/analysis/model/right/DeleteSpecificFactAction.java new file mode 100644 index 00000000000..d2a969d113d --- /dev/null +++ b/drools-impact-analysis/drools-impact-analysis-model/src/main/java/org/drools/impact/analysis/model/right/DeleteSpecificFactAction.java @@ -0,0 +1,53 @@ +/** + * 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.impact.analysis.model.right; + +import java.util.ArrayList; +import java.util.List; + +/** + * This class represents a delete action for a specific fact. + * Use this action when you know the fact's properties to be deleted, assuming other facts of the same class still + * exist in the working memory. (Usually, you don't know the fact's properties) + * This action is introduced to support retract_fact action in drools-ansible-rulebook-integration-visualization. + */ +public class DeleteSpecificFactAction extends ConsequenceAction { + + private final List specificProperties = new ArrayList<>(); + + public DeleteSpecificFactAction(Class actionClass) { + super(Type.DELETE, actionClass); + } + + public List getSpecificProperties() { + return specificProperties; + } + + public void addSpecificProperty(SpecificProperty specificProperty) { + specificProperties.add(specificProperty); + } + + @Override + public String toString() { + return "DeleteSpecificFactAction{" + + "actionClass=" + actionClass + + ", specificProperties=" + specificProperties + + '}'; + } +} diff --git a/drools-impact-analysis/drools-impact-analysis-model/src/main/java/org/drools/impact/analysis/model/right/SpecificProperty.java b/drools-impact-analysis/drools-impact-analysis-model/src/main/java/org/drools/impact/analysis/model/right/SpecificProperty.java new file mode 100644 index 00000000000..049ab3821ed --- /dev/null +++ b/drools-impact-analysis/drools-impact-analysis-model/src/main/java/org/drools/impact/analysis/model/right/SpecificProperty.java @@ -0,0 +1,38 @@ +/** + * 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.impact.analysis.model.right; + +public class SpecificProperty extends ModifiedProperty { + + public SpecificProperty(String property) { + this(property, null); + } + + public SpecificProperty(String property, Object value) { + super(property, value); + } + + @Override + public String toString() { + return "SpecificProperty{" + + "property='" + property + '\'' + + ", value=" + value + + '}'; + } +} From f12f3f6262f1fcd044a225b7adde53d7f30e7018 Mon Sep 17 00:00:00 2001 From: Toshiya Kobayashi Date: Mon, 11 Dec 2023 22:08:11 +0900 Subject: [PATCH 40/41] =?UTF-8?q?[KIE-748]=20drools=20executable-model=20f?= =?UTF-8?q?ails=20with=20BigDecimal=20coercion=20for=20=E2=80=A6=20(#5618)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [KIE-748] drools executable-model fails with BigDecimal coercion for method arguments * refactor --- .../generator/drlxparse/ConstraintParser.java | 8 ++- .../expressiontyper/ExpressionTyper.java | 30 ++++++++++- .../execmodel/bigdecimaltest/BDFact.java | 43 ++++++++++++++++ .../bigdecimaltest/BigDecimalTest.java | 51 +++++++++++++++++++ .../generator/ExpressionTyperTest.java | 8 +++ 5 files changed, 137 insertions(+), 3 deletions(-) create mode 100644 drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/bigdecimaltest/BDFact.java diff --git a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/drlxparse/ConstraintParser.java b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/drlxparse/ConstraintParser.java index 50f95366c16..2a85da6e2f0 100644 --- a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/drlxparse/ConstraintParser.java +++ b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/drlxparse/ConstraintParser.java @@ -657,7 +657,7 @@ private DrlxParseResult parseBinaryExpr(BinaryExpr binaryExpr, Class patternT Expression combo; - boolean arithmeticExpr = ARITHMETIC_OPERATORS.contains(operator); + boolean arithmeticExpr = isArithmeticOperator(operator); boolean isBetaConstraint = right.getExpression() != null && hasDeclarationFromOtherPattern( expressionTyperContext ); boolean requiresSplit = operator == BinaryExpr.Operator.AND && binaryExpr.getRight() instanceof HalfBinaryExpr && !isBetaConstraint; @@ -981,7 +981,7 @@ private Optional convertBigDecimalArithmetic(MethodCallExpr metho List binaryExprList = methodCallExpr.findAll(BinaryExpr.class); for (BinaryExpr binaryExpr : binaryExprList) { Operator operator = binaryExpr.getOperator(); - boolean arithmeticExpr = ARITHMETIC_OPERATORS.contains(operator); + boolean arithmeticExpr = isArithmeticOperator(operator); if (arithmeticExpr) { final ExpressionTyperContext expressionTyperContext = new ExpressionTyperContext(); final ExpressionTyper expressionTyper = new ExpressionTyper(context, patternType, bindingId, isPositional, expressionTyperContext); @@ -1008,4 +1008,8 @@ private Optional convertBigDecimalArithmetic(MethodCallExpr metho } return Optional.empty(); } + + public static boolean isArithmeticOperator(BinaryExpr.Operator operator) { + return ARITHMETIC_OPERATORS.contains(operator); + } } 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 9b5dd94561e..328aa5466e5 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 @@ -23,6 +23,7 @@ import java.lang.reflect.Modifier; import java.lang.reflect.ParameterizedType; import java.lang.reflect.TypeVariable; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -90,6 +91,8 @@ import org.drools.mvel.parser.ast.expr.OOPathExpr; import org.drools.mvel.parser.ast.expr.PointFreeExpr; import org.drools.mvel.parser.printer.PrintUtil; +import org.drools.mvelcompiler.CompiledExpressionResult; +import org.drools.mvelcompiler.ConstraintCompiler; import org.drools.mvelcompiler.util.BigDecimalArgumentCoercion; import org.drools.util.MethodUtils; import org.drools.util.TypeResolver; @@ -100,6 +103,7 @@ import static java.util.Optional.empty; import static java.util.Optional.of; import static org.drools.model.codegen.execmodel.generator.DrlxParseUtil.THIS_PLACEHOLDER; +import static org.drools.model.codegen.execmodel.generator.DrlxParseUtil.createConstraintCompiler; import static org.drools.model.codegen.execmodel.generator.DrlxParseUtil.findRootNodeViaParent; import static org.drools.model.codegen.execmodel.generator.DrlxParseUtil.getClassFromContext; import static org.drools.model.codegen.execmodel.generator.DrlxParseUtil.getClassFromType; @@ -114,6 +118,7 @@ import static org.drools.model.codegen.execmodel.generator.DrlxParseUtil.toStringLiteral; import static org.drools.model.codegen.execmodel.generator.DrlxParseUtil.transformDrlNameExprToNameExpr; import static org.drools.model.codegen.execmodel.generator.DrlxParseUtil.trasformHalfBinaryToBinary; +import static org.drools.model.codegen.execmodel.generator.drlxparse.ConstraintParser.isArithmeticOperator; import static org.drools.model.codegen.execmodel.generator.expressiontyper.FlattenScope.flattenScope; import static org.drools.model.codegen.execmodel.generator.expressiontyper.FlattenScope.transformFullyQualifiedInlineCastExpr; import static org.drools.mvel.parser.MvelParser.parseType; @@ -801,7 +806,30 @@ private TypedExpressionCursor binaryExpr(BinaryExpr binaryExpr) { TypedExpression rightTypedExpression = right.getTypedExpression() .orElseThrow(() -> new NoSuchElementException("TypedExpressionResult doesn't contain TypedExpression!")); binaryExpr.setRight(rightTypedExpression.getExpression()); - return new TypedExpressionCursor(binaryExpr, getBinaryType(leftTypedExpression, rightTypedExpression, binaryExpr.getOperator())); + java.lang.reflect.Type binaryType = getBinaryType(leftTypedExpression, rightTypedExpression, binaryExpr.getOperator()); + if (shouldConvertArithmeticBinaryToMethodCall(binaryExpr.getOperator(), binaryType)) { + Expression compiledExpression = convertArithmeticBinaryToMethodCall(binaryExpr, leftTypedExpression.getOriginalPatternType(), ruleContext); + return new TypedExpressionCursor(compiledExpression, binaryType); + } else { + return new TypedExpressionCursor(binaryExpr, binaryType); + } + } + + /* + * Converts arithmetic binary expression (including coercion) to method call using ConstraintCompiler. + * This method can be generic, so we may centralize the calls in drools-model + */ + private static Expression convertArithmeticBinaryToMethodCall(BinaryExpr binaryExpr, Optional> originalPatternType, RuleContext ruleContext) { + ConstraintCompiler constraintCompiler = createConstraintCompiler(ruleContext, originalPatternType); + CompiledExpressionResult compiledExpressionResult = constraintCompiler.compileExpression(printNode(binaryExpr)); + return compiledExpressionResult.getExpression(); + } + + /* + * BigDecimal arithmetic operations should be converted to method calls. We may also apply this to BigInteger. + */ + private static boolean shouldConvertArithmeticBinaryToMethodCall(BinaryExpr.Operator operator, java.lang.reflect.Type type) { + return isArithmeticOperator(operator) && type.equals(BigDecimal.class); } private java.lang.reflect.Type getBinaryType(TypedExpression leftTypedExpression, TypedExpression rightTypedExpression, Operator operator) { diff --git a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/bigdecimaltest/BDFact.java b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/bigdecimaltest/BDFact.java new file mode 100644 index 00000000000..de9721e8bc3 --- /dev/null +++ b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/bigdecimaltest/BDFact.java @@ -0,0 +1,43 @@ +/** + * 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.model.codegen.execmodel.bigdecimaltest; + +import java.math.BigDecimal; + +public class BDFact { + + private BigDecimal value1; + private BigDecimal value2; + + public BigDecimal getValue1() { + return value1; + } + + public void setValue1(BigDecimal value1) { + this.value1 = value1; + } + + public BigDecimal getValue2() { + return value2; + } + + public void setValue2(BigDecimal value2) { + this.value2 = value2; + } +} diff --git a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/bigdecimaltest/BigDecimalTest.java b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/bigdecimaltest/BigDecimalTest.java index bdc842a2d1c..0cc90ca3179 100644 --- a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/bigdecimaltest/BigDecimalTest.java +++ b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/bigdecimaltest/BigDecimalTest.java @@ -721,4 +721,55 @@ public void bigDecimalEqualityWithDifferentScale_shouldBeEqual() { // BigDecimal("1.0") and BigDecimal("1.00") are considered as equal because exec-model uses EvaluationUtil.equals() which is based on compareTo() assertThat(result).contains(new BigDecimal("1.00")); } + + @Test + public void bigDecimalCoercionInMethodArgument_shouldNotFailToBuild() { + // KIE-748 + String str = + "package org.drools.modelcompiler.bigdecimals\n" + + "import " + BDFact.class.getCanonicalName() + ";\n" + + "import static " + BigDecimalTest.class.getCanonicalName() + ".intToString;\n" + + "rule \"Rule 1a\"\n" + + " when\n" + + " BDFact( intToString(value2 - 1) == \"2\" )\n" + + " then\n" + + "end"; + + KieSession ksession = getKieSession(str); + + BDFact bdFact = new BDFact(); + bdFact.setValue2(new BigDecimal("3")); + + ksession.insert(bdFact); + + assertThat(ksession.fireAllRules()).isEqualTo(1); + } + + @Test + public void bigDecimalCoercionInNestedMethodArgument_shouldNotFailToBuild() { + // KIE-748 + String str = + "package org.drools.modelcompiler.bigdecimals\n" + + "import " + BDFact.class.getCanonicalName() + ";\n" + + "import static " + BigDecimalTest.class.getCanonicalName() + ".intToString;\n" + + "rule \"Rule 1a\"\n" + + " when\n" + + " BDFact( intToString(value1 * (value2 - 1)) == \"20\" )\n" + + " then\n" + + "end"; + + KieSession ksession = getKieSession(str); + + BDFact bdFact = new BDFact(); + bdFact.setValue1(new BigDecimal("10")); + bdFact.setValue2(new BigDecimal("3")); + + ksession.insert(bdFact); + + assertThat(ksession.fireAllRules()).isEqualTo(1); + } + + public static String intToString(int value) { + return Integer.toString(value); + } } diff --git a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/generator/ExpressionTyperTest.java b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/generator/ExpressionTyperTest.java index f8ad08e8543..29a0e20a66c 100644 --- a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/generator/ExpressionTyperTest.java +++ b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/generator/ExpressionTyperTest.java @@ -266,6 +266,14 @@ public void parseIntStringConcatenation() { assertThat(typedExpression.getExpression().toString()).isEqualTo(expected); } + @Test + public void coercionInMethodArgument() { + TypedExpression typedExpression = toTypedExpression("identityBigDecimal(money - 1)", Person.class); + assertThat(ruleContext.hasCompilationError()).isFalse(); + String expected = "_this.identityBigDecimal(_this.getMoney().subtract(new java.math.BigDecimal(1), java.math.MathContext.DECIMAL128))"; + assertThat(typedExpression.getExpression().toString()).isEqualTo(expected); + } + private TypedExpression toTypedExpression(String inputExpression, Class patternType, DeclarationSpec... declarations) { for(DeclarationSpec d : declarations) { From fd4f6eb013d3adc18b9bb3341a8ea31ebb85cb58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Wed, 13 Dec 2023 09:17:54 +0100 Subject: [PATCH 41/41] [kie-issues#754] Use UTF-8 on important places during Quarkus build (#5620) * Use UTF-8 when handling files and file content. * Fix memory compiler to use UTF-8 * Fix QueryGenerator to use UTF-8. * Revert selected fixes. --- .../main/java/org/drools/codegen/common/GeneratedFile.java | 2 +- .../common/context/AbstractDroolsModelBuildContext.java | 3 ++- .../org/drools/quarkus/deployment/ResourceCollector.java | 5 +++-- .../quarkus/util/deployment/DroolsQuarkusResourceUtils.java | 3 ++- .../main/java/org/kie/memorycompiler/KieMemoryCompiler.java | 3 ++- .../org/kie/memorycompiler/jdknative/NativeJavaCompiler.java | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/GeneratedFile.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/GeneratedFile.java index 2d8af79e849..bd5455641e2 100644 --- a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/GeneratedFile.java +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/GeneratedFile.java @@ -93,7 +93,7 @@ public GeneratedFileType.Category category() { public String toStringWithContent() { return "GeneratedFile{" + "path=" + path + - ", content='\n" + new String(contents) + "\n'}"; + ", content='\n" + new String(contents, StandardCharsets.UTF_8) + "\n'}"; } @Override diff --git a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/AbstractDroolsModelBuildContext.java b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/AbstractDroolsModelBuildContext.java index 65d28dec01b..487f5f033a1 100644 --- a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/AbstractDroolsModelBuildContext.java +++ b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/context/AbstractDroolsModelBuildContext.java @@ -30,6 +30,7 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.nio.file.Paths; import java.text.MessageFormat; import java.util.Collection; @@ -75,7 +76,7 @@ protected static Properties load(File... resourcePaths) { Properties applicationProperties = new Properties(); for (File resourcePath : resourcePaths) { - try (FileReader fileReader = new FileReader(new File(resourcePath, APPLICATION_PROPERTIES_FILE_NAME))) { + try (FileReader fileReader = new FileReader(new File(resourcePath, APPLICATION_PROPERTIES_FILE_NAME), StandardCharsets.UTF_8)) { applicationProperties.load(fileReader); } catch (IOException ioe) { LOGGER.debug("Unable to load '" + APPLICATION_PROPERTIES_FILE_NAME + "'."); diff --git a/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/ResourceCollector.java b/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/ResourceCollector.java index d60b9b7199e..746885d8a8b 100644 --- a/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/ResourceCollector.java +++ b/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/ResourceCollector.java @@ -21,6 +21,7 @@ import java.io.File; import java.io.IOException; import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -88,7 +89,7 @@ public static Collection fromJarFile(Path jarPath) { if (resourceType == null) { continue; } - InternalResource resource = new ByteArrayResource(readBytesFromInputStream(zipFile.getInputStream(entry))); + InternalResource resource = new ByteArrayResource(readBytesFromInputStream(zipFile.getInputStream(entry)), StandardCharsets.UTF_8.name()); resource.setSourcePath(entry.getName()); resource.setResourceType(resourceType); resources.add(resource); @@ -119,7 +120,7 @@ private static Resource toResource(File file) { if (resourceType == null) { return null; } - Resource resource = new FileSystemResource(file); + Resource resource = new FileSystemResource(file, StandardCharsets.UTF_8.name()); resource.setResourceType(resourceType); return resource; } diff --git a/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/DroolsQuarkusResourceUtils.java b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/DroolsQuarkusResourceUtils.java index 9ebcb26c6de..6cd06cbdc74 100644 --- a/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/DroolsQuarkusResourceUtils.java +++ b/drools-quarkus-extension/drools-quarkus-util-deployment/src/main/java/org/drools/quarkus/util/deployment/DroolsQuarkusResourceUtils.java @@ -18,6 +18,7 @@ */ package org.drools.quarkus.util.deployment; +import java.nio.charset.StandardCharsets; import io.quarkus.arc.deployment.GeneratedBeanBuildItem; import io.quarkus.bootstrap.classloading.QuarkusClassLoader; import io.quarkus.deployment.annotations.BuildProducer; @@ -174,7 +175,7 @@ private static Map getSourceMap(Collection genera Map sourcesMap = new HashMap<>(); for (GeneratedFile javaFile : generatedFiles) { if (javaFile.category() == GeneratedFileType.Category.SOURCE) { - sourcesMap.put(toClassName(javaFile.relativePath()), new String(javaFile.contents())); + sourcesMap.put(toClassName(javaFile.relativePath()), new String(javaFile.contents(), StandardCharsets.UTF_8)); } } return sourcesMap; diff --git a/kie-memory-compiler/src/main/java/org/kie/memorycompiler/KieMemoryCompiler.java b/kie-memory-compiler/src/main/java/org/kie/memorycompiler/KieMemoryCompiler.java index 4a04914faad..880029b44ca 100644 --- a/kie-memory-compiler/src/main/java/org/kie/memorycompiler/KieMemoryCompiler.java +++ b/kie-memory-compiler/src/main/java/org/kie/memorycompiler/KieMemoryCompiler.java @@ -19,6 +19,7 @@ package org.kie.memorycompiler; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -124,7 +125,7 @@ public static Map compileNoLoad(Map classNameSou int i = 0; for (Map.Entry entry : classNameSourceMap.entrySet()) { classNames[i] = toJavaSource( entry.getKey() ); - reader.add( classNames[i], entry.getValue().getBytes()); + reader.add( classNames[i], entry.getValue().getBytes(StandardCharsets.UTF_8)); i++; } JavaConfiguration javaConfiguration = new JavaConfiguration(); diff --git a/kie-memory-compiler/src/main/java/org/kie/memorycompiler/jdknative/NativeJavaCompiler.java b/kie-memory-compiler/src/main/java/org/kie/memorycompiler/jdknative/NativeJavaCompiler.java index a59653567ca..1bd38483400 100644 --- a/kie-memory-compiler/src/main/java/org/kie/memorycompiler/jdknative/NativeJavaCompiler.java +++ b/kie-memory-compiler/src/main/java/org/kie/memorycompiler/jdknative/NativeJavaCompiler.java @@ -87,7 +87,7 @@ public CompilationResult compile( String[] pResourcePaths, DiagnosticCollector diagnostics = new DiagnosticCollector<>(); JavaCompiler compiler = getJavaCompiler(); - try (StandardJavaFileManager jFileManager = compiler.getStandardFileManager(diagnostics, null, null)) { + try (StandardJavaFileManager jFileManager = compiler.getStandardFileManager(diagnostics, null, Charset.forName(pSettings.getSourceEncoding()))) { try { jFileManager.setLocation( StandardLocation.CLASS_PATH, pSettings.getClasspathLocations() ); jFileManager.setLocation( StandardLocation.CLASS_OUTPUT, Collections.singletonList(new File("target/classes")) );