Package org.nuxeo.audit.io
Class LogEntryJsonWriter
java.lang.Object
org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter<LogEntry>
org.nuxeo.ecm.core.io.marshallers.json.ExtensibleEntityJsonWriter<LogEntry>
org.nuxeo.audit.io.LogEntryJsonWriter
- All Implemented Interfaces:
Marshaller<LogEntry>,Writer<LogEntry>
@Setup(mode=SINGLETON,
priority=2000)
public class LogEntryJsonWriter
extends ExtensibleEntityJsonWriter<LogEntry>
Convert
LogEntry to Json.
This marshaller is enrichable: register class implementing AbstractJsonEnricher and managing LogEntry
.
This marshaller is also extensible: extend it and simply override
ExtensibleEntityJsonWriter.extend(Object, JsonGenerator).
Format is:
{
"entity-type":"logEntry",
"category": "LOG_ENTRY_CATEGORY",
"principalName": "LOG_ENTRY_PRINCIPAL",
"comment": "LOG_ENTRY_COMMENT",
"docLifeCycle": "DOC_LIFECYCLE",
"docPath": "DOC_PATH",
"docType": "DOC_TYPE",
"docUUID": "DOC_UUID",
"eventId": "EVENT_ID",
"repositoryId": "REPO_ID",
"eventDate": "LOG_EVENT_DATE",
"logDate": "LOG_DATE"
<-- contextParameters if there are enrichers activated
<-- additional property provided by extend() method
}
- Since:
- 7.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringRenderingContextparameter to serialize JSON like extended infos as JSON and not String.static final StringFields inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
ctx, registry -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected NuxeoPrincipalgetPrincipal(String principalName) static booleanisJsonContent(String value) protected voidwriteEntityBody(LogEntry logEntry, com.fasterxml.jackson.core.JsonGenerator jg) Implement this method to write the entity body.protected voidwriteExtendedInfo(com.fasterxml.jackson.core.JsonGenerator jg, String key, Serializable value) protected voidwriteExtendedInfos(com.fasterxml.jackson.core.JsonGenerator jg, LogEntry logEntry) protected voidwriteValues(com.fasterxml.jackson.core.JsonGenerator jg, String key, Serializable value) Methods inherited from class org.nuxeo.ecm.core.io.marshallers.json.ExtensibleEntityJsonWriter
extend, writeMethods inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
accept, getGenerator, write, writeEntity, writeEntity, writeEntityField, writeSerializable, writeSerializableField, writeSerializableListField, writeSerializableMapField
-
Field Details
-
ENTITY_TYPE
- See Also:
-
EXTENDED_INFO_JSON_STRING_AS_JSON
RenderingContextparameter to serialize JSON like extended infos as JSON and not String.- Since:
- 2025.0
- See Also:
-
FETCH_PRINCIPAL
- Since:
- 2025.9
- See Also:
-
-
Constructor Details
-
LogEntryJsonWriter
public LogEntryJsonWriter()
-
-
Method Details
-
writeEntityBody
protected void writeEntityBody(LogEntry logEntry, com.fasterxml.jackson.core.JsonGenerator jg) throws IOException Description copied from class:ExtensibleEntityJsonWriterImplement this method to write the entity body.- Specified by:
writeEntityBodyin classExtensibleEntityJsonWriter<LogEntry>- Parameters:
logEntry- The Java entity.jg- AJsonGeneratorready to write your entity as Json.- Throws:
IOException
-
getPrincipal
-
writeExtendedInfos
protected void writeExtendedInfos(com.fasterxml.jackson.core.JsonGenerator jg, LogEntry logEntry) throws IOException - Throws:
IOException
-
writeExtendedInfo
protected void writeExtendedInfo(com.fasterxml.jackson.core.JsonGenerator jg, String key, Serializable value) throws IOException - Throws:
IOException
-
writeValues
protected void writeValues(com.fasterxml.jackson.core.JsonGenerator jg, String key, Serializable value) throws IOException - Throws:
IOException
-
isJsonContent
- Since:
- 2025.0
-