use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class CaseTaskTest method testInputSourceNullValue.
/**
* assertion on default execution - take manual start out
*/
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputSource.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testInputSourceNullValue() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
List<VariableInstance> variables = runtimeService.createVariableInstanceQuery().caseInstanceIdIn(subCaseInstance.getId()).list();
assertFalse(variables.isEmpty());
assertEquals(2, variables.size());
for (VariableInstance variable : variables) {
String name = variable.getName();
if ("aVariable".equals(name)) {
assertEquals("aVariable", name);
} else if ("anotherVariable".equals(name)) {
assertEquals("anotherVariable", name);
} else {
fail("Found an unexpected variable: '" + name + "'");
}
assertNull(variable.getValue());
}
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class CaseCallActivityBehavior method onParseMigratingInstance.
@Override
public void onParseMigratingInstance(MigratingInstanceParseContext parseContext, MigratingActivityInstance migratingInstance) {
ActivityImpl callActivity = (ActivityImpl) migratingInstance.getSourceScope();
// must be maintained throughout migration
if (!callActivity.isScope()) {
ExecutionEntity callActivityExecution = migratingInstance.resolveRepresentativeExecution();
CaseExecutionEntity calledCaseInstance = callActivityExecution.getSubCaseInstance();
migratingInstance.addMigratingDependentInstance(new MigratingCalledCaseInstance(calledCaseInstance));
}
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class DefaultHistoryEventProducer method initHistoricVariableUpdateEvt.
protected void initHistoricVariableUpdateEvt(HistoricVariableUpdateEventEntity evt, VariableInstanceEntity variableInstance, HistoryEventType eventType) {
// init properties
evt.setEventType(eventType.getEventName());
evt.setTimestamp(ClockUtil.getCurrentTime());
evt.setVariableInstanceId(variableInstance.getId());
evt.setProcessInstanceId(variableInstance.getProcessInstanceId());
evt.setExecutionId(variableInstance.getExecutionId());
evt.setCaseInstanceId(variableInstance.getCaseInstanceId());
evt.setCaseExecutionId(variableInstance.getCaseExecutionId());
evt.setTaskId(variableInstance.getTaskId());
evt.setRevision(variableInstance.getRevision());
evt.setVariableName(variableInstance.getName());
evt.setSerializerName(variableInstance.getSerializerName());
evt.setTenantId(variableInstance.getTenantId());
evt.setUserOperationId(Context.getCommandContext().getOperationId());
ExecutionEntity execution = variableInstance.getExecution();
if (execution != null) {
ProcessDefinitionEntity definition = execution.getProcessDefinition();
if (definition != null) {
evt.setProcessDefinitionId(definition.getId());
evt.setProcessDefinitionKey(definition.getKey());
}
}
CaseExecutionEntity caseExecution = variableInstance.getCaseExecution();
if (caseExecution != null) {
CaseDefinitionEntity definition = (CaseDefinitionEntity) caseExecution.getCaseDefinition();
if (definition != null) {
evt.setCaseDefinitionId(definition.getId());
evt.setCaseDefinitionKey(definition.getKey());
}
}
// copy value
evt.setTextValue(variableInstance.getTextValue());
evt.setTextValue2(variableInstance.getTextValue2());
evt.setDoubleValue(variableInstance.getDoubleValue());
evt.setLongValue(variableInstance.getLongValue());
if (variableInstance.getByteArrayValueId() != null) {
evt.setByteValue(variableInstance.getByteArrayValue());
}
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class DefaultHistoryEventProducer method createHistoricVariableEvent.
protected HistoryEvent createHistoricVariableEvent(VariableInstanceEntity variableInstance, VariableScope sourceVariableScope, HistoryEventType eventType) {
String scopeActivityInstanceId = null;
String sourceActivityInstanceId = null;
if (variableInstance.getExecutionId() != null) {
ExecutionEntity scopeExecution = Context.getCommandContext().getDbEntityManager().selectById(ExecutionEntity.class, variableInstance.getExecutionId());
if (variableInstance.getTaskId() == null && !variableInstance.isConcurrentLocal()) {
scopeActivityInstanceId = scopeExecution.getParentActivityInstanceId();
} else {
scopeActivityInstanceId = scopeExecution.getActivityInstanceId();
}
} else if (variableInstance.getCaseExecutionId() != null) {
scopeActivityInstanceId = variableInstance.getCaseExecutionId();
}
ExecutionEntity sourceExecution = null;
CaseExecutionEntity sourceCaseExecution = null;
if (sourceVariableScope instanceof ExecutionEntity) {
sourceExecution = (ExecutionEntity) sourceVariableScope;
sourceActivityInstanceId = sourceExecution.getActivityInstanceId();
} else if (sourceVariableScope instanceof TaskEntity) {
sourceExecution = ((TaskEntity) sourceVariableScope).getExecution();
if (sourceExecution != null) {
sourceActivityInstanceId = sourceExecution.getActivityInstanceId();
} else {
sourceCaseExecution = ((TaskEntity) sourceVariableScope).getCaseExecution();
if (sourceCaseExecution != null) {
sourceActivityInstanceId = sourceCaseExecution.getId();
}
}
} else if (sourceVariableScope instanceof CaseExecutionEntity) {
sourceCaseExecution = (CaseExecutionEntity) sourceVariableScope;
sourceActivityInstanceId = sourceCaseExecution.getId();
}
// create event
HistoricVariableUpdateEventEntity evt = newVariableUpdateEventEntity(sourceExecution);
// initialize
initHistoricVariableUpdateEvt(evt, variableInstance, eventType);
// initialize sequence counter
initSequenceCounter(variableInstance, evt);
// set scope activity instance id
evt.setScopeActivityInstanceId(scopeActivityInstanceId);
// set source activity instance id
evt.setActivityInstanceId(sourceActivityInstanceId);
return evt;
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class DefaultCmmnHistoryEventProducer method createCaseInstanceUpdateEvt.
public HistoryEvent createCaseInstanceUpdateEvt(DelegateCaseExecution caseExecution) {
final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
// create event instance
HistoricCaseInstanceEventEntity evt = loadCaseInstanceEventEntity(caseExecutionEntity);
// initialize event
initCaseInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_INSTANCE_UPDATE);
return evt;
}
Aggregations