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();
}
Aggregations