Class DocumentPropertyJsonWriter

java.lang.Object
org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter<Property>
org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertyJsonWriter
All Implemented Interfaces:
Marshaller<Property>, Writer<Property>

@Setup(mode=SINGLETON, priority=2000) public class DocumentPropertyJsonWriter extends AbstractJsonWriter<Property>
Convert Property to Json.

Format is:

 "stringPropertyValue"  <-- for string property, 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
 or
 true|false  <- for boolean property
 or
 123  <- for int property
 ...
 {  <- for complex property
   "subProperty": ...,
    ...
 },
 [ ... ] <- for list property
 }
 
Since:
7.2
  • Field Details

    • OMIT_PHANTOM_SECURED_PROPERTY

      public static final String OMIT_PHANTOM_SECURED_PROPERTY
      Whether we should omit to write phantom secured properties.
      Since:
      11.1
      See Also:
  • Constructor Details

    • DocumentPropertyJsonWriter

      public DocumentPropertyJsonWriter()
  • Method Details

    • write

      public void write(Property prop, com.fasterxml.jackson.core.JsonGenerator jg) throws IOException
      Description copied from class: AbstractJsonWriter
      Implement this method to writes the entity in the provided JsonGenerator.

      This method implementation can use injected properties.

      The JsonGenerator's flushing is done by this abstract class, it's also not not necessary to flush it. Do not close the provided JsonGenerator. It may be used is another marshaller calling this one.

      Specified by:
      write in class AbstractJsonWriter<Property>
      Parameters:
      prop - The entity to marshall as Json.
      jg - The JsonGenerator used to produce Json output.
      Throws:
      IOException
    • writeProperty

      protected void writeProperty(com.fasterxml.jackson.core.JsonGenerator jg, Property prop) throws IOException
      Throws:
      IOException
    • writeScalarProperty

      protected void writeScalarProperty(com.fasterxml.jackson.core.JsonGenerator jg, Property prop) throws IOException
      Throws:
      IOException
    • writeScalarPropertyValue

      protected void writeScalarPropertyValue(com.fasterxml.jackson.core.JsonGenerator jg, Type type, Object value) throws IOException
      Throws:
      IOException
    • fetchProperty

      protected boolean fetchProperty(com.fasterxml.jackson.core.JsonGenerator jg, ObjectResolver resolver, Object value, String path) throws IOException
      Throws:
      IOException
    • writeListProperty

      protected void writeListProperty(com.fasterxml.jackson.core.JsonGenerator jg, Property prop) throws IOException
      Throws:
      IOException
    • writeComplexProperty

      protected void writeComplexProperty(com.fasterxml.jackson.core.JsonGenerator jg, Property prop) throws IOException
      Throws:
      IOException
    • writeBlobProperty

      protected void writeBlobProperty(com.fasterxml.jackson.core.JsonGenerator jg, BlobProperty prop) throws IOException
      Throws:
      IOException
    • enrichBlobProperty

      protected void enrichBlobProperty(com.fasterxml.jackson.core.JsonGenerator jg, BlobProperty property) throws IOException
      Throws:
      IOException
      Since:
      10.3
    • getBlobUrl

      protected String getBlobUrl(Property prop)
      Gets the full URL of where a blob can be downloaded.
      Since:
      7.2
    • getBlobUrl

      protected String getBlobUrl(Property prop, boolean fullDownloadUrl)
      Since:
      2021.43
    • skipProperty

      protected static boolean skipProperty(RenderingContext ctx, Property property)