Java Code Examples for org.camunda.bpm.engine.runtime.ProcessInstance#isEnded()

The following examples show how to use org.camunda.bpm.engine.runtime.ProcessInstance#isEnded() . 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: TestBPMModule.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public void assertProcessEnded(String processInstanceId, boolean soft) {
	ProcessInstance processInstance = processEngineRule.getProcessEngine().getRuntimeService()
			.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();

	if (processInstance != null && (!soft || !processInstance.isEnded())) {

		throw new AssertionFailedError(
				"expected finished process instance '" + processInstanceId + "' but it was still in the db");
	}
}
 
Example 2
Source File: BusinessProcess.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessInstance startProcessById(String processDefinitionId) {
  assertCommandContextNotActive();

  ProcessInstance instance = processEngine.getRuntimeService().startProcessInstanceById(processDefinitionId, getAndClearCachedVariableMap());
  if (!instance.isEnded()) {
    setExecution(instance);
  }
  return instance;
}
 
Example 3
Source File: BusinessProcess.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessInstance startProcessById(String processDefinitionId, String businessKey) {
  assertCommandContextNotActive();

  ProcessInstance instance = processEngine.getRuntimeService().startProcessInstanceById(processDefinitionId, businessKey, getAndClearCachedVariableMap());
  if (!instance.isEnded()) {
    setExecution(instance);
  }
  return instance;
}
 
Example 4
Source File: BusinessProcess.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessInstance startProcessById(String processDefinitionId, Map<String, Object> variables) {
  assertCommandContextNotActive();

  VariableMap cachedVariables = getAndClearCachedVariableMap();
  cachedVariables.putAll(variables);
  ProcessInstance instance = processEngine.getRuntimeService().startProcessInstanceById(processDefinitionId, cachedVariables);
  if (!instance.isEnded()) {
    setExecution(instance);
  }
  return instance;
}
 
Example 5
Source File: BusinessProcess.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessInstance startProcessById(String processDefinitionId, String businessKey, Map<String, Object> variables) {
  assertCommandContextNotActive();

  VariableMap cachedVariables = getAndClearCachedVariableMap();
  cachedVariables.putAll(variables);
  ProcessInstance instance = processEngine.getRuntimeService().startProcessInstanceById(processDefinitionId, businessKey, cachedVariables);
  if (!instance.isEnded()) {
    setExecution(instance);
  }
  return instance;
}
 
Example 6
Source File: BusinessProcess.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessInstance startProcessByKey(String key) {
  assertCommandContextNotActive();

  ProcessInstance instance = processEngine.getRuntimeService().startProcessInstanceByKey(key, getAndClearCachedVariableMap());
  if (!instance.isEnded()) {
    setExecution(instance);
  }
  return instance;
}
 
Example 7
Source File: BusinessProcess.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessInstance startProcessByKey(String key, String businessKey) {
  assertCommandContextNotActive();

  ProcessInstance instance = processEngine.getRuntimeService().startProcessInstanceByKey(key, businessKey, getAndClearCachedVariableMap());
  if (!instance.isEnded()) {
    setExecution(instance);
  }
  return instance;
}
 
Example 8
Source File: BusinessProcess.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessInstance startProcessByKey(String key, Map<String, Object> variables) {
  assertCommandContextNotActive();

  VariableMap cachedVariables = getAndClearCachedVariableMap();
  cachedVariables.putAll(variables);
  ProcessInstance instance = processEngine.getRuntimeService().startProcessInstanceByKey(key, cachedVariables);
  if (!instance.isEnded()) {
    setExecution(instance);
  }
  return instance;
}
 
Example 9
Source File: BusinessProcess.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessInstance startProcessByKey(String key, String businessKey, Map<String, Object> variables) {
  assertCommandContextNotActive();

  VariableMap cachedVariables = getAndClearCachedVariableMap();
  cachedVariables.putAll(variables);
  ProcessInstance instance = processEngine.getRuntimeService().startProcessInstanceByKey(key, businessKey, cachedVariables);
  if (!instance.isEnded()) {
    setExecution(instance);
  }
  return instance;
}
 
Example 10
Source File: BusinessProcess.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessInstance startProcessByMessage(String messageName) {
  assertCommandContextNotActive();

  VariableMap cachedVariables = getAndClearCachedVariableMap();
  ProcessInstance instance =  processEngine.getRuntimeService().startProcessInstanceByMessage(messageName, cachedVariables);
  if (!instance.isEnded()) {
    setExecution(instance);
  }
  return instance;
}
 
Example 11
Source File: BusinessProcess.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessInstance startProcessByMessage(String messageName, Map<String, Object> processVariables) {
  assertCommandContextNotActive();

  VariableMap cachedVariables = getAndClearCachedVariableMap();
  cachedVariables.putAll(processVariables);
  ProcessInstance instance =  processEngine.getRuntimeService().startProcessInstanceByMessage(messageName, cachedVariables);
  if (!instance.isEnded()) {
    setExecution(instance);
  }
  return instance;
}
 
Example 12
Source File: BusinessProcess.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessInstance startProcessByMessage(String messageName, String businessKey, Map<String, Object> processVariables) {
  assertCommandContextNotActive();

  VariableMap cachedVariables = getAndClearCachedVariableMap();
  cachedVariables.putAll(processVariables);
  ProcessInstance instance =  processEngine.getRuntimeService().startProcessInstanceByMessage(messageName, businessKey, cachedVariables);
  if (!instance.isEnded()) {
    setExecution(instance);
  }
  return instance;
}
 
Example 13
Source File: ProcessInstanceDto.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessInstanceDto(ProcessInstance instance) {
  this.id = instance.getId();
  this.definitionId = instance.getProcessDefinitionId();
  this.businessKey = instance.getBusinessKey();
  this.caseInstanceId = instance.getCaseInstanceId();
  this.ended = instance.isEnded();
  this.suspended = instance.isSuspended();
  this.tenantId = instance.getTenantId();
}
 
Example 14
Source File: TestBPMModule.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
public boolean isProcessFinished(String processInstanceId) {
	ProcessInstance processInstance = processEngineRule.getProcessEngine().getRuntimeService()
			.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
	return processInstance == null || processInstance.isEnded();
}