Class NuxeoPrincipalJsonWriter
java.lang.Object
org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter<EntityType>
org.nuxeo.ecm.core.io.marshallers.json.ExtensibleEntityJsonWriter<NuxeoPrincipal>
org.nuxeo.ecm.platform.usermanager.io.NuxeoPrincipalJsonWriter
- All Implemented Interfaces:
Marshaller<NuxeoPrincipal>
,Writer<NuxeoPrincipal>
@Setup(mode=SINGLETON,
priority=2000)
public class NuxeoPrincipalJsonWriter
extends ExtensibleEntityJsonWriter<NuxeoPrincipal>
Convert
NuxeoPrincipal
to Json.
This marshaller is enrichable: register class implementing AbstractJsonEnricher
and managing
NuxeoPrincipal
.
This marshaller is also extensible: extend it and simply override
ExtensibleEntityJsonWriter.extend(Object, JsonGenerator)
.
Format is:
{
"entity-type":"user",
"id":"USERNAME",
"properties":{ <- depending on the user schema / format is managed by {@link DocumentPropertyJsonWriter }
"firstName":"FIRSTNAME",
"lastName":"LASTNAME",
"username":"USERNAME",
"email":"[email protected]",
"company":"COMPANY",
"password":"", <- ALWAYS EMPTY
"groups":[
"GROUP1 NAME OF THE USER",
"GROUP2 NAME OF THE USER",
...
]
},
"extendedGroups":[
{
"name":"GROUP1NAME",
"label":"GROUP1 DISPLAY NAME",
"url":"GROUP1 URL"
},
...
],
"isAdministrator":true|false,
"isAnonymous":false|false
<-- contextParameters if there are enrichers activated
<-- additional property provided by extend() method
}
- Since:
- 7.2
-
Field Summary
Fields inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
ctx, registry
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
writeEntityBody
(NuxeoPrincipal principal, com.fasterxml.jackson.core.JsonGenerator jg) Implement this method to write the entity body.Methods inherited from class org.nuxeo.ecm.core.io.marshallers.json.ExtensibleEntityJsonWriter
extend, write
Methods 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:
-
-
Constructor Details
-
NuxeoPrincipalJsonWriter
public NuxeoPrincipalJsonWriter()
-
-
Method Details
-
writeEntityBody
protected void writeEntityBody(NuxeoPrincipal principal, com.fasterxml.jackson.core.JsonGenerator jg) throws IOException Description copied from class:ExtensibleEntityJsonWriter
Implement this method to write the entity body.- Specified by:
writeEntityBody
in classExtensibleEntityJsonWriter<NuxeoPrincipal>
- Parameters:
principal
- The Java entity.jg
- AJsonGenerator
ready to write your entity as Json.- Throws:
IOException
-