Skip to content

Commit ab7b6f6

Browse files
committed
Merge remote-tracking branch 'origin/develop' into release/2.0.2
2 parents e6a5963 + d97055c commit ab7b6f6

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/ObjectMapperFactory.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@
1919

2020
import com.fasterxml.jackson.annotation.JsonInclude;
2121
import com.fasterxml.jackson.annotation.JsonInclude.Include;
22+
import com.fasterxml.jackson.databind.DeserializationFeature;
2223
import com.fasterxml.jackson.databind.MapperFeature;
2324
import com.fasterxml.jackson.databind.ObjectMapper;
25+
import com.fasterxml.jackson.databind.SerializationFeature;
2426
import com.fasterxml.jackson.databind.json.JsonMapper;
2527
import com.fasterxml.jackson.databind.module.SimpleModule;
28+
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
2629

2730
import ca.uhn.fhir.context.FhirContext;
2831

@@ -37,9 +40,12 @@ public static ObjectMapper createObjectMapper(FhirContext fhirContext)
3740
return JsonMapper.builder()
3841
.defaultPropertyInclusion(JsonInclude.Value.construct(Include.NON_NULL, Include.NON_NULL))
3942
.defaultPropertyInclusion(JsonInclude.Value.construct(Include.NON_EMPTY, Include.NON_EMPTY))
40-
.addModule(fhirModule(fhirContext)).disable(MapperFeature.AUTO_DETECT_CREATORS)
41-
.disable(MapperFeature.AUTO_DETECT_FIELDS).disable(MapperFeature.AUTO_DETECT_GETTERS)
42-
.disable(MapperFeature.AUTO_DETECT_IS_GETTERS).disable(MapperFeature.AUTO_DETECT_SETTERS).build();
43+
.addModule(fhirModule(fhirContext)).addModule(new JavaTimeModule())
44+
.disable(MapperFeature.AUTO_DETECT_CREATORS).disable(MapperFeature.AUTO_DETECT_FIELDS)
45+
.disable(MapperFeature.AUTO_DETECT_GETTERS).disable(MapperFeature.AUTO_DETECT_IS_GETTERS)
46+
.disable(MapperFeature.AUTO_DETECT_SETTERS).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
47+
.enable(SerializationFeature.WRITE_DATES_WITH_ZONE_ID)
48+
.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE).build();
4349
}
4450

4551
public static SimpleModule fhirModule(FhirContext fhirContext)

dsf-bpe/dsf-bpe-test-plugin-v2/src/main/java/dev/dsf/bpe/test/json/JsonPojo.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,20 @@
1515
*/
1616
package dev.dsf.bpe.test.json;
1717

18+
import java.time.ZonedDateTime;
19+
1820
import com.fasterxml.jackson.annotation.JsonCreator;
1921
import com.fasterxml.jackson.annotation.JsonProperty;
2022

21-
public record JsonPojo(@JsonProperty("value-1") String value1, @JsonProperty("value-2") String value2)
23+
public record JsonPojo(@JsonProperty("value-1") String value1, @JsonProperty("value-2") String value2,
24+
@JsonProperty("zoned-date-time") ZonedDateTime zonedDateTime)
2225
{
2326
@JsonCreator
24-
public JsonPojo(@JsonProperty("value-1") String value1, @JsonProperty("value-2") String value2)
27+
public JsonPojo(@JsonProperty("value-1") String value1, @JsonProperty("value-2") String value2,
28+
@JsonProperty("zoned-date-time") ZonedDateTime zonedDateTime)
2529
{
2630
this.value1 = value1;
2731
this.value2 = value2;
32+
this.zonedDateTime = zonedDateTime;
2833
}
2934
}

dsf-bpe/dsf-bpe-test-plugin-v2/src/main/java/dev/dsf/bpe/test/service/JsonVariableTestGet.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public void getJsonVariable(Variables variables) throws Exception
4242
expectNotNull(variable);
4343
expectSame(JsonVariableTestSet.TEST_VALUE_1, variable.value1());
4444
expectSame(JsonVariableTestSet.TEST_VALUE_2, variable.value2());
45+
expectSame(JsonVariableTestSet.TEST_ZONED_DATE_TIME_VALUE, variable.zonedDateTime());
4546
}
4647

4748
@PluginTest

dsf-bpe/dsf-bpe-test-plugin-v2/src/main/java/dev/dsf/bpe/test/service/JsonVariableTestSet.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package dev.dsf.bpe.test.service;
1717

18+
import java.time.ZonedDateTime;
19+
1820
import dev.dsf.bpe.test.json.JsonPojo;
1921
import dev.dsf.bpe.v2.ProcessPluginApi;
2022
import dev.dsf.bpe.v2.activity.ServiceTask;
@@ -29,13 +31,14 @@ public class JsonVariableTestSet implements ServiceTask
2931

3032
public static final String TEST_VALUE_1 = "test-value-1";
3133
public static final String TEST_VALUE_2 = "test-value-2";
34+
public static final ZonedDateTime TEST_ZONED_DATE_TIME_VALUE = ZonedDateTime.now();
3235
public static final String TEST_STRING = "test-string";
3336
public static final Integer TEST_INTEGER = 42;
3437

3538
@Override
3639
public void execute(ProcessPluginApi api, Variables variables) throws ErrorBoundaryEvent, Exception
3740
{
38-
variables.setJsonVariable(JSON_VARIABLE, new JsonPojo(TEST_VALUE_1, TEST_VALUE_2));
41+
variables.setJsonVariable(JSON_VARIABLE, new JsonPojo(TEST_VALUE_1, TEST_VALUE_2, TEST_ZONED_DATE_TIME_VALUE));
3942
variables.setString(STRING_VARIABLE, TEST_STRING);
4043
variables.setInteger(INTEGER_VARIABLE, TEST_INTEGER);
4144
}

0 commit comments

Comments
 (0)