From 8a9d2f800b6cd03dfa85212d6e1cf56aab0e80ee Mon Sep 17 00:00:00 2001 From: Enrique Gonzalez Martinez Date: Wed, 15 Nov 2023 13:02:03 +0100 Subject: [PATCH] fix configuration. simplification --- data-audit/README.md | 17 +- .../src/main/resources/application.properties | 10 +- .../src/main/resources/META-INF/beans.xml | 0 .../main/resources/META-INF/entity-orm.xml | 20 - .../src/main/resources/META-INF/job-orm.xml | 326 ------- .../src/main/resources/META-INF/orm.xml | 899 ++++++++++++++++++ .../main/resources/META-INF/process-orm.xml | 335 ------- .../main/resources/META-INF/usertask-orm.xml | 229 ----- .../QuarkusJPADataAuditContextFactory.java | 2 +- .../src/main/resources/application.properties | 6 +- .../SpringbootJPAAuditDataConfiguration.java | 56 +- .../SpringbootJPADataAuditContextFactory.java | 2 - .../src/main/resources/application.properties | 3 - .../src/test/resources/application.properties | 10 +- .../src/test/resources/application.properties | 6 +- 15 files changed, 919 insertions(+), 1002 deletions(-) create mode 100644 data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/beans.xml delete mode 100644 data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/entity-orm.xml delete mode 100644 data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/job-orm.xml create mode 100644 data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/orm.xml delete mode 100644 data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/process-orm.xml delete mode 100644 data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/usertask-orm.xml delete mode 100644 data-audit/kogito-addons-data-audit-quarkus/src/main/resources/application.properties diff --git a/data-audit/README.md b/data-audit/README.md index cc42fd1220..4e3e3be25a 100644 --- a/data-audit/README.md +++ b/data-audit/README.md @@ -77,20 +77,5 @@ Each implementation might require additional dependencies. In our case for using quarkus-jdbc-h2 -for the case of use h2 database with quarkus runtime. plus additional parameters. In our case for make in work in quarkus you need to define -the data audit persistence +No additional configuration is requires besides the default datasource use by the application already. - -quarkus.datasource.data-audit-ds.db-kind=posgres -quarkus.datasource.data-audit-ds.username=kogito-user -quarkus.datasource.data-audit-ds.password=kogito-pass -quarkus.datasource.data-audit-ds.jdbc.url=${QUARKUS_DATASOURCE_JDBC_URL:jdbc:postgresql://localhost:5432/kogito} - -In springboot might look like: - -spring.datasource.jdbc-url=jdbc:h2:mem:test -spring.datasource.driver-class-name=org.h2.Driver - -data-audit.spring.jpa.database=H2 -data-audit.spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect -data-audit.spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop \ No newline at end of file diff --git a/data-audit/kogito-addons-data-audit-jpa/data-audit-quarkus-jpa-service/src/main/resources/application.properties b/data-audit/kogito-addons-data-audit-jpa/data-audit-quarkus-jpa-service/src/main/resources/application.properties index 064c901bc3..be277ecd5c 100644 --- a/data-audit/kogito-addons-data-audit-jpa/data-audit-quarkus-jpa-service/src/main/resources/application.properties +++ b/data-audit/kogito-addons-data-audit-jpa/data-audit-quarkus-jpa-service/src/main/resources/application.properties @@ -1,11 +1,11 @@ #default values -quarkus.datasource.data-audit.db-kind=${QUARKUS_DATASOURCE_DB:h2} -quarkus.datasource.data-audit.username=${QUARKUS_DATASOURCE_USER:kogito-user} -quarkus.datasource.data-audit.password=${QUARKUS_DATASOURCE_PASS:kogito-pass} -quarkus.datasource.data-audit.jdbc.url=${QUARKUS_DATASOURCE_JDBC_URL:jdbc:h2:mem:data-audit} +quarkus.datasource.db-kind=${QUARKUS_DATASOURCE_DB:h2} +quarkus.datasource.username=${QUARKUS_DATASOURCE_USER:kogito-user} +quarkus.datasource.password=${QUARKUS_DATASOURCE_PASS:kogito-pass} +quarkus.datasource.jdbc.url=${QUARKUS_DATASOURCE_JDBC_URL:jdbc:h2:mem:data-audit} -quarkus.hibernate-orm.DataAuditPU.database.generation=update +quarkus.hibernate-orm.database.generation=update quarkus.container-image.build=${quarkus.build.image:true} quarkus.container-image.group=org.kie.kogito diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/beans.xml b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/entity-orm.xml b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/entity-orm.xml deleted file mode 100644 index e384c33f24..0000000000 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/entity-orm.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/job-orm.xml b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/job-orm.xml deleted file mode 100644 index d3653b559a..0000000000 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/job-orm.xml +++ /dev/null @@ -1,326 +0,0 @@ - - - - - - - - - - - SELECT - o1.job_id as jobId, - o1.expiration_time as expirationTime, - o1.priority as priority, - o1.process_instance_id as processInstanceId, - o1.node_instance_id as nodeInstanceId, - o1.repeat_interval as repeatInterval, - o1.repeat_limit as repeatLimit, - o1.scheduled_id as scheduledId, - o1.retries as retries, - o1.status as status, - o1.execution_counter as executionCounter, - o1.event_date as eventDate - FROM Job_Execution_Log o1 - LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date - WHERE o2.job_id IS NULL AND o1.status = 'SCHEDULED' - - - - - - - SELECT - o1.job_id as jobId, - o1.expiration_time as expirationTime, - o1.priority as priority, - o1.process_instance_id as processInstanceId, - o1.node_instance_id as nodeInstanceId, - o1.repeat_interval as repeatInterval, - o1.repeat_limit as repeatLimit, - o1.scheduled_id as scheduledId, - o1.retries as retries, - o1.status as status, - o1.execution_counter as executionCounter, - o1.event_date as eventDate - FROM Job_Execution_Log o1 - LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date - WHERE o2.job_id IS NULL AND o1.job_id = :jobId - - - - - - SELECT - o1.job_id as jobId, - o1.expiration_time as expirationTime, - o1.priority as priority, - o1.process_instance_id as processInstanceId, - o1.node_instance_id as nodeInstanceId, - o1.repeat_interval as repeatInterval, - o1.repeat_limit as repeatLimit, - o1.scheduled_id as scheduledId, - o1.retries as retries, - o1.status as status, - o1.execution_counter as executionCounter, - o1.event_date as eventDate - FROM Job_Execution_Log o1 - WHERE o1.job_id = :jobId - ORDER BY o1.event_date DESC - - - - - - SELECT - o1.job_id as jobId, - o1.expiration_time as expirationTime, - o1.priority as priority, - o1.process_instance_id as processInstanceId, - o1.node_instance_id as nodeInstanceId, - o1.repeat_interval as repeatInterval, - o1.repeat_limit as repeatLimit, - o1.scheduled_id as scheduledId, - o1.retries as retries, - o1.status as status, - o1.execution_counter as executionCounter, - o1.event_date as eventDate - FROM Job_Execution_Log o1 - WHERE o1.process_instance_id = :processInstanceId - ORDER BY o1.event_date DESC - - - - - - SELECT - o1.job_id as jobId, - o1.expiration_time as expirationTime, - o1.priority as priority, - o1.process_instance_id as processInstanceId, - o1.node_instance_id as nodeInstanceId, - o1.repeat_interval as repeatInterval, - o1.repeat_limit as repeatLimit, - o1.scheduled_id as scheduledId, - o1.retries as retries, - o1.status as status, - o1.execution_counter as executionCounter, - o1.event_date as eventDate - FROM Job_Execution_Log o1 - LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date - WHERE o2.job_id IS NULL AND o1.status IN ('SCHEDULED', 'RETRY') - - - - - - SELECT - o1.job_id as jobId, - o1.expiration_time as expirationTime, - o1.priority as priority, - o1.process_instance_id as processInstanceId, - o1.node_instance_id as nodeInstanceId, - o1.repeat_interval as repeatInterval, - o1.repeat_limit as repeatLimit, - o1.scheduled_id as scheduledId, - o1.retries as retries, - o1.status as status, - o1.execution_counter as executionCounter, - o1.event_date as eventDate - FROM Job_Execution_Log o1 - LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date - WHERE o2.job_id IS NULL AND o1.status IN ('SCHEDULED') - - - - - - SELECT - o1.job_id as jobId, - o1.expiration_time as expirationTime, - o1.priority as priority, - o1.process_instance_id as processInstanceId, - o1.node_instance_id as nodeInstanceId, - o1.repeat_interval as repeatInterval, - o1.repeat_limit as repeatLimit, - o1.scheduled_id as scheduledId, - o1.retries as retries, - o1.status as status, - o1.execution_counter as executionCounter, - o1.event_date as eventDate - FROM Job_Execution_Log o1 - LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date - WHERE o2.job_id IS NULL AND o1.status IN ('RETRY', 'ERROR') - - - - - - - SELECT - o1.job_id as jobId, - o1.expiration_time as expirationTime, - o1.priority as priority, - o1.process_instance_id as processInstanceId, - o1.node_instance_id as nodeInstanceId, - o1.repeat_interval as repeatInterval, - o1.repeat_limit as repeatLimit, - o1.scheduled_id as scheduledId, - o1.retries as retries, - o1.status as status, - o1.execution_counter as executionCounter, - o1.event_date as eventDate - FROM Job_Execution_Log o1 - LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date - WHERE o2.job_id IS NULL - ORDER BY o1.event_date DESC - - - - - - SELECT - o1.job_id as jobId, - o1.expiration_time as expirationTime, - o1.priority as priority, - o1.process_instance_id as processInstanceId, - o1.node_instance_id as nodeInstanceId, - o1.repeat_interval as repeatInterval, - o1.repeat_limit as repeatLimit, - o1.scheduled_id as scheduledId, - o1.retries as retries, - o1.status as status, - o1.execution_counter as executionCounter, - o1.event_date as eventDate - FROM Job_Execution_Log o1 - LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date - WHERE o2.job_id IS NULL AND o1.status = 'EXECUTED' - - - - - - SELECT - o1.job_id as jobId, - o1.expiration_time as expirationTime, - o1.priority as priority, - o1.process_instance_id as processInstanceId, - o1.node_instance_id as nodeInstanceId, - o1.repeat_interval as repeatInterval, - o1.repeat_limit as repeatLimit, - o1.scheduled_id as scheduledId, - o1.retries as retries, - o1.status as status, - o1.execution_counter as executionCounter, - o1.event_date as eventDate - FROM Job_Execution_Log o1 - LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date - WHERE o2.job_id IS NULL AND o1.status = 'ERROR' - - - - - - SELECT - o1.job_id as jobId, - o1.expiration_time as expirationTime, - o1.priority as priority, - o1.process_instance_id as processInstanceId, - o1.node_instance_id as nodeInstanceId, - o1.repeat_interval as repeatInterval, - o1.repeat_limit as repeatLimit, - o1.scheduled_id as scheduledId, - o1.retries as retries, - o1.status as status, - o1.execution_counter as executionCounter, - o1.event_date as eventDate - FROM Job_Execution_Log o1 - LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date - WHERE o2.job_id IS NULL AND o1.status = 'CANCELED' - - - - - - - SELECT - o1.job_id as jobId, - o1.expiration_time as expirationTime, - o1.priority as priority, - o1.process_instance_id as processInstanceId, - o1.node_instance_id as nodeInstanceId, - o1.repeat_interval as repeatInterval, - o1.repeat_limit as repeatLimit, - o1.scheduled_id as scheduledId, - o1.retries as retries, - o1.status as status, - o1.execution_counter as executionCounter, - o1.event_date as eventDate - FROM Job_Execution_Log o1 - LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date - WHERE o2.job_id IS NULL AND o1.status IN (:status) - ORDER BY o1.event_date DESC - - - - - - SELECT - o1.job_id as jobId, - o1.expiration_time as expirationTime, - o1.priority as priority, - o1.process_instance_id as processInstanceId, - o1.node_instance_id as nodeInstanceId, - o1.repeat_interval as repeatInterval, - o1.repeat_limit as repeatLimit, - o1.scheduled_id as scheduledId, - o1.retries as retries, - o1.status as status, - o1.execution_counter as executionCounter, - o1.event_date as eventDate - FROM Job_Execution_Log o1 - LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date - WHERE o2.job_id IS NULL AND o1.process_instance_id = :processInstanceId - ORDER BY o1.event_date DESC - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/orm.xml b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/orm.xml new file mode 100644 index 0000000000..cf1619ebd8 --- /dev/null +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/orm.xml @@ -0,0 +1,899 @@ + + + + + + + + + + + SELECT + o1.job_id as jobId, + o1.expiration_time as expirationTime, + o1.priority as priority, + o1.process_instance_id as processInstanceId, + o1.node_instance_id as nodeInstanceId, + o1.repeat_interval as repeatInterval, + o1.repeat_limit as repeatLimit, + o1.scheduled_id as scheduledId, + o1.retries as retries, + o1.status as status, + o1.execution_counter as executionCounter, + o1.event_date as eventDate + FROM Job_Execution_Log o1 + LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date + WHERE o2.job_id IS NULL AND o1.status = 'SCHEDULED' + + + + + + + SELECT + o1.job_id as jobId, + o1.expiration_time as expirationTime, + o1.priority as priority, + o1.process_instance_id as processInstanceId, + o1.node_instance_id as nodeInstanceId, + o1.repeat_interval as repeatInterval, + o1.repeat_limit as repeatLimit, + o1.scheduled_id as scheduledId, + o1.retries as retries, + o1.status as status, + o1.execution_counter as executionCounter, + o1.event_date as eventDate + FROM Job_Execution_Log o1 + LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date + WHERE o2.job_id IS NULL AND o1.job_id = :jobId + + + + + + SELECT + o1.job_id as jobId, + o1.expiration_time as expirationTime, + o1.priority as priority, + o1.process_instance_id as processInstanceId, + o1.node_instance_id as nodeInstanceId, + o1.repeat_interval as repeatInterval, + o1.repeat_limit as repeatLimit, + o1.scheduled_id as scheduledId, + o1.retries as retries, + o1.status as status, + o1.execution_counter as executionCounter, + o1.event_date as eventDate + FROM Job_Execution_Log o1 + WHERE o1.job_id = :jobId + ORDER BY o1.event_date DESC + + + + + + SELECT + o1.job_id as jobId, + o1.expiration_time as expirationTime, + o1.priority as priority, + o1.process_instance_id as processInstanceId, + o1.node_instance_id as nodeInstanceId, + o1.repeat_interval as repeatInterval, + o1.repeat_limit as repeatLimit, + o1.scheduled_id as scheduledId, + o1.retries as retries, + o1.status as status, + o1.execution_counter as executionCounter, + o1.event_date as eventDate + FROM Job_Execution_Log o1 + WHERE o1.process_instance_id = :processInstanceId + ORDER BY o1.event_date DESC + + + + + + SELECT + o1.job_id as jobId, + o1.expiration_time as expirationTime, + o1.priority as priority, + o1.process_instance_id as processInstanceId, + o1.node_instance_id as nodeInstanceId, + o1.repeat_interval as repeatInterval, + o1.repeat_limit as repeatLimit, + o1.scheduled_id as scheduledId, + o1.retries as retries, + o1.status as status, + o1.execution_counter as executionCounter, + o1.event_date as eventDate + FROM Job_Execution_Log o1 + LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date + WHERE o2.job_id IS NULL AND o1.status IN ('SCHEDULED', 'RETRY') + + + + + + SELECT + o1.job_id as jobId, + o1.expiration_time as expirationTime, + o1.priority as priority, + o1.process_instance_id as processInstanceId, + o1.node_instance_id as nodeInstanceId, + o1.repeat_interval as repeatInterval, + o1.repeat_limit as repeatLimit, + o1.scheduled_id as scheduledId, + o1.retries as retries, + o1.status as status, + o1.execution_counter as executionCounter, + o1.event_date as eventDate + FROM Job_Execution_Log o1 + LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date + WHERE o2.job_id IS NULL AND o1.status IN ('SCHEDULED') + + + + + + SELECT + o1.job_id as jobId, + o1.expiration_time as expirationTime, + o1.priority as priority, + o1.process_instance_id as processInstanceId, + o1.node_instance_id as nodeInstanceId, + o1.repeat_interval as repeatInterval, + o1.repeat_limit as repeatLimit, + o1.scheduled_id as scheduledId, + o1.retries as retries, + o1.status as status, + o1.execution_counter as executionCounter, + o1.event_date as eventDate + FROM Job_Execution_Log o1 + LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date + WHERE o2.job_id IS NULL AND o1.status IN ('RETRY', 'ERROR') + + + + + + + SELECT + o1.job_id as jobId, + o1.expiration_time as expirationTime, + o1.priority as priority, + o1.process_instance_id as processInstanceId, + o1.node_instance_id as nodeInstanceId, + o1.repeat_interval as repeatInterval, + o1.repeat_limit as repeatLimit, + o1.scheduled_id as scheduledId, + o1.retries as retries, + o1.status as status, + o1.execution_counter as executionCounter, + o1.event_date as eventDate + FROM Job_Execution_Log o1 + LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date + WHERE o2.job_id IS NULL + ORDER BY o1.event_date DESC + + + + + + SELECT + o1.job_id as jobId, + o1.expiration_time as expirationTime, + o1.priority as priority, + o1.process_instance_id as processInstanceId, + o1.node_instance_id as nodeInstanceId, + o1.repeat_interval as repeatInterval, + o1.repeat_limit as repeatLimit, + o1.scheduled_id as scheduledId, + o1.retries as retries, + o1.status as status, + o1.execution_counter as executionCounter, + o1.event_date as eventDate + FROM Job_Execution_Log o1 + LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date + WHERE o2.job_id IS NULL AND o1.status = 'EXECUTED' + + + + + + SELECT + o1.job_id as jobId, + o1.expiration_time as expirationTime, + o1.priority as priority, + o1.process_instance_id as processInstanceId, + o1.node_instance_id as nodeInstanceId, + o1.repeat_interval as repeatInterval, + o1.repeat_limit as repeatLimit, + o1.scheduled_id as scheduledId, + o1.retries as retries, + o1.status as status, + o1.execution_counter as executionCounter, + o1.event_date as eventDate + FROM Job_Execution_Log o1 + LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date + WHERE o2.job_id IS NULL AND o1.status = 'ERROR' + + + + + + SELECT + o1.job_id as jobId, + o1.expiration_time as expirationTime, + o1.priority as priority, + o1.process_instance_id as processInstanceId, + o1.node_instance_id as nodeInstanceId, + o1.repeat_interval as repeatInterval, + o1.repeat_limit as repeatLimit, + o1.scheduled_id as scheduledId, + o1.retries as retries, + o1.status as status, + o1.execution_counter as executionCounter, + o1.event_date as eventDate + FROM Job_Execution_Log o1 + LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date + WHERE o2.job_id IS NULL AND o1.status = 'CANCELED' + + + + + + + SELECT + o1.job_id as jobId, + o1.expiration_time as expirationTime, + o1.priority as priority, + o1.process_instance_id as processInstanceId, + o1.node_instance_id as nodeInstanceId, + o1.repeat_interval as repeatInterval, + o1.repeat_limit as repeatLimit, + o1.scheduled_id as scheduledId, + o1.retries as retries, + o1.status as status, + o1.execution_counter as executionCounter, + o1.event_date as eventDate + FROM Job_Execution_Log o1 + LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date + WHERE o2.job_id IS NULL AND o1.status IN (:status) + ORDER BY o1.event_date DESC + + + + + + SELECT + o1.job_id as jobId, + o1.expiration_time as expirationTime, + o1.priority as priority, + o1.process_instance_id as processInstanceId, + o1.node_instance_id as nodeInstanceId, + o1.repeat_interval as repeatInterval, + o1.repeat_limit as repeatLimit, + o1.scheduled_id as scheduledId, + o1.retries as retries, + o1.status as status, + o1.execution_counter as executionCounter, + o1.event_date as eventDate + FROM Job_Execution_Log o1 + LEFT JOIN Job_Execution_Log o2 ON o1.job_id = o2.job_id AND o1.event_date < o2.event_date + WHERE o2.job_id IS NULL AND o1.process_instance_id = :processInstanceId + ORDER BY o1.event_date DESC + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.process_type as processType, + log.process_id as processId, + log.process_version as processVersion, + log.parent_process_instance_id as parentProcessInstanceId, + log.root_process_id as rootProcessId, + log.root_process_instance_id as rootProcessInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.event_type as eventType, + log.outcome as outcome, + log.state as state, + log.sla_due_date as slaDueDate, + roles.role as role + FROM Process_Instance_State_Log log + LEFT JOIN Process_Instance_State_Log log_newer ON log.event_date < log_newer.event_date AND log.process_instance_id = log_newer.process_instance_id + LEFT JOIN Process_Instance_State_Roles_Log roles ON log.id = roles.process_instance_state_log_id + WHERE log_newer.event_id IS NULL + ORDER BY log.event_date DESC + + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.process_type as processType, + log.process_id as processId, + log.process_version as processVersion, + log.parent_process_instance_id as parentProcessInstanceId, + log.root_process_id as rootProcessId, + log.root_process_instance_id as rootProcessInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.event_type as eventType, + log.outcome as outcome, + log.state as state, + log.sla_due_date as slaDueDate, + roles.role as role + FROM Process_Instance_State_Log log + LEFT JOIN Process_Instance_State_Log log_newer ON log.event_date < log_newer.event_date AND log.process_instance_id = log_newer.process_instance_id + LEFT JOIN Process_Instance_State_Roles_Log roles ON log.id = roles.process_instance_state_log_id + WHERE log_newer.event_id IS NULL AND log.state = :status + ORDER BY log.event_date DESC + + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.process_type as processType, + log.process_id as processId, + log.process_version as processVersion, + log.parent_process_instance_id as parentProcessInstanceId, + log.root_process_id as rootProcessId, + log.root_process_instance_id as rootProcessInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.event_type as eventType, + log.outcome as outcome, + log.state as state, + log.sla_due_date as slaDueDate, + roles.role as role + FROM Process_Instance_State_Log log + LEFT JOIN Process_Instance_State_Log log_newer ON log.event_date < log_newer.event_date AND log.process_instance_id = log_newer.process_instance_id + LEFT JOIN Process_Instance_State_Roles_Log roles ON log.id = roles.process_instance_state_log_id + WHERE log_newer.event_id IS NULL AND log.process_id = :processId + ORDER BY log.event_date DESC + + + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.process_type as processType, + log.process_id as processId, + log.process_version as processVersion, + log.parent_process_instance_id as parentProcessInstanceId, + log.root_process_id as rootProcessId, + log.root_process_instance_id as rootProcessInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.event_type as eventType, + log.outcome as outcome, + log.state as state, + log.sla_due_date as slaDueDate, + roles.role as role + FROM Process_Instance_State_Log log + LEFT JOIN Process_Instance_State_Roles_Log roles ON log.id = roles.process_instance_state_log_id + WHERE log.process_instance_id = :processInstanceId + ORDER BY log.event_date DESC + + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.process_type as processType, + log.process_id as processId, + log.process_version as processVersion, + log.parent_process_instance_id as parentProcessInstanceId, + log.root_process_id as rootProcessId, + log.root_process_instance_id as rootProcessInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.event_type as eventType, + log.outcome as outcome, + log.state as state, + log.sla_due_date as slaDueDate, + roles.role as role + FROM Process_Instance_State_Log log + LEFT JOIN Process_Instance_State_Roles_Log roles ON log.id = roles.process_instance_state_log_id + WHERE log.business_key = :businessKey + ORDER BY log.event_date DESC + + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.process_type as processType, + log.process_id as processId, + log.process_version as processVersion, + log.parent_process_instance_id as parentProcessInstanceId, + log.root_process_id as rootProcessId, + log.root_process_instance_id as rootProcessInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.event_type as eventType, + log.node_type as nodeType, + log.node_name as nodeName, + log.node_instance_id as nodeInstanceId, + log.connection as connection, + log.work_item_id as workItemId, + log.sla_due_date as slaDueDate, + log.event_data as eventData + FROM Process_Instance_Node_Log log + LEFT JOIN Process_Instance_Node_Log log_newer ON log.event_date < log_newer.event_date AND log.process_instance_id = log_newer.process_instance_id AND log.node_instance_id = log_newer.node_instance_id + WHERE log_newer.event_id IS NULL AND log.process_instance_id = :processInstanceId + ORDER BY log.event_date DESC + + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.process_type as processType, + log.process_id as processId, + log.process_version as processVersion, + log.parent_process_instance_id as parentProcessInstanceId, + log.root_process_id as rootProcessId, + log.root_process_instance_id as rootProcessInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.error_message as errorMessage, + log.node_definition_id as nodeDefinitionId, + log.node_instance_id as nodeInstanceId + FROM Process_Instance_Error_Log log + WHERE log.process_instance_id = :processInstanceId + ORDER BY log.event_date DESC + + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.process_type as processType, + log.process_id as processId, + log.process_version as processVersion, + log.parent_process_instance_id as parentProcessInstanceId, + log.root_process_id as rootProcessId, + log.root_process_instance_id as rootProcessInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.variable_id as variableId, + log.variable_name as variableName, + log.variable_value as variableValue + FROM Process_Instance_Variable_Log log + LEFT JOIN Process_Instance_Variable_Log log_newer ON log.event_date < log_newer.event_date + AND log.process_instance_id = log_newer.process_instance_id + AND log.variable_id = log_newer.variable_id + WHERE log_newer.event_id IS NULL AND log.process_instance_id = :processInstanceId + ORDER BY log.event_date DESC + + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.process_type as processType, + log.process_id as processId, + log.process_version as processVersion, + log.parent_process_instance_id as parentProcessInstanceId, + log.root_process_id as rootProcessId, + log.root_process_instance_id as rootProcessInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.variable_id as variableId, + log.variable_name as variableName, + log.variable_value as variableValue + FROM Process_Instance_Variable_Log log + WHERE log.process_instance_id = :processInstanceId + ORDER BY log.variable_id ASC, log.event_date DESC + + + + + + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.user_task_definition_id as userTaskDefinitionId, + log.user_task_instance_id as userTaskInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.task_id as taskId, + log.name as name, + log.description as description, + log.actual_user as actualUser, + log.state as state, + log.node_definition_id as nodeDefinitionId, + log.node_instance_id as nodeInstanceId, + log.event_type as eventType + FROM Task_Instance_State_Log log + LEFT JOIN Task_Instance_State_Log log_newer ON log.user_task_instance_id = log_newer.user_task_instance_id + AND log_newer.event_date < log_newer.event_date + WHERE log_newer.event_id IS NULL + + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.event_user as eventUser, + log.user_task_definition_id as userTaskDefinitionId, + log.user_task_instance_id as userTaskInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.task_name as userTaskName, + log.assignment_type as assignmentType, + users.user_id + FROM Task_Instance_Assignment_Log log + LEFT JOIN Task_Instance_Assignment_Users_Log users ON users.task_instance_assignment_log_id = log.id + WHERE log.user_task_instance_id = :userTaskInstanceId + + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.event_user as eventUser, + log.user_task_definition_id as userTaskDefinitionId, + log.user_task_instance_id as userTaskInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.attachment_id as attachmentId, + log.attachment_name as attachmentName, + log.attachment_uri as attachmentURI, + log.event_type as eventType + FROM Task_Instance_Attachment_Log log + LEFT JOIN Task_Instance_Attachment_Log log_newer ON log.user_task_instance_id = log_newer.user_task_instance_id + AND log.attachment_id = log_newer.attachment_id + AND log_newer.event_date < log_newer.event_date + WHERE log_newer.event_id IS NULL AND log.user_task_instance_id = :userTaskInstanceId + + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.user_task_definition_id as userTaskDefinitionId, + log.user_task_instance_id as userTaskInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.comment_id as commentId, + log.comment_content as commentContent, + log.event_type as eventType + FROM Task_Instance_Comment_Log log + LEFT JOIN Task_Instance_Comment_Log log_newer ON log.user_task_instance_id = log_newer.user_task_instance_id + AND log.comment_id = log_newer.comment_id + AND log_newer.event_date < log_newer.event_date + WHERE log_newer.event_id IS NULL AND log.user_task_instance_id = :userTaskInstanceId + + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.user_task_definition_id as userTaskDefinitionId, + log.user_task_instance_id as userTaskInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.event_type as eventType, + notification.property_name as propertyName, + notification.property_value as propertyValue + FROM Task_Instance_Deadline_Log log + LEFT JOIN TaskInstanceDeadlineNotificationLog notification ON log.id = notification.task_instance_deadline_log_id + WHERE log.user_task_instance_id = :userTaskInstanceId + + + + + + + SELECT log.event_id as eventId, + log.event_date as eventDate, + log.event_user as eventUser, + log.user_task_definition_id as userTaskDefinitionId, + log.user_task_instance_id as userTaskInstanceId, + log.process_instance_id as processInstanceId, + log.business_key as businessKey, + log.variable_id as variableId, + log.variable_name as variableName, + log.variable_value as variableValue, + log.variable_type as variableType + FROM Task_Instance_Variable_Log log + LEFT JOIN Task_Instance_Variable_Log log_newer ON log.user_task_instance_id = log_newer.user_task_instance_id + AND log.variable_id = log_newer.variable_id + AND log.variable_type = log_newer.variable_type + AND log.event_date < log_newer.event_date + WHERE log_newer.event_id IS NULL AND log.user_task_instance_id = :userTaskInstanceId + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/process-orm.xml b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/process-orm.xml deleted file mode 100644 index 951008af48..0000000000 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/process-orm.xml +++ /dev/null @@ -1,335 +0,0 @@ - - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.process_type as processType, - log.process_id as processId, - log.process_version as processVersion, - log.parent_process_instance_id as parentProcessInstanceId, - log.root_process_id as rootProcessId, - log.root_process_instance_id as rootProcessInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.event_type as eventType, - log.outcome as outcome, - log.state as state, - log.sla_due_date as slaDueDate, - roles.role as role - FROM Process_Instance_State_Log log - LEFT JOIN Process_Instance_State_Log log_newer ON log.event_date < log_newer.event_date AND log.process_instance_id = log_newer.process_instance_id - LEFT JOIN Process_Instance_State_Roles_Log roles ON log.id = roles.process_instance_state_log_id - WHERE log_newer.event_id IS NULL - ORDER BY log.event_date DESC - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.process_type as processType, - log.process_id as processId, - log.process_version as processVersion, - log.parent_process_instance_id as parentProcessInstanceId, - log.root_process_id as rootProcessId, - log.root_process_instance_id as rootProcessInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.event_type as eventType, - log.outcome as outcome, - log.state as state, - log.sla_due_date as slaDueDate, - roles.role as role - FROM Process_Instance_State_Log log - LEFT JOIN Process_Instance_State_Log log_newer ON log.event_date < log_newer.event_date AND log.process_instance_id = log_newer.process_instance_id - LEFT JOIN Process_Instance_State_Roles_Log roles ON log.id = roles.process_instance_state_log_id - WHERE log_newer.event_id IS NULL AND log.state = :status - ORDER BY log.event_date DESC - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.process_type as processType, - log.process_id as processId, - log.process_version as processVersion, - log.parent_process_instance_id as parentProcessInstanceId, - log.root_process_id as rootProcessId, - log.root_process_instance_id as rootProcessInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.event_type as eventType, - log.outcome as outcome, - log.state as state, - log.sla_due_date as slaDueDate, - roles.role as role - FROM Process_Instance_State_Log log - LEFT JOIN Process_Instance_State_Log log_newer ON log.event_date < log_newer.event_date AND log.process_instance_id = log_newer.process_instance_id - LEFT JOIN Process_Instance_State_Roles_Log roles ON log.id = roles.process_instance_state_log_id - WHERE log_newer.event_id IS NULL AND log.process_id = :processId - ORDER BY log.event_date DESC - - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.process_type as processType, - log.process_id as processId, - log.process_version as processVersion, - log.parent_process_instance_id as parentProcessInstanceId, - log.root_process_id as rootProcessId, - log.root_process_instance_id as rootProcessInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.event_type as eventType, - log.outcome as outcome, - log.state as state, - log.sla_due_date as slaDueDate, - roles.role as role - FROM Process_Instance_State_Log log - LEFT JOIN Process_Instance_State_Roles_Log roles ON log.id = roles.process_instance_state_log_id - WHERE log.process_instance_id = :processInstanceId - ORDER BY log.event_date DESC - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.process_type as processType, - log.process_id as processId, - log.process_version as processVersion, - log.parent_process_instance_id as parentProcessInstanceId, - log.root_process_id as rootProcessId, - log.root_process_instance_id as rootProcessInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.event_type as eventType, - log.outcome as outcome, - log.state as state, - log.sla_due_date as slaDueDate, - roles.role as role - FROM Process_Instance_State_Log log - LEFT JOIN Process_Instance_State_Roles_Log roles ON log.id = roles.process_instance_state_log_id - WHERE log.business_key = :businessKey - ORDER BY log.event_date DESC - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.process_type as processType, - log.process_id as processId, - log.process_version as processVersion, - log.parent_process_instance_id as parentProcessInstanceId, - log.root_process_id as rootProcessId, - log.root_process_instance_id as rootProcessInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.event_type as eventType, - log.node_type as nodeType, - log.node_name as nodeName, - log.node_instance_id as nodeInstanceId, - log.connection as connection, - log.work_item_id as workItemId, - log.sla_due_date as slaDueDate, - log.event_data as eventData - FROM Process_Instance_Node_Log log - LEFT JOIN Process_Instance_Node_Log log_newer ON log.event_date < log_newer.event_date AND log.process_instance_id = log_newer.process_instance_id AND log.node_instance_id = log_newer.node_instance_id - WHERE log_newer.event_id IS NULL AND log.process_instance_id = :processInstanceId - ORDER BY log.event_date DESC - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.process_type as processType, - log.process_id as processId, - log.process_version as processVersion, - log.parent_process_instance_id as parentProcessInstanceId, - log.root_process_id as rootProcessId, - log.root_process_instance_id as rootProcessInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.error_message as errorMessage, - log.node_definition_id as nodeDefinitionId, - log.node_instance_id as nodeInstanceId - FROM Process_Instance_Error_Log log - WHERE log.process_instance_id = :processInstanceId - ORDER BY log.event_date DESC - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.process_type as processType, - log.process_id as processId, - log.process_version as processVersion, - log.parent_process_instance_id as parentProcessInstanceId, - log.root_process_id as rootProcessId, - log.root_process_instance_id as rootProcessInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.variable_id as variableId, - log.variable_name as variableName, - log.variable_value as variableValue - FROM Process_Instance_Variable_Log log - LEFT JOIN Process_Instance_Variable_Log log_newer ON log.event_date < log_newer.event_date - AND log.process_instance_id = log_newer.process_instance_id - AND log.variable_id = log_newer.variable_id - WHERE log_newer.event_id IS NULL AND log.process_instance_id = :processInstanceId - ORDER BY log.event_date DESC - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.process_type as processType, - log.process_id as processId, - log.process_version as processVersion, - log.parent_process_instance_id as parentProcessInstanceId, - log.root_process_id as rootProcessId, - log.root_process_instance_id as rootProcessInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.variable_id as variableId, - log.variable_name as variableName, - log.variable_value as variableValue - FROM Process_Instance_Variable_Log log - WHERE log.process_instance_id = :processInstanceId - ORDER BY log.variable_id ASC, log.event_date DESC - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/usertask-orm.xml b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/usertask-orm.xml deleted file mode 100644 index 5c93c5fedf..0000000000 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/usertask-orm.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.user_task_definition_id as userTaskDefinitionId, - log.user_task_instance_id as userTaskInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.task_id as taskId, - log.name as name, - log.description as description, - log.actual_user as actualUser, - log.state as state, - log.node_definition_id as nodeDefinitionId, - log.node_instance_id as nodeInstanceId, - log.event_type as eventType - FROM Task_Instance_State_Log log - LEFT JOIN Task_Instance_State_Log log_newer ON log.user_task_instance_id = log_newer.user_task_instance_id - AND log_newer.event_date < log_newer.event_date - WHERE log_newer.event_id IS NULL - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.event_user as eventUser, - log.user_task_definition_id as userTaskDefinitionId, - log.user_task_instance_id as userTaskInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.task_name as userTaskName, - log.assignment_type as assignmentType, - users.user_id - FROM Task_Instance_Assignment_Log log - LEFT JOIN Task_Instance_Assignment_Users_Log users ON users.task_instance_assignment_log_id = log.id - WHERE log.user_task_instance_id = :userTaskInstanceId - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.event_user as eventUser, - log.user_task_definition_id as userTaskDefinitionId, - log.user_task_instance_id as userTaskInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.attachment_id as attachmentId, - log.attachment_name as attachmentName, - log.attachment_uri as attachmentURI, - log.event_type as eventType - FROM Task_Instance_Attachment_Log log - LEFT JOIN Task_Instance_Attachment_Log log_newer ON log.user_task_instance_id = log_newer.user_task_instance_id - AND log.attachment_id = log_newer.attachment_id - AND log_newer.event_date < log_newer.event_date - WHERE log_newer.event_id IS NULL AND log.user_task_instance_id = :userTaskInstanceId - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.user_task_definition_id as userTaskDefinitionId, - log.user_task_instance_id as userTaskInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.comment_id as commentId, - log.comment_content as commentContent, - log.event_type as eventType - FROM Task_Instance_Comment_Log log - LEFT JOIN Task_Instance_Comment_Log log_newer ON log.user_task_instance_id = log_newer.user_task_instance_id - AND log.comment_id = log_newer.comment_id - AND log_newer.event_date < log_newer.event_date - WHERE log_newer.event_id IS NULL AND log.user_task_instance_id = :userTaskInstanceId - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.user_task_definition_id as userTaskDefinitionId, - log.user_task_instance_id as userTaskInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.event_type as eventType, - notification.property_name as propertyName, - notification.property_value as propertyValue - FROM Task_Instance_Deadline_Log log - LEFT JOIN TaskInstanceDeadlineNotificationLog notification ON log.id = notification.task_instance_deadline_log_id - WHERE log.user_task_instance_id = :userTaskInstanceId - - - - - - - SELECT log.event_id as eventId, - log.event_date as eventDate, - log.event_user as eventUser, - log.user_task_definition_id as userTaskDefinitionId, - log.user_task_instance_id as userTaskInstanceId, - log.process_instance_id as processInstanceId, - log.business_key as businessKey, - log.variable_id as variableId, - log.variable_name as variableName, - log.variable_value as variableValue, - log.variable_type as variableType - FROM Task_Instance_Variable_Log log - LEFT JOIN Task_Instance_Variable_Log log_newer ON log.user_task_instance_id = log_newer.user_task_instance_id - AND log.variable_id = log_newer.variable_id - AND log.variable_type = log_newer.variable_type - AND log.event_date < log_newer.event_date - WHERE log_newer.event_id IS NULL AND log.user_task_instance_id = :userTaskInstanceId - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/src/main/java/org/kie/kogito/app/audit/quarkus/QuarkusJPADataAuditContextFactory.java b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/src/main/java/org/kie/kogito/app/audit/quarkus/QuarkusJPADataAuditContextFactory.java index 873046f053..776a27114d 100644 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/src/main/java/org/kie/kogito/app/audit/quarkus/QuarkusJPADataAuditContextFactory.java +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/src/main/java/org/kie/kogito/app/audit/quarkus/QuarkusJPADataAuditContextFactory.java @@ -28,7 +28,7 @@ @ApplicationScoped public class QuarkusJPADataAuditContextFactory implements DataAuditContextFactory { - @PersistenceContext(unitName = "DataAuditPU") + @PersistenceContext EntityManager entityManager; @Override diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/src/main/resources/application.properties b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/src/main/resources/application.properties index b6fdadeb08..b60de7d417 100644 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/src/main/resources/application.properties +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/src/main/resources/application.properties @@ -1,3 +1,3 @@ -quarkus.hibernate-orm.DataAuditPU.packages=org.kie.kogito.app.audit.jpa.model -quarkus.hibernate-orm.DataAuditPU.mapping-files=META-INF/entity-orm.xml,META-INF/job-orm.xml,META-INF/process-orm.xml,META-INF/usertask-orm.xml -quarkus.hibernate-orm.DataAuditPU.datasource=data-audit \ No newline at end of file +#quarkus.hibernate-orm.DataAuditPU.packages=org.kie.kogito.app.audit.jpa.model +#quarkus.hibernate-orm.DataAuditPU.mapping-files=META-INF/entity-orm.xml,META-INF/job-orm.xml,META-INF/process-orm.xml,META-INF/usertask-orm.xml +#quarkus.hibernate-orm.DataAuditPU.datasource=data-audit \ No newline at end of file diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-springboot/src/main/java/org/kie/kogito/app/audit/springboot/SpringbootJPAAuditDataConfiguration.java b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-springboot/src/main/java/org/kie/kogito/app/audit/springboot/SpringbootJPAAuditDataConfiguration.java index 0f920c12aa..b1e3ba37cc 100644 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-springboot/src/main/java/org/kie/kogito/app/audit/springboot/SpringbootJPAAuditDataConfiguration.java +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-springboot/src/main/java/org/kie/kogito/app/audit/springboot/SpringbootJPAAuditDataConfiguration.java @@ -18,63 +18,11 @@ */ package org.kie.kogito.app.audit.springboot; -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; -import org.springframework.context.annotation.Bean; +import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.context.annotation.PropertySource; -import org.springframework.orm.jpa.JpaVendorAdapter; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; @Configuration(proxyBeanMethods = false) -@PropertySource("classpath:/application-data-audit.properties") +@EntityScan(basePackages = "org.kie.kogito.app.audit.jpa.model") public class SpringbootJPAAuditDataConfiguration { - @Bean - @Primary - public JpaProperties primaryJpaDataAuditProperties() { - return new JpaProperties(); - } - - @Bean(name = "JPADataAuditProperties") - @Qualifier("JPADataAuditProperties") - @ConfigurationProperties(prefix = "data-audit.spring.jpa") - public JpaProperties jpaDataAuditProperties() { - return new JpaProperties(); - } - - @Bean(name = "jpaDataAuditEntityManagerFactory") - @Qualifier("jpaDataAuditEntityManagerFactory") - public LocalContainerEntityManagerFactoryBean jpaDataAuditEntityManagerFactory( - DataSource dataSource, - @Autowired @Qualifier("JPADataAuditProperties") JpaProperties jpaProperties) { - EntityManagerFactoryBuilder builder = createEntityManagerFactoryBuilder(jpaProperties); - return builder - .dataSource(dataSource) - .mappingResources(jpaProperties.getMappingResources().toArray(String[]::new)) - .properties(jpaProperties.getProperties()) - .persistenceUnit("DataAuditPU") - .build(); - } - - private EntityManagerFactoryBuilder createEntityManagerFactoryBuilder(JpaProperties jpaProperties) { - JpaVendorAdapter jpaVendorAdapter = createJpaVendorAdapter(jpaProperties); - return new EntityManagerFactoryBuilder(jpaVendorAdapter, jpaProperties.getProperties(), null); - } - - private JpaVendorAdapter createJpaVendorAdapter(JpaProperties jpaProperties) { - HibernateJpaVendorAdapter hibernate = new HibernateJpaVendorAdapter(); - hibernate.setDatabase(jpaProperties.getDatabase()); - hibernate.setGenerateDdl(jpaProperties.isGenerateDdl()); - hibernate.setShowSql(jpaProperties.isShowSql()); - hibernate.setDatabasePlatform(jpaProperties.getDatabasePlatform()); - return hibernate; - } } diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-springboot/src/main/java/org/kie/kogito/app/audit/springboot/SpringbootJPADataAuditContextFactory.java b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-springboot/src/main/java/org/kie/kogito/app/audit/springboot/SpringbootJPADataAuditContextFactory.java index 07a0f51115..32f933e338 100644 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-springboot/src/main/java/org/kie/kogito/app/audit/springboot/SpringbootJPADataAuditContextFactory.java +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-springboot/src/main/java/org/kie/kogito/app/audit/springboot/SpringbootJPADataAuditContextFactory.java @@ -23,14 +23,12 @@ import org.kie.kogito.app.audit.api.DataAuditContext; import org.kie.kogito.app.audit.spi.DataAuditContextFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; @Component public class SpringbootJPADataAuditContextFactory implements DataAuditContextFactory { @Autowired - @Qualifier("jpaDataAuditEntityManagerFactory") EntityManager entityManager; @Override diff --git a/data-audit/kogito-addons-data-audit-quarkus/src/main/resources/application.properties b/data-audit/kogito-addons-data-audit-quarkus/src/main/resources/application.properties deleted file mode 100644 index 0b034e5aa0..0000000000 --- a/data-audit/kogito-addons-data-audit-quarkus/src/main/resources/application.properties +++ /dev/null @@ -1,3 +0,0 @@ -quarkus.hibernate-orm.DataAuditPU.enabled=true -quarkus.hibernate-orm.DataAuditPU.packages=org.kie.kogito.app.audit.jpa.model -quarkus.hibernate-orm.DataAuditPU.mapping-files=META-INF/entity-orm.xml,META-INF/job-orm.xml,META-INF/process-orm.xml,META-INF/usertask-orm.xml \ No newline at end of file diff --git a/data-audit/kogito-addons-data-audit-quarkus/src/test/resources/application.properties b/data-audit/kogito-addons-data-audit-quarkus/src/test/resources/application.properties index 85757a56c4..21c5f97026 100644 --- a/data-audit/kogito-addons-data-audit-quarkus/src/test/resources/application.properties +++ b/data-audit/kogito-addons-data-audit-quarkus/src/test/resources/application.properties @@ -1,9 +1,9 @@ -quarkus.datasource.data-audit.db-kind=h2 -quarkus.datasource.data-audit.username=hibernate -quarkus.datasource.data-audit.password=hibernate -quarkus.datasource.data-audit.jdbc.url=jdbc:h2:mem:test +quarkus.datasource.db-kind=h2 +quarkus.datasource.username=hibernate +quarkus.datasource.password=hibernate +quarkus.datasource.jdbc.url=jdbc:h2:mem:test -quarkus.hibernate-orm.DataAuditPU.database.generation=create-drop +quarkus.hibernate-orm.database.generation=create-drop diff --git a/data-audit/kogito-addons-data-audit-springboot/src/test/resources/application.properties b/data-audit/kogito-addons-data-audit-springboot/src/test/resources/application.properties index aa16a2b100..2ab6c0f432 100644 --- a/data-audit/kogito-addons-data-audit-springboot/src/test/resources/application.properties +++ b/data-audit/kogito-addons-data-audit-springboot/src/test/resources/application.properties @@ -4,7 +4,7 @@ spring.datasource.jdbc-url=jdbc:h2:mem:test spring.datasource.driver-class-name=org.h2.Driver -data-audit.spring.jpa.database=H2 -data-audit.spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect -data-audit.spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop +spring.jpa.database=H2 +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect +spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop