use of org.candlepin.common.jackson.DynamicPropertyFilter 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);
}
use of org.candlepin.common.jackson.DynamicPropertyFilter in project candlepin by candlepin.
the class ProductDataTest method createObjects.
@Before
public void createObjects() {
this.mapper = new ObjectMapper();
SimpleFilterProvider filterProvider = new SimpleFilterProvider();
filterProvider.setDefaultFilter(new DynamicPropertyFilter());
this.mapper.setFilters(filterProvider);
}
use of org.candlepin.common.jackson.DynamicPropertyFilter in project candlepin by candlepin.
the class PoolTest method createObjects.
@Before
public void createObjects() {
this.mapper = new ObjectMapper();
SimpleFilterProvider filterProvider = new SimpleFilterProvider();
filterProvider = filterProvider.addFilter("PoolFilter", new PoolEventFilter());
filterProvider = filterProvider.addFilter("OwnerFilter", new HateoasBeanPropertyFilter());
filterProvider.setDefaultFilter(new DynamicPropertyFilter());
this.mapper.setFilters(filterProvider);
beginTransaction();
try {
owner = new Owner("testowner");
ownerCurator.create(owner);
prod1 = this.createProduct(owner);
prod2 = this.createProduct(owner);
Set<Product> providedProducts = new HashSet<>();
providedProducts.add(prod2);
pool = TestUtil.createPool(owner, prod1, providedProducts, 1000);
subscription = TestUtil.createSubscription(owner, prod1);
subscription.setId(Util.generateDbUUID());
pool.setSourceSubscription(new SourceSubscription(subscription.getId(), "master"));
poolCurator.create(pool);
owner = pool.getOwner();
consumer = this.createConsumer(owner);
productCurator.create(prod1);
poolCurator.create(pool);
commitTransaction();
} catch (RuntimeException e) {
rollbackTransaction();
throw e;
}
}
Aggregations