use of org.activiti.spring.SpringProcessEngineConfiguration in project Activiti by Activiti.
the class CamelBehavior method setAppropriateCamelContext.
protected void setAppropriateCamelContext(ActivityExecution execution) {
//Check to see if the springConfiguration has been set. If not, set it.
if (springConfiguration == null) {
//Get the ProcessEngineConfiguration object.
ProcessEngineConfiguration engineConfiguration = Context.getProcessEngineConfiguration();
// (ActivitiException extends RuntimeException.)
try {
springConfiguration = (SpringProcessEngineConfiguration) engineConfiguration;
} catch (Exception e) {
throw new ActivitiException("Expecting a SpringProcessEngineConfiguration for the Activiti Camel module.", e);
}
}
//Get the appropriate String representation of the CamelContext object from ActivityExecution (if available).
String camelContextValue = getStringFromField(camelContext, execution);
//If the String representation of the CamelContext object from ActivityExecution is empty, use the default.
if (StringUtils.isEmpty(camelContextValue) && camelContextObj != null) {
//No processing required. No custom CamelContext & the default is already set.
} else {
if (StringUtils.isEmpty(camelContextValue) && camelContextObj == null) {
camelContextValue = springConfiguration.getDefaultCamelContext();
}
//Get the CamelContext object and set the super's member variable.
Object ctx = springConfiguration.getApplicationContext().getBean(camelContextValue);
if (ctx == null || ctx instanceof CamelContext == false) {
throw new ActivitiException("Could not find CamelContext named " + camelContextValue + ".");
}
camelContextObj = (CamelContext) ctx;
}
}
use of org.activiti.spring.SpringProcessEngineConfiguration in project Activiti by Activiti.
the class AbstractProcessEngineAutoConfiguration method baseSpringProcessEngineConfiguration.
protected SpringProcessEngineConfiguration baseSpringProcessEngineConfiguration(DataSource dataSource, PlatformTransactionManager platformTransactionManager, SpringAsyncExecutor springAsyncExecutor) throws IOException {
List<Resource> procDefResources = this.discoverProcessDefinitionResources(this.resourceLoader, this.activitiProperties.getProcessDefinitionLocationPrefix(), this.activitiProperties.getProcessDefinitionLocationSuffixes(), this.activitiProperties.isCheckProcessDefinitions());
SpringProcessEngineConfiguration conf = super.processEngineConfigurationBean(procDefResources.toArray(new Resource[procDefResources.size()]), dataSource, platformTransactionManager, springAsyncExecutor);
conf.setDeploymentName(defaultText(activitiProperties.getDeploymentName(), conf.getDeploymentName()));
conf.setDatabaseSchema(defaultText(activitiProperties.getDatabaseSchema(), conf.getDatabaseSchema()));
conf.setDatabaseSchemaUpdate(defaultText(activitiProperties.getDatabaseSchemaUpdate(), conf.getDatabaseSchemaUpdate()));
conf.setDbIdentityUsed(activitiProperties.isDbIdentityUsed());
conf.setDbHistoryUsed(activitiProperties.isDbHistoryUsed());
conf.setJobExecutorActivate(activitiProperties.isJobExecutorActivate());
conf.setAsyncExecutorEnabled(activitiProperties.isAsyncExecutorEnabled());
conf.setAsyncExecutorActivate(activitiProperties.isAsyncExecutorActivate());
conf.setMailServerHost(activitiProperties.getMailServerHost());
conf.setMailServerPort(activitiProperties.getMailServerPort());
conf.setMailServerUsername(activitiProperties.getMailServerUserName());
conf.setMailServerPassword(activitiProperties.getMailServerPassword());
conf.setMailServerDefaultFrom(activitiProperties.getMailServerDefaultFrom());
conf.setMailServerUseSSL(activitiProperties.isMailServerUseSsl());
conf.setMailServerUseTLS(activitiProperties.isMailServerUseTls());
conf.setHistoryLevel(activitiProperties.getHistoryLevel());
if (activitiProperties.getCustomMybatisMappers() != null) {
conf.setCustomMybatisMappers(getCustomMybatisMapperClasses(activitiProperties.getCustomMybatisMappers()));
}
if (activitiProperties.getCustomMybatisXMLMappers() != null) {
conf.setCustomMybatisXMLMappers(new HashSet<String>(activitiProperties.getCustomMybatisXMLMappers()));
}
if (processEngineConfigurationConfigurer != null) {
processEngineConfigurationConfigurer.configure(conf);
}
return conf;
}
use of org.activiti.spring.SpringProcessEngineConfiguration in project Activiti by Activiti.
the class AbstractProcessEngineConfiguration method processEngineConfigurationBean.
public SpringProcessEngineConfiguration processEngineConfigurationBean(Resource[] processDefinitions, DataSource dataSource, PlatformTransactionManager transactionManager, SpringAsyncExecutor springAsyncExecutor) throws IOException {
SpringProcessEngineConfiguration engine = new SpringProcessEngineConfiguration();
if (processDefinitions != null && processDefinitions.length > 0) {
engine.setDeploymentResources(processDefinitions);
}
engine.setDataSource(dataSource);
engine.setTransactionManager(transactionManager);
if (null != springAsyncExecutor) {
engine.setAsyncExecutorEnabled(true);
engine.setAsyncExecutor(springAsyncExecutor);
}
return engine;
}
use of org.activiti.spring.SpringProcessEngineConfiguration in project Activiti by Activiti.
the class JPAActivitiEngineConfiguration method processEngineConfiguration.
@Bean(name = "processEngineConfiguration")
public ProcessEngineConfigurationImpl processEngineConfiguration() {
SpringProcessEngineConfiguration processEngineConfiguration = new SpringProcessEngineConfiguration();
processEngineConfiguration.setDataSource(dataSource);
processEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
processEngineConfiguration.setTransactionManager(transactionManager);
processEngineConfiguration.setJobExecutorActivate(false);
processEngineConfiguration.setAsyncExecutorEnabled(true);
processEngineConfiguration.setAsyncExecutorActivate(false);
processEngineConfiguration.setJpaEntityManagerFactory(entityManagerFactory);
processEngineConfiguration.setJpaHandleTransaction(false);
processEngineConfiguration.setJpaHandleTransaction(false);
processEngineConfiguration.setHistoryLevel(HistoryLevel.FULL);
return processEngineConfiguration;
}
use of org.activiti.spring.SpringProcessEngineConfiguration in project Activiti by Activiti.
the class ActivitiEngineConfiguration method processEngineConfiguration.
@Bean(name = "processEngineConfiguration")
public ProcessEngineConfigurationImpl processEngineConfiguration() {
SpringProcessEngineConfiguration processEngineConfiguration = new SpringProcessEngineConfiguration();
processEngineConfiguration.setDataSource(dataSource());
processEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
processEngineConfiguration.setTransactionManager(annotationDrivenTransactionManager());
processEngineConfiguration.setJobExecutorActivate(false);
processEngineConfiguration.setAsyncExecutorEnabled(true);
processEngineConfiguration.setAsyncExecutorActivate(false);
processEngineConfiguration.setHistoryLevel(HistoryLevel.FULL);
return processEngineConfiguration;
}
Aggregations