当前位置: 首页>>代码示例>>Java>>正文


Java ProcessEngine类代码示例

本文整理汇总了Java中org.camunda.bpm.engine.ProcessEngine的典型用法代码示例。如果您正苦于以下问题:Java ProcessEngine类的具体用法?Java ProcessEngine怎么用?Java ProcessEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ProcessEngine类属于org.camunda.bpm.engine包,在下文中一共展示了ProcessEngine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clean

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
public void clean(ProcessEngine engine) {
	
	repositoryService = engine.getRepositoryService();
	runtimeService = engine.getRuntimeService();
	identityService = engine.getIdentityService();
	filterService = engine.getFilterService();
	authorizationService = engine.getAuthorizationService();

	// Delete all previous data in camunda
	cleanInstances();
	cleanMemberships();
	cleanUsers();
	cleanGroups();
	cleanFilters();
	cleanAuthorizations();
}
 
开发者ID:derursm,项目名称:bvis,代码行数:17,代码来源:CamundaCleaner.java

示例2: shouldAutoActivateIfNoPropertySet

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
@Test
public void shouldAutoActivateIfNoPropertySet() {

  // given
  JobExecutorXmlImpl jobExecutorXml = defineJobExecutor();
  ProcessEngineXmlImpl processEngineXml = defineProcessEngine();
  BpmPlatformXmlImpl bpmPlatformXml = new BpmPlatformXmlImpl(jobExecutorXml, Collections.<ProcessEngineXml>singletonList(processEngineXml));

  // when
  deployPlatform(bpmPlatformXml);

  try {
    ProcessEngine processEngine = getProcessEngine(ENGINE_NAME);
    ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
    // then
    assertEquals(true, processEngineConfiguration.getJobExecutor().isActive());
  }
  finally {
    undeployPlatform();
  }


}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:PlatformJobExecutorActivateTest.java

示例3: createDefaultFilter

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
private void createDefaultFilter(ProcessEngine processEngine) {
    TaskService taskService = processEngine.getTaskService();
    FilterService filterService = processEngine.getFilterService();

    TaskQuery myTasksQuery = taskService.createTaskQuery().taskAssigneeExpression("${currentUser()}").active();
    FilterEntity myTasksFilter = (FilterEntity) filterService.newTaskFilter("Мої завдання");
    myTasksFilter.setQuery(myTasksQuery);
    myTasksFilter.setPropertiesInternal("{\"refresh\":true}");
    filterService.saveFilter(myTasksFilter);

    TaskQuery myQueueQuery = taskService.createTaskQuery().taskCandidateUserExpression("${currentUser()}").active();
    FilterEntity myQueueFilter = (FilterEntity) filterService.newTaskFilter("В черзі");
    myQueueFilter.setQuery(myQueueQuery);
    myQueueFilter.setPropertiesInternal("{\"refresh\":true}");
    filterService.saveFilter(myQueueFilter);

    addAuthorizationGroup(processEngine.getAuthorizationService(), Resources.FILTER, myTasksFilter.getId(), ALL_USERS, new Permission[] {Permissions.READ});
    addAuthorizationGroup(processEngine.getAuthorizationService(), Resources.FILTER, myQueueFilter.getId(), ALL_USERS, new Permission[] {Permissions.READ});
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:20,代码来源:ResourcesAuthorization.java

示例4: createUser

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
private void createUser(User user, Map<String, String> userPass, ProcessEngine processEngine) {
    IdentityService identityService = processEngine.getIdentityService();
    if (!userExist(user.getEmail(), identityService)) {

        String[] fio = user.getName().split(" ");

        org.camunda.bpm.engine.identity.User newUser = identityService.newUser(user.getEmail());

        newUser.setEmail(user.getEmail());
        newUser.setFirstName(fio[1]);
        newUser.setLastName(fio[0]);
        String password = userPass.get(user.getEmail());
        newUser.setPassword(isNotEmpty(password) ? password : UUID.randomUUID().toString());
        identityService.saveUser(newUser);

        identityService.createMembership(user.getEmail(), ALL_USERS);
        createViewFilter(processEngine, user.getEmail());
    }
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:20,代码来源:ResourcesAuthorization.java

示例5: executeImpl

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
@Override
public void executeImpl(ProcessEngine engine) {
  if (workItem.isSuspended())
    return;

  if (workItem instanceof TimerEntity) {
    /*
     * Caused by DurationHelper.getDateAfterRepeat: return next.before(date)
     * ? null : next;
     * 
     * This leads to endless loop if we call a timer job at exactly the time
     * it will schedule next. Cannot be handled by engine, because there is
     * no "counter" in the database for executions - it has to trust the
     * clock on the wall.
     */
    Calendar cal = Calendar.getInstance();
    cal.setTime(ClockUtil.getCurrentTime());
    cal.add(Calendar.MILLISECOND, 1);
    ClockUtil.setCurrentTime(cal.getTime());
  }
  engine.getManagementService().executeJob(workItem.getId());
}
 
开发者ID:camunda-consulting,项目名称:camunda-util-demo-data-generator,代码行数:23,代码来源:TimeAwareDemoGenerator.java

示例6: main

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
public static void main(String... args) throws Exception {
  SpringApplication.run(Application.class, args);

  // do default setup of platform (everything is only applied if not yet there)
  ProcessEngine engine = BpmPlatform.getDefaultProcessEngine();
  
  // start a Saga right away
  engine.getRuntimeService().startProcessInstanceByKey(
      "trip", 
      Variables.putValue("someVariableToPass", "someValue"));
  
  // and add default users to Camunda to be ready-to-go
  UserGenerator.createDefaultUsers(engine);
  LicenseHelper.setLicense(engine);    
  
  // Start H2 server to be able to connect to database from the outside
  Server.createTcpServer(new String[] { "-tcpPort", "8092", "-tcpAllowOthers" }).start();
}
 
开发者ID:flowing,项目名称:flowing-trip-booking-saga,代码行数:19,代码来源:Application.java

示例7: startService

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
@PostDeploy
public void startService(ProcessEngine processEngine) throws Exception {
  RuntimeService runtimeService = processEngine.getRuntimeService();

  configuration = MailConfigurationFactory.getConfiguration();
  notificationService = new MailNotificationService(configuration);

  notificationService.registerMailHandler(mail -> {
    runtimeService.startProcessInstanceByKey("printProcess",
        Variables.createVariables()
          .putValue("mail", mail)
          .putValue("invoice", getInvoicePath()));
  });

  notificationService.start();
}
 
开发者ID:camunda,项目名称:camunda-bpm-mail,代码行数:17,代码来源:PrintServiceProcessApplication.java

示例8: init

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
protected void init() {
  if (executed)
    throw new IllegalStateException("Scenarios may use execute() just once per Scenario.run(). " +
        "Please create a new Scenario.run().");
  executed = true;
  if (processEngine == null) {
    Map<String, ProcessEngine> processEngines = ProcessEngines.getProcessEngines();
    if (processEngines.size() == 1) {
      init(processEngines.values().iterator().next());
    } else {
      String message = processEngines.size() == 0 ? "No ProcessEngine found to be " +
          "registered with " + ProcessEngines.class.getSimpleName() + "!"
          : String.format(processEngines.size() + " ProcessEngines initialized. " +
          "Explicitely initialise engine by calling " + ScenarioImpl.class.getSimpleName() +
          "(scenario, engine)");
      throw new IllegalStateException(message);
    }
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-assert-scenario,代码行数:20,代码来源:ScenarioImpl.java

示例9: eventBus

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
/**
 * Gets EventBus from given process engine via plugin.
 *
 * @param processEngine the process engine
 * @return the camunda eventBus
 */
public static CamundaEventBus eventBus(final ProcessEngine processEngine) {
  final ProcessEngineConfigurationImpl configuration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
  final List<ProcessEnginePlugin> plugins = Optional.ofNullable(configuration.getProcessEnginePlugins()).orElse(Collections.EMPTY_LIST);

  final Function<List<ProcessEnginePlugin>, Optional<CamundaEventBus>> filterReactorPlugin = l -> l.stream()
    .filter(plugin -> plugin instanceof ReactorProcessEnginePlugin)
    .map(ReactorProcessEnginePlugin.class::cast)
    .map(ReactorProcessEnginePlugin::getEventBus)
    .findFirst();

  Optional<CamundaEventBus> reactorProcessEnginePlugin = filterReactorPlugin.apply(plugins);
  if (reactorProcessEnginePlugin.isPresent()) {
    return reactorProcessEnginePlugin.get();
  }

  return plugins.stream()
    .filter(plugin -> plugin instanceof CompositeProcessEnginePlugin)
    .map(CompositeProcessEnginePlugin.class::cast)
    .map(CompositeProcessEnginePlugin::getPlugins)
    .map(filterReactorPlugin)
    .flatMap(o -> o.map(Stream::of).orElseGet(Stream::empty))
    .findFirst()
    .orElseThrow(illegalState("No eventBus found. Make sure the Reactor plugin is configured correctly."));
}
 
开发者ID:camunda,项目名称:camunda-bpm-reactor,代码行数:31,代码来源:CamundaReactor.java

示例10: get_eventBus_from_engine_composite

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
@Test
public void get_eventBus_from_engine_composite() {
  final CamundaEventBus eventBus = new CamundaEventBus();
  ReactorProcessEnginePlugin plugin = new ReactorProcessEnginePlugin(eventBus);

  ReactorProcessEngineConfiguration configuration = new ReactorProcessEngineConfiguration(eventBus);
  configuration.getProcessEnginePlugins().clear();

  configuration.getProcessEnginePlugins().add(new CompositeProcessEnginePlugin(plugin));

  ProcessEngine engine = configuration.buildProcessEngine();

  try {
    assertThat(CamundaReactor.eventBus(engine)).isEqualTo(eventBus);

  } finally {
    engine.close();
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-reactor,代码行数:20,代码来源:CamundaReactorTest.java

示例11: do_not_create_when_already_exist

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
@Test
public void do_not_create_when_already_exist() throws Exception {
  CamundaBpmProperties camundaBpmProperties = new CamundaBpmProperties();
  camundaBpmProperties.getFilter().setCreate("All");
  final CreateFilterConfiguration configuration = new CreateFilterConfiguration();
  ReflectionTestUtils.setField(configuration, "camundaBpmProperties", camundaBpmProperties);
  configuration.init();

  ProcessEngine engine = mock(ProcessEngine.class);
  FilterService filterService = mock(FilterService.class);
  when(engine.getFilterService()).thenReturn(filterService);
  Filter filter = mock(Filter.class);

  FilterQuery filterQuery = CamundaMockito.mockFilterQuery(filterService).singleResult(filter);


  configuration.postProcessEngineBuild(engine);

  verify(filterService).createFilterQuery();
  verify(filterQuery).filterName("All");
  verify(filterService, never()).newTaskFilter("All");

}
 
开发者ID:camunda,项目名称:camunda-bpm-spring-boot-starter,代码行数:24,代码来源:CreateFilterConfigurationTest.java

示例12: initializeTestMethodCoverage

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
/**
 * Adds a test method to the class coverage.
 * 
 * @param processEngine
 * @param deploymentId
 *            The deployment ID of the test method run. (Hint: Every test
 *            method run has its own deployment.)
 * @param processDefinitions
 *            The process definitions of the test method deployment.
 * @param testName
 *            The name of the test method.
 */
public void initializeTestMethodCoverage(ProcessEngine processEngine, String deploymentId,
        List<ProcessDefinition> processDefinitions, String testName) {

    final MethodCoverage testCoverage = new MethodCoverage(deploymentId);
    for (ProcessDefinition processDefinition : processDefinitions) {

        // Construct the pristine coverage object

        // TODO decide on the builders fate
        final ProcessCoverage processCoverage = new ProcessCoverage(processEngine, processDefinition);

        testCoverage.addProcessCoverage(processCoverage);
    }

    classCoverage.addTestMethodCoverage(testName, testCoverage);
}
 
开发者ID:camunda,项目名称:camunda-bpm-process-test-coverage,代码行数:29,代码来源:CoverageTestRunState.java

示例13: evaluateDecisionTable

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
@PostDeploy
public void evaluateDecisionTable(ProcessEngine processEngine) {

  DecisionService decisionService = processEngine.getDecisionService();

  VariableMap variables = Variables.createVariables()
    .putValue("season", "Spring")
    .putValue("guestCount", 10)
    .putValue("guestsWithChildren", false);

  DmnDecisionTableResult dishDecisionResult = decisionService.evaluateDecisionTableByKey("dish", variables);
  String desiredDish = dishDecisionResult.getSingleEntry();

  System.out.println("Desired dish: " + desiredDish);

  DmnDecisionTableResult beveragesDecisionResult = decisionService.evaluateDecisionTableByKey("beverages", variables);
  List<Object> beverages = beveragesDecisionResult.collectEntries("beverages");

  System.out.println("Desired beverages: " + beverages);
}
 
开发者ID:camunda,项目名称:camunda-get-started-dmn,代码行数:21,代码来源:DinnerApplication.java

示例14: CamundaInstancesSupplier

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
public CamundaInstancesSupplier(final ProcessEngine processEngine) {
  checkArgument(processEngine != null);
  this.processEngine = processEngine;

  providers.add(providerForInstance(processEngine));
  providers.add(providerForInstance(getCommandExecutor()));
  providers.add(providerForInstance(getProcessEngineConfiguration()));

  providers.add(providerForInstance(getAuthorizationService()));
  providers.add(providerForInstance(getCaseService()));
  providers.add(providerForInstance(getDecisionService()));
  providers.add(providerForInstance(getExternalTaskService()));
  providers.add(providerForInstance(getFilterService()));
  providers.add(providerForInstance(getFormService()));
  providers.add(providerForInstance(getHistoryService()));
  providers.add(providerForInstance(getIdentityService()));
  providers.add(providerForInstance(getManagementService()));
  providers.add(providerForInstance(getRepositoryService()));
  providers.add(providerForInstance(getRuntimeService()));
  providers.add(providerForInstance(getTaskService()));
}
 
开发者ID:camunda,项目名称:camunda-bpm-needle,代码行数:22,代码来源:CamundaInstancesSupplier.java

示例15: unregisterProcessEngine

import org.camunda.bpm.engine.ProcessEngine; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void unregisterProcessEngine(ProcessEngine processEngine) {

  if(processEngine == null) {
    throw new ProcessEngineException("Cannot unregister process engine with Msc Runtime Container: process engine is 'null'");
  }

  ServiceName serviceName = ServiceNames.forManagedProcessEngine(processEngine.getName());

  // remove the service asynchronously
  ServiceController<ProcessEngine> service = (ServiceController<ProcessEngine>) serviceContainer.getService(serviceName);
  if(service != null && service.getService() instanceof MscManagedProcessEngine) {
    service.setMode(Mode.REMOVE);
  }

}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:MscRuntimeContainerDelegate.java


注:本文中的org.camunda.bpm.engine.ProcessEngine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。