use of org.candlepin.common.jackson.MultiFilter in project candlepin by candlepin.
the class JsonProvider method configureHateoasObjectMapper.
private void configureHateoasObjectMapper(ObjectMapper mapper, boolean indentJson) {
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
if (indentJson) {
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
}
SimpleFilterProvider filterProvider = new SimpleFilterProvider();
filterProvider = filterProvider.addFilter("ConsumerFilter", new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter()));
filterProvider = filterProvider.addFilter("EntitlementFilter", new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter()));
filterProvider = filterProvider.addFilter("OwnerFilter", new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter()));
filterProvider = filterProvider.addFilter("GuestFilter", new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter()));
filterProvider.setDefaultFilter(new DynamicPropertyFilter());
filterProvider.setFailOnUnknownId(false);
mapper.setFilterProvider(filterProvider);
AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
AnnotationIntrospector secondary = new JaxbAnnotationIntrospector(mapper.getTypeFactory());
AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary);
mapper.setAnnotationIntrospector(pair);
}
Aggregations