org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl Java Examples

The following examples show how to use org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl. 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: CachingAndArtifactsManager.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
/**
 * Ensures that the process definition is cached in the appropriate places, including the
 * deployment's collection of deployed artifacts and the deployment manager's cache, as well
 * as caching any ProcessDefinitionInfos.
 */
public void updateCachingAndArtifacts(ParsedDeployment parsedDeployment) {
  CommandContext commandContext = Context.getCommandContext();
  final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
  DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache 
    = processEngineConfiguration.getDeploymentManager().getProcessDefinitionCache();
  DeploymentEntity deployment = parsedDeployment.getDeployment();

  for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) {
    BpmnModel bpmnModel = parsedDeployment.getBpmnModelForProcessDefinition(processDefinition);
    Process process = parsedDeployment.getProcessModelForProcessDefinition(processDefinition);
    ProcessDefinitionCacheEntry cacheEntry = new ProcessDefinitionCacheEntry(processDefinition, bpmnModel, process);
    processDefinitionCache.add(processDefinition.getId(), cacheEntry);
    addDefinitionInfoToCache(processDefinition, processEngineConfiguration, commandContext);
  
    // Add to deployment for further usage
    deployment.addDeployedArtifact(processDefinition);
  }
}
 
Example #2
Source File: DefaultProcessEngineFactory.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
protected void copyConfigItems(ProcessEngineConfigurationImpl activiti6Configuration, org.activiti5.engine.impl.cfg.ProcessEngineConfigurationImpl activiti5Configuration) {
  activiti5Configuration.setActiviti5CompatibilityHandler(activiti6Configuration.getActiviti5CompatibilityHandler());
  
  copyJdbcConfig(activiti6Configuration, activiti5Configuration);
  copyHistoryConfig(activiti6Configuration, activiti5Configuration);
  copyMailConfig(activiti6Configuration, activiti5Configuration);
  copyDiagramConfig(activiti6Configuration, activiti5Configuration);
  copyAsyncExecutorConfig(activiti6Configuration, activiti5Configuration);
  copyJpaConfig(activiti6Configuration, activiti5Configuration);
  copyBeans(activiti6Configuration, activiti5Configuration);
  copyCaches(activiti6Configuration, activiti5Configuration);
  copyActivityBehaviorFactory(activiti6Configuration, activiti5Configuration);
  copyListenerFactory(activiti6Configuration, activiti5Configuration);
  convertParseHandlers(activiti6Configuration, activiti5Configuration);
  copyCustomMybatisMappers(activiti6Configuration, activiti5Configuration);
  activiti5Configuration.setEventDispatcher(activiti6Configuration.getEventDispatcher());
  copyPostDeployers(activiti6Configuration, activiti5Configuration);
  activiti5Configuration.setBusinessCalendarManager(activiti6Configuration.getBusinessCalendarManager());
}
 
Example #3
Source File: ActivitiScriptBase.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
protected ServiceRegistry getServiceRegistry()
{
    ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
    if (config != null) 
    {
        // Fetch the registry that is injected in the activiti spring-configuration
        ServiceRegistry registry = (ServiceRegistry) config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
        if (registry == null)
        {
            throw new RuntimeException(
                        "Service-registry not present in ProcessEngineConfiguration beans, expected ServiceRegistry with key" + 
                        ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
        }
        return registry;
    }
    throw new IllegalStateException("No ProcessEngineCOnfiguration found in active context");
}
 
Example #4
Source File: DefaultFlowable5CompatibilityHandler.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
@Override
public void signalEventReceived(final SignalEventSubscriptionEntity signalEventSubscriptionEntity, final Object payload, final boolean async) {
    final ProcessEngineConfigurationImpl processEngineConfig = (ProcessEngineConfigurationImpl) getProcessEngine().getProcessEngineConfiguration();
    processEngineConfig.getCommandExecutor().execute(new Command<Void>() {

        @Override
        public Void execute(CommandContext commandContext) {
            org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity activiti5SignalEvent = new org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity();
            activiti5SignalEvent.setId(signalEventSubscriptionEntity.getId());
            activiti5SignalEvent.setExecutionId(signalEventSubscriptionEntity.getExecutionId());
            activiti5SignalEvent.setActivityId(signalEventSubscriptionEntity.getActivityId());
            activiti5SignalEvent.setEventName(signalEventSubscriptionEntity.getEventName());
            activiti5SignalEvent.setEventType(signalEventSubscriptionEntity.getEventType());
            activiti5SignalEvent.setConfiguration(signalEventSubscriptionEntity.getConfiguration());
            activiti5SignalEvent.setProcessDefinitionId(signalEventSubscriptionEntity.getProcessDefinitionId());
            activiti5SignalEvent.setProcessInstanceId(signalEventSubscriptionEntity.getProcessInstanceId());
            activiti5SignalEvent.setTenantId(signalEventSubscriptionEntity.getTenantId());
            activiti5SignalEvent.setRevision(signalEventSubscriptionEntity.getRevision());
            activiti5SignalEvent.eventReceived(payload, async);
            return null;
        }
    });

}
 
Example #5
Source File: DbSqlSession.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public void performSchemaOperationsProcessEngineBuild() {
  String databaseSchemaUpdate = Context.getProcessEngineConfiguration().getDatabaseSchemaUpdate();
  log.debug("Executing performSchemaOperationsProcessEngineBuild with setting " + databaseSchemaUpdate);
  if (ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_DROP_CREATE.equals(databaseSchemaUpdate)) {
    try {
      dbSchemaDrop();
    } catch (RuntimeException e) {
      // ignore
    }
  }
  if (org.activiti.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_CREATE_DROP.equals(databaseSchemaUpdate)
      || ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_DROP_CREATE.equals(databaseSchemaUpdate) || ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_CREATE.equals(databaseSchemaUpdate)) {
    dbSchemaCreate();

  } else if (org.activiti.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE.equals(databaseSchemaUpdate)) {
    dbSchemaCheckVersion();

  } else if (ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE.equals(databaseSchemaUpdate)) {
    dbSchemaUpdate();
  }
}
 
Example #6
Source File: LeaveJpaEntityTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
protected void initializeProcessEngine() {
    if (cachedProcessEngine == null) {
        ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
                .createProcessEngineConfigurationFromResource("activiti.jpa.cfg.xml");

        cachedProcessEngine = processEngineConfiguration.buildProcessEngine();

        EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration
                .getSessionFactories()
                .get(EntityManagerSession.class);

        System.out.println("entityManagerSessionFactory=" + entityManagerSessionFactory);
        entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
    }
    processEngine = cachedProcessEngine;
}
 
Example #7
Source File: PlaybackRunTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
private void recordEvents() {
  Clock clock = new DefaultClockImpl();
  ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
  config.setClock(clock);
  ProcessEngine processEngine = (new RecordableProcessEngineFactory(config, listener)).getObject();

  processEngine.getProcessEngineConfiguration().setClock(clock);
  processEngine.getRepositoryService().createDeployment().
    addClasspathResource(THE_SIMPLEST_PROCESS).
    deploy();

  Map<String,Object> variables = new HashMap<String, Object>();
  variables.put(TEST_VARIABLE, TEST_VALUE);
  processEngine.getRuntimeService().startProcessInstanceByKey(SIMPLEST_PROCESS, BUSINESS_KEY, variables);
  checkStatus(processEngine);
  EventRecorderTestUtils.closeProcessEngine(processEngine, listener);
  ProcessEngines.destroy();
}
 
Example #8
Source File: LDAPConfigurator.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public void configure(ProcessEngineConfigurationImpl processEngineConfiguration) {
  
  // User 
  processEngineConfiguration.setUserEntityManager(new LDAPUserManager(processEngineConfiguration, this));
  
  // Groups
  LDAPGroupCache ldapGroupCache = null;
  if (getGroupCacheSize() > 0) {
    ldapGroupCache = new LDAPGroupCache(getGroupCacheSize(), getGroupCacheExpirationTime(), processEngineConfiguration.getClock());
    if (groupCacheListener != null) {
      ldapGroupCache.setLdapCacheListener(groupCacheListener);
    }
  }
  
  LDAPGroupManager ldapGroupManager = null;
  if (ldapGroupCache == null) {
    ldapGroupManager = new LDAPGroupManager(processEngineConfiguration, this);
  } else {
    ldapGroupManager = new LDAPGroupManager(processEngineConfiguration, this, ldapGroupCache);
  }
  processEngineConfiguration.setGroupEntityManager(ldapGroupManager);
}
 
Example #9
Source File: MetaDataTest.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
public void testMetaData() {
    ProcessEngineConfigurationImpl activiti5ProcessEngineConfig = (ProcessEngineConfigurationImpl) processEngineConfiguration.getFlowable5CompatibilityHandler().getRawProcessConfiguration();
    activiti5ProcessEngineConfig.getCommandExecutor().execute(new Command<Object>() {
        public Object execute(CommandContext commandContext) {
            // PRINT THE TABLE NAMES TO CHECK IF WE CAN USE METADATA INSTEAD
            // THIS IS INTENDED FOR TEST THAT SHOULD RUN ON OUR QA INFRASTRUCTURE TO SEE IF METADATA
            // CAN BE USED INSTEAD OF PERFORMING A QUERY THAT MIGHT FAIL
            try {
                SqlSession sqlSession = commandContext.getSession(DbSqlSession.class).getSqlSession();
                ResultSet tables = sqlSession.getConnection().getMetaData().getTables(null, null, null, null);
                while (tables.next()) {
                    ResultSetMetaData resultSetMetaData = tables.getMetaData();
                    int columnCount = resultSetMetaData.getColumnCount();
                    for (int i = 1; i <= columnCount; i++) {
                        LOGGER.info("result set column {}|{}|{}|{}", i, resultSetMetaData.getColumnName(i), resultSetMetaData.getColumnLabel(i), tables.getString(i));
                    }
                    LOGGER.info("-------------------------------------------------------");
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }
    });
}
 
Example #10
Source File: DefaultHistoryManager.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
@Override
public void recordProcessInstanceEnd(String processInstanceId, String deleteReason, String activityId) {

    if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
        HistoricProcessInstanceEntity historicProcessInstance = getHistoricProcessInstanceManager()
                .findHistoricProcessInstance(processInstanceId);

        if (historicProcessInstance != null) {
            historicProcessInstance.markEnded(deleteReason);
            historicProcessInstance.setEndActivityId(activityId);

            // Fire event
            ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
            if (config != null && config.getEventDispatcher().isEnabled()) {
                config.getEventDispatcher().dispatchEvent(
                        ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.HISTORIC_PROCESS_INSTANCE_ENDED, historicProcessInstance));
            }
        }
    }
}
 
Example #11
Source File: LoadDummyFormTypes.java    From openwebflow with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void beforeStartEngine(ProcessEngineConfigurationImpl conf)
{
	//避免User类型报错
	List<AbstractFormType> types = conf.getCustomFormTypes();
	if (types == null)
	{
		types = new ArrayList<AbstractFormType>();
		conf.setCustomFormTypes(types);
	}

	for (String typeName : _typeNames)
	{
		types.add(new DummyFormType(typeName));
	}
}
 
Example #12
Source File: ActivitiMockSupport.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public ActivitiMockSupport(ProcessEngine processEngine) {
  ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration();
  org.activiti5.engine.impl.cfg.ProcessEngineConfigurationImpl activiti5ProcessEngineConfiguration = (org.activiti5.engine.impl.cfg.ProcessEngineConfigurationImpl) 
      processEngineConfiguration.getActiviti5CompatibilityHandler().getRawProcessConfiguration();
  ActivityBehaviorFactory existingActivityBehaviorFactory = activiti5ProcessEngineConfiguration.getActivityBehaviorFactory();
  this.testActivityBehaviorFactory = new TestActivityBehaviorFactory(existingActivityBehaviorFactory);

  activiti5ProcessEngineConfiguration.setActivityBehaviorFactory(testActivityBehaviorFactory);
  activiti5ProcessEngineConfiguration.getBpmnParser().setActivityBehaviorFactory(testActivityBehaviorFactory);
}
 
Example #13
Source File: LeaveJpaEntityTest.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
protected void initializeProcessEngine() {
    if (cachedProcessEngine == null) {
        ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
                .createProcessEngineConfigurationFromResource("activiti.jpa.cfg.xml");

        cachedProcessEngine = processEngineConfiguration.buildProcessEngine();

        EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration
                .getSessionFactories()
                .get(EntityManagerSession.class);

        entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
    }
    processEngine = cachedProcessEngine;
}
 
Example #14
Source File: SecureServiceTaskConfigurator.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
public void beforeInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
    if (shellCommandExecutorFactory == null) {
        shellCommandExecutorFactory = new ShellCommandExecutorFactory();
    }

    if (isEnableCommandWhiteListing() || getWhiteListedShellCommands() != null) {
        shellCommandExecutorFactory.setWhiteListedCommands(getWhiteListedShellCommands());
    }

    CommandExecutorContext.setShellExecutorContextFactory(shellCommandExecutorFactory);
}
 
Example #15
Source File: LeaveJpaEntityTest.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
protected void initializeProcessEngine() {
    if (cachedProcessEngine == null) {
        ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
                .createProcessEngineConfigurationFromResource("activiti.jpa.cfg.xml");

        cachedProcessEngine = processEngineConfiguration.buildProcessEngine();

        EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration
                .getSessionFactories()
                .get(EntityManagerSession.class);

        entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
    }
    processEngine = cachedProcessEngine;
}
 
Example #16
Source File: DefaultFlowable5CompatibilityHandler.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
public Object getScriptingEngineValue(String payloadExpressionValue, String languageValue, DelegateExecution execution) {
    try {
        final ProcessEngineConfigurationImpl processEngineConfig = (ProcessEngineConfigurationImpl) getProcessEngine().getProcessEngineConfiguration();
        ScriptingEngines scriptingEngines = processEngineConfig.getScriptingEngines();
        return scriptingEngines.evaluate(payloadExpressionValue, languageValue, execution);

    } catch (org.activiti.engine.ActivitiException e) {
        handleActivitiException(e);
        return null;
    }
}
 
Example #17
Source File: Activiti5Util.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
/**
 * Use this method when running outside a {@link CommandContext}. 
 * It will check the cache first and only start a new {@link CommandContext} when no result is found in the cache. 
 */
public static boolean isActiviti5ProcessDefinitionId(final ProcessEngineConfigurationImpl processEngineConfiguration, final String processDefinitionId) {
  
  if (processDefinitionId == null) {
    return false;
  }
  
  if (!processEngineConfiguration.isActiviti5CompatibilityEnabled()) {
    return false;
  }
  
  ProcessDefinitionCacheEntry cacheEntry = processEngineConfiguration.getProcessDefinitionCache().get(processDefinitionId);
  if (cacheEntry != null) {
    ProcessDefinition processDefinition = cacheEntry.getProcessDefinition();
    return Activiti5CompatibilityHandler.ACTIVITI_5_ENGINE_TAG.equals(processDefinition.getEngineVersion());
  } else {
    return processEngineConfiguration.getCommandExecutor().execute(new Command<Boolean>() {
      
      @Override
      public Boolean execute(CommandContext commandContext) {
        return isActiviti5ProcessDefinitionId(commandContext, processDefinitionId);
      }
      
    });
    
  }
}
 
Example #18
Source File: AbstractDatabaseEventLoggerEventHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected EventLogEntryEntity createEventLogEntry(String type, String processDefinitionId, String processInstanceId, String executionId, String taskId, Map<String, Object> data) {

    EventLogEntryEntity eventLogEntry = Context.getCommandContext().getEventLogEntryEntityManager().create();
    eventLogEntry.setProcessDefinitionId(processDefinitionId);
    eventLogEntry.setProcessInstanceId(processInstanceId);
    eventLogEntry.setExecutionId(executionId);
    eventLogEntry.setTaskId(taskId);
    eventLogEntry.setType(type);
    eventLogEntry.setTimeStamp(timeStamp);
    putInMapIfNotNull(data, Fields.TIMESTAMP, timeStamp);

    // Current user
    String userId = Authentication.getAuthenticatedUserId();
    if (userId != null) {
      eventLogEntry.setUserId(userId);
      putInMapIfNotNull(data, "userId", userId);
    }

    // Current tenant
    if (!data.containsKey(Fields.TENANT_ID) && processDefinitionId != null) {
      ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(processDefinitionId);
      if (processDefinition != null && !ProcessEngineConfigurationImpl.NO_TENANT_ID.equals(processDefinition.getTenantId())) {
        putInMapIfNotNull(data, Fields.TENANT_ID, processDefinition.getTenantId());
      }
    }

    try {
      eventLogEntry.setData(objectMapper.writeValueAsBytes(data));
    } catch (Exception e) {
      logger.warn("Could not serialize event data. Data will not be written to the database", e);
    }

    return eventLogEntry;

  }
 
Example #19
Source File: ServiceEnvTestSpringModuleConfig.java    From herd with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the Activiti database schema update approach. Values should come from a "DB_SCHEMA_UPDATE_*" constant in ProcessEngineConfiguration or
 * ProcessEngineConfigurationImpl.
 *
 * @return the Activiti database schema update approach.
 */
@Bean
public String activitiDbSchemaUpdateParam()
{
    // Create a new schema for testing purposes.
    return ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_CREATE;
}
 
Example #20
Source File: WSService.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
SyncWebServiceClient getClient() {
  if (this.client == null) {
    // TODO refactor to use configuration
    SyncWebServiceClientFactory factory = (SyncWebServiceClientFactory) ReflectUtil.instantiate(ProcessEngineConfigurationImpl.DEFAULT_WS_SYNC_FACTORY);
    this.client = factory.create(this.wsdlLocation);
  }
  return this.client;
}
 
Example #21
Source File: DefaultHistoryManager.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected void endHistoricActivityInstance(HistoricActivityInstanceEntity historicActivityInstance) {
    historicActivityInstance.markEnded(null);

    // Fire event
    ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
    if (config != null && config.getEventDispatcher().isEnabled()) {
        config.getEventDispatcher().dispatchEvent(
                ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.HISTORIC_ACTIVITY_INSTANCE_ENDED, historicActivityInstance));
    }
}
 
Example #22
Source File: ExecutorPerTenantAsyncExecutor.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
public void setProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration) {
  this.processEngineConfiguration = processEngineConfiguration;
  for (AsyncExecutor asyncExecutor : tenantExecutors.values()) {
    asyncExecutor.setProcessEngineConfiguration(processEngineConfiguration);
  }
}
 
Example #23
Source File: DefaultFlowable5CompatibilityHandler.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
public ProcessDefinition getProcessDefinition(final String processDefinitionId) {
    final ProcessEngineConfigurationImpl processEngineConfig = (ProcessEngineConfigurationImpl) getProcessEngine().getProcessEngineConfiguration();
    ProcessDefinition processDefinitionEntity = processEngineConfig.getCommandExecutor().execute(new Command<ProcessDefinition>() {

        @Override
        public ProcessDefinition execute(CommandContext commandContext) {
            return processEngineConfig.getDeploymentManager().findDeployedProcessDefinitionById(processDefinitionId);
        }
    });

    return processDefinitionEntity;
}
 
Example #24
Source File: TestHelper.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public static void annotationDeploymentTearDown(ProcessEngine processEngine, String deploymentId, Class<?> testClass, String methodName) {
  log.debug("annotation @Deployment deletes deployment for {}.{}", testClass.getSimpleName(), methodName);
  if (deploymentId != null) {
    try {
      ProcessEngineConfigurationImpl processEngineConfig = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
      processEngineConfig.getActiviti5CompatibilityHandler().deleteDeployment(deploymentId, true);
    } catch (ActivitiObjectNotFoundException e) {
      // Deployment was already deleted by the test case. Ignore.
    }
  }
}
 
Example #25
Source File: BpmnDeployer.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected void addProcessDefinitionToCache(ProcessDefinitionEntity processDefinition, Map<String, BpmnModel> bpmnModelMap,
                                           ProcessEngineConfigurationImpl processEngineConfiguration, CommandContext commandContext) {

    // Add to cache
    DeploymentManager deploymentManager = processEngineConfiguration.getDeploymentManager();
    BpmnModel bpmnModel = bpmnModelMap.get(processDefinition.getKey());
    ProcessDefinitionCacheEntry cacheEntry = new ProcessDefinitionCacheEntry(processDefinition, bpmnModel,
            bpmnModel.getProcessById(processDefinition.getKey()));
    deploymentManager.getProcessDefinitionCache().add(processDefinition.getId(), cacheEntry);
    addDefinitionInfoToCache(processDefinition, processEngineConfiguration, commandContext);
}
 
Example #26
Source File: ActivitiProfiler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
public void beforeInit(ProcessEngineConfigurationImpl processEngineConfiguration) {

    // Command interceptor
    List<CommandInterceptor> interceptors = new ArrayList<CommandInterceptor>();
    interceptors.add(new TotalExecutionTimeCommandInterceptor());
    processEngineConfiguration.setCustomPreCommandInterceptors(interceptors);

    // DbsqlSession
    processEngineConfiguration.setDbSqlSessionFactory(new ProfilingDbSqlSessionFactory());
}
 
Example #27
Source File: DefaultProcessEngineFactory.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void copyAsyncExecutorConfig(ProcessEngineConfigurationImpl activiti6Configuration, org.activiti5.engine.impl.cfg.ProcessEngineConfigurationImpl activiti5Configuration) {
  if (activiti6Configuration.isAsyncExecutorActivate()) {
    activiti5Configuration.setAsyncExecutorActivate(true);
  }
  activiti5Configuration.setDefaultFailedJobWaitTime(activiti6Configuration.getDefaultFailedJobWaitTime());
  activiti5Configuration.setAsyncFailedJobWaitTime(activiti6Configuration.getAsyncFailedJobWaitTime());
  activiti5Configuration.setAsyncExecutor(activiti6Configuration.getAsyncExecutor());
}
 
Example #28
Source File: CommandContext.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public CommandContext(Command<?> command, ProcessEngineConfigurationImpl processEngineConfiguration) {
  this.command = command;
  this.processEngineConfiguration = processEngineConfiguration;
  this.failedJobCommandFactory = processEngineConfiguration.getFailedJobCommandFactory();
  this.sessionFactories = processEngineConfiguration.getSessionFactories();
  this.agenda = processEngineConfiguration.getEngineAgendaFactory().createAgenda(this);
}
 
Example #29
Source File: ReplayEventLogTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
private ProcessEngineConfigurationImpl getProcessEngineConfiguration() {
  ProcessEngineConfigurationImpl configuration = new org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration();
  configuration.
    setEnableDatabaseEventLogging(true).
    setDatabaseSchemaUpdate("create-drop");
  return configuration;
}
 
Example #30
Source File: ProcessEngineFactoryWithELResolver.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
public void init() throws Exception {
  ProcessEngineConfigurationImpl configImpl = (ProcessEngineConfigurationImpl) getProcessEngineConfiguration();
  configImpl.setExpressionManager(new BlueprintExpressionManager());

  List<ResolverFactory> resolverFactories = configImpl.getResolverFactories();
  if (resolverFactories == null) {
    resolverFactories = new ArrayList<ResolverFactory>();
    resolverFactories.add(new VariableScopeResolverFactory());
    resolverFactories.add(new BeansResolverFactory());
  }

  configImpl.setScriptingEngines(new OsgiScriptingEngines(new ScriptBindingsFactory(configImpl, resolverFactories)));
  super.init();
}