@Setup(mode=SINGLETON, priority=2000) public class DocumentModelJsonWriter extends ExtensibleEntityJsonWriter<DocumentModel>
DocumentModel to Json.
This marshaller is enrichable: register class implementing AbstractJsonEnricher and managing
DocumentModel.
This marshaller is also extensible: extend it and simply override
ExtensibleEntityJsonWriter#extend(DocumentModel, JsonWriter).
Format is:
{
"entity-type":"document",
"repository": "REPOSITORY_NAME",
"uid": "DOCUMENT_UID",
"path": "DOCUMENT_PATH",
"type": "DOCUMENT_TYPE",
"state": "DOCUMENT_STATE",
"parentRef": "PARENT_DOCUMENT_UID",
"isCheckedOut": true|false,
"changeToken": null|"CHANGE_TOKEN",
"isCheckedOut": true|false,
"title": "DOCUMENT_TITLE",
"lastModified": "DATE_UPDATE", <-- if dublincore is present and if dc:modified is not null
"versionLabel": "DOCUMENT_VERSION", <-- only activated with parameter fetch.document=versionLabel or system property nuxeo.document.json.fetch.heavy=true
"lockOwner": "LOCK_OWNER", <-- only activated if locked and with parameter fetch.document=lock or system property nuxeo.document.json.fetch.heavy=true
"lockCreated": "LOCK_DATE", <-- only activated if locked and with parameter fetch.document=lock or system property nuxeo.document.json.fetch.heavy=true
"properties": { <-- only present with parameter properties=schema1,schema2,... see DocumentPropertyJsonWriter for format
"schemaPrefix:stringProperty": "stringPropertyValue", <-- each property may be fetched if a resolver is associated with that property and if a parameter fetch.document=propXPath is present, in this case, an object will be marshalled as value
"schemaPrefix:booleanProperty": true|false,
"schemaPrefix:integerProperty": 123,
...
"schemaPrefix:complexProperty": {
"subProperty": ...,
...
},
"schemaPrefix:listProperty": [
...
]
}
<-- contextParameters if there are enrichers activated
<-- additional property provided by extend() method
}
| Modifier and Type | Field and Description |
|---|---|
static String |
DOCUMENT_JSON_FETCH_HEAVY_KEY |
static String |
ENTITY_TYPE |
ctx, registry| Constructor and Description |
|---|
DocumentModelJsonWriter() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
writeEntityBody(DocumentModel doc,
org.codehaus.jackson.JsonGenerator jg)
Implement this method to write the entity body.
|
extend, writeaccept, getGenerator, write, writeEntity, writeEntity, writeEntityFieldpublic static final String ENTITY_TYPE
public static final String DOCUMENT_JSON_FETCH_HEAVY_KEY
public DocumentModelJsonWriter()
protected void writeEntityBody(DocumentModel doc, org.codehaus.jackson.JsonGenerator jg) throws IOException
ExtensibleEntityJsonWriterwriteEntityBody in class ExtensibleEntityJsonWriter<DocumentModel>doc - The Java entity.jg - A JsonGenerator ready to write your entity as Json.IOExceptionCopyright © 2018 Nuxeo. All rights reserved.