From f8614de844ccbae96731b5c7943deea5cb07df68 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:47:37 +0200 Subject: [PATCH 1/7] Bump org.springframework.kafka:spring-kafka from 3.0.9 to 3.0.10 (#3717) Bumps [org.springframework.kafka:spring-kafka](https://github.com/spring-projects/spring-kafka) from 3.0.9 to 3.0.10. - [Release notes](https://github.com/spring-projects/spring-kafka/releases) - [Commits](https://github.com/spring-projects/spring-kafka/compare/v3.0.9...v3.0.10) --- updated-dependencies: - dependency-name: org.springframework.kafka:spring-kafka dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 76f6991f733..675bd995cec 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 6.0.11 6.1.2 3.0.5 - 3.0.9 + 3.0.10 3.1.0 1.1.8 2.15.2 From 4a65b756472301a172a24ff30e7c7d25a5742696 Mon Sep 17 00:00:00 2001 From: Arthur H <516104+arthware@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:48:13 +0200 Subject: [PATCH 2/7] Update README.md to v7 (#3721) --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f3cea0f70cd..eb5b96ce7a0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Flowable (V6) +Flowable (V7) ======== [Maven Central: @@ -33,9 +33,11 @@ The Flowable downloads can be found on https://www.flowable.org/downloads.html. The distribution contains most of the sources as jar files. The source code of Flowable can be found on https://github.com/flowable/flowable-engine. -### JDK 8+ +### JDK 17+ -Flowable runs on a JDK higher than or equal to version 8. Use the JDK packaged with your Linux distribution or go to [adoptium.net](https://adoptium.net/) and click on the *Latest LTS Release* button. There are installation instructions on that page as well. To verify that your installation was successful, run `java -version` on the command line. That should print the installed version of your JDK. +Flowable V7 runs on a Java higher than or equal to version 17. Use the JDK packaged with your Linux distribution or go to [adoptium.net](https://adoptium.net/) and click on the *Latest LTS Release* button. There are installation instructions on that page as well. To verify that your installation was successful, run `java -version` on the command line. That should print the installed version of your JDK. + +[Flowable V6](https://github.com/flowable/flowable-engine/tree/flowable6.x) is still maintained and supports Java 8+. ### Contributing From 2b94a80edb577deaca841efc0a6d3eecfc290234 Mon Sep 17 00:00:00 2001 From: David B Malkovsky Date: Tue, 29 Aug 2023 07:48:37 -0400 Subject: [PATCH 3/7] Chore: remove duplicated semicolon (#3716) * Chore: remove duplicated semicolon * Chore: remove duplicated semicolon * Chore: remove unnecessary semicolon --- .../api/runtime/CaseInstanceCollectionResourceTest.java | 6 +++--- .../AbstractVariableComparatorExpressionFunction.java | 2 +- .../IntermediateThrowSignalEventActivityBehavior.java | 2 +- .../spring/test/jms/JmsChannelDefinitionProcessorTest.java | 2 +- .../task/service/impl/HistoricTaskInstanceQueryImpl.java | 1 - .../java/org/flowable/task/service/impl/TaskQueryImpl.java | 1 - 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/api/runtime/CaseInstanceCollectionResourceTest.java b/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/api/runtime/CaseInstanceCollectionResourceTest.java index 5b13776ba97..dd208b0a9a5 100644 --- a/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/api/runtime/CaseInstanceCollectionResourceTest.java +++ b/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/api/runtime/CaseInstanceCollectionResourceTest.java @@ -147,14 +147,14 @@ public void testGetCaseInstances() throws Exception { url = CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_CASE_INSTANCE_COLLECTION) + "?startedBefore=" + getISODateString(futureCal.getTime()); assertResultsPresentInDataResponse(url, id); - url = CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_CASE_INSTANCE_COLLECTION) + "?startedBefore=" + getISODateString(historicCal.getTime());; + url = CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_CASE_INSTANCE_COLLECTION) + "?startedBefore=" + getISODateString(historicCal.getTime()); assertResultsPresentInDataResponse(url); // Case instance started after - url = CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_CASE_INSTANCE_COLLECTION) + "?startedAfter=" + getISODateString(historicCal.getTime());; + url = CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_CASE_INSTANCE_COLLECTION) + "?startedAfter=" + getISODateString(historicCal.getTime()); assertResultsPresentInDataResponse(url, id); - url = CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_CASE_INSTANCE_COLLECTION) + "?startedAfter=" + getISODateString(futureCal.getTime());; + url = CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_CASE_INSTANCE_COLLECTION) + "?startedAfter=" + getISODateString(futureCal.getTime()); assertResultsPresentInDataResponse(url); // Case instance state diff --git a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/function/AbstractVariableComparatorExpressionFunction.java b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/function/AbstractVariableComparatorExpressionFunction.java index b7319c768a4..b748a561749 100644 --- a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/function/AbstractVariableComparatorExpressionFunction.java +++ b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/function/AbstractVariableComparatorExpressionFunction.java @@ -21,7 +21,7 @@ */ public abstract class AbstractVariableComparatorExpressionFunction extends AbstractFlowableVariableExpressionFunction { - protected enum OPERATOR { LT, LTE, GT, GTE, EQ }; + protected enum OPERATOR { LT, LTE, GT, GTE, EQ } public AbstractVariableComparatorExpressionFunction(List functionNameOptions, String functionName) { super(functionNameOptions, functionName); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/IntermediateThrowSignalEventActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/IntermediateThrowSignalEventActivityBehavior.java index 5efecfb642e..455a4b7e0f2 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/IntermediateThrowSignalEventActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/IntermediateThrowSignalEventActivityBehavior.java @@ -103,7 +103,7 @@ public void execute(DelegateExecution execution) { } Map payload = IOParameterUtil.extractOutVariables(throwEvent.getOutParameters(), execution, - processEngineConfiguration.getExpressionManager());; + processEngineConfiguration.getExpressionManager()); for (SignalEventSubscriptionEntity signalEventSubscriptionEntity : subscriptionEntities) { processEngineConfiguration.getEventDispatcher().dispatchEvent(FlowableEventBuilder.createSignalEvent(FlowableEngineEventType.ACTIVITY_SIGNALED, signalEventSubscriptionEntity.getActivityId(), eventSubscriptionName, diff --git a/modules/flowable-event-registry-spring/src/test/java/org/flowable/eventregistry/spring/test/jms/JmsChannelDefinitionProcessorTest.java b/modules/flowable-event-registry-spring/src/test/java/org/flowable/eventregistry/spring/test/jms/JmsChannelDefinitionProcessorTest.java index 68d698cee4e..edf7074fff0 100644 --- a/modules/flowable-event-registry-spring/src/test/java/org/flowable/eventregistry/spring/test/jms/JmsChannelDefinitionProcessorTest.java +++ b/modules/flowable-event-registry-spring/src/test/java/org/flowable/eventregistry/spring/test/jms/JmsChannelDefinitionProcessorTest.java @@ -712,7 +712,7 @@ void jmsOutboundChannelShouldResolveDestinationFromExpressionUsingCombinationFor Object message = await("receive message") .atMost(Duration.ofSeconds(10)) - .until(() -> jmsTemplate.receiveAndConvert("test-combination.test-expression-customer"), Objects::nonNull);; + .until(() -> jmsTemplate.receiveAndConvert("test-combination.test-expression-customer"), Objects::nonNull); assertThat(message).isNotNull(); assertThatJson(message) .isEqualTo("{" diff --git a/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java b/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java index ab1ff7ffe1b..a9279538053 100644 --- a/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java +++ b/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java @@ -1279,7 +1279,6 @@ public HistoricTaskInstanceQuery caseVariableValueNotEquals(String variableName, currentOrQueryObject.scopedVariableValueNotEquals(variableName, variableValue, ScopeTypes.CMMN); } else { this.scopedVariableValueNotEquals(variableName, variableValue, ScopeTypes.CMMN); - ; } return this; } diff --git a/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java b/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java index c35e8e5fca9..29f79e0e9cc 100644 --- a/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java +++ b/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java @@ -1374,7 +1374,6 @@ public TaskQuery caseVariableValueNotEquals(String variableName, Object variable currentOrQueryObject.scopedVariableValueNotEquals(variableName, variableValue, ScopeTypes.CMMN); } else { this.scopedVariableValueNotEquals(variableName, variableValue, ScopeTypes.CMMN); - ; } return this; } From eddca26e51b5926a95bee0141157478945855f7d Mon Sep 17 00:00:00 2001 From: David B Malkovsky Date: Tue, 29 Aug 2023 07:49:46 -0400 Subject: [PATCH 4/7] Upgrade to Spring Boot 3.1.3 (#3715) * Upgrade to Spring Boot 3.1.3 * Upgrade to Spring Boot 3.1.3 --------- Co-authored-by: Tijs Rademakers --- distro/src/notice.txt | 12 ++++++------ pom.xml | 28 ++++++++++++++-------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/distro/src/notice.txt b/distro/src/notice.txt index 228b7223256..c834af857b4 100644 --- a/distro/src/notice.txt +++ b/distro/src/notice.txt @@ -97,8 +97,8 @@ org.apache.httpcomponents httpclient 4.5.13 Apac org.apache.httpcomponents httpcore 4.4.15 Apache License, Version 2.0 org.apache.httpcomponents httpmime 4.5.13 Apache License, Version 2.0 org.apache.geronimo.bundles json 20090211_1 The Apache Software License, Version 2.0 -org.apache.groovy groovy 4.0.13 The Apache Software License, Version 2.0 -org.apache.groovy groovy-jsr223 4.0.13 The Apache Software License, Version 2.0 +org.apache.groovy groovy 4.0.14 The Apache Software License, Version 2.0 +org.apache.groovy groovy-jsr223 4.0.14 The Apache Software License, Version 2.0 org.eclipse.angus angus-mail 2.0.2 EDL 1.0 / EPL 2.0 org.liquibase liquibase-core 4.5.0 Apache License, Version 2.0 org.mybatis mybatis 3.5.11 The Apache Software License, Version 2.0 @@ -119,10 +119,10 @@ org.springframework spring-aop 6.0.11 The org.springframework spring-core 6.0.11 The Apache Software License, Version 2.0 org.springframework spring-expression 6.0.11 The Apache Software License, Version 2.0 org.springframework spring-orm 6.0.11 The Apache Software License, Version 2.0 -org.springframework.security spring-security-config 6.1.2 The Apache Software License, Version 2.0 -org.springframework.security spring-security-core 6.1.2 The Apache Software License, Version 2.0 -org.springframework.security spring-security-crypto 6.1.2 The Apache Software License, Version 2.0 -org.springframework.security spring-security-web 6.1.2 The Apache Software License, Version 2.0 +org.springframework.security spring-security-config 6.1.3 The Apache Software License, Version 2.0 +org.springframework.security spring-security-core 6.1.3 The Apache Software License, Version 2.0 +org.springframework.security spring-security-crypto 6.1.3 The Apache Software License, Version 2.0 +org.springframework.security spring-security-web 6.1.3 The Apache Software License, Version 2.0 org.tinyjee.jgraphx jgraphx 1.10.4.1 JGraph Ltd - 3 clause BSD license org.yaml snakeyaml 1.17 The Apache Software License, Version 2.0 xerces xercesImpl 2.12.1 The Apache Software License, Version 2.0 diff --git a/pom.xml b/pom.xml index 675bd995cec..7d43202ef43 100644 --- a/pom.xml +++ b/pom.xml @@ -14,19 +14,19 @@ https://oss.sonatype.org/content/repositories/snapshots/ 17 - 3.1.2 + 3.1.3 6.0.11 - 6.1.2 - 3.0.5 + 6.1.3 + 3.0.8 3.0.10 - 3.1.0 + 3.1.1 1.1.8 2.15.2 3.1.0 4.0.0 4.0.2 2.0.7 - 4.0.13 + 4.0.14 3.3.1 4.13.2 @@ -265,7 +265,7 @@ org.hibernate.orm hibernate-core - 6.2.6.Final + 6.2.7.Final org.apache.groovy @@ -1276,42 +1276,42 @@ - http://www.flowable.org + https://www.flowable.org Apache v2 - http://www.apache.org/licenses/LICENSE-2.0.html + https://www.apache.org/licenses/LICENSE-2.0.html Flowable - http://www.flowable.org + https://www.flowable.org Tijs Rademakers Flowable - http://www.flowable.org + https://www.flowable.org Joram Barrez Flowable - http://www.flowable.org + https://www.flowable.org Filip Hrisafov Flowable - http://www.flowable.org + https://www.flowable.org Yvo Swillens Flowable - http://www.flowable.org + https://www.flowable.org Josh Long Pivotal - http://www.pivotal.com + https://www.pivotal.com From 0a57281cbca5768857e1b0134593fd31c3710ea3 Mon Sep 17 00:00:00 2001 From: Simon Amport <10498683+amporsim@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:50:49 +0200 Subject: [PATCH 5/7] The property "migrateToProcessDefinitionVersion" is optional, if it is not set it takes the latest process definition (see AbstractDynamicStateManager#resolveProcessDefinition()) (#3714) --- .../migration/ProcessInstanceMigrationDocumentBuilderImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/migration/ProcessInstanceMigrationDocumentBuilderImpl.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/migration/ProcessInstanceMigrationDocumentBuilderImpl.java index 6ba54df9942..52310f28e52 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/migration/ProcessInstanceMigrationDocumentBuilderImpl.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/migration/ProcessInstanceMigrationDocumentBuilderImpl.java @@ -129,7 +129,7 @@ public ProcessInstanceMigrationDocument build() { if (migrateToProcessDefinitionKey == null) { throw new FlowableException("Process definition key cannot be null"); } - if (migrateToProcessDefinitionVersion == null || migrateToProcessDefinitionVersion < 0) { + if (migrateToProcessDefinitionVersion != null && migrateToProcessDefinitionVersion < 0) { throw new FlowableException("Process definition version must be a positive number"); } } From 67ae239239b0842239c73822bf580edb1fd2819d Mon Sep 17 00:00:00 2001 From: Simon Amport <10498683+amporsim@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:51:20 +0200 Subject: [PATCH 6/7] Filter jobs by handlerType over REST (#3713) --- .../service/api/CmmnRestResponseFactory.java | 1 + .../service/api/management/JobResponse.java | 10 +++++ .../api/management/JobResourceTest.java | 3 ++ .../rest/service/api/RestResponseFactory.java | 1 + .../DeadLetterJobCollectionResource.java | 9 +++++ .../HistoryJobCollectionResource.java | 9 +++++ .../api/management/JobCollectionResource.java | 9 +++++ .../service/api/management/JobResponse.java | 10 +++++ .../SuspendedJobCollectionResource.java | 9 +++++ .../TimerJobCollectionResource.java | 9 +++++ .../management/JobCollectionResourceTest.java | 38 +++++++++++++++++++ .../api/management/JobResourceTest.java | 4 ++ 12 files changed, 112 insertions(+) diff --git a/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/CmmnRestResponseFactory.java b/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/CmmnRestResponseFactory.java index 44ba80e7f0d..6693757a594 100644 --- a/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/CmmnRestResponseFactory.java +++ b/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/CmmnRestResponseFactory.java @@ -1014,6 +1014,7 @@ public JobResponse createJobResponse(Job job, RestUrlBuilder urlBuilder, String[ response.setTenantId(job.getTenantId()); response.setElementId(job.getElementId()); response.setElementName(job.getElementName()); + response.setHandlerType(job.getJobHandlerType()); response.setUrl(urlBuilder.buildUrl(urlJobSegments, job.getId())); diff --git a/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/management/JobResponse.java b/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/management/JobResponse.java index 9f8db947fbd..6ea27cd20d2 100644 --- a/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/management/JobResponse.java +++ b/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/management/JobResponse.java @@ -35,6 +35,7 @@ public class JobResponse { protected String planItemInstanceId; protected String elementId; protected String elementName; + protected String handlerType; protected Integer retries; protected String exceptionMessage; @JsonSerialize(using = DateToStringSerializer.class, as = Date.class) @@ -127,6 +128,15 @@ public void setElementName(String elementName) { this.elementName = elementName; } + public void setHandlerType(String handlerType) { + this.handlerType = handlerType; + } + + @ApiModelProperty(example = "cmmn-trigger-timer") + public String getHandlerType() { + return handlerType; + } + @ApiModelProperty(example = "3") public Integer getRetries() { return retries; diff --git a/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/api/management/JobResourceTest.java b/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/api/management/JobResourceTest.java index 22279d5f535..a56d9c4a609 100644 --- a/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/api/management/JobResourceTest.java +++ b/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/api/management/JobResourceTest.java @@ -69,6 +69,7 @@ public void testGetTimerJob() throws Exception { + "caseInstanceId: '" + timerJob.getScopeId() + "'," + "elementId: 'timerListener'," + "elementName: 'Timer listener'," + + "handlerType: 'cmmn-trigger-timer'," + "retries: " + timerJob.getRetries() + "," + "dueDate: " + new TextNode(getISODateStringWithTZ(timerJob.getDuedate())) + "," + "tenantId: ''" @@ -109,6 +110,7 @@ public void testGetDeadLetterJob() throws Exception { + "caseInstanceId: '" + deadLetterJob.getScopeId() + "'," + "elementId: 'timerListener'," + "elementName: 'Timer listener'," + + "handlerType: 'cmmn-trigger-timer'," + "retries: " + deadLetterJob.getRetries() + "," + "dueDate: " + new TextNode(getISODateStringWithTZ(deadLetterJob.getDuedate())) + "," + "tenantId: ''" @@ -167,6 +169,7 @@ public Void execute(CommandContext commandContext) { + "caseInstanceId: '" + lockedJob.getScopeId() + "'," + "elementId: 'timerListener'," + "elementName: 'Timer listener'," + + "handlerType: 'cmmn-trigger-timer'," + "retries: " + lockedJob.getRetries() + "," + "dueDate: " + new TextNode(getISODateStringWithTZ(lockedJob.getDuedate())) + "," + "lockOwner: 'test'," diff --git a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/RestResponseFactory.java b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/RestResponseFactory.java index 28192e12fc5..a0c693842a7 100644 --- a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/RestResponseFactory.java +++ b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/RestResponseFactory.java @@ -1160,6 +1160,7 @@ protected JobResponse createJobResponse(Job job, RestUrlBuilder urlBuilder, Stri response.setElementName(job.getElementName()); response.setRetries(job.getRetries()); response.setCreateTime(job.getCreateTime()); + response.setHandlerType(job.getJobHandlerType()); if (job instanceof JobInfoEntity) { JobInfoEntity jobInfoEntity = (JobInfoEntity) job; response.setLockOwner(jobInfoEntity.getLockOwner()); diff --git a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/DeadLetterJobCollectionResource.java b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/DeadLetterJobCollectionResource.java index 1af678e66b0..c94434b1d0c 100644 --- a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/DeadLetterJobCollectionResource.java +++ b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/DeadLetterJobCollectionResource.java @@ -15,6 +15,7 @@ import static org.flowable.common.rest.api.PaginateListUtil.paginateList; +import java.util.Arrays; import java.util.Map; import org.flowable.common.engine.api.FlowableIllegalArgumentException; @@ -63,6 +64,8 @@ public class DeadLetterJobCollectionResource { @ApiImplicitParam(name = "processDefinitionId", dataType = "string", value = "Only return jobs with the given process definition id", paramType = "query"), @ApiImplicitParam(name = "elementId", dataType = "string", value = "Only return jobs with the given element id", paramType = "query"), @ApiImplicitParam(name = "elementName", dataType = "string", value = "Only return jobs with the given element name", paramType = "query"), + @ApiImplicitParam(name = "handlerType", dataType = "string", value = "Only return jobs with the given handler type", paramType = "query"), + @ApiImplicitParam(name = "handlerTypes", dataType = "string", value = "Only return jobs which have one of the given job handler type", paramType = "query"), @ApiImplicitParam(name = "executable", dataType = "boolean", value = "If true, only return jobs which are executable. If false, this parameter is ignored.", paramType = "query"), @ApiImplicitParam(name = "timersOnly", dataType = "boolean", value = "If true, only return jobs which are timers. If false, this parameter is ignored. Cannot be used together with 'messagesOnly'.", paramType = "query"), @ApiImplicitParam(name = "messagesOnly", dataType = "boolean", value = "If true, only return jobs which are messages. If false, this parameter is ignored. Cannot be used together with 'timersOnly'", paramType = "query"), @@ -108,6 +111,12 @@ public DataResponse getJobs(@ApiParam(hidden = true) @RequestParam if (allRequestParams.containsKey("elementName")) { query.elementName(allRequestParams.get("elementName")); } + if (allRequestParams.containsKey("handlerType")) { + query.handlerType(allRequestParams.get("handlerType")); + } + if (allRequestParams.containsKey("handlerTypes")) { + query.handlerTypes(Arrays.asList(allRequestParams.get("handlerTypes").split(","))); + } if (allRequestParams.containsKey("executable")) { query.executable(); } diff --git a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/HistoryJobCollectionResource.java b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/HistoryJobCollectionResource.java index adce44d4ef1..306c6cbceda 100644 --- a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/HistoryJobCollectionResource.java +++ b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/HistoryJobCollectionResource.java @@ -15,6 +15,7 @@ import static org.flowable.common.rest.api.PaginateListUtil.paginateList; +import java.util.Arrays; import java.util.Map; import org.flowable.common.rest.api.DataResponse; @@ -58,6 +59,8 @@ public class HistoryJobCollectionResource { @ApiImplicitParam(name = "withException", dataType = "boolean", value = "If true, only return jobs for which an exception occurred while executing it. If false, this parameter is ignored.", paramType = "query"), @ApiImplicitParam(name = "exceptionMessage", dataType = "string", value = "Only return jobs with the given exception message", paramType = "query"), @ApiImplicitParam(name = "scopeType", dataType = "string", value = "Only return jobs with the given scope type", paramType = "query"), + @ApiImplicitParam(name = "handlerType", dataType = "string", value = "Only return jobs with the given handler type", paramType = "query"), + @ApiImplicitParam(name = "handlerTypes", dataType = "string", value = "Only return jobs which have one of the given job handler type", paramType = "query"), @ApiImplicitParam(name = "tenantId", dataType = "string", value = "Only return jobs with the given tenantId.", paramType = "query"), @ApiImplicitParam(name = "tenantIdLike", dataType = "string", value = "Only return jobs with a tenantId like the given value.", paramType = "query"), @ApiImplicitParam(name = "withoutTenantId", dataType = "boolean", value = "If true, only returns jobs without a tenantId set. If false, the withoutTenantId parameter is ignored.", paramType = "query"), @@ -80,6 +83,12 @@ public DataResponse getHistoryJobs(@ApiParam(hidden = true) if (allRequestParams.containsKey("scopeType")) { query.jobId(allRequestParams.get("scopeType")); } + if (allRequestParams.containsKey("handlerType")) { + query.handlerType(allRequestParams.get("handlerType")); + } + if (allRequestParams.containsKey("handlerTypes")) { + query.handlerTypes(Arrays.asList(allRequestParams.get("handlerTypes").split(","))); + } if (allRequestParams.containsKey("withException")) { if (Boolean.parseBoolean(allRequestParams.get("withException"))) { query.withException(); diff --git a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/JobCollectionResource.java b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/JobCollectionResource.java index 8ec4da0775a..d0581421876 100644 --- a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/JobCollectionResource.java +++ b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/JobCollectionResource.java @@ -15,6 +15,7 @@ import static org.flowable.common.rest.api.PaginateListUtil.paginateList; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -81,6 +82,8 @@ public class JobCollectionResource { @ApiImplicitParam(name = "processDefinitionId", dataType = "string", value = "Only return jobs with the given process definition id", paramType = "query"), @ApiImplicitParam(name = "elementId", dataType = "string", value = "Only return jobs with the given element id", paramType = "query"), @ApiImplicitParam(name = "elementName", dataType = "string", value = "Only return jobs with the given element name", paramType = "query"), + @ApiImplicitParam(name = "handlerType", dataType = "string", value = "Only return jobs with the given handler type", paramType = "query"), + @ApiImplicitParam(name = "handlerTypes", dataType = "string", value = "Only return jobs which have one of the given job handler type", paramType = "query"), @ApiImplicitParam(name = "timersOnly", dataType = "boolean", value = "If true, only return jobs which are timers. If false, this parameter is ignored. Cannot be used together with 'messagesOnly'.", paramType = "query"), @ApiImplicitParam(name = "messagesOnly", dataType = "boolean", value = "If true, only return jobs which are messages. If false, this parameter is ignored. Cannot be used together with 'timersOnly'", paramType = "query"), @ApiImplicitParam(name = "withException", dataType = "boolean", value = "If true, only return jobs for which an exception occurred while executing it. If false, this parameter is ignored.", paramType = "query"), @@ -125,6 +128,12 @@ public DataResponse getJobs(@ApiParam(hidden = true) @RequestParam if (allRequestParams.containsKey("elementName")) { query.elementName(allRequestParams.get("elementName")); } + if (allRequestParams.containsKey("handlerType")) { + query.handlerType(allRequestParams.get("handlerType")); + } + if (allRequestParams.containsKey("handlerTypes")) { + query.handlerTypes(Arrays.asList(allRequestParams.get("handlerTypes").split(","))); + } if (allRequestParams.containsKey("timersOnly")) { if (allRequestParams.containsKey("messagesOnly")) { throw new FlowableIllegalArgumentException("Only one of 'timersOnly' or 'messagesOnly' can be provided."); diff --git a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/JobResponse.java b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/JobResponse.java index aa78d340821..c8ef45827df 100644 --- a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/JobResponse.java +++ b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/JobResponse.java @@ -37,6 +37,7 @@ public class JobResponse { protected String executionUrl; protected String elementId; protected String elementName; + protected String handlerType; protected Integer retries; protected String exceptionMessage; @JsonSerialize(using = DateToStringSerializer.class, as = Date.class) @@ -147,6 +148,15 @@ public void setElementName(String elementName) { this.elementName = elementName; } + @ApiModelProperty(example = "trigger-timer") + public String getHandlerType() { + return handlerType; + } + + public void setHandlerType(String handlerType) { + this.handlerType = handlerType; + } + @ApiModelProperty(example = "3") public Integer getRetries() { return retries; diff --git a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/SuspendedJobCollectionResource.java b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/SuspendedJobCollectionResource.java index 0e1aebd34f2..7467e76eb7c 100644 --- a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/SuspendedJobCollectionResource.java +++ b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/SuspendedJobCollectionResource.java @@ -15,6 +15,7 @@ import static org.flowable.common.rest.api.PaginateListUtil.paginateList; +import java.util.Arrays; import java.util.Map; import org.flowable.common.engine.api.FlowableIllegalArgumentException; @@ -64,6 +65,8 @@ public class SuspendedJobCollectionResource { @ApiImplicitParam(name = "processDefinitionId", dataType = "string", value = "Only return jobs with the given process definition id", paramType = "query"), @ApiImplicitParam(name = "elementId", dataType = "string", value = "Only return jobs with the given element id", paramType = "query"), @ApiImplicitParam(name = "elementName", dataType = "string", value = "Only return jobs with the given element name", paramType = "query"), + @ApiImplicitParam(name = "handlerType", dataType = "string", value = "Only return jobs with the given handler type", paramType = "query"), + @ApiImplicitParam(name = "handlerTypes", dataType = "string", value = "Only return jobs which have one of the given job handler type", paramType = "query"), @ApiImplicitParam(name = "executable", dataType = "boolean", value = "If true, only return jobs which are executable. If false, this parameter is ignored.", paramType = "query"), @ApiImplicitParam(name = "timersOnly", dataType = "boolean", value = "If true, only return jobs which are timers. If false, this parameter is ignored. Cannot be used together with 'messagesOnly'.", paramType = "query"), @ApiImplicitParam(name = "messagesOnly", dataType = "boolean", value = "If true, only return jobs which are messages. If false, this parameter is ignored. Cannot be used together with 'timersOnly'", paramType = "query"), @@ -109,6 +112,12 @@ public DataResponse getJobs(@ApiParam(hidden = true) @RequestParam if (allRequestParams.containsKey("elementName")) { query.elementName(allRequestParams.get("elementName")); } + if (allRequestParams.containsKey("handlerType")) { + query.handlerType(allRequestParams.get("handlerType")); + } + if (allRequestParams.containsKey("handlerTypes")) { + query.handlerTypes(Arrays.asList(allRequestParams.get("handlerTypes").split(","))); + } if (allRequestParams.containsKey("executable")) { query.executable(); } diff --git a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/TimerJobCollectionResource.java b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/TimerJobCollectionResource.java index 73fdb153835..aa675eae17b 100644 --- a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/TimerJobCollectionResource.java +++ b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/TimerJobCollectionResource.java @@ -15,6 +15,7 @@ import static org.flowable.common.rest.api.PaginateListUtil.paginateList; +import java.util.Arrays; import java.util.Map; import org.flowable.common.engine.api.FlowableIllegalArgumentException; @@ -64,6 +65,8 @@ public class TimerJobCollectionResource { @ApiImplicitParam(name = "processDefinitionId", dataType = "string", value = "Only return jobs with the given process definition id", paramType = "query"), @ApiImplicitParam(name = "elementId", dataType = "string", value = "Only return jobs with the given element id", paramType = "query"), @ApiImplicitParam(name = "elementName", dataType = "string", value = "Only return jobs with the given element name", paramType = "query"), + @ApiImplicitParam(name = "handlerType", dataType = "string", value = "Only return jobs with the given handler type", paramType = "query"), + @ApiImplicitParam(name = "handlerTypes", dataType = "string", value = "Only return jobs which have one of the given job handler type", paramType = "query"), @ApiImplicitParam(name = "executable", dataType = "boolean", value = "If true, only return jobs which are executable. If false, this parameter is ignored.", paramType = "query"), @ApiImplicitParam(name = "timersOnly", dataType = "boolean", value = "If true, only return jobs which are timers. If false, this parameter is ignored. Cannot be used together with 'messagesOnly'.", paramType = "query"), @ApiImplicitParam(name = "messagesOnly", dataType = "boolean", value = "If true, only return jobs which are messages. If false, this parameter is ignored. Cannot be used together with 'timersOnly'", paramType = "query"), @@ -106,6 +109,12 @@ public DataResponse getJobs(@ApiParam(hidden = true) @RequestParam if (allRequestParams.containsKey("elementId")) { query.elementId(allRequestParams.get("elementId")); } + if (allRequestParams.containsKey("handlerType")) { + query.handlerType(allRequestParams.get("handlerType")); + } + if (allRequestParams.containsKey("handlerTypes")) { + query.handlerTypes(Arrays.asList(allRequestParams.get("handlerTypes").split(","))); + } if (allRequestParams.containsKey("elementName")) { query.elementName(allRequestParams.get("elementName")); } diff --git a/modules/flowable-rest/src/test/java/org/flowable/rest/service/api/management/JobCollectionResourceTest.java b/modules/flowable-rest/src/test/java/org/flowable/rest/service/api/management/JobCollectionResourceTest.java index 42b65086a14..9a86fbae0ec 100644 --- a/modules/flowable-rest/src/test/java/org/flowable/rest/service/api/management/JobCollectionResourceTest.java +++ b/modules/flowable-rest/src/test/java/org/flowable/rest/service/api/management/JobCollectionResourceTest.java @@ -154,6 +154,18 @@ public void testGetJobs() throws Exception { url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TIMER_JOB_COLLECTION) + "?withoutScopeId=true"; assertResultsPresentInDataResponse(url, timerJob.getId()); + url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TIMER_JOB_COLLECTION) + "?handlerType=trigger-timer"; + assertResultsPresentInDataResponse(url, timerJob.getId()); + + url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TIMER_JOB_COLLECTION) + "?handlerType=unknown-type"; + assertResultsPresentInDataResponse(url); + + url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TIMER_JOB_COLLECTION) + "?handlerTypes=unknown-type,trigger-timer"; + assertResultsPresentInDataResponse(url, timerJob.getId()); + + url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TIMER_JOB_COLLECTION) + "?handlerTypes=unknown-type"; + assertResultsPresentInDataResponse(url); + Job timerJob2 = managementService.createTimerJobQuery().processInstanceId(processInstance.getId()).timers().singleResult(); for (int i = 0; i < timerJob2.getRetries(); i++) { // Force execution of job until retries are exhausted @@ -301,6 +313,32 @@ public void testGetJobs() throws Exception { url = RestUrls.createRelativeResourceUrl(RestUrls.URL_JOB_COLLECTION) + "?tenantIdLike=anotherTenant"; assertResultsPresentInDataResponse(url); + // Handler type(s) + url = RestUrls.createRelativeResourceUrl(RestUrls.URL_JOB_COLLECTION) + "?handlerType=async-continuation"; + assertResultsPresentInDataResponse(url, asyncJob.getId()); + + url = RestUrls.createRelativeResourceUrl(RestUrls.URL_JOB_COLLECTION) + "?handlerType=unknown-type"; + assertResultsPresentInDataResponse(url); + + url = RestUrls.createRelativeResourceUrl(RestUrls.URL_DEADLETTER_JOB_COLLECTION) + "?handlerType=trigger-timer"; + assertResultsPresentInDataResponse(url, timerJob.getId()); + + url = RestUrls.createRelativeResourceUrl(RestUrls.URL_DEADLETTER_JOB_COLLECTION) + "?handlerType=unknown-type"; + assertResultsPresentInDataResponse(url); + + url = RestUrls.createRelativeResourceUrl(RestUrls.URL_JOB_COLLECTION) + "?handlerTypes=unknown-type,async-continuation"; + assertResultsPresentInDataResponse(url, asyncJob.getId()); + + url = RestUrls.createRelativeResourceUrl(RestUrls.URL_JOB_COLLECTION) + "?handlerTypes=unknown-type"; + assertResultsPresentInDataResponse(url); + + url = RestUrls.createRelativeResourceUrl(RestUrls.URL_DEADLETTER_JOB_COLLECTION) + "?handlerTypes=unknown-type,trigger-timer"; + assertResultsPresentInDataResponse(url, timerJob.getId()); + + url = RestUrls.createRelativeResourceUrl(RestUrls.URL_DEADLETTER_JOB_COLLECTION) + "?handlerTypes=unknown-type"; + assertResultsPresentInDataResponse(url); + + } @Test public void getUnexistingDeadLetterJob() throws Exception { diff --git a/modules/flowable-rest/src/test/java/org/flowable/rest/service/api/management/JobResourceTest.java b/modules/flowable-rest/src/test/java/org/flowable/rest/service/api/management/JobResourceTest.java index 4a7dca04d70..e6e150defac 100644 --- a/modules/flowable-rest/src/test/java/org/flowable/rest/service/api/management/JobResourceTest.java +++ b/modules/flowable-rest/src/test/java/org/flowable/rest/service/api/management/JobResourceTest.java @@ -79,6 +79,7 @@ public void testGetTimerJob() throws Exception { + "processInstanceId: '" + timerJob.getProcessInstanceId() + "'," + "elementId: 'escalationTimer'," + "elementName: 'Escalation'," + + "handlerType: 'trigger-timer'," + "retries: " + timerJob.getRetries() + "," + "dueDate: " + new TextNode(getISODateStringWithTZ(timerJob.getDuedate())) + "," + "tenantId: ''" @@ -134,6 +135,7 @@ public void testGetSuspendedJob() throws Exception { + "processInstanceId: '" + suspendedJob.getProcessInstanceId() + "'," + "elementId: 'escalationTimer'," + "elementName: 'Escalation'," + + "handlerType: 'trigger-timer'," + "retries: " + suspendedJob.getRetries() + "," + "dueDate: " + new TextNode(getISODateStringWithTZ(suspendedJob.getDuedate())) + "," + "tenantId: ''" @@ -189,6 +191,7 @@ public void testGetDeadLetterJob() throws Exception { + "processInstanceId: '" + deadLetterJob.getProcessInstanceId() + "'," + "elementId: 'escalationTimer'," + "elementName: 'Escalation'," + + "handlerType: 'trigger-timer'," + "retries: " + deadLetterJob.getRetries() + "," + "dueDate: " + new TextNode(getISODateStringWithTZ(deadLetterJob.getDuedate())) + "," + "tenantId: ''" @@ -262,6 +265,7 @@ public Void execute(CommandContext commandContext) { + "processInstanceId: '" + lockedJob.getProcessInstanceId() + "'," + "elementId: 'escalationTimer'," + "elementName: 'Escalation'," + + "handlerType: 'trigger-timer'," + "retries: " + lockedJob.getRetries() + "," + "dueDate: " + new TextNode(getISODateStringWithTZ(lockedJob.getDuedate())) + "," + "lockOwner: 'test'," From 71e71954d06e412780156872c04dfb307cbc6482 Mon Sep 17 00:00:00 2001 From: Arthur H <516104+arthware@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:53:00 +0200 Subject: [PATCH 7/7] Handle Supplier for EventPayloadToJsonStringSerializer (#3722) --- .../CaseWithEventRegistryTest.java | 45 ++++++++++++++++++- .../integrationtest/oneJson.event | 15 +++++++ .../testSendEventTaskWithJson.cmmn | 26 +++++++++++ .../EventPayloadToJsonStringSerializer.java | 21 ++++++--- 4 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 modules/flowable-event-registry-integration-test/src/test/resources/org/flowable/eventregistry/integrationtest/oneJson.event create mode 100644 modules/flowable-event-registry-integration-test/src/test/resources/org/flowable/eventregistry/integrationtest/testSendEventTaskWithJson.cmmn diff --git a/modules/flowable-event-registry-integration-test/src/test/java/org/flowable/eventregistry/integrationtest/CaseWithEventRegistryTest.java b/modules/flowable-event-registry-integration-test/src/test/java/org/flowable/eventregistry/integrationtest/CaseWithEventRegistryTest.java index 707a16880dd..66df6ed3ad0 100644 --- a/modules/flowable-event-registry-integration-test/src/test/java/org/flowable/eventregistry/integrationtest/CaseWithEventRegistryTest.java +++ b/modules/flowable-event-registry-integration-test/src/test/java/org/flowable/eventregistry/integrationtest/CaseWithEventRegistryTest.java @@ -18,6 +18,7 @@ import java.time.Duration; import java.util.List; +import java.util.function.Supplier; import jakarta.jms.Message; import jakarta.jms.TextMessage; @@ -39,6 +40,7 @@ import org.springframework.jms.core.JmsTemplate; import org.springframework.test.context.TestPropertySource; +import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; @CmmnJmsEventTest @@ -59,6 +61,9 @@ public class CaseWithEventRegistryTest { @Autowired protected JmsTemplate jmsTemplate; + @Autowired + ObjectMapper objectMapper; + @Test @CmmnDeployment(resources = { "org/flowable/eventregistry/integrationtest/startCaseWithEvent.cmmn", "org/flowable/eventregistry/integrationtest/one.event", @@ -176,7 +181,45 @@ public void testSendEventTask() throws Exception { } } } - + + @Test + @CmmnDeployment(resources = { "org/flowable/eventregistry/integrationtest/testSendEventTaskWithJson.cmmn", + "org/flowable/eventregistry/integrationtest/oneJson.event", + "org/flowable/eventregistry/integrationtest/one-outbound.channel" }) + public void testSendEventTaskWithJsonPayload() throws Exception { + try { + ObjectNode objectNode = objectMapper.createObjectNode(); + objectNode.put("firstname", "Kermit"); + objectNode.put("lastname", "The Frog"); + + Supplier supplier = () -> objectMapper.createObjectNode() + .put("firstname", "Annie Sue") + .put("lastname", "Pig"); + + CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionKey("testSendEvent") + .transientVariable("myJsonVariable", objectNode) + .transientVariable("myJsonSupplierVariable", supplier) + .start(); + + Task task = cmmnTaskService.createTaskQuery().caseInstanceId(caseInstance.getId()).singleResult(); + assertThat(task).isNotNull(); + + Message message = jmsTemplate.receive("test-outbound-queue"); + TextMessage textMessage = (TextMessage) message; + assertThatJson(textMessage.getText()) + .isEqualTo("{" + + " jsonPayload1: {firstname: 'Kermit',lastname: 'The Frog'}," + + " jsonPayload2: {firstname: 'Annie Sue',lastname: 'Pig'}" + + "}"); + + } finally { + List eventDeployments = getEventRepositoryService().createDeploymentQuery().list(); + for (EventDeployment eventDeployment : eventDeployments) { + getEventRepositoryService().deleteDeployment(eventDeployment.getId()); + } + } + } + @Test @CmmnDeployment(resources = { "org/flowable/eventregistry/integrationtest/startCaseWithEvent.cmmn", "org/flowable/eventregistry/integrationtest/one.event", diff --git a/modules/flowable-event-registry-integration-test/src/test/resources/org/flowable/eventregistry/integrationtest/oneJson.event b/modules/flowable-event-registry-integration-test/src/test/resources/org/flowable/eventregistry/integrationtest/oneJson.event new file mode 100644 index 00000000000..721a50678f6 --- /dev/null +++ b/modules/flowable-event-registry-integration-test/src/test/resources/org/flowable/eventregistry/integrationtest/oneJson.event @@ -0,0 +1,15 @@ +{ + "key": "one", + "name": "My first Event", + "payload": [ + { + "name": "jsonPayload1", + "type": "json" + }, + { + "name": "jsonPayload2", + "type": "json" + } + + ] +} diff --git a/modules/flowable-event-registry-integration-test/src/test/resources/org/flowable/eventregistry/integrationtest/testSendEventTaskWithJson.cmmn b/modules/flowable-event-registry-integration-test/src/test/resources/org/flowable/eventregistry/integrationtest/testSendEventTaskWithJson.cmmn new file mode 100644 index 00000000000..e237adfb3f6 --- /dev/null +++ b/modules/flowable-event-registry-integration-test/src/test/resources/org/flowable/eventregistry/integrationtest/testSendEventTaskWithJson.cmmn @@ -0,0 +1,26 @@ + + + + + + + + + + + complete + + + + + one + one-outbound + + + + + + + + + diff --git a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/serialization/EventPayloadToJsonStringSerializer.java b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/serialization/EventPayloadToJsonStringSerializer.java index 380705b6c62..86dd8429d6b 100644 --- a/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/serialization/EventPayloadToJsonStringSerializer.java +++ b/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/serialization/EventPayloadToJsonStringSerializer.java @@ -13,6 +13,7 @@ package org.flowable.eventregistry.impl.serialization; import java.util.Collection; +import java.util.function.Supplier; import org.flowable.common.engine.api.FlowableException; import org.flowable.common.engine.api.FlowableIllegalArgumentException; @@ -96,19 +97,25 @@ public String serialize(EventInstance eventInstance) { } } else if (EventPayloadTypes.JSON.equals(definitionType)) { - - if (payloadInstanceValue instanceof JsonNode) { - objectNode.set(payloadInstance.getDefinitionName(), (JsonNode) payloadInstanceValue); - } else if (payloadInstanceValue instanceof String) { - JsonNode jsonNode = null; + Object jsonValue = payloadInstanceValue; + if (payloadInstanceValue instanceof Supplier) { + Object suppliedValue = ((Supplier) payloadInstanceValue).get(); + if (suppliedValue instanceof JsonNode) { + jsonValue = suppliedValue; + } + } + if (jsonValue instanceof JsonNode) { + objectNode.set(payloadInstance.getDefinitionName(), (JsonNode) jsonValue); + } else if (jsonValue instanceof String) { + JsonNode jsonNode; try { - jsonNode = objectMapper.readTree((String) payloadInstanceValue); + jsonNode = objectMapper.readTree((String) jsonValue); } catch (JsonProcessingException e) { throw new FlowableIllegalArgumentException("Could not read json event payload", e); } objectNode.set(payloadInstance.getDefinitionName(), jsonNode); } else { - throw new FlowableIllegalArgumentException("Cannot convert event payload " + payloadInstanceValue + " to type 'json'"); + throw new FlowableIllegalArgumentException("Cannot convert event payload " + jsonValue + " to type 'json'"); } } else {