-------- class ExampleDto /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH * under one or more contributor license agreements. See the NOTICE file * distributed with this work for additional information regarding copyright * ownership. Camunda licenses this file to you under the Apache License, * Version 2.0; you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.camunda.examples; import com.fasterxml.jackson.annotation.JsonIgnore; import java.time.ZoneId; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; /** * @author Christopher Zell */ public class ExampleDto { public String property1; /** * This property should be ignored on serialization. */ @JsonIgnore public String property2; public String property3; public ZonedDateTime zonedDateTime; public ExampleDto(String property1, String property2, String property3) { this.property1 = property1; this.property2 = property2; this.property3 = property3; // Add the zonedDateTime String dumpDateTime = "2019-02-02T12:12:01"; this.zonedDateTime = ZonedDateTime.parse(dumpDateTime, DateTimeFormatter.ISO_LOCAL_DATE_TIME.withZone(ZoneId.systemDefault())); } public ExampleDto() { } } -------- class ShowObjectInLog package org.camunda.examples; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.camunda.bpm.engine.variable.value.SerializableValue; /** * @author sapostolou */ public class ShowObjectInLog implements JavaDelegate { public void execute(DelegateExecution execution) throws Exception { RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService(); SerializableValue serializedCarValue = runtimeService.getVariableTyped(execution.getId(), "variable"); ExampleDto exampleDto = (ExampleDto) serializedCarValue.getValue(); System.out.println("Show object: " + exampleDto.toString()); } } -------- class JacksonAnnotationApplication /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH * under one or more contributor license agreements. See the NOTICE file * distributed with this work for additional information regarding copyright * ownership. Camunda licenses this file to you under the Apache License, * Version 2.0; you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.camunda.examples; import org.camunda.bpm.application.PostDeploy; import org.camunda.bpm.application.ProcessApplication; import org.camunda.bpm.application.impl.ServletProcessApplication; import org.camunda.bpm.engine.ProcessEngine; import org.camunda.bpm.engine.variable.Variables; import org.camunda.bpm.engine.variable.value.ObjectValue; import java.util.Map; @ProcessApplication("Jackson Annotation App") public class JacksonAnnotationApplication extends ServletProcessApplication { /* ** * The {@literal @}PostDeploy method is invoked when the deployment of all BPMN 2.0 processes is complete. * The process engine can be injected. */ @PostDeploy public void startProcessInstance(ProcessEngine processEngine) { //create typed variable with json as serialization format Map vars = Variables.createVariables(); ExampleDto exampleDto = new ExampleDto("prop1", "shouldBeIgnored", "prop2"); ObjectValue typedObjectValue = Variables.objectValue(exampleDto).serializationDataFormat(Variables.SerializationDataFormats.JSON).create(); vars.put("variable", typedObjectValue); // start a new instance of our process with that variable processEngine.getRuntimeService().startProcessInstanceByKey("waitingProcess", vars); } } -------- jboss-deployment-structure.xml -------- pom.xml 4.0.0 org.camunda.bpm.example camunda-jackson-annotation-example 0.1.0-SNAPSHOT war 7.11.0 4.11 1.3.168 org.camunda.bpm camunda-bom ${version.camunda} import pom org.camunda.bpm camunda-engine provided javax.servlet javax.servlet-api 3.0.1 provided com.fasterxml.jackson.core jackson-annotations 2.9.0 provided org.apache.maven.plugins maven-war-plugin 2.3 false org.apache.maven.plugins maven-compiler-plugin 8 8