org.springframework.data.mapping.context.PersistentEntities Java Examples

The following examples show how to use org.springframework.data.mapping.context.PersistentEntities. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Neo4jAuditingRegistrar.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
protected BeanDefinitionBuilder getAuditHandlerBeanDefinitionBuilder(AuditingConfiguration configuration) {

	Assert.notNull(configuration, "AuditingConfiguration must not be null!");

	BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(IsNewAwareAuditingHandler.class);

	BeanDefinitionBuilder persistentEntities = BeanDefinitionBuilder
		.genericBeanDefinition(PersistentEntities.class)
		.setFactoryMethod("of");
	persistentEntities.addConstructorArgReference(MAPPING_CONTEXT_BEAN_NAME);

	builder.addConstructorArgValue(persistentEntities.getBeanDefinition());
	return configureDefaultAuditHandlerAttributes(configuration, builder);
}
 
Example #2
Source File: AuditingBeforeBindCallbackTest.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@BeforeEach
public void setUp() {

	Neo4jMappingContext mappingContext = new Neo4jMappingContext();
	mappingContext.setInitialEntitySet(new HashSet<>(Arrays.asList(Sample.class, ImmutableSample.class)));
	mappingContext.initialize();

	IsNewAwareAuditingHandler originalHandler = new IsNewAwareAuditingHandler(
		new PersistentEntities(Arrays.asList(mappingContext)));
	spyOnHandler = spy(originalHandler);
	callback = new AuditingBeforeBindCallback(() -> spyOnHandler);
}
 
Example #3
Source File: ReactiveAuditingBeforeBindCallbackTest.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@BeforeEach
public void setUp() {

	Neo4jMappingContext mappingContext = new Neo4jMappingContext();
	mappingContext.setInitialEntitySet(new HashSet<>(Arrays.asList(Sample.class, ImmutableSample.class)));
	mappingContext.initialize();

	IsNewAwareAuditingHandler originalHandler = new IsNewAwareAuditingHandler(
		new PersistentEntities(Arrays.asList(mappingContext)));
	spyOnHandler = spy(originalHandler);
	callback = new ReactiveAuditingBeforeBindCallback(() -> spyOnHandler);
}
 
Example #4
Source File: MappingAuditableBeanWrapperFactory.java    From spring-data-mybatis with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link MappingAuditableBeanWrapperFactory} using the given
 * {@link PersistentEntities}.
 * @param entities must not be {@literal null}.
 */
public MappingAuditableBeanWrapperFactory(PersistentEntities entities) {

	Assert.notNull(entities, "PersistentEntities must not be null!");

	this.entities = entities;
	this.metadataCache = new ConcurrentReferenceHashMap<>();
}
 
Example #5
Source File: MybatisAuditingHandler.java    From spring-data-mybatis with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link AuditableBeanWrapper} using the given
 * {@link PersistentEntities} when looking up auditing metadata via reflection.
 * @param entities must not be {@literal null}.
 * @since 1.10
 */
public MybatisAuditingHandler(PersistentEntities entities) {

	Assert.notNull(entities, "PersistentEntities must not be null!");

	this.factory = new MappingAuditableBeanWrapperFactory(entities);
	this.auditorAware = Optional.empty();
}
 
Example #6
Source File: MybatisAuditingHandler.java    From spring-data-mybatis with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new {@link AuditableBeanWrapper} using the given {@link MappingContext}
 * when looking up auditing metadata via reflection.
 * @param mappingContext must not be {@literal null}.
 * @since 1.8
 * @deprecated use {@link AuditingHandler ( PersistentEntities )} instead.
 */
@Deprecated
public MybatisAuditingHandler(
		MappingContext<? extends PersistentEntity<?, ?>, ? extends PersistentProperty<?>> mappingContext) {
	this(PersistentEntities.of(mappingContext));
}