diff --git a/jbpm-audit/pom.xml b/jbpm-audit/pom.xml
index 09878e3b16..ae28ab0a68 100644
--- a/jbpm-audit/pom.xml
+++ b/jbpm-audit/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-audit
diff --git a/jbpm-audit/src/main/java/org/jbpm/process/audit/event/DefaultAuditEventBuilderImpl.java b/jbpm-audit/src/main/java/org/jbpm/process/audit/event/DefaultAuditEventBuilderImpl.java
index ab1b75eb2d..107ac72de3 100644
--- a/jbpm-audit/src/main/java/org/jbpm/process/audit/event/DefaultAuditEventBuilderImpl.java
+++ b/jbpm-audit/src/main/java/org/jbpm/process/audit/event/DefaultAuditEventBuilderImpl.java
@@ -86,6 +86,7 @@ public AuditEvent buildEvent(ProcessCompletedEvent pce, Object log) {
logEvent.setDuration(logEvent.getEnd().getTime() - logEvent.getStart().getTime());
logEvent.setProcessInstanceDescription( pi.getDescription() );
logEvent.setSlaCompliance(pi.getSlaCompliance());
+ logEvent.setSlaDueDate(pi.getSlaDueDate());
return logEvent;
}
diff --git a/jbpm-bpmn2-emfextmodel/pom.xml b/jbpm-bpmn2-emfextmodel/pom.xml
index 859c7b409a..990dec247a 100644
--- a/jbpm-bpmn2-emfextmodel/pom.xml
+++ b/jbpm-bpmn2-emfextmodel/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-bpmn2-emfextmodel
diff --git a/jbpm-bpmn2/pom.xml b/jbpm-bpmn2/pom.xml
index 251f282537..f4a5677783 100644
--- a/jbpm-bpmn2/pom.xml
+++ b/jbpm-bpmn2/pom.xml
@@ -6,7 +6,7 @@
org.jbpm
jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-bpmn2
diff --git a/jbpm-bpmn2/src/test/java/org/jbpm/bpmn2/SLAComplianceTest.java b/jbpm-bpmn2/src/test/java/org/jbpm/bpmn2/SLAComplianceTest.java
index c493cfbe5a..9eba57b2f3 100644
--- a/jbpm-bpmn2/src/test/java/org/jbpm/bpmn2/SLAComplianceTest.java
+++ b/jbpm-bpmn2/src/test/java/org/jbpm/bpmn2/SLAComplianceTest.java
@@ -16,6 +16,7 @@
package org.jbpm.bpmn2;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
@@ -31,11 +32,17 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import org.drools.core.command.SingleSessionCommandService;
+import org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession;
+import org.drools.core.impl.StatefulKnowledgeSessionImpl;
import org.jbpm.bpmn2.objects.TestWorkItemHandler;
import org.jbpm.process.audit.NodeInstanceLog;
import org.jbpm.process.audit.ProcessInstanceLog;
+import org.jbpm.process.instance.InternalProcessRuntime;
import org.jbpm.process.instance.command.UpdateTimerCommand;
import org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler;
+import org.jbpm.process.instance.timer.TimerInstance;
+import org.jbpm.process.instance.timer.TimerManager;
import org.jbpm.workflow.instance.node.HumanTaskNodeInstance;
import org.junit.After;
import org.junit.BeforeClass;
@@ -126,6 +133,49 @@ public void afterSLAViolated(SLAViolatedEvent event) {
ksession.dispose();
}
+ @Test
+ public void testSLAonProcessUpdated() throws Exception {
+ CountDownLatch latch = new CountDownLatch(1);
+ KieBase kbase = createKnowledgeBase("BPMN2-UserTaskWithSLA.bpmn2");
+ KieSession ksession = createKnowledgeSession(kbase);
+
+ ProcessInstance processInstance = ksession.startProcess("UserTask");
+ assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
+
+ Date firstSlaDueDate = getSLADueDateForProcessInstance(processInstance.getId(),
+ (org.jbpm.workflow.instance.WorkflowProcessInstance) processInstance);
+
+ Collection timers = getTimerManager(ksession).getTimers();
+ assertThat(timers.size()).isEqualTo(1);
+
+ ksession.execute(new UpdateTimerCommand(processInstance.getId(), timers.iterator().next().getId(), 7));
+
+ boolean slaViolated = latch.await(5, TimeUnit.SECONDS);
+ assertFalse("Process SLA was violated while it is not expected after update SLA", slaViolated);
+
+ processInstance = ksession.getProcessInstance(processInstance.getId());
+ assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
+
+ int slaCompliance = getSLAComplianceForProcessInstance(processInstance);
+ assertEquals(ProcessInstance.SLA_PENDING, slaCompliance);
+
+ slaViolated = latch.await(5, TimeUnit.SECONDS);
+ assertFalse("Process SLA was not violated while it is expected after 10s", slaViolated);
+
+ slaCompliance = getSLAComplianceForProcessInstance(processInstance);
+ assertEquals(ProcessInstance.SLA_VIOLATED, slaCompliance);
+
+ ksession.abortProcessInstance(processInstance.getId());
+ Date updatedSlaDueDate = getSLADueDateForProcessInstance(processInstance.getId(),
+ (org.jbpm.workflow.instance.WorkflowProcessInstance) processInstance);
+
+ assertTrue(String.format("updatedSlaDueDate '%tc' should be around 4-5 seconds after firstSlaDueDate '%tc'",
+ updatedSlaDueDate, firstSlaDueDate),
+ updatedSlaDueDate.after(firstSlaDueDate));
+
+ ksession.dispose();
+ }
+
@Test
public void testSLAonProcessMet() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-UserTaskWithSLA.bpmn2");
@@ -306,7 +356,7 @@ class TimerIdListener extends DefaultProcessEventListener {
public TimerIdListener(CountDownLatch latch) {
this.latch = latch;
}
-
+
@Override
public void afterNodeTriggered(ProcessNodeTriggeredEvent event) {
if (event.getNodeInstance() instanceof HumanTaskNodeInstance) {
@@ -664,4 +714,31 @@ private Date getSLADueDateForNodeInstance(long processInstanceId, org.jbpm.workf
throw new RuntimeException("NodeInstanceLog not found for id "+nodeInstance.getId()+" and type "+logType);
}
+
+ private Date getSLADueDateForProcessInstance(long processInstanceId, org.jbpm.workflow.instance.WorkflowProcessInstance processInstance) {
+ if (!sessionPersistence) {
+ return processInstance.getSlaDueDate();
+ }
+
+ List logs = logService.findProcessInstances();
+ if (logs == null)
+ throw new RuntimeException("ProcessInstanceLog not found");
+
+ for (ProcessInstanceLog log : logs) {
+ if (log.getId() == processInstanceId) {
+ return log.getSlaDueDate();
+ }
+ }
+
+ throw new RuntimeException("ProcessInstanceLog not found for id "+processInstanceId);
+ }
+
+ private TimerManager getTimerManager(KieSession ksession) {
+ KieSession internal = ksession;
+ if (ksession instanceof CommandBasedStatefulKnowledgeSession) {
+ internal = ( (SingleSessionCommandService) ( (CommandBasedStatefulKnowledgeSession) ksession ).getRunner() ).getKieSession();;
+ }
+
+ return ((InternalProcessRuntime)((StatefulKnowledgeSessionImpl)internal).getProcessRuntime()).getTimerManager();
+ }
}
\ No newline at end of file
diff --git a/jbpm-case-mgmt/jbpm-case-mgmt-api/pom.xml b/jbpm-case-mgmt/jbpm-case-mgmt-api/pom.xml
index a7bd0a06e1..2814429666 100644
--- a/jbpm-case-mgmt/jbpm-case-mgmt-api/pom.xml
+++ b/jbpm-case-mgmt/jbpm-case-mgmt-api/pom.xml
@@ -4,7 +4,7 @@
org.jbpm
jbpm-case-mgmt
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-case-mgmt-api
diff --git a/jbpm-case-mgmt/jbpm-case-mgmt-cmmn/pom.xml b/jbpm-case-mgmt/jbpm-case-mgmt-cmmn/pom.xml
index 64e2930488..637ad5f133 100644
--- a/jbpm-case-mgmt/jbpm-case-mgmt-cmmn/pom.xml
+++ b/jbpm-case-mgmt/jbpm-case-mgmt-cmmn/pom.xml
@@ -3,7 +3,7 @@
org.jbpm
jbpm-case-mgmt
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-case-mgmt-cmmn
diff --git a/jbpm-case-mgmt/jbpm-case-mgmt-impl/pom.xml b/jbpm-case-mgmt/jbpm-case-mgmt-impl/pom.xml
index da75f8ff76..2cae13d59c 100644
--- a/jbpm-case-mgmt/jbpm-case-mgmt-impl/pom.xml
+++ b/jbpm-case-mgmt/jbpm-case-mgmt-impl/pom.xml
@@ -4,7 +4,7 @@
org.jbpm
jbpm-case-mgmt
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-case-mgmt-impl
jBPM :: Case Management Impl
diff --git a/jbpm-case-mgmt/pom.xml b/jbpm-case-mgmt/pom.xml
index 24d7fc410e..80fc3ea107 100644
--- a/jbpm-case-mgmt/pom.xml
+++ b/jbpm-case-mgmt/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-case-mgmt
diff --git a/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/hibernate-core/pom.xml b/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/hibernate-core/pom.xml
index 409811e1be..c17b8ce3ee 100644
--- a/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/hibernate-core/pom.xml
+++ b/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/hibernate-core/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm-container-integration-deps
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
idep-hibernate-core
diff --git a/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/jbpm-ejb-services/pom.xml b/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/jbpm-ejb-services/pom.xml
index a088843f87..eaa1710269 100644
--- a/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/jbpm-ejb-services/pom.xml
+++ b/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/jbpm-ejb-services/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm-container-integration-deps
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
idep-jbpm-ejb-services
diff --git a/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/jbpm-persistence/pom.xml b/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/jbpm-persistence/pom.xml
index f760d149ad..35589a8a34 100644
--- a/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/jbpm-persistence/pom.xml
+++ b/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/jbpm-persistence/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm-container-integration-deps
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
idep-jbpm-persistence
diff --git a/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/jbpm/pom.xml b/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/jbpm/pom.xml
index 5114011e28..8df57bdaba 100644
--- a/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/jbpm/pom.xml
+++ b/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/jbpm/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm-container-integration-deps
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
idep-jbpm
diff --git a/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/pom.xml b/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/pom.xml
index 82b5b4ae6b..61beeb1b17 100644
--- a/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/pom.xml
+++ b/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm-in-container-test
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-container-integration-deps
diff --git a/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/rest/pom.xml b/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/rest/pom.xml
index 0662bfe30d..90dbd67e57 100644
--- a/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/rest/pom.xml
+++ b/jbpm-container-test/jbpm-in-container-test/jbpm-container-integration-deps/rest/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm-container-integration-deps
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
idep-rest
diff --git a/jbpm-container-test/jbpm-in-container-test/jbpm-container-test-suite/pom.xml b/jbpm-container-test/jbpm-in-container-test/jbpm-container-test-suite/pom.xml
index 407ef1f914..66a1131fa2 100644
--- a/jbpm-container-test/jbpm-in-container-test/jbpm-container-test-suite/pom.xml
+++ b/jbpm-container-test/jbpm-in-container-test/jbpm-container-test-suite/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm-in-container-test
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-container-test-suite
diff --git a/jbpm-container-test/jbpm-in-container-test/pom.xml b/jbpm-container-test/jbpm-in-container-test/pom.xml
index 417d2733e4..f9ecfa199a 100644
--- a/jbpm-container-test/jbpm-in-container-test/pom.xml
+++ b/jbpm-container-test/jbpm-in-container-test/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm-container-test
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-in-container-test
diff --git a/jbpm-container-test/jbpm-in-container-test/shrinkwrap-war-profiles/pom.xml b/jbpm-container-test/jbpm-in-container-test/shrinkwrap-war-profiles/pom.xml
index 27078a8b6c..6370d1fdab 100644
--- a/jbpm-container-test/jbpm-in-container-test/shrinkwrap-war-profiles/pom.xml
+++ b/jbpm-container-test/jbpm-in-container-test/shrinkwrap-war-profiles/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm-in-container-test
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
shrinkwrap-war-profiles
diff --git a/jbpm-container-test/jbpm-remote-ejb-test/jbpm-remote-ejb-test-app/pom.xml b/jbpm-container-test/jbpm-remote-ejb-test/jbpm-remote-ejb-test-app/pom.xml
index 31857e1926..96e73ea218 100644
--- a/jbpm-container-test/jbpm-remote-ejb-test/jbpm-remote-ejb-test-app/pom.xml
+++ b/jbpm-container-test/jbpm-remote-ejb-test/jbpm-remote-ejb-test-app/pom.xml
@@ -6,7 +6,7 @@
jbpm-remote-ejb-test
org.jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-remote-ejb-test-app
diff --git a/jbpm-container-test/jbpm-remote-ejb-test/jbpm-remote-ejb-test-domain/pom.xml b/jbpm-container-test/jbpm-remote-ejb-test/jbpm-remote-ejb-test-domain/pom.xml
index 220a7bc313..7b3b119fc2 100644
--- a/jbpm-container-test/jbpm-remote-ejb-test/jbpm-remote-ejb-test-domain/pom.xml
+++ b/jbpm-container-test/jbpm-remote-ejb-test/jbpm-remote-ejb-test-domain/pom.xml
@@ -6,7 +6,7 @@
org.jbpm
jbpm-remote-ejb-test
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-remote-ejb-test-domain
diff --git a/jbpm-container-test/jbpm-remote-ejb-test/jbpm-remote-ejb-test-suite/pom.xml b/jbpm-container-test/jbpm-remote-ejb-test/jbpm-remote-ejb-test-suite/pom.xml
index 60f7b20ff8..224bc32f1d 100644
--- a/jbpm-container-test/jbpm-remote-ejb-test/jbpm-remote-ejb-test-suite/pom.xml
+++ b/jbpm-container-test/jbpm-remote-ejb-test/jbpm-remote-ejb-test-suite/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm-remote-ejb-test
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-remote-ejb-test-suite
diff --git a/jbpm-container-test/jbpm-remote-ejb-test/pom.xml b/jbpm-container-test/jbpm-remote-ejb-test/pom.xml
index f35ac00f99..3b22279fa3 100644
--- a/jbpm-container-test/jbpm-remote-ejb-test/pom.xml
+++ b/jbpm-container-test/jbpm-remote-ejb-test/pom.xml
@@ -6,7 +6,7 @@
org.jbpm
jbpm-container-test
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-remote-ejb-test
diff --git a/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/pom.xml b/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/pom.xml
index 21f9f7d3f5..7524d411d5 100644
--- a/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/pom.xml
+++ b/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/pom.xml
@@ -7,7 +7,7 @@
jbpm-remote-ejb-test
org.jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
test-kjar-parent
diff --git a/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/test-kjar-bpmn-build/pom.xml b/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/test-kjar-bpmn-build/pom.xml
index 43a17865db..fa4d85ee10 100644
--- a/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/test-kjar-bpmn-build/pom.xml
+++ b/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/test-kjar-bpmn-build/pom.xml
@@ -5,7 +5,7 @@
test-kjar-parent
org.jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
test-kjar-bpmn-build
diff --git a/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/test-kjar-evaluation/pom.xml b/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/test-kjar-evaluation/pom.xml
index bae23658a5..fb1f2b92fd 100644
--- a/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/test-kjar-evaluation/pom.xml
+++ b/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/test-kjar-evaluation/pom.xml
@@ -6,7 +6,7 @@
test-kjar-parent
org.jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
test-kjar-evaluation
diff --git a/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/test-kjar-integration/pom.xml b/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/test-kjar-integration/pom.xml
index 21ce4c6378..6d72fab913 100644
--- a/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/test-kjar-integration/pom.xml
+++ b/jbpm-container-test/jbpm-remote-ejb-test/test-kjar-parent/test-kjar-integration/pom.xml
@@ -5,7 +5,7 @@
test-kjar-parent
org.jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
4.0.0
diff --git a/jbpm-container-test/pom.xml b/jbpm-container-test/pom.xml
index 0f762fa844..b00b84e0a5 100644
--- a/jbpm-container-test/pom.xml
+++ b/jbpm-container-test/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-container-test
diff --git a/jbpm-db-scripts/pom.xml b/jbpm-db-scripts/pom.xml
index f392aa49f7..6d964a426c 100644
--- a/jbpm-db-scripts/pom.xml
+++ b/jbpm-db-scripts/pom.xml
@@ -6,7 +6,7 @@
org.jbpm
jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-db-scripts
diff --git a/jbpm-distribution/pom.xml b/jbpm-distribution/pom.xml
index 589845ffdf..40add86441 100644
--- a/jbpm-distribution/pom.xml
+++ b/jbpm-distribution/pom.xml
@@ -6,7 +6,7 @@
org.jbpm
jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-distribution
diff --git a/jbpm-document/pom.xml b/jbpm-document/pom.xml
index e69e77849c..9c185c2fb7 100644
--- a/jbpm-document/pom.xml
+++ b/jbpm-document/pom.xml
@@ -5,7 +5,7 @@
jbpm
org.jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-document
diff --git a/jbpm-event-emitters/jbpm-event-emitters-elasticsearch/pom.xml b/jbpm-event-emitters/jbpm-event-emitters-elasticsearch/pom.xml
index 5a58ae7ebc..e3cb05ac28 100644
--- a/jbpm-event-emitters/jbpm-event-emitters-elasticsearch/pom.xml
+++ b/jbpm-event-emitters/jbpm-event-emitters-elasticsearch/pom.xml
@@ -5,7 +5,7 @@
org.jbpm
jbpm-event-emitters
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-event-emitters-elasticsearch
jBPM :: Event Emitters :: ElasticSearch
diff --git a/jbpm-event-emitters/jbpm-event-emitters-kafka/pom.xml b/jbpm-event-emitters/jbpm-event-emitters-kafka/pom.xml
index 4faebb2f6d..23bec74a96 100644
--- a/jbpm-event-emitters/jbpm-event-emitters-kafka/pom.xml
+++ b/jbpm-event-emitters/jbpm-event-emitters-kafka/pom.xml
@@ -5,7 +5,7 @@
org.jbpm
jbpm-event-emitters
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-event-emitters-kafka
jBPM :: Event Emitters :: Kafka
diff --git a/jbpm-event-emitters/pom.xml b/jbpm-event-emitters/pom.xml
index 64db6f28d2..e2e125d2d0 100644
--- a/jbpm-event-emitters/pom.xml
+++ b/jbpm-event-emitters/pom.xml
@@ -3,7 +3,7 @@
org.jbpm
jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-event-emitters
pom
diff --git a/jbpm-examples/pom.xml b/jbpm-examples/pom.xml
index c5ae4818fd..21a36b9b7c 100644
--- a/jbpm-examples/pom.xml
+++ b/jbpm-examples/pom.xml
@@ -5,7 +5,7 @@
org.jbpm
jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-examples
diff --git a/jbpm-flow-builder/pom.xml b/jbpm-flow-builder/pom.xml
index e69b4397e4..ad65c34627 100644
--- a/jbpm-flow-builder/pom.xml
+++ b/jbpm-flow-builder/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-flow-builder
diff --git a/jbpm-flow/pom.xml b/jbpm-flow/pom.xml
index 4f13fb0d80..35fbd8613e 100644
--- a/jbpm-flow/pom.xml
+++ b/jbpm-flow/pom.xml
@@ -7,7 +7,7 @@
org.jbpm
jbpm
- 7.74.0-SNAPSHOT
+ 7.75.0-SNAPSHOT
jbpm-flow
@@ -106,6 +106,11 @@
org.drools
drools-core
+
+ org.jpmml
+ pmml-model
+ true
+
org.drools
drools-mvel
diff --git a/jbpm-flow/src/main/java/org/jbpm/process/core/context/variable/VariableScope.java b/jbpm-flow/src/main/java/org/jbpm/process/core/context/variable/VariableScope.java
index 4f22535b5a..4619da58c9 100644
--- a/jbpm-flow/src/main/java/org/jbpm/process/core/context/variable/VariableScope.java
+++ b/jbpm-flow/src/main/java/org/jbpm/process/core/context/variable/VariableScope.java
@@ -102,18 +102,13 @@ public Object validateVariable(String processName, String name, Object value) {
}
} else if (value != null) {
DataType type = var.getType();
- ObjectDataType obj = new ObjectDataType();
boolean isRightType = type == null || type.verifyDataType(value);
if (!isRightType ) {
if (variableStrictEnabled) {
throw new IllegalArgumentException("Variable '" + name + "' has incorrect data type expected:" + var
.getType().getStringType() + " actual:" + value.getClass().getName());
} else if (value instanceof String) {
- if (type.getClass() == obj.getClass()) {
- value = type.readValue(value.toString());
- } else {
- value = type.valueOf(value.toString());
- }
+ value = type.valueOf(value.toString());
}
}
}
diff --git a/jbpm-flow/src/main/java/org/jbpm/process/core/datatype/impl/type/ObjectDataType.java b/jbpm-flow/src/main/java/org/jbpm/process/core/datatype/impl/type/ObjectDataType.java
index f94b9a335f..11f7c85f63 100644
--- a/jbpm-flow/src/main/java/org/jbpm/process/core/datatype/impl/type/ObjectDataType.java
+++ b/jbpm-flow/src/main/java/org/jbpm/process/core/datatype/impl/type/ObjectDataType.java
@@ -19,16 +19,24 @@
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.Date;
import java.util.Map;
+import java.util.Optional;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.security.ExplicitTypePermission;
import org.drools.reflective.classloader.ProjectClassLoader;
import org.jbpm.process.core.datatype.DataType;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
import static org.kie.soup.xstream.XStreamUtils.createTrustingXStream;
@@ -37,6 +45,7 @@
*/
public class ObjectDataType implements DataType {
+ private static final Logger logger = LoggerFactory.getLogger(ObjectDataType.class);
private static final long serialVersionUID = 510l;
private String className;
@@ -79,55 +88,83 @@ public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(className);
}
- public boolean verifyDataType(final Object value) {
- if (value == null || className == null) {
- return true;
- }
+ private static final Collection prefixes = Arrays.asList("java.lang", "java.util", "java.time");
+
+ private Optional> getClass(Object value) {
try {
- Class> clazz = Class.forName(className, true, value.getClass().getClassLoader());
- if (clazz.isInstance(value) || isValidDate(value)) {
- return true;
- }
+ return Optional.of(Class.forName(className, true, value.getClass().getClassLoader()));
} catch (ClassNotFoundException e) {
- // check class again
+ logger.info("Error {} loading class {}", e, className);
}
- // try to expand fundamental classes if it's not a FQCN
- if(!className.contains(".")) {
- try {
- className = "java.lang."+className;
- Class> clazz = Class.forName(className, true, value.getClass().getClassLoader());
- if (clazz.isInstance(value)) {
- return true;
+ if (!className.contains(".")) {
+ for (String prefix : prefixes) {
+ String altName = prefix + "." + className;
+ try {
+ return Optional.of(Class.forName(altName, true, classLoader));
+ } catch (ClassNotFoundException e) {
+ logger.debug("Error {} loading class {}", e, altName);
}
- } catch (ClassNotFoundException e) {
- return false;
}
}
- return false;
+ return Optional.empty();
}
- private boolean isValidDate(Object value) {
- boolean parseable = false;
- try{
- parseable = LocalDate.parse((String)value)!=null;
- } catch(Exception e) {
- // ignore parse exception
+ public boolean verifyDataType(final Object value) {
+ if (value == null || className == null) {
+ return true;
}
- try{
- parseable = LocalDateTime.parse((String)value)!=null;
- } catch(Exception e) {
- // ignore parse exception
+ return getClass(value).map(c -> c.isInstance(value)).orElse(false);
+ }
+
+ private Optional