Search in sources :

Example 1 with BeanPropertyParameterSourceFactory

use of org.springframework.integration.jpa.support.parametersource.BeanPropertyParameterSourceFactory in project spring-integration by spring-projects.

the class JpaExecutor method afterPropertiesSet.

/**
 * Verify and sets the parameters. E.g. initializes the to be used
 * {@link ParameterSourceFactory}.
 */
@Override
public void afterPropertiesSet() {
    if (!CollectionUtils.isEmpty(this.jpaParameters)) {
        if (this.parameterSourceFactory == null) {
            ExpressionEvaluatingParameterSourceFactory expressionSourceFactory = new ExpressionEvaluatingParameterSourceFactory(this.beanFactory);
            expressionSourceFactory.setParameters(this.jpaParameters);
            this.parameterSourceFactory = expressionSourceFactory;
        } else {
            if (!(this.parameterSourceFactory instanceof ExpressionEvaluatingParameterSourceFactory)) {
                throw new IllegalStateException("You are providing 'JpaParameters'. " + "Was expecting the the provided jpaParameterSourceFactory " + "to be an instance of 'ExpressionEvaluatingJpaParameterSourceFactory', " + "however the provided one is of type '" + this.parameterSourceFactory.getClass().getName() + "'");
            }
        }
        if (this.usePayloadAsParameterSource == null) {
            this.usePayloadAsParameterSource = false;
        }
    } else {
        if (this.parameterSourceFactory == null) {
            this.parameterSourceFactory = new BeanPropertyParameterSourceFactory();
        }
        if (this.usePayloadAsParameterSource == null) {
            this.usePayloadAsParameterSource = true;
        }
    }
    if (this.flushSize > 0) {
        this.flush = true;
    } else if (this.flush) {
        this.flushSize = 1;
    }
    if (this.evaluationContext == null) {
        this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.beanFactory);
    }
}
Also used : BeanPropertyParameterSourceFactory(org.springframework.integration.jpa.support.parametersource.BeanPropertyParameterSourceFactory) ExpressionEvaluatingParameterSourceFactory(org.springframework.integration.jpa.support.parametersource.ExpressionEvaluatingParameterSourceFactory)

Aggregations

BeanPropertyParameterSourceFactory (org.springframework.integration.jpa.support.parametersource.BeanPropertyParameterSourceFactory)1 ExpressionEvaluatingParameterSourceFactory (org.springframework.integration.jpa.support.parametersource.ExpressionEvaluatingParameterSourceFactory)1