Search in sources :

Example 1 with JsonRawValue

use of com.fasterxml.jackson.annotation.JsonRawValue in project ma-modules-public by infiniteautomation.

the class AuditEventInstanceModel method getContext.

@JsonRawValue
public String getContext() {
    // Since the JsonData table can contain JSON within the context, return raw JSON all the time here
    StringWriter stringWriter = new StringWriter();
    JsonWriter writer = new JsonWriter(Common.JSON_CONTEXT, stringWriter);
    writer.setPrettyIndent(3);
    writer.setPrettyOutput(true);
    try {
        writer.writeObject(this.data.getContext());
        return stringWriter.toString();
    } catch (JsonException e) {
        throw new ShouldNeverHappenException(e);
    } catch (IOException e) {
        throw new ShouldNeverHappenException(e);
    }
}
Also used : JsonException(com.serotonin.json.JsonException) StringWriter(java.io.StringWriter) ShouldNeverHappenException(com.serotonin.ShouldNeverHappenException) IOException(java.io.IOException) JsonWriter(com.serotonin.json.JsonWriter) JsonRawValue(com.fasterxml.jackson.annotation.JsonRawValue)

Aggregations

JsonRawValue (com.fasterxml.jackson.annotation.JsonRawValue)1 ShouldNeverHappenException (com.serotonin.ShouldNeverHappenException)1 JsonException (com.serotonin.json.JsonException)1 JsonWriter (com.serotonin.json.JsonWriter)1 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1