use of org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext in project hibernate-search by hibernate.
the class CleanupIT method startup.
private void startup(Consumer<ProgrammaticMappingConfigurationContext> additionalMappingContributor) {
this.mapping = setupHelper.start().withConfiguration(builder -> {
builder.addEntityType(IndexedEntity.class);
builder.addEntityType(OtherIndexedEntity.class);
ContainerExtractorConfigurationContext containerExtractorDefinition = builder.containerExtractors();
containerExtractorDefinition.define(StartupStubContainerExtractor.NAME, StartupStubContainerExtractor.class, /*
* Increment static counters upon retrieval of the extractor
* and closing of its bean holder,
* so that we can check the bean holders are properly closed.
*/
ignored -> StartupStubContainerExtractor.create(CONTAINER_VALUE_EXTRACTOR_COUNTER_KEYS));
containerExtractorDefinition.define(FailingContainerExtractor.NAME, FailingContainerExtractor.class);
ProgrammaticMappingConfigurationContext mappingDefinition = builder.programmaticMapping();
TypeMappingStep indexedEntityMapping = mappingDefinition.type(IndexedEntity.class);
indexedEntityMapping.indexed().index(IndexedEntity.INDEX).routingBinder(StartupStubBridge.binder(ROUTING_BRIDGE_COUNTER_KEYS));
indexedEntityMapping.binder(StartupStubBridge.binder(TYPE_BRIDGE_COUNTER_KEYS));
indexedEntityMapping.property("id").documentId().identifierBinder(StartupStubBridge.binder(Integer.class, IDENTIFIER_BRIDGE_COUNTER_KEYS));
indexedEntityMapping.property("text").genericField().valueBinder(StartupStubBridge.binder(Object.class, VALUE_BRIDGE_COUNTER_KEYS)).extractor(StartupStubContainerExtractor.NAME);
indexedEntityMapping.property("embedded").associationInverseSide(PojoModelPath.builder().property("embedding").value(StartupStubContainerExtractor.NAME).toValuePath()).binder(StartupStubBridge.binder(PROPERTY_BRIDGE_COUNTER_KEYS)).indexedEmbedded().includePaths("text");
indexedEntityMapping.property("otherEmbedded").associationInverseSide(PojoModelPath.builder().property("otherEmbedding").value(StartupStubContainerExtractor.NAME).toValuePath());
additionalMappingContributor.accept(mappingDefinition);
}).setup();
}
Aggregations