Ejemplo n.º 1
0
 @Bean
 public SpringProcessEngineConfiguration springProcessEngineConfiguration(
     DataSource dataSource,
     PlatformTransactionManager transactionManager,
     SpringAsyncExecutor springAsyncExecutor)
     throws IOException {
   SpringProcessEngineConfiguration spec =
       baseSpringProcessEngineConfiguration(dataSource, transactionManager, springAsyncExecutor);
   spec.setLabelFontName("ї¬Ме");
   spec.setActivityFontName("ї¬Ме");
   return spec;
 }
Ejemplo n.º 2
0
  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();

      // Convert it to a SpringProcessEngineConfiguration. If this doesn't work, throw a
      // RuntimeException.
      // (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;
    }
  }
  @Bean
  public ProcessEngineFactoryBean processEngine() {
    ProcessEngineFactoryBean processEngineFactoryBean = new ProcessEngineFactoryBean();

    SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration();
    configuration.setTransactionManager(dataSourceTransactionManager());
    configuration.setDatabaseType("h2");
    configuration.setJobExecutorActivate(false);
    configuration.setDataSource(targetDataSource());
    configuration.setDatabaseSchemaUpdate(getDatabaseSchemaUpdate());
    processEngineFactoryBean.setProcessEngineConfiguration(configuration);
    return processEngineFactoryBean;
  }