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>
ConvertNuxeoPrincipalto Json.This marshaller is enrichable: register class implementing
AbstractJsonEnricherand managingNuxeoPrincipal.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 Modifier and Type Field Description static StringENTITY_TYPE-
Fields inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
ctx, registry
-
-
Constructor Summary
Constructors Constructor Description NuxeoPrincipalJsonWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidwriteEntityBody(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 Detail
-
ENTITY_TYPE
public static final String ENTITY_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
writeEntityBody
protected void writeEntityBody(NuxeoPrincipal principal, com.fasterxml.jackson.core.JsonGenerator jg) throws IOException
Description copied from class:ExtensibleEntityJsonWriterImplement this method to write the entity body.- Specified by:
writeEntityBodyin classExtensibleEntityJsonWriter<NuxeoPrincipal>- Parameters:
principal- The Java entity.jg- AJsonGeneratorready to write your entity as Json.- Throws:
IOException
-
-