org.activiti.spring.SpringProcessEngineConfiguration Java Examples
The following examples show how to use
org.activiti.spring.SpringProcessEngineConfiguration.
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: AbstractProcessEngineConfiguration.java From activiti6-boot2 with Apache License 2.0 | 7 votes |
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.setAsyncExecutor(springAsyncExecutor); } return engine; }
Example #2
Source File: ActivitiConfig.java From MicroCommunity with Apache License 2.0 | 6 votes |
@Bean public SpringProcessEngineConfiguration springProcessEngineConfiguration() { SpringProcessEngineConfiguration spec = new SpringProcessEngineConfiguration(); spec.setDataSource(dataSource); spec.setTransactionManager(platformTransactionManager); spec.setDatabaseSchemaUpdate("true"); spec.setActivityFontName("宋体"); spec.setAnnotationFontName("宋体"); spec.setLabelFontName("宋体"); Resource[] resources = null; // 启动自动部署流程 try { resources = new PathMatchingResourcePatternResolver().getResources("classpath*:processes/*.bpmn"); } catch (IOException e) { e.printStackTrace(); } spec.setDeploymentResources(resources); return spec; }
Example #3
Source File: DefaultSpringProcessEngineFactory.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
/** * Takes in an Activiti 6 process engine config, gives back an Activiti 5 Process engine. */ @Override public ProcessEngine buildProcessEngine(ProcessEngineConfigurationImpl activiti6Configuration) { org.activiti5.engine.impl.cfg.ProcessEngineConfigurationImpl activiti5Configuration = null; if (activiti6Configuration instanceof SpringProcessEngineConfiguration) { activiti5Configuration = new org.activiti5.spring.SpringProcessEngineConfiguration(); super.copyConfigItems(activiti6Configuration, activiti5Configuration); copySpringConfigItems((SpringProcessEngineConfiguration) activiti6Configuration, (org.activiti5.spring.SpringProcessEngineConfiguration) activiti5Configuration); return activiti5Configuration.buildProcessEngine(); } else { return super.buildProcessEngine(activiti6Configuration); } }
Example #4
Source File: DataSourceProcessEngineAutoConfiguration.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean public SpringProcessEngineConfiguration springProcessEngineConfiguration( DataSource dataSource, PlatformTransactionManager transactionManager, SpringAsyncExecutor springAsyncExecutor) throws IOException { return this.baseSpringProcessEngineConfiguration(dataSource, transactionManager, springAsyncExecutor); }
Example #5
Source File: HerdProcessEngineConfiguratorTest.java From herd with Apache License 2.0 | 5 votes |
/** * Activiti by default configures StringType and LongStringType VariableType in configuration. * This method tests the scenarios where no StringType and LongStringType is already configured in configuration. */ @Test public void testNoStringAndLongStringType() throws Exception { SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration(); configuration.setVariableTypes(new DefaultVariableTypes()); herdProcessEngineConfigurator.configure(configuration); VariableType type = configuration.getVariableTypes().findVariableType(StringUtils.repeat("a", 2000)); assertEquals(StringType.class, type.getClass()); type = configuration.getVariableTypes().findVariableType(StringUtils.repeat("a", 2001)); assertEquals(LongStringType.class, type.getClass()); }
Example #6
Source File: ServiceSpringModuleConfig.java From herd with Apache License 2.0 | 5 votes |
/** * Gets the Activiti Process Engine. * * @param activitiProcessEngineConfiguration the Activiti process engine configuration to use. * * @return the Activiti Process Engine. */ @Bean(destroyMethod = "destroy") public ProcessEngineFactoryBean activitiProcessEngine(SpringProcessEngineConfiguration activitiProcessEngineConfiguration) { // Create and return a factory bean that can return an Activiti process engine based on our Activiti process engine configuration bean. ProcessEngineFactoryBean bean = new ProcessEngineFactoryBean(); bean.setProcessEngineConfiguration(activitiProcessEngineConfiguration); return bean; }
Example #7
Source File: DefaultFlowable5SpringCompatibilityHandler.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public Object getCamelContextObject(String camelContextValue) { SpringProcessEngineConfiguration springConfiguration = (SpringProcessEngineConfiguration) getProcessEngine().getProcessEngineConfiguration(); if (StringUtils.isEmpty(camelContextValue)) { camelContextValue = springConfiguration.getDefaultCamelContext(); } // Get the CamelContext object and set the super's member variable. Object ctx = springConfiguration.getApplicationContext().getBean(camelContextValue); return ctx; }
Example #8
Source File: ShareniuProcessEngineConfigurationConfigurer.java From easyweb with Apache License 2.0 | 5 votes |
public void configure(SpringProcessEngineConfiguration processEngineConfiguration) { processEngineConfiguration.setActivityFontName("宋体"); processEngineConfiguration.setLabelFontName("宋体"); processEngineConfiguration.setAnnotationFontName("宋体"); processEngineConfiguration.setJdbcDriver(databaseConfig.getDriverClassName()); processEngineConfiguration.setJdbcUrl(databaseConfig.getUrl()); // processEngineConfiguration.setSqlSessionFactory(sqlSessionFactory); // processEngineConfiguration.setDatabaseSchemaUpdate("SP2"); // processEngineConfiguration.setDatabaseSchema("TEST"); // processEngineConfiguration.setDatabaseSchemaUpdate("true"); System.out.println("ShareniuProcessEngineConfigurationConfigurer#############"); System.out.println(processEngineConfiguration.getActivityFontName()); }
Example #9
Source File: ActivitiConfig.java From easyweb with Apache License 2.0 | 5 votes |
@Bean public SpringProcessEngineConfiguration springProcessEngineConfiguration( @Qualifier("activitidatabaseSource") DataSource dataSource, @Qualifier("activitiTransactionManager") PlatformTransactionManager transactionManager, SpringAsyncExecutor springAsyncExecutor) throws IOException { return this.baseSpringProcessEngineConfiguration(dataSource, transactionManager, springAsyncExecutor); }
Example #10
Source File: ProcessEngineAutoConfigurationTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@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()); }
Example #11
Source File: ProcessEngineConfiguration.java From open-cloud with MIT License | 5 votes |
@Bean public SpringProcessEngineConfiguration springProcessEngineConfiguration(DataSource dataSource, PlatformTransactionManager transactionManager, SpringAsyncExecutor springAsyncExecutor ) throws IOException { SpringProcessEngineConfiguration engineConfiguration = baseSpringProcessEngineConfiguration( dataSource, transactionManager, springAsyncExecutor); Map<String, List<ActivitiEventListener>> typedListeners = new HashMap<>(); typedListeners.put("TASK_CREATED", Collections.singletonList(taskCreatedListener())); typedListeners.put("TASK_COMPLETED", Collections.singletonList(taskCompletedListener())); engineConfiguration.setTypedEventListeners(typedListeners); return engineConfiguration; }
Example #12
Source File: JpaProcessEngineAutoConfiguration.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean public SpringProcessEngineConfiguration springProcessEngineConfiguration( DataSource dataSource, EntityManagerFactory entityManagerFactory, PlatformTransactionManager transactionManager, SpringAsyncExecutor springAsyncExecutor) throws IOException { SpringProcessEngineConfiguration config = this.baseSpringProcessEngineConfiguration(dataSource, transactionManager, springAsyncExecutor); config.setJpaEntityManagerFactory(entityManagerFactory); config.setTransactionManager(transactionManager); config.setJpaHandleTransaction(false); config.setJpaCloseEntityManager(false); return config; }
Example #13
Source File: SpringJmsConfig.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Bean public SpringProcessEngineConfiguration processEngineConfiguration() { SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration(); configuration.setDataSource(dataSource()); configuration.setTransactionManager(transactionManager()); configuration.setDatabaseSchemaUpdate(SpringProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE); configuration.setAsyncExecutorMessageQueueMode(true); configuration.setAsyncExecutorActivate(true); configuration.setJobManager(jobManager()); return configuration; }
Example #14
Source File: ActivitiDataSourceConfig.java From opscenter with Apache License 2.0 | 5 votes |
@Bean public SpringProcessEngineConfiguration springProcessEngineConfiguration() { SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration(); configuration.setDataSource(dataSource); configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE); configuration.setJobExecutorActivate(true); configuration.setTransactionManager(transactionManager()); return configuration; }
Example #15
Source File: DefaultSpringProcessEngineFactory.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
protected void copySpringConfigItems(SpringProcessEngineConfiguration activiti6Configuration, org.activiti5.spring.SpringProcessEngineConfiguration activiti5Configuration) { activiti5Configuration.setApplicationContext(activiti6Configuration.getApplicationContext()); activiti5Configuration.setTransactionManager(activiti6Configuration.getTransactionManager()); }
Example #16
Source File: AbstractProcessEngineAutoConfiguration.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean public Clock clock(SpringProcessEngineConfiguration processEngineConfiguration) { return processEngineConfiguration.getClock(); }
Example #17
Source File: AbstractProcessEngineAutoConfiguration.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Bean public ProcessEngineFactoryBean processEngine(SpringProcessEngineConfiguration configuration) throws Exception { return super.springProcessEngineBean(configuration); }
Example #18
Source File: AbstractProcessEngineAutoConfiguration.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
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 #19
Source File: AbstractProcessEngineConfiguration.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public ProcessEngineFactoryBean springProcessEngineBean(SpringProcessEngineConfiguration configuration) { ProcessEngineFactoryBean processEngineFactoryBean = new ProcessEngineFactoryBean(); processEngineFactoryBean.setProcessEngineConfiguration(configuration); return processEngineFactoryBean; }
Example #20
Source File: ServiceSpringModuleConfig.java From herd with Apache License 2.0 | 4 votes |
/** * 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; }
Example #21
Source File: ProcessEngineConfigurationConfigurer.java From activiti6-boot2 with Apache License 2.0 | votes |
void configure(SpringProcessEngineConfiguration processEngineConfiguration);