use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-engine-dmn by camunda.
the class DmnDataTypeTransformerTest method longType.
@Test
public void longType() {
DmnDataTypeTransformer typeTransformer = registry.getTransformer("long");
assertThat(typeTransformer.transform(2L), is((TypedValue) Variables.longValue(2L)));
assertThat(typeTransformer.transform("2"), is((TypedValue) Variables.longValue(2L)));
assertThat(typeTransformer.transform(4), is((TypedValue) Variables.longValue(4L)));
assertThat(typeTransformer.transform(4.0), is((TypedValue) Variables.longValue(4L)));
assertThat(typeTransformer.transform(Long.MIN_VALUE), is((TypedValue) Variables.longValue(Long.MIN_VALUE)));
assertThat(typeTransformer.transform(Long.MAX_VALUE), is((TypedValue) Variables.longValue(Long.MAX_VALUE)));
}
use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-engine-dmn by camunda.
the class DmnDataTypeTransformerTest method stringType.
@Test
public void stringType() {
DmnDataTypeTransformer typeTransformer = registry.getTransformer("string");
assertThat(typeTransformer.transform("abc"), is((TypedValue) Variables.stringValue("abc")));
assertThat(typeTransformer.transform(true), is((TypedValue) Variables.stringValue("true")));
assertThat(typeTransformer.transform(4), is((TypedValue) Variables.stringValue("4")));
assertThat(typeTransformer.transform(2L), is((TypedValue) Variables.stringValue("2")));
assertThat(typeTransformer.transform(4.2), is((TypedValue) Variables.stringValue("4.2")));
}
use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-engine-dmn by camunda.
the class DmnDataTypeTransformerTest method integerType.
@Test
public void integerType() {
DmnDataTypeTransformer typeTransformer = registry.getTransformer("integer");
assertThat(typeTransformer.transform(4), is((TypedValue) Variables.integerValue(4)));
assertThat(typeTransformer.transform("4"), is((TypedValue) Variables.integerValue(4)));
assertThat(typeTransformer.transform(2L), is((TypedValue) Variables.integerValue(2)));
assertThat(typeTransformer.transform(4.0), is((TypedValue) Variables.integerValue(4)));
assertThat(typeTransformer.transform(Integer.MIN_VALUE), is((TypedValue) Variables.integerValue(Integer.MIN_VALUE)));
assertThat(typeTransformer.transform(Integer.MAX_VALUE), is((TypedValue) Variables.integerValue(Integer.MAX_VALUE)));
}
use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-engine-dmn by camunda.
the class DmnDataTypeTransformerTest method dateType.
@Test
public void dateType() throws ParseException {
DmnDataTypeTransformer typeTransformer = registry.getTransformer("date");
Date date = toDate("2015-09-18T12:00:00");
TypedValue dateValue = Variables.dateValue(date);
assertThat(typeTransformer.transform("2015-09-18T12:00:00"), is(dateValue));
assertThat(typeTransformer.transform(date), is(dateValue));
}
use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-engine-dmn by camunda.
the class DecisionLiteralExpressionEvaluationHandler method evaluate.
@Override
public DmnDecisionLogicEvaluationEvent evaluate(DmnDecision decision, VariableContext variableContext) {
DmnDecisionLiteralExpressionEvaluationEventImpl evaluationResult = new DmnDecisionLiteralExpressionEvaluationEventImpl();
evaluationResult.setDecision(decision);
evaluationResult.setExecutedDecisionElements(1);
DmnDecisionLiteralExpressionImpl dmnDecisionLiteralExpression = (DmnDecisionLiteralExpressionImpl) decision.getDecisionLogic();
DmnVariableImpl variable = dmnDecisionLiteralExpression.getVariable();
DmnExpressionImpl expression = dmnDecisionLiteralExpression.getExpression();
Object evaluateExpression = evaluateLiteralExpression(expression, variableContext);
TypedValue typedValue = variable.getTypeDefinition().transform(evaluateExpression);
evaluationResult.setOutputValue(typedValue);
evaluationResult.setOutputName(variable.getName());
return evaluationResult;
}
Aggregations