@Setup(mode=SINGLETON, priority=2000) public class NuxeoPrincipalJsonWriter extends ExtensibleEntityJsonWriter<NuxeoPrincipal>
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(NuxeoPrincipal, JsonWriter)
.
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":"user@mail.com", "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 }
Modifier and Type | Field and Description |
---|---|
static String |
ENTITY_TYPE |
ctx, registry
Constructor and Description |
---|
NuxeoPrincipalJsonWriter() |
Modifier and Type | Method and Description |
---|---|
protected void |
writeEntityBody(NuxeoPrincipal principal,
com.fasterxml.jackson.core.JsonGenerator jg)
Implement this method to write the entity body.
|
extend, write
accept, getGenerator, write, writeEntity, writeEntity, writeEntityField, writeSerializable, writeSerializableField, writeSerializableListField, writeSerializableMapField
public static final String ENTITY_TYPE
public NuxeoPrincipalJsonWriter()
protected void writeEntityBody(NuxeoPrincipal principal, com.fasterxml.jackson.core.JsonGenerator jg) throws IOException
ExtensibleEntityJsonWriter
writeEntityBody
in class ExtensibleEntityJsonWriter<NuxeoPrincipal>
principal
- The Java entity.jg
- A JsonGenerator
ready to write your entity as Json.IOException
Copyright © 2018 Nuxeo. All rights reserved.