Search in sources :

Example 1 with SchemaTypeGroupSerializer

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

the class GroupCoreLoadingStrategy 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 groupCoreLoadingStrategyModule = new SimpleModule("GroupCoreLoadingStrategyModule", new Version(1, 0, 0, ""));
    SchemaTypeGroupSerializer serializer = new SchemaTypeGroupSerializer();
    serializer.setSchemaType(schemaType);
    groupCoreLoadingStrategyModule.addSerializer(Group.class, serializer);
    mapper.registerModule(groupCoreLoadingStrategyModule);
    mapper.writeValueAsString(createDummyGroup());
    return serializer.getSchemaType();
}
Also used : Meta(org.gluu.oxtrust.model.scim2.Meta) SchemaTypeGroupSerializer(org.gluu.oxtrust.service.scim2.schema.strategy.serializers.SchemaTypeGroupSerializer) 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 SchemaTypeGroupSerializer (org.gluu.oxtrust.service.scim2.schema.strategy.serializers.SchemaTypeGroupSerializer)1