Class DocumentModelJsonReader
java.lang.Object
org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonReader<EntityType>
org.nuxeo.ecm.core.io.marshallers.json.EntityJsonReader<DocumentModel>
org.nuxeo.ecm.core.io.marshallers.json.document.DocumentModelJsonReader
- All Implemented Interfaces:
Marshaller<DocumentModel>
,Reader<DocumentModel>
@Setup(mode=SINGLETON,
priority=2000)
public class DocumentModelJsonReader
extends EntityJsonReader<DocumentModel>
Convert Json as
DocumentModel
.
Format is (any additional json property is ignored):
{
"entity-type": "document",
"uid": "EXISTING_DOCUMENT_UID", <- use it to update an existing document
"name": "DOCUMENT_NAME", <- use it to create an new document
"type": "DOCUMENT_TYPE", <- use it to create an new document
"changeToken": "CHANGE_TOKEN", <- pass the previous change token for optimistic locking
"properties": ... <-- see DocumentPropertiesJsonReader
}
- Since:
- 7.2
-
Field Summary
Fields inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonReader
ctx, registry
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
applyAllPropertyValues
(DocumentModel src, DocumentModel dst) static void
protected static void
applyPropertyValue
(DataModelImpl srcDataModel, DataModelImpl dstDataModel, String fieldName) Deprecated.since 11.1.protected static void
applyPropertyValue
(Property property, DocumentModel dst) static void
applyPropertyValues
(DocumentModel src, DocumentModel dst) static void
applyPropertyValues
(DocumentModel src, DocumentModel dst, boolean dirtyOnly) protected DocumentModel
getDocument
(com.fasterxml.jackson.databind.JsonNode jn) protected static String
read
(Class<?> clazz, Type genericType, javax.ws.rs.core.MediaType mediaType, InputStream in) Read the entity from inInputStream
using mediatype format.protected DocumentModel
readEntity
(com.fasterxml.jackson.databind.JsonNode jn) Implement this method to read the entity.Methods inherited from class org.nuxeo.ecm.core.io.marshallers.json.EntityJsonReader
read
Methods inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonReader
accept, getBooleanField, getLongField, getNode, getStringField, getStringListField, readEntity
-
Field Details
-
LEGACY_MODE_READER
- See Also:
-
-
Constructor Details
-
DocumentModelJsonReader
public DocumentModelJsonReader()
-
-
Method Details
-
read
public DocumentModel read(Class<?> clazz, Type genericType, javax.ws.rs.core.MediaType mediaType, InputStream in) throws IOException Description copied from interface:Reader
Read the entity from inInputStream
using mediatype format.This method implementation can use injected properties.
- Specified by:
read
in interfaceReader<DocumentModel>
- Overrides:
read
in classAbstractJsonReader<DocumentModel>
- Parameters:
clazz
- The requested marshalled class.genericType
- The requested marshalled generic type.mediaType
- The input media type.in
- The input of this marshaller.- Throws:
IOException
- If some error append while reading entity from in.
-
readEntity
Description copied from class:EntityJsonReader
Implement this method to read the entity.- Specified by:
readEntity
in classEntityJsonReader<DocumentModel>
- Parameters:
jn
- AJsonNode
pointing at the root of the json input.- Returns:
- The parsed entity.
- Throws:
IOException
-
getDocument
- Throws:
IOException
- Since:
- 11.1
-
applyPropertyValues
-
applyPropertyValues
-
applyDirtyPropertyValues
-
applyAllPropertyValues
-
applyPropertyValue
-
getXPath
-
applyPropertyValue
@Deprecated(since="11.1") protected static void applyPropertyValue(DataModelImpl srcDataModel, DataModelImpl dstDataModel, String fieldName) Deprecated.since 11.1. Not used anymore.
-