use of org.camunda.bpm.model.cmmn.instance.camunda.CamundaOut in project camunda-bpm-platform by camunda.
the class ProcessOrCaseTaskItemHandler method initializeOutputParameter.
protected void initializeOutputParameter(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CallableElement callableElement) {
ExpressionManager expressionManager = context.getExpressionManager();
List<CamundaOut> outputs = getOutputs(element);
for (CamundaOut output : outputs) {
// create new parameter
CallableElementParameter parameter = new CallableElementParameter();
callableElement.addOutput(parameter);
// all variables
String variables = output.getCamundaVariables();
if ("all".equals(variables)) {
parameter.setAllVariables(true);
continue;
}
// source/sourceExpression
String source = output.getCamundaSource();
if (source == null || source.isEmpty()) {
source = output.getCamundaSourceExpression();
}
ParameterValueProvider sourceValueProvider = createParameterValueProvider(source, expressionManager);
parameter.setSourceValueProvider(sourceValueProvider);
// target
String target = output.getCamundaTarget();
parameter.setTarget(target);
}
}
use of org.camunda.bpm.model.cmmn.instance.camunda.CamundaOut in project camunda-bpm-platform by camunda.
the class ProcessTaskPlanItemHandlerTest method testOutputSourceExpression.
@Test
public void testOutputSourceExpression() {
// given:
String source = "${a}";
ExtensionElements extensionElements = addExtensionElements(processTask);
CamundaOut sourceElement = createElement(extensionElements, null, CamundaOut.class);
sourceElement.setCamundaSourceExpression(source);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
ProcessTaskActivityBehavior behavior = (ProcessTaskActivityBehavior) activity.getActivityBehavior();
CallableElement callableElement = behavior.getCallableElement();
CallableElementParameter parameter = callableElement.getOutputs().get(0);
assertNotNull(parameter);
assertFalse(parameter.isAllVariables());
ParameterValueProvider sourceExpressionValueProvider = parameter.getSourceValueProvider();
assertNotNull(sourceExpressionValueProvider);
assertTrue(sourceExpressionValueProvider instanceof ElValueProvider);
ElValueProvider valueProvider = (ElValueProvider) sourceExpressionValueProvider;
assertEquals(source, valueProvider.getExpression().getExpressionText());
}
use of org.camunda.bpm.model.cmmn.instance.camunda.CamundaOut in project camunda-bpm-platform by camunda.
the class CaseTaskPlanItemHandlerTest method testOutputSourceExpression.
@Test
public void testOutputSourceExpression() {
// given:
String source = "${a}";
ExtensionElements extensionElements = addExtensionElements(caseTask);
CamundaOut sourceElement = createElement(extensionElements, null, CamundaOut.class);
sourceElement.setCamundaSourceExpression(source);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
CaseTaskActivityBehavior behavior = (CaseTaskActivityBehavior) activity.getActivityBehavior();
CallableElement callableElement = behavior.getCallableElement();
CallableElementParameter parameter = callableElement.getOutputs().get(0);
assertNotNull(parameter);
assertFalse(parameter.isAllVariables());
ParameterValueProvider sourceExpressionValueProvider = parameter.getSourceValueProvider();
assertNotNull(sourceExpressionValueProvider);
assertTrue(sourceExpressionValueProvider instanceof ElValueProvider);
ElValueProvider valueProvider = (ElValueProvider) sourceExpressionValueProvider;
assertEquals(source, valueProvider.getExpression().getExpressionText());
}
use of org.camunda.bpm.model.cmmn.instance.camunda.CamundaOut in project camunda-bpm-platform by camunda.
the class CaseTaskPlanItemHandlerTest method testOutputSource.
@Test
public void testOutputSource() {
// given:
String source = "a";
ExtensionElements extensionElements = addExtensionElements(caseTask);
CamundaOut sourceElement = createElement(extensionElements, null, CamundaOut.class);
sourceElement.setCamundaSource(source);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
CaseTaskActivityBehavior behavior = (CaseTaskActivityBehavior) activity.getActivityBehavior();
CallableElement callableElement = behavior.getCallableElement();
CallableElementParameter parameter = callableElement.getOutputs().get(0);
assertNotNull(parameter);
assertFalse(parameter.isAllVariables());
ParameterValueProvider sourceValueProvider = parameter.getSourceValueProvider();
assertNotNull(sourceValueProvider);
assertTrue(sourceValueProvider instanceof ConstantValueProvider);
assertEquals(source, sourceValueProvider.getValue(null));
}
use of org.camunda.bpm.model.cmmn.instance.camunda.CamundaOut in project camunda-bpm-platform by camunda.
the class CaseTaskPlanItemHandlerTest method testOutputTarget.
@Test
public void testOutputTarget() {
// given:
String target = "b";
ExtensionElements extensionElements = addExtensionElements(caseTask);
CamundaOut sourceElement = createElement(extensionElements, null, CamundaOut.class);
sourceElement.setCamundaTarget(target);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
CaseTaskActivityBehavior behavior = (CaseTaskActivityBehavior) activity.getActivityBehavior();
CallableElement callableElement = behavior.getCallableElement();
CallableElementParameter parameter = callableElement.getOutputs().get(0);
assertNotNull(parameter);
assertFalse(parameter.isAllVariables());
assertEquals(target, parameter.getTarget());
}
Aggregations