use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class DefaultHistoryEventProducer method initActivityInstanceEvent.
protected void initActivityInstanceEvent(HistoricActivityInstanceEventEntity evt, ExecutionEntity execution, HistoryEventType eventType) {
PvmScope eventSource = execution.getActivity();
if (eventSource == null) {
eventSource = (PvmScope) execution.getEventSource();
}
String activityInstanceId = execution.getActivityInstanceId();
String parentActivityInstanceId = null;
ExecutionEntity parentExecution = execution.getParent();
if (parentExecution != null && CompensationBehavior.isCompensationThrowing(parentExecution) && execution.getActivity() != null) {
parentActivityInstanceId = CompensationBehavior.getParentActivityInstanceId(execution);
} else {
parentActivityInstanceId = execution.getParentActivityInstanceId();
}
initActivityInstanceEvent(evt, execution, eventSource, activityInstanceId, parentActivityInstanceId, eventType);
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class DefaultHistoryEventProducer method createActivityInstanceEndEvt.
public HistoryEvent createActivityInstanceEndEvt(DelegateExecution execution) {
final ExecutionEntity executionEntity = (ExecutionEntity) execution;
// create event instance
HistoricActivityInstanceEventEntity evt = loadActivityInstanceEventEntity(executionEntity);
evt.setActivityInstanceState(executionEntity.getActivityInstanceState());
// initialize event
initActivityInstanceEvent(evt, (ExecutionEntity) execution, HistoryEventTypes.ACTIVITY_INSTANCE_END);
evt.setEndTime(ClockUtil.getCurrentTime());
if (evt.getStartTime() != null) {
evt.setDurationInMillis(evt.getEndTime().getTime() - evt.getStartTime().getTime());
}
return evt;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class DefaultHistoryEventProducer method initTaskInstanceEvent.
protected void initTaskInstanceEvent(HistoricTaskInstanceEventEntity evt, TaskEntity taskEntity, HistoryEventType eventType) {
String processDefinitionKey = null;
ProcessDefinitionEntity definition = taskEntity.getProcessDefinition();
if (definition != null) {
processDefinitionKey = definition.getKey();
}
String processDefinitionId = taskEntity.getProcessDefinitionId();
String processInstanceId = taskEntity.getProcessInstanceId();
String executionId = taskEntity.getExecutionId();
String caseDefinitionKey = null;
CaseDefinitionEntity caseDefinition = taskEntity.getCaseDefinition();
if (caseDefinition != null) {
caseDefinitionKey = caseDefinition.getKey();
}
String caseDefinitionId = taskEntity.getCaseDefinitionId();
String caseExecutionId = taskEntity.getCaseExecutionId();
String caseInstanceId = taskEntity.getCaseInstanceId();
String tenantId = taskEntity.getTenantId();
evt.setId(taskEntity.getId());
evt.setEventType(eventType.getEventName());
evt.setTaskId(taskEntity.getId());
evt.setProcessDefinitionKey(processDefinitionKey);
evt.setProcessDefinitionId(processDefinitionId);
evt.setProcessInstanceId(processInstanceId);
evt.setExecutionId(executionId);
evt.setCaseDefinitionKey(caseDefinitionKey);
evt.setCaseDefinitionId(caseDefinitionId);
evt.setCaseExecutionId(caseExecutionId);
evt.setCaseInstanceId(caseInstanceId);
evt.setAssignee(taskEntity.getAssignee());
evt.setDescription(taskEntity.getDescription());
evt.setDueDate(taskEntity.getDueDate());
evt.setFollowUpDate(taskEntity.getFollowUpDate());
evt.setName(taskEntity.getName());
evt.setOwner(taskEntity.getOwner());
evt.setParentTaskId(taskEntity.getParentTaskId());
evt.setPriority(taskEntity.getPriority());
evt.setTaskDefinitionKey(taskEntity.getTaskDefinitionKey());
evt.setTenantId(tenantId);
ExecutionEntity execution = taskEntity.getExecution();
if (execution != null) {
evt.setActivityInstanceId(execution.getActivityInstanceId());
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class MigrationTestRule method assertSuperExecutionOfProcessInstance.
public void assertSuperExecutionOfProcessInstance(String processInstance, String expectedSuperExecutionId) {
ExecutionEntity calledInstance = (ExecutionEntity) processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstance).singleResult();
Assert.assertEquals(expectedSuperExecutionId, calledInstance.getSuperExecutionId());
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class AsyncEndEventTest method testCallActivity.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/async/AsyncEndEventTest.testCallActivity-super.bpmn20.xml", "org/camunda/bpm/engine/test/bpmn/async/AsyncEndEventTest.testCallActivity-sub.bpmn20.xml" })
public void testCallActivity() {
runtimeService.startProcessInstanceByKey("super");
ProcessInstance pi = runtimeService.createProcessInstanceQuery().processDefinitionKey("sub").singleResult();
assertTrue(pi instanceof ExecutionEntity);
assertEquals("theSubEnd", ((ExecutionEntity) pi).getActivityId());
}
Aggregations