use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class DefaultCmmnHistoryEventProducer method createCaseInstanceCreateEvt.
public HistoryEvent createCaseInstanceCreateEvt(DelegateCaseExecution caseExecution) {
final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
// create event instance
HistoricCaseInstanceEventEntity evt = newCaseInstanceEventEntity(caseExecutionEntity);
// initialize event
initCaseInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_INSTANCE_CREATE);
// set create time
evt.setCreateTime(ClockUtil.getCurrentTime());
// set create user id
evt.setCreateUserId(Context.getCommandContext().getAuthenticatedUserId());
// set super case instance id
CmmnExecution superCaseExecution = caseExecutionEntity.getSuperCaseExecution();
if (superCaseExecution != null) {
evt.setSuperCaseInstanceId(superCaseExecution.getCaseInstanceId());
}
// set super process instance id
ExecutionEntity superExecution = caseExecutionEntity.getSuperExecution();
if (superExecution != null) {
evt.setSuperProcessInstanceId(superExecution.getProcessInstanceId());
}
return evt;
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class DefaultCmmnHistoryEventProducer method createCaseActivityInstanceUpdateEvt.
public HistoryEvent createCaseActivityInstanceUpdateEvt(DelegateCaseExecution caseExecution) {
final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
// create event instance
HistoricCaseActivityInstanceEventEntity evt = loadCaseActivityInstanceEventEntity(caseExecutionEntity);
// initialize event
initCaseActivityInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_ACTIVITY_INSTANCE_UPDATE);
if (caseExecutionEntity.getTask() != null) {
evt.setTaskId(caseExecutionEntity.getTask().getId());
}
if (caseExecutionEntity.getSubProcessInstance() != null) {
evt.setCalledProcessInstanceId(caseExecutionEntity.getSubProcessInstance().getId());
}
if (caseExecutionEntity.getSubCaseInstance() != null) {
evt.setCalledCaseInstanceId(caseExecutionEntity.getSubCaseInstance().getId());
}
return evt;
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class DefaultCmmnHistoryEventProducer method createCaseInstanceCloseEvt.
public HistoryEvent createCaseInstanceCloseEvt(DelegateCaseExecution caseExecution) {
final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
// create event instance
HistoricCaseInstanceEventEntity evt = loadCaseInstanceEventEntity(caseExecutionEntity);
// initialize event
initCaseInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_INSTANCE_CLOSE);
// set end time
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.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class MigrationTestRule method assertSuperExecutionOfCaseInstance.
public void assertSuperExecutionOfCaseInstance(String caseInstanceId, String expectedSuperExecutionId) {
CaseExecutionEntity calledInstance = (CaseExecutionEntity) processEngine.getCaseService().createCaseInstanceQuery().caseInstanceId(caseInstanceId).singleResult();
Assert.assertEquals(expectedSuperExecutionId, calledInstance.getSuperExecutionId());
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class CaseTaskTest method testInputBusinessKey.
/**
* assertion on default behaviour - remove manual activation
*/
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputBusinessKey.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testInputBusinessKey() {
// given
String businessKey = "myBusinessKey";
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, businessKey).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
String superCaseExecutionId = subCaseInstance.getSuperCaseExecutionId();
CaseExecution superCaseExecution = queryCaseExecutionById(superCaseExecutionId);
assertEquals(caseTaskId, superCaseExecutionId);
assertEquals(superCaseInstanceId, superCaseExecution.getCaseInstanceId());
assertEquals(businessKey, subCaseInstance.getBusinessKey());
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
}
Aggregations