Search in sources :

Example 6 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(environment.getProperty("engine.schema.update", "true"));
    processEngineConfiguration.setTransactionManager(annotationDrivenTransactionManager());
    processEngineConfiguration.setJobExecutorActivate(Boolean.valueOf(environment.getProperty("engine.activate.jobexecutor", "false")));
    processEngineConfiguration.setAsyncExecutorEnabled(Boolean.valueOf(environment.getProperty("engine.asyncexecutor.enabled", "true")));
    processEngineConfiguration.setAsyncExecutorActivate(Boolean.valueOf(environment.getProperty("engine.asyncexecutor.activate", "true")));
    processEngineConfiguration.setHistory(environment.getProperty("engine.history.level", "full"));
    String mailEnabled = environment.getProperty("engine.email.enabled");
    if ("true".equals(mailEnabled)) {
        processEngineConfiguration.setMailServerHost(environment.getProperty("engine.email.host"));
        int emailPort = 1025;
        String emailPortProperty = environment.getProperty("engine.email.port");
        if (StringUtils.isNotEmpty(emailPortProperty)) {
            emailPort = Integer.valueOf(emailPortProperty);
        }
        processEngineConfiguration.setMailServerPort(emailPort);
        String emailUsernameProperty = environment.getProperty("engine.email.username");
        if (StringUtils.isNotEmpty(emailUsernameProperty)) {
            processEngineConfiguration.setMailServerUsername(emailUsernameProperty);
        }
        String emailPasswordProperty = environment.getProperty("engine.email.password");
        if (StringUtils.isNotEmpty(emailPasswordProperty)) {
            processEngineConfiguration.setMailServerPassword(emailPasswordProperty);
        }
    }
    List<AbstractFormType> formTypes = new ArrayList<AbstractFormType>();
    formTypes.add(new UserFormType());
    formTypes.add(new ProcessDefinitionFormType());
    formTypes.add(new MonthFormType());
    processEngineConfiguration.setCustomFormTypes(formTypes);
    return processEngineConfiguration;
}
Also used : MonthFormType(org.activiti.explorer.form.MonthFormType) ProcessDefinitionFormType(org.activiti.explorer.form.ProcessDefinitionFormType) SpringProcessEngineConfiguration(org.activiti.spring.SpringProcessEngineConfiguration) ArrayList(java.util.ArrayList) UserFormType(org.activiti.explorer.form.UserFormType) AbstractFormType(org.activiti.engine.form.AbstractFormType) ProcessEngineFactoryBean(org.activiti.spring.ProcessEngineFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 7 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(environment.getProperty("engine.schema.update", "true"));
    processEngineConfiguration.setTransactionManager(annotationDrivenTransactionManager());
    processEngineConfiguration.setJobExecutorActivate(Boolean.valueOf(environment.getProperty("engine.activate.jobexecutor", "false")));
    processEngineConfiguration.setAsyncExecutorEnabled(Boolean.valueOf(environment.getProperty("engine.asyncexecutor.enabled", "true")));
    processEngineConfiguration.setAsyncExecutorActivate(Boolean.valueOf(environment.getProperty("engine.asyncexecutor.activate", "true")));
    processEngineConfiguration.setHistory(environment.getProperty("engine.history.level", "full"));
    List<AbstractFormType> formTypes = new ArrayList<AbstractFormType>();
    formTypes.add(new UserFormType());
    formTypes.add(new ProcessDefinitionFormType());
    formTypes.add(new MonthFormType());
    processEngineConfiguration.setCustomFormTypes(formTypes);
    return processEngineConfiguration;
}
Also used : MonthFormType(org.activiti.rest.form.MonthFormType) ProcessDefinitionFormType(org.activiti.rest.form.ProcessDefinitionFormType) SpringProcessEngineConfiguration(org.activiti.spring.SpringProcessEngineConfiguration) ArrayList(java.util.ArrayList) UserFormType(org.activiti.rest.form.UserFormType) AbstractFormType(org.activiti.engine.form.AbstractFormType) ProcessEngineFactoryBean(org.activiti.spring.ProcessEngineFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 8 with SpringProcessEngineConfiguration

use of org.activiti.spring.SpringProcessEngineConfiguration in project Activiti by Activiti.

the class ProcessEngineAutoConfigurationTest method processEngineWithJpaEntityManager.

@Test
public void processEngineWithJpaEntityManager() throws Exception {
    AnnotationConfigApplicationContext context = this.context(DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, JpaProcessEngineAutoConfiguration.JpaConfiguration.class);
    Assert.assertNotNull("entityManagerFactory should not be null", context.getBean(EntityManagerFactory.class));
    Assert.assertNotNull("the processEngine should not be null!", context.getBean(ProcessEngine.class));
    SpringProcessEngineConfiguration configuration = context.getBean(SpringProcessEngineConfiguration.class);
    Assert.assertNotNull("the " + SpringProcessEngineConfiguration.class.getName() + " should not be null", configuration);
    Assert.assertNotNull(configuration.getJpaEntityManagerFactory());
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) EntityManagerFactory(javax.persistence.EntityManagerFactory) SpringProcessEngineConfiguration(org.activiti.spring.SpringProcessEngineConfiguration) JpaProcessEngineAutoConfiguration(org.activiti.spring.boot.JpaProcessEngineAutoConfiguration) ProcessEngine(org.activiti.engine.ProcessEngine) Test(org.junit.Test)

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