APISonar


org.camunda.bpm.engine.variable.Variables.SerializationDataFormats.JSON

> org > camunda > bpm > engine > variable > Variables > SerializationDataFormats > JSON
org APIs camunda APIs bpm APIs engine APIs variable APIs Variables APIs SerializationDataFormats APIs JSON APIs

Example 1
public void execute(DelegateExecution execution) throws Exception {
    RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();

    ObjectValue jsonSerializeable = Variables
        .objectValue(createJsonSerializable())
        .serializationDataFormat(SerializationDataFormats.JSON)
        .create();

    // this should be executed in the context of the current process application
    runtimeService.setVariable(execution.getProcessInstanceId(), VARIABLE_NAME, jsonSerializeable);

  }
Example 2
public void testSerializationDataFormats() {
    ObjectValue objectValue = objectValue(DESERIALIZED_OBJECT_VAR_VALUE).serializationDataFormat(SerializationDataFormats.JAVA).create();
    assertEquals(SerializationDataFormats.JAVA.getName(), objectValue.getSerializationDataFormat());

    objectValue = objectValue(DESERIALIZED_OBJECT_VAR_VALUE).serializationDataFormat(SerializationDataFormats.JSON).create();
    assertEquals(SerializationDataFormats.JSON.getName(), objectValue.getSerializationDataFormat());

    objectValue = objectValue(DESERIALIZED_OBJECT_VAR_VALUE).serializationDataFormat(SerializationDataFormats.XML).create();
    assertEquals(SerializationDataFormats.XML.getName(), objectValue.getSerializationDataFormat());
  }