Java Code Examples for org.activiti.spring.SpringProcessEngineConfiguration#setMailServerHost()

The following examples show how to use org.activiti.spring.SpringProcessEngineConfiguration#setMailServerHost() . 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 File: AbstractProcessEngineAutoConfiguration.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
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.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 (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);
  }
  //从ActivitiEngineConfiguration copy来的
  FormEngineConfiguration formEngineConfiguration = new FormEngineConfiguration();
  formEngineConfiguration.setDataSource(dataSource);

  FormEngineConfigurator formEngineConfigurator = new FormEngineConfigurator();
  formEngineConfigurator.setFormEngineConfiguration(formEngineConfiguration);
  conf.addConfigurator(formEngineConfigurator);

  DmnEngineConfiguration dmnEngineConfiguration = new DmnEngineConfiguration();
  dmnEngineConfiguration.setDataSource(dataSource);

  DmnEngineConfigurator dmnEngineConfigurator = new DmnEngineConfigurator();
  dmnEngineConfigurator.setDmnEngineConfiguration(dmnEngineConfiguration);
  conf.addConfigurator(dmnEngineConfigurator);

  return conf;
}
 
Example 2
Source File: ServiceSpringModuleConfig.java    From herd with Apache License 2.0 4 votes vote down vote up
/**
 * Gets the Activiti Process Engine Configuration.
 *
 * @param activitiAsyncExecutor the async executor to set on the configuration.
 *
 * @return the Activiti Process Engine Configuration.
 */
@Bean
public SpringProcessEngineConfiguration activitiProcessEngineConfiguration(AsyncExecutor activitiAsyncExecutor)
{
    // Initialize a new process engine configuration for Activiti that is Spring enabled.
    SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration();

    // Share the herd data source and transaction manager with Activiti so all DB operations between the herd schema and the Activiti schema will occur
    // within the same transaction that can be committed or rolled back together.
    configuration.setDataSource(herdDataSource);
    configuration.setTransactionManager(herdTransactionManager);

    // Set the database schema update approach. This will be different for the main application and JUnits which is why we get it from a bean
    // via the method below.
    configuration.setDatabaseSchemaUpdate(getActivitiDbSchemaUpdateParamBeanName());

    // Enable the async executor so threads can be picked up and worked on.
    configuration.setAsyncExecutorActivate(true);

    // Explicitly wire in our "Spring" async executor which in turn is configured with our own task executor.
    configuration.setAsyncExecutorEnabled(true);
    configuration.setAsyncExecutor(activitiAsyncExecutor);

    // Set the allowed beans to an empty map so the Activiti workflows won't be able to call any arbitrary bean (e.g. services, etc.).
    configuration.setBeans(new HashMap<>());

    // Explicitly set a custom herd delegate interceptor that allows us to autowire in Spring beans onto our Java delegate tasks.
    configuration.setDelegateInterceptor(herdDelegateInterceptor);

    // Explicitly set a custom herd command invoker that allows us to perform specialized logging for asynchronous tasks.
    configuration.setCommandInvoker(herdCommandInvoker);

    // Initialize the scripting engines.
    initScriptingEngines(configuration);

    // Set the default "from" field for Activiti mail
    String mailServerDefaultFrom = configurationHelper.getProperty(ConfigurationValue.ACTIVITI_DEFAULT_MAIL_FROM);
    configuration.setMailServerDefaultFrom(mailServerDefaultFrom);
    // Set the mail server hostname for Activiti mail
    String mailServerHost = configurationHelper.getProperty(ConfigurationValue.ACTIVITI_MAIL_SERVER_HOST);
    configuration.setMailServerHost(mailServerHost);
    // Set the mail server port number for Activiti mail
    int mailServerPort = configurationHelper.getProperty(ConfigurationValue.ACTIVITI_MAIL_SERVER_PORT, Integer.class);
    configuration.setMailServerPort(mailServerPort);
    LOGGER.info("Activiti mail server configurations: activitiMailServerDefaultFrom=\"{}\" activitiMailServerHost=\"{}\" activitiMailServerPort={}",
        mailServerDefaultFrom, mailServerHost, mailServerPort);

    // Attach a custom herd process engine configurator that will allow us to modify the configuration before the engine is built.
    List<ProcessEngineConfigurator> herdConfigurators = new ArrayList<>();
    herdConfigurators.add(herdProcessEngineConfigurator);
    configuration.setConfigurators(herdConfigurators);

    // Return the configuration.
    return configuration;
}