Java Code Examples for org.springframework.data.mapping.callback.EntityCallbacks

The following examples show how to use org.springframework.data.mapping.callback.EntityCallbacks. These examples are extracted from open source projects. 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 Project: sdn-rx   Source File: Neo4jTemplate.java    License: Apache License 2.0 5 votes vote down vote up
public Neo4jTemplate(Neo4jClient neo4jClient, Neo4jMappingContext neo4jMappingContext, DatabaseSelectionProvider databaseSelectionProvider) {

		Assert.notNull(neo4jClient, "The Neo4jClient is required");
		Assert.notNull(neo4jMappingContext, "The Neo4jMappingContext is required");
		Assert.notNull(databaseSelectionProvider, "The database name provider is required");

		this.neo4jClient = neo4jClient;
		this.neo4jMappingContext = neo4jMappingContext;
		this.cypherGenerator = CypherGenerator.INSTANCE;
		this.eventSupport = new Neo4jEvents(EntityCallbacks.create());

		this.databaseSelectionProvider = databaseSelectionProvider;
	}
 
Example 2
@Override
public void afterPropertiesSet() {

    Assert.state(this.mappingContext != null, "MappingContext is required and must not be null!");
    Assert.state(this.converter != null, "RelationalConverter is required and must not be null!");

    if (this.operations == null) {

        Assert.state(beanFactory != null, "If no JdbcOperations are set a BeanFactory must be available.");

        this.operations = beanFactory.getBean(NamedParameterJdbcOperations.class);
    }

    if (this.dataAccessStrategy == null) {

        Assert.state(beanFactory != null, "If no DataAccessStrategy is set a BeanFactory must be available.");

        this.dataAccessStrategy = this.beanFactory.getBeanProvider(DataAccessStrategy.class) //
                                                  .getIfAvailable(() -> {
                                                      SqlGeneratorSource sqlGeneratorSource = new SqlGeneratorSource(
                                                              this.mappingContext,
                                                              this.converter,
                                                              this.dialect);
                                                      return new DefaultDataAccessStrategy(sqlGeneratorSource,
                                                                                           this.mappingContext,
                                                                                           this.converter,
                                                                                           this.operations);
                                                  });
    }

    if (this.queryMappingConfiguration == null) {
        this.queryMappingConfiguration = QueryMappingConfiguration.EMPTY;
    }

    if (beanFactory != null) {
        entityCallbacks = EntityCallbacks.create(beanFactory);
    }

    super.afterPropertiesSet();
}
 
Example 3
Source Project: sdn-rx   Source File: Neo4jTemplate.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {

	this.eventSupport = new Neo4jEvents(EntityCallbacks.create(beanFactory));
}
 
Example 4
Source Project: sdn-rx   Source File: Neo4jTemplate.java    License: Apache License 2.0 4 votes vote down vote up
Neo4jEvents(EntityCallbacks entityCallbacks) {
	this.entityCallbacks = entityCallbacks;
}
 
Example 5
public void setEntityCallbacks(EntityCallbacks entityCallbacks) {
    super.setEntityCallbacks(entityCallbacks);
    this.entityCallbacks = entityCallbacks;
}