Search in sources :

Example 1 with SpringProcessEngineConfiguration

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;
    }
}
Also used : CamelContext(org.apache.camel.CamelContext) ActivitiException(org.activiti.engine.ActivitiException) SpringProcessEngineConfiguration(org.activiti.spring.SpringProcessEngineConfiguration) ProcessEngineConfiguration(org.activiti.engine.ProcessEngineConfiguration) ActivitiException(org.activiti.engine.ActivitiException)

Example 2 with SpringProcessEngineConfiguration

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;
}
Also used : Resource(org.springframework.core.io.Resource) SpringProcessEngineConfiguration(org.activiti.spring.SpringProcessEngineConfiguration)

Example 3 with SpringProcessEngineConfiguration

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;
}
Also used : SpringProcessEngineConfiguration(org.activiti.spring.SpringProcessEngineConfiguration)

Example 4 with SpringProcessEngineConfiguration

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;
}
Also used : SpringProcessEngineConfiguration(org.activiti.spring.SpringProcessEngineConfiguration) ProcessEngineFactoryBean(org.activiti.spring.ProcessEngineFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 5 with SpringProcessEngineConfiguration

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;
}
Also used : SpringProcessEngineConfiguration(org.activiti.spring.SpringProcessEngineConfiguration) ProcessEngineFactoryBean(org.activiti.spring.ProcessEngineFactoryBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

SpringProcessEngineConfiguration (org.activiti.spring.SpringProcessEngineConfiguration)8 ProcessEngineFactoryBean (org.activiti.spring.ProcessEngineFactoryBean)4 Bean (org.springframework.context.annotation.Bean)4 ArrayList (java.util.ArrayList)2 AbstractFormType (org.activiti.engine.form.AbstractFormType)2 EntityManagerFactory (javax.persistence.EntityManagerFactory)1 ActivitiException (org.activiti.engine.ActivitiException)1 ProcessEngine (org.activiti.engine.ProcessEngine)1 ProcessEngineConfiguration (org.activiti.engine.ProcessEngineConfiguration)1 MonthFormType (org.activiti.explorer.form.MonthFormType)1 ProcessDefinitionFormType (org.activiti.explorer.form.ProcessDefinitionFormType)1 UserFormType (org.activiti.explorer.form.UserFormType)1 MonthFormType (org.activiti.rest.form.MonthFormType)1 ProcessDefinitionFormType (org.activiti.rest.form.ProcessDefinitionFormType)1 UserFormType (org.activiti.rest.form.UserFormType)1 JpaProcessEngineAutoConfiguration (org.activiti.spring.boot.JpaProcessEngineAutoConfiguration)1 CamelContext (org.apache.camel.CamelContext)1 Test (org.junit.Test)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1 Resource (org.springframework.core.io.Resource)1