Class DocumentModelJsonWriter

  • All Implemented Interfaces:
    Marshaller<DocumentModel>, Writer<DocumentModel>

    @Setup(mode=SINGLETON,
           priority=2000)
    public class DocumentModelJsonWriter
    extends ExtensibleEntityJsonWriter<DocumentModel>
    Convert 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(Object, JsonGenerator).

    Format is:

     {
       "entity-type":"document",
       "repository": "REPOSITORY_NAME",
       "uid": "DOCUMENT_UID",
       "path": "DOCUMENT_PATH",
       "type": "DOCUMENT_TYPE",
       "facets": [ "FACET1", "FACET2", ... ],
       "schemas": [ {"name": SCHEMA1", "prefix": "PREFIX1"}, {"name": SCHEMA2", "prefix": "PREFIX2"}, ... ],
       "state": "DOCUMENT_STATE",
       "parentRef": "PARENT_DOCUMENT_UID",
       "isCheckedOut": true|false,
       "isRecord": true|false,
       "retainUntil": "RETAIN_UNTIL_DATE", <-- or null
       "hasLegalHold": true|false,
       "isUnderRetentionOrLegalHold": 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
     }
     
    Since:
    7.2