Search in sources :

Example 1 with SchemaTypeUserSerializer

use of org.gluu.oxtrust.service.scim2.schema.strategy.serializers.SchemaTypeUserSerializer in project oxTrust by GluuFederation.

the class UserCoreLoadingStrategy method load.

@Override
public SchemaType load(AppConfiguration appConfiguration, SchemaType schemaType) throws Exception {
    log.info(" load() ");
    Meta meta = new Meta();
    meta.setLocation(appConfiguration.getBaseEndpoint() + "/scim/v2/Schemas/" + schemaType.getId());
    meta.setResourceType("Schema");
    schemaType.setMeta(meta);
    // Use serializer to walk the class structure
    ObjectMapper mapper = new ObjectMapper();
    mapper.disable(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS);
    SimpleModule userCoreLoadingStrategyModule = new SimpleModule("UserCoreLoadingStrategyModule", new Version(1, 0, 0, ""));
    SchemaTypeUserSerializer serializer = new SchemaTypeUserSerializer();
    serializer.setSchemaType(schemaType);
    userCoreLoadingStrategyModule.addSerializer(User.class, serializer);
    mapper.registerModule(userCoreLoadingStrategyModule);
    mapper.writeValueAsString(createDummyUser());
    return serializer.getSchemaType();
}
Also used : SchemaTypeUserSerializer(org.gluu.oxtrust.service.scim2.schema.strategy.serializers.SchemaTypeUserSerializer) Meta(org.gluu.oxtrust.model.scim2.Meta) Version(org.codehaus.jackson.Version) ObjectMapper(org.codehaus.jackson.map.ObjectMapper) SimpleModule(org.codehaus.jackson.map.module.SimpleModule)

Aggregations

Version (org.codehaus.jackson.Version)1 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1 SimpleModule (org.codehaus.jackson.map.module.SimpleModule)1 Meta (org.gluu.oxtrust.model.scim2.Meta)1 SchemaTypeUserSerializer (org.gluu.oxtrust.service.scim2.schema.strategy.serializers.SchemaTypeUserSerializer)1