Search in sources :

Example 21 with TypedValue

use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-bpm-platform by camunda.

the class DefaultDmnHistoryEventProducer method createHistoricDecisionInputInstances.

protected List<HistoricDecisionInputInstance> createHistoricDecisionInputInstances(DmnDecisionTableEvaluationEvent evaluationEvent) {
    List<HistoricDecisionInputInstance> inputInstances = new ArrayList<HistoricDecisionInputInstance>();
    for (DmnEvaluatedInput inputClause : evaluationEvent.getInputs()) {
        HistoricDecisionInputInstanceEntity inputInstance = new HistoricDecisionInputInstanceEntity();
        inputInstance.setClauseId(inputClause.getId());
        inputInstance.setClauseName(inputClause.getName());
        TypedValue typedValue = Variables.untypedValue(inputClause.getValue());
        inputInstance.setValue(typedValue);
        inputInstances.add(inputInstance);
    }
    return inputInstances;
}
Also used : HistoricDecisionInputInstance(org.camunda.bpm.engine.history.HistoricDecisionInputInstance) HistoricDecisionInputInstanceEntity(org.camunda.bpm.engine.impl.history.event.HistoricDecisionInputInstanceEntity) DmnEvaluatedInput(org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedInput) ArrayList(java.util.ArrayList) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue)

Example 22 with TypedValue

use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-bpm-platform by camunda.

the class CaseCallActivityTest method testCallCaseOutputAllVariablesTypedToProcess.

@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testOutputAll.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn" })
public void testCallCaseOutputAllVariablesTypedToProcess() {
    startProcessInstanceByKey("process");
    CaseInstance caseInstance = queryOneTaskCaseInstance();
    String variableName = "foo";
    String variableName2 = "null";
    TypedValue variableValue = Variables.stringValue("bar");
    TypedValue variableValue2 = Variables.integerValue(null);
    caseService.withCaseExecution(caseInstance.getId()).setVariable(variableName, variableValue).setVariable(variableName2, variableValue2).execute();
    complete(caseInstance.getId());
    Task task = taskService.createTaskQuery().singleResult();
    TypedValue value = runtimeService.getVariableTyped(task.getProcessInstanceId(), variableName);
    assertThat(value, is(variableValue));
    value = runtimeService.getVariableTyped(task.getProcessInstanceId(), variableName2);
    assertThat(value, is(variableValue2));
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) Task(org.camunda.bpm.engine.task.Task) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 23 with TypedValue

use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-bpm-platform by camunda.

the class PrimitiveTypeValueSerializationTest method shouldGetTypedNullVariable.

@Test
public void shouldGetTypedNullVariable() {
    ProcessInstance instance = runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY);
    runtimeService.setVariable(instance.getId(), VARIABLE_NAME, nullValue);
    assertEquals(null, runtimeService.getVariable(instance.getId(), VARIABLE_NAME));
    TypedValue typedVariableValue = runtimeService.getVariableTyped(instance.getId(), VARIABLE_NAME);
    assertEquals(nullValue.getType(), typedVariableValue.getType());
    assertEquals(null, typedVariableValue.getValue());
}
Also used : ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue) Test(org.junit.Test)

Example 24 with TypedValue

use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-bpm-platform by camunda.

the class CmmnExecution method hasVariableWithSameNameInParent.

protected boolean hasVariableWithSameNameInParent(CmmnExecution execution, String variableName) {
    while (execution != null) {
        if (execution.getId().equals(getId())) {
            return false;
        }
        TypedValue variableTypedValue = execution.getVariableLocalTyped(variableName);
        if (variableTypedValue != null) {
            return true;
        }
        execution = execution.getParent();
    }
    return false;
}
Also used : TypedValue(org.camunda.bpm.engine.variable.value.TypedValue)

Example 25 with TypedValue

use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-bpm-platform by camunda.

the class GetCaseExecutionVariableTypedCmd method execute.

public TypedValue execute(CommandContext commandContext) {
    ensureNotNull("caseExecutionId", caseExecutionId);
    ensureNotNull("variableName", variableName);
    CaseExecutionEntity caseExecution = commandContext.getCaseExecutionManager().findCaseExecutionById(caseExecutionId);
    ensureNotNull(CaseExecutionNotFoundException.class, "case execution " + caseExecutionId + " doesn't exist", "caseExecution", caseExecution);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkReadCaseInstance(caseExecution);
    }
    TypedValue value;
    if (isLocal) {
        value = caseExecution.getVariableLocalTyped(variableName, deserializeValue);
    } else {
        value = caseExecution.getVariableTyped(variableName, deserializeValue);
    }
    return value;
}
Also used : CaseExecutionEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue)

Aggregations

TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)81 Test (org.junit.Test)25 Deployment (org.camunda.bpm.engine.test.Deployment)15 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)14 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)11 DecisionResource (org.camunda.bpm.dmn.engine.test.DecisionResource)8 VariableMap (org.camunda.bpm.engine.variable.VariableMap)7 DmnDataTypeTransformer (org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer)6 BusinessProcess (org.camunda.bpm.engine.cdi.BusinessProcess)6 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)4 DmnDecisionTableResult (org.camunda.bpm.dmn.engine.DmnDecisionTableResult)4 DmnExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl)3 DeclarativeProcessController (org.camunda.bpm.engine.cdi.test.impl.beans.DeclarativeProcessController)3 RestException (org.camunda.bpm.engine.rest.exception.RestException)3 Task (org.camunda.bpm.engine.task.Task)3 ArrayList (java.util.ArrayList)2 DmnDecisionResultEntries (org.camunda.bpm.dmn.engine.DmnDecisionResultEntries)2 DmnDecisionRuleResult (org.camunda.bpm.dmn.engine.DmnDecisionRuleResult)2 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2