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


Java ProcessEngine.getRuntimeService方法代码示例

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


在下文中一共展示了ProcessEngine.getRuntimeService方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: placeInquiry

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public void placeInquiry() {
	if (!EmailValidator.validate(email)) {
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Invalid Email format"));
	} else {
		Map<String, Object> variables = new HashMap<String, Object>();
		variables.put("customerFirstname", firstname);
		variables.put("customerSurname", lastname);
		variables.put("customerCompanyName", companyName);
		variables.put("customerEmail", email);
		variables.put("customerPhoneNumber", phoneNumber);
		variables.put("customerDateOfBirth", dateOfBirth);
		variables.put("customerStreet", street);
		variables.put("customerHouseNumber", houseNumber);
		variables.put("customerPostcode", postcode);
		variables.put("customerCity", city);
		variables.put("customerCountry", country);
		variables.put("fleet", fleetRental);
		variables.put("pickUpDate", pickupDate);
		variables.put("returnDate", returnDate);
		variables.put("pickUpLoc", pickupLocation);
		variables.put("returnStore", returnLocation);
		variables.put("insuranceType", insuranceType);
		variables.put("car", car);
		variables.put("inquiryText", comment);
		variables.put("priceCars", priceCars);
		variables.put("priceInsurance_expected", priceInsurance_expected);
		ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
		RuntimeService runtimeService = processEngine.getRuntimeService();
		ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("contracting", variables);
		System.out.println(WebUrls.getUrl(WebUrls.ORDER_SUBMITTED, false, false));
		try {
			FacesContext.getCurrentInstance().getExternalContext()
					.redirect(WebUrls.getUrl(WebUrls.ORDER_SUBMITTED, false, false));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:derursm,项目名称:bvis,代码行数:39,代码来源:PlaceInquiryBackingBean.java

示例4: placeInquiry2

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
/**
 * Method for placing inquiries when already logged in
 */
public void placeInquiry2() {
	long cid = sessionBean.getUid();
	Customer customer = customerService.getCustomer(cid);
	Map<String, Object> variables = new HashMap<String, Object>();
	variables.put("customerID", customer.getCustomerID());
	variables.put("fleet", fleetRental);
	variables.put("pickUpDate", pickupDate);
	variables.put("returnDate", returnDate);
	variables.put("pickUpLoc", pickupLocation);
	variables.put("returnStore", returnLocation);
	variables.put("insuranceType", insuranceType);
	variables.put("car", car);
	variables.put("inquiryText", comment);
	variables.put("priceCars", priceCars);
	variables.put("priceInsurance_expected", priceInsurance_expected);
	ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
	RuntimeService runtimeService = processEngine.getRuntimeService();
	ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("contracting", variables);
	System.out.println(WebUrls.getUrl(WebUrls.ORDER_SUBMITTED, false, false));
	try {
		FacesContext.getCurrentInstance().getExternalContext()
				.redirect(WebUrls.getUrl(WebUrls.ORDER_SUBMITTED, false, false));
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:derursm,项目名称:bvis,代码行数:30,代码来源:PlaceInquiryBackingBean.java

示例5: executionByProcessDefinitionKey

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public static NullTolerantComparator<Execution> executionByProcessDefinitionKey(ProcessEngine processEngine) {
  final RuntimeService runtimeService = processEngine.getRuntimeService();
  final RepositoryService repositoryService = processEngine.getRepositoryService();

  return propertyComparator(new PropertyAccessor<Execution, String>() {
    @Override
    public String getProperty(Execution obj) {
      ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
          .processInstanceId(obj.getProcessInstanceId()).singleResult();
      ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());
      return processDefinition.getKey();
    }
  });
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:15,代码来源:TestOrderingUtil.java

示例6: setUp

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@Before
public void setUp() {
  ProcessEngine processEngine = rule.getProcessEngine();

  identityService = processEngine.getIdentityService();
  repositoryService = processEngine.getRepositoryService();
  runtimeService = processEngine.getRuntimeService();
  taskService = processEngine.getTaskService();
  historyService = processEngine.getHistoryService();
  formService = processEngine.getFormService();

  identityService.clearAuthentication();
  identityService.setAuthentication("test", Arrays.asList("accounting"));
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:15,代码来源:AuthorizationTest.java

示例7: TestFixture

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public TestFixture(ProcessEngine processEngine) {
  this.processEngine = processEngine;
  repositoryService = processEngine.getRepositoryService();
  runtimeService = processEngine.getRuntimeService();
  managementService = processEngine.getManagementService();
  taskService = processEngine.getTaskService();
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:8,代码来源:TestFixture.java

示例8: reportDamage

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public void reportDamage() {
	if (!orderService.orderExists(orderID)) {
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Invalid order ID"));
	}
	else if (!orderService.vehicleExistsForOrder(orderID, vehicleID)) {
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Specified car not part of the order"));
	}
	else if (!insuranceService.insuranceExists(party1Insurance)) {
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Specified insurance does not exist"));			
	}
	else if (!EmailValidator.validate(party1EMail)) {
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Invalid Email format"));
	}
	else {
		RentalOrder order = orderService.getOrder(orderID);
		Date begin = order.getPick_up_date();

		Date end = order.getReturn_date();
		// increment end date by one
		Calendar c = Calendar.getInstance();
		c.setTime(end);
		c.add(Calendar.DATE, 1);  // number of days to add
		end = c.getTime();
		if (!((this.damageDate.after(begin) || this.damageDate.equals(begin)) && 
				(this.damageDate.before(end) || this.damageDate.equals(end)))) {
			FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Damage date must be in the rental period"));
		}
		else {
			Map<String, Object> variables = new HashMap<String, Object>();
			variables.put("orderID", orderID);
			variables.put("damageDescription", damageDescription);
			variables.put("damageDate", damageDate);
			variables.put("vehicleID", vehicleID);
			// set to true per default, since this bean method is only invoked if the damage is reported by customer
			reportedByCustomer = true;
			variables.put("reportedByCustomer", reportedByCustomer);
			variables.put("towingServiceNeeded", towingServiceNeeded);
			variables.put("party1Firstname", party1Firstname);
			variables.put("party1Surname", party1Surname);
			variables.put("party1Street", party1Street);
			variables.put("party1HouseNo", party1HouseNo);
			variables.put("party1Country", party1Country);
			variables.put("party1ZIP", party1ZIP);
			variables.put("party1City", party1City);
			variables.put("party1Company", party1Company);
			variables.put("party1Insurance", party1Insurance);
			variables.put("party1Phone", party1Phone);
			variables.put("party1EMail", party1EMail);
			variables.put("party1Birthday", party1Birthday);
			ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
			RuntimeService runtimeService = processEngine.getRuntimeService();
			ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("claimHandling", variables);	
			try {
				FacesContext.getCurrentInstance().getExternalContext().redirect(WebUrls.getUrl(WebUrls.DAMAGE_REPORT_SUBMITTED, false, false));
			} catch (IOException e) {
				e.printStackTrace();
			}		
		}
	}
}
 
开发者ID:derursm,项目名称:bvis,代码行数:61,代码来源:DamageReportBackingBean.java

示例9: reportDamageCamunda

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public void reportDamageCamunda() {
	if (!orderService.orderExists(orderID)) {
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Invalid order ID"));
	}
	else if (!orderService.vehicleExistsForOrder(orderID, vehicleID)) {
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Specified car not part of the order"));
	}
	else if (!insuranceService.insuranceExists(party1Insurance)) {
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Specified insurance does not exist"));
	}
	else if (!EmailValidator.validate(party1EMail)) {
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Invalid Email format"));
	}
	else {
		RentalOrder order = orderService.getOrder(orderID);
		Date begin = order.getPick_up_date();
		Date end = order.getReturn_date();
		// increment end date by one
		Calendar c = Calendar.getInstance();
		c.setTime(end);
		c.add(Calendar.DATE, 1);  // number of days to add
		end = c.getTime();
		if (!((this.damageDate.after(begin) || this.damageDate.equals(begin)) && 
				(this.damageDate.before(end) || this.damageDate.equals(end)))) {
			FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Damage date must be in the rental period"));
		}
		else {
			Map<String, Object> variables = new HashMap<String, Object>();
			variables.put("orderID", orderID);
			variables.put("damageDescription", damageDescription);
			variables.put("damageDate", damageDate);
			variables.put("vehicleID", vehicleID);
			variables.put("reportedByCustomer", reportedByCustomer);
			variables.put("towingServiceNeeded", towingServiceNeeded);
			variables.put("party1Firstname", party1Firstname);
			variables.put("party1Surname", party1Surname);
			variables.put("party1Street", party1Street);
			variables.put("party1HouseNo", party1HouseNo);
			variables.put("party1Country", party1Country);
			variables.put("party1ZIP", party1ZIP);
			variables.put("party1City", party1City);
			variables.put("party1Company", party1Company);
			variables.put("party1Insurance", party1Insurance);
			variables.put("party1Phone", party1Phone);
			variables.put("party1EMail", party1EMail);
			variables.put("party1Birthday", party1Birthday);
			ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
			RuntimeService runtimeService = processEngine.getRuntimeService();
			ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("claimHandling", variables);

			try {
				FacesContext.getCurrentInstance().getExternalContext().redirect("/camunda/app/tasklist/default/#/");
			} catch (IOException e) {
				e.printStackTrace();
			}				
		}
	}
}
 
开发者ID:derursm,项目名称:bvis,代码行数:59,代码来源:DamageReportBackingBean.java

示例10: startInvoiceProcess

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public static HashMap<String, ProcessDataContainer> startInvoiceProcess(ProcessEngine processEngine, final int numberOfInstances, boolean addRandomTimeInterval) {
  RepositoryService repositoryService = processEngine.getRepositoryService();
  RuntimeService runtimeService = processEngine.getRuntimeService();
  TaskService taskService = processEngine.getTaskService();

  Deployment deployment = repositoryService.createDeployment().addClasspathResource("invoice.bpmn").deploy();
  Assert.assertNotNull(repositoryService.createDeploymentQuery().deploymentId(deployment.getId()).singleResult());

  LOGGER.info("Creating " + numberOfInstances + " instances of 'invoice.bpmn' process.");


  HashMap<String, ProcessDataContainer> variablesByProcessIds = new HashMap<String, ProcessDataContainer>(numberOfInstances);

  for (int i = 0; i < numberOfInstances; i++) {
    if (addRandomTimeInterval) {
      ClockUtil.setCurrentTime(new Date(ClockUtil.getCurrentTime().getTime() + getRandomLong()));
    }

    HashMap<String, Object> variables = new HashMap<String, Object>();
    variables.put(TestDataGenerator.getRandomString(), TestDataGenerator.getRandomString());
    variables.put("long", TestDataGenerator.getRandomLong());
    variables.put("double", TestDataGenerator.getRandomDouble());

    ProcessInstance pi = runtimeService.startProcessInstanceByKey("invoice", variables);
    Assert.assertNotNull(pi);

    List<Task> tasks = taskService.createTaskQuery().processInstanceId(pi.getId()).list();

    assertEquals(1, tasks.size());
    assertEquals("assignApprover", tasks.get(0).getTaskDefinitionKey());

    variables.clear();
    String approver = TestDataGenerator.getRandomString();
    variables.put("approver", approver);
    taskService.complete(tasks.get(0).getId(), variables);

    tasks = taskService.createTaskQuery().processInstanceId(pi.getId()).list();

    assertEquals(1, tasks.size());
    assertEquals("approveInvoice", tasks.get(0).getTaskDefinitionKey());
    assertEquals(approver, tasks.get(0).getAssignee());

    variables.clear();
    variables.put("approved", Boolean.TRUE);
    taskService.complete(tasks.get(0).getId(), variables);

    tasks = taskService.createTaskQuery().processInstanceId(pi.getId()).list();

    // retrieve all variables
    List<VariableInstance> variableInstances = runtimeService.createVariableInstanceQuery().processInstanceIdIn(pi.getProcessInstanceId()).list();
    variablesByProcessIds.put(pi.getProcessInstanceId(), new ProcessDataContainer(pi.getProcessInstanceId(), pi.getBusinessKey(), variableInstances));

    assertEquals(1, tasks.size());
    assertEquals("prepareBankTransfer", tasks.get(0).getTaskDefinitionKey());
    taskService.complete(tasks.get(0).getId());

    ProcessEngineAssert.assertProcessEnded(processEngine, pi.getId());
  }

  LOGGER.info("Created " + numberOfInstances + " instances of 'invoice.bpmn' process.");

  return variablesByProcessIds;
}
 
开发者ID:camunda,项目名称:camunda-bpm-elasticsearch,代码行数:64,代码来源:TestDataGenerator.java

示例11: testDeployRevisedProcessAfterDeleteOnOtherProcessEngine

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public void testDeployRevisedProcessAfterDeleteOnOtherProcessEngine() {

    // Setup both process engines
    ProcessEngine processEngine1 = new StandaloneProcessEngineConfiguration()
      .setProcessEngineName("reboot-test-schema")
      .setDatabaseSchemaUpdate(org.camunda.bpm.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
      .setJdbcUrl("jdbc:h2:mem:activiti-process-cache-test;DB_CLOSE_DELAY=1000")
      .setJobExecutorActivate(false)
      .buildProcessEngine();
    RepositoryService repositoryService1 = processEngine1.getRepositoryService();

    ProcessEngine processEngine2 = new StandaloneProcessEngineConfiguration()
      .setProcessEngineName("reboot-test")
      .setDatabaseSchemaUpdate(org.camunda.bpm.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
      .setJdbcUrl("jdbc:h2:mem:activiti-process-cache-test;DB_CLOSE_DELAY=1000")
      .setJobExecutorActivate(false)
      .buildProcessEngine();
    RepositoryService repositoryService2 = processEngine2.getRepositoryService();
    RuntimeService runtimeService2 = processEngine2.getRuntimeService();
    TaskService taskService2 = processEngine2.getTaskService();

    // Deploy first version of process: start->originalTask->end on first process engine
    String deploymentId = repositoryService1.createDeployment()
      .addClasspathResource("org/camunda/bpm/engine/test/api/repository/RepositoryServiceTest.testDeployRevisedProcessAfterDeleteOnOtherProcessEngine.v1.bpmn20.xml")
      .deploy()
      .getId();

    // Start process instance on second engine
    String processDefinitionId = repositoryService2.createProcessDefinitionQuery().singleResult().getId();
    runtimeService2.startProcessInstanceById(processDefinitionId);
    Task task = taskService2.createTaskQuery().singleResult();
    assertEquals("original task", task.getName());

    // Delete the deployment on second process engine
    repositoryService2.deleteDeployment(deploymentId, true);
    assertEquals(0, repositoryService2.createDeploymentQuery().count());
    assertEquals(0, runtimeService2.createProcessInstanceQuery().count());

    // deploy a revised version of the process: start->revisedTask->end on first process engine
    //
    // Before the bugfix, this would set the cache on the first process engine,
    // but the second process engine still has the original process definition in his cache.
    // Since there is a deployment delete in between, the new generated process definition id is the same
    // as in the original deployment, making the second process engine using the old cached process definition.
    deploymentId = repositoryService1.createDeployment()
      .addClasspathResource("org/camunda/bpm/engine/test/api/repository/RepositoryServiceTest.testDeployRevisedProcessAfterDeleteOnOtherProcessEngine.v2.bpmn20.xml")
      .deploy()
      .getId();

    // Start process instance on second process engine -> must use revised process definition
    processDefinitionId = repositoryService2.createProcessDefinitionQuery().singleResult().getId();
    runtimeService2.startProcessInstanceByKey("oneTaskProcess");
    task = taskService2.createTaskQuery().singleResult();
    assertEquals("revised task", task.getName());

    // cleanup
    repositoryService1.deleteDeployment(deploymentId, true);
    processEngine1.close();
    processEngine2.close();
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:61,代码来源:RepositoryServiceTest.java

示例12: ProcessEngineAwareStep

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public ProcessEngineAwareStep(ProcessEngine processEngine) {
  this.processEngine = processEngine;
  runtimeService = processEngine.getRuntimeService();
  taskService = processEngine.getTaskService();
  repositoryService = processEngine.getRepositoryService();
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:7,代码来源:ProcessEngineAwareStep.java

示例13: runtimeService

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
/**
 * Camunda runtime service.
 *
 * @param processEngine processEngine
 * @return RuntimeService
 */
@Bean
public RuntimeService runtimeService(ProcessEngine processEngine) {
    return processEngine.getRuntimeService();
}
 
开发者ID:satspeedy,项目名称:camunda-migrator,代码行数:11,代码来源:CamundaProcessEngineConfiguration.java


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