Skip to content

Commit

Permalink
Merge branch 'main' of github.com:flowable/flowable-engine
Browse files Browse the repository at this point in the history
  • Loading branch information
tijsrademakers committed Aug 29, 2023
2 parents 1898742 + 71e7195 commit 7bd4ee8
Show file tree
Hide file tree
Showing 26 changed files with 244 additions and 41 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Flowable (V6)
Flowable (V7)
========

[Maven Central:
Expand Down Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions distro/src/notice.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: ''"
Expand Down Expand Up @@ -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: ''"
Expand Down Expand Up @@ -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',"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> functionNameOptions, String functionName) {
super(functionNameOptions, functionName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void execute(DelegateExecution execution) {
}

Map<String, Object> 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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",
Expand Down Expand Up @@ -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<ObjectNode> 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<EventDeployment> 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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"key": "one",
"name": "My first Event",
"payload": [
{
"name": "jsonPayload1",
"type": "json"
},
{
"name": "jsonPayload2",
"type": "json"
}

]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/CMMN/20151109/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:flowable="http://flowable.org/cmmn" xmlns:cmmndi="http://www.omg.org/spec/CMMN/20151109/CMMNDI" xmlns:dc="http://www.omg.org/spec/CMMN/20151109/DC" xmlns:di="http://www.omg.org/spec/CMMN/20151109/DI" xmlns:design="http://flowable.org/design" targetNamespace="http://flowable.org/cmmn">
<case id="testSendEvent" name="testSendEvent" flowable:initiatorVariableName="initiator" flowable:candidateStarterGroups="flowableUser">
<casePlanModel id="onecaseplanmodel1" name="Case plan model" flowable:formFieldValidation="false">
<planItem id="planItem1" name="Send event task" definitionRef="sendEventTask1"></planItem>
<planItem id="planItem2" name="Human task" definitionRef="humanTask1">
<entryCriterion id="entryCriterion1" sentryRef="sentry1"></entryCriterion>
</planItem>
<sentry id="sentry1">
<planItemOnPart id="sentryOnPart1" sourceRef="planItem1">
<standardEvent>complete</standardEvent>
</planItemOnPart>
</sentry>
<task id="sendEventTask1" name="Send event task" flowable:type="send-event">
<extensionElements>
<flowable:eventType>one</flowable:eventType>
<flowable:channelKey>one-outbound</flowable:channelKey>
<flowable:eventInParameter source="test" target="headerProperty1" />
<flowable:eventInParameter source="${myJsonVariable}" target="jsonPayload1" />
<flowable:eventInParameter source="${myJsonSupplierVariable}" target="jsonPayload2" />
</extensionElements>
</task>
<humanTask id="humanTask1" />
</casePlanModel>
</case>
</definitions>
Original file line number Diff line number Diff line change
Expand Up @@ -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("{"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Loading

0 comments on commit 7bd4ee8

Please sign in to comment.